- 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>
39 lines
1.8 KiB
Bash
Executable File
39 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# Usage: scripts/bootstrap-project.sh <slug> <KEY> "<Name>" [owner=peppa-bot]
|
||
# Creates a Gitea repo, fills it from the Gitea template repo, runs `openspec init`, pushes, and
|
||
# leaves a working clone in $PEPPA_WORKSPACES/<slug>. The web platform will call the
|
||
# same steps (stage 5); this script is the manual path until then.
|
||
set -euo pipefail
|
||
cd "$(dirname "$0")/.."
|
||
ROOT="$PWD"
|
||
[ -f .env ] && set -a && . ./.env && set +a
|
||
. scripts/gitea-lib.sh
|
||
SLUG="${1:?slug}"; KEY="$(echo "${2:?KEY}" | tr a-z A-Z)"; NAME="${3:?name}"; OWNER="${4:-$GITEA_BOT_USER}"
|
||
WS="${PEPPA_WORKSPACES:-$HOME/peppa/workspaces}"; WS="${WS/#\~/$HOME}"
|
||
DEST="$WS/$SLUG"
|
||
|
||
[ -e "$DEST" ] && { echo "already exists: $DEST" >&2; exit 1; }
|
||
gitea_create_repo "$OWNER" "$SLUG" "$NAME"
|
||
|
||
# Start from the shared template in Gitea (RULES.md stays there: sessions load it live).
|
||
TPL="$(mktemp -d)"; trap 'rm -rf "$TPL"' EXIT
|
||
git -c credential.helper=peppa clone -q --depth 1 "$GITEA_URL/${GITEA_TEMPLATE_REPO:-peppa-bot/template}.git" "$TPL"
|
||
rm -rf "$TPL/.git" "$TPL/RULES.md" "$TPL/README.md"
|
||
mkdir -p "$DEST"
|
||
cp -R "$TPL/." "$DEST/"
|
||
cd "$DEST"
|
||
printf '# %s\n\nПроект Пеппы. Ключ задач: `%s`. Правила — в [AGENTS.md](AGENTS.md).\n' "$NAME" "$KEY" > README.md
|
||
mkdir -p .peppa
|
||
cat > .peppa/project.json <<JSON
|
||
{ "slug": "$SLUG", "key": "$KEY", "name": "$NAME", "peppaUrl": "${PEPPA_WEB_URL:-http://localhost:3100}" }
|
||
JSON
|
||
openspec init --tools claude,agents --no-animation . >/dev/null
|
||
git init -q -b main
|
||
gitea_git_setup
|
||
git add -A
|
||
git commit -qm "Bootstrap $NAME from Peppa template"
|
||
git remote add origin "$GITEA_URL/$OWNER/$SLUG.git"
|
||
git push -q -u origin main
|
||
"$ROOT/packages/cli/bin/peppa" project add "$SLUG" "$KEY" "$NAME" --owner "$OWNER" --path "$DEST"
|
||
echo "ready: $DEST ($GITEA_URL/$OWNER/$SLUG)"
|