- pnpm workspace: apps/web (Next.js), apps/bot, packages/{db,shared,mcp,runner}
- Drizzle schema: projects, goals, tasks, sessions, questions, events
- Postgres via infra/docker-compose.yml
- template/: AGENTS.md workflow on OpenSpec, Claude hooks, peppa MCP config
- scripts to push template and bootstrap projects in Gitea
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
1.2 KiB
Bash
Executable File
28 lines
1.2 KiB
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")/.."
|
|
[ -f .env ] && set -a && . ./.env && set +a
|
|
: "${GITEA_URL:?}" "${GITEA_TOKEN:?set GITEA_TOKEN in .env}"
|
|
REPO="${GITEA_TEMPLATE_REPO:-peppa/template}"
|
|
OWNER="${REPO%%/*}"; NAME="${REPO##*/}"
|
|
api() { curl -fsS -H "Authorization: token $GITEA_TOKEN" -H "Content-Type: application/json" "$@"; }
|
|
|
|
# Org may already exist, or OWNER may be the token's user.
|
|
api -X POST "$GITEA_URL/api/v1/orgs" -d "{\"username\":\"$OWNER\"}" >/dev/null 2>&1 || true
|
|
if ! api "$GITEA_URL/api/v1/repos/$OWNER/$NAME" >/dev/null 2>&1; then
|
|
api -X POST "$GITEA_URL/api/v1/orgs/$OWNER/repos" \
|
|
-d "{\"name\":\"$NAME\",\"description\":\"Peppa project template\",\"default_branch\":\"main\",\"template\":true}" >/dev/null
|
|
echo "created $REPO"
|
|
fi
|
|
|
|
TMP="$(mktemp -d)"; trap 'rm -rf "$TMP"' EXIT
|
|
cp -R template/. "$TMP/"
|
|
cd "$TMP"
|
|
git init -q -b main
|
|
git add -A
|
|
git -c user.name="Peppa" -c user.email="peppa@localhost" commit -qm "Update Peppa template"
|
|
HOST="${GITEA_URL#*://}"
|
|
git push -qf "https://peppa:${GITEA_TOKEN}@${HOST}/${OWNER}/${NAME}.git" main
|
|
echo "pushed template to $GITEA_URL/$REPO"
|