peppa/scripts/push-template.sh
Асель e1384a4c6f Push Peppa to Gitea; shared RULES.md loaded live into every session
- 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>
2026-11-12 19:50:45 +05:00

24 lines
993 B
Bash
Executable File

#!/usr/bin/env bash
# Creates (if missing) and pushes template/ to $GITEA_TEMPLATE_REPO in Gitea.
set -euo pipefail
cd "$(dirname "$0")/.."
ROOT="$PWD"
[ -f .env ] && set -a && . ./.env && set +a
. scripts/gitea-lib.sh
REPO="${GITEA_TEMPLATE_REPO:-peppa-bot/template}"
OWNER="${REPO%%/*}"; NAME="${REPO##*/}"
gitea_create_repo "$OWNER" "$NAME" "Peppa project template" ',"template":true'
TMP="$(mktemp -d)"; trap 'rm -rf "$TMP"' EXIT
git clone -q "$GITEA_URL/$REPO.git" "$TMP" -c credential.helper=peppa 2>/dev/null || git -C "$TMP" init -q -b main
cd "$TMP"
gitea_git_setup
git remote get-url origin >/dev/null 2>&1 || git remote add origin "$GITEA_URL/$REPO.git"
find . -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
cp -R "$ROOT/template/." .
git add -A
if git diff --cached --quiet; then echo "template unchanged"; exit 0; fi
git commit -qm "Update Peppa template ($(git -C "$ROOT" rev-parse --short HEAD))"
git push -q origin HEAD:main
echo "pushed template to $GITEA_URL/$REPO"