- @peppa/core: projects, goals, tasks (atomic per-project numbering), PM questions, progress events, pg NOTIFY on peppa_events - @peppa/mcp (peppa-mcp): get_task, list_tasks, list_goals, create_task, update_task, request_approval, ask_pm, report_progress - @peppa/cli (peppa): project/goal/task/q commands - questions/events now link to project and task; session is optional - scripts/install-bins.sh; bootstrap-project.sh registers the project Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.9 KiB
Bash
Executable File
40 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# Usage: scripts/bootstrap-project.sh <slug> <KEY> "<Name>" [owner]
|
||
# Creates a Gitea repo, fills it from the template, 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
|
||
: "${GITEA_URL:?}" "${GITEA_TOKEN:?set GITEA_TOKEN in .env}"
|
||
SLUG="${1:?slug}"; KEY="$(echo "${2:?KEY}" | tr a-z A-Z)"; NAME="${3:?name}"; OWNER="${4:-peppa}"
|
||
WS="${PEPPA_WORKSPACES:-$HOME/peppa/workspaces}"; WS="${WS/#\~/$HOME}"
|
||
DEST="$WS/$SLUG"
|
||
HOST="${GITEA_URL#*://}"
|
||
REMOTE="https://peppa:${GITEA_TOKEN}@${HOST}/${OWNER}/${SLUG}.git"
|
||
api() { curl -fsS -H "Authorization: token $GITEA_TOKEN" -H "Content-Type: application/json" "$@"; }
|
||
|
||
[ -e "$DEST" ] && { echo "already exists: $DEST" >&2; exit 1; }
|
||
api -X POST "$GITEA_URL/api/v1/orgs/$OWNER/repos" \
|
||
-d "{\"name\":\"$SLUG\",\"description\":\"$NAME\",\"default_branch\":\"main\",\"private\":true}" >/dev/null
|
||
|
||
mkdir -p "$DEST"
|
||
cp -R "$ROOT/template/." "$DEST/"
|
||
rm -f "$DEST/README.md"
|
||
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
|
||
git add -A
|
||
git -c user.name="Peppa" -c user.email="peppa@localhost" commit -qm "Bootstrap $NAME from Peppa template"
|
||
git remote add origin "$REMOTE"
|
||
git push -q -u origin main
|
||
git remote set-url origin "$GITEA_URL/$OWNER/$SLUG.git"
|
||
"$ROOT/packages/cli/bin/peppa" project add "$SLUG" "$KEY" "$NAME" --owner "$OWNER" --path "$DEST"
|
||
echo "ready: $DEST ($GITEA_URL/$OWNER/$SLUG)"
|