- peppa-bot account: repos peppa-bot/peppa and peppa-bot/template - git-credential-peppa: per-repo credential helper with the bot token - template split: RULES.md (shared, stays in Gitea) + AGENTS.md (project) - runner fetches RULES.md from Gitea on each launch (cached fallback) and passes it via --append-system-prompt-file; MCP get_rules for manual runs - bootstrap-project.sh clones the template from Gitea Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
1.1 KiB
Bash
24 lines
1.1 KiB
Bash
# Shared helpers for Peppa's Gitea scripts. Source after loading .env.
|
|
: "${GITEA_URL:?}" "${GITEA_TOKEN:?set GITEA_TOKEN in .env}"
|
|
GITEA_BOT_USER="${GITEA_BOT_USER:-peppa-bot}"
|
|
|
|
gitea_api() { curl -fsS -H "Authorization: token $GITEA_TOKEN" -H "Content-Type: application/json" "$@"; }
|
|
|
|
# gitea_create_repo <owner> <name> <description> [extra-json-fields]
|
|
# Repos owned by the bot user go through /user/repos, others through /orgs/<owner>/repos.
|
|
gitea_create_repo() {
|
|
local owner=$1 name=$2 desc=$3 extra=${4:-}
|
|
gitea_api "$GITEA_URL/api/v1/repos/$owner/$name" >/dev/null 2>&1 && return 0
|
|
local path="orgs/$owner/repos"; [ "$owner" = "$GITEA_BOT_USER" ] && path="user/repos"
|
|
gitea_api -X POST "$GITEA_URL/api/v1/$path" \
|
|
-d "{\"name\":\"$name\",\"description\":\"$desc\",\"default_branch\":\"main\",\"private\":true$extra}" >/dev/null
|
|
echo "created $owner/$name"
|
|
}
|
|
|
|
# Configures a local repo to push to Gitea as the bot via git-credential-peppa.
|
|
gitea_git_setup() {
|
|
git config credential.helper peppa
|
|
git config user.name "Peppa"
|
|
git config user.email "$GITEA_BOT_USER@telecom.quest"
|
|
}
|