Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283#!/usr/bin/env bash# Post-commit hook:# 1) log the commit event to local agent memory# 2) import recent Codex messages into local memory# 3) flush remote queue (no-op unless remote sync is enabled)# 4) auto-deploy landing page to silo when it changesset -uREPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || true)"if [ -z "${REPO_ROOT:-}" ]; then exit 0fiNODE_BIN="${NODE_BIN:-node}"if ! command -v "$NODE_BIN" >/dev/null 2>&1; then exit 0fi# Agent memory"$NODE_BIN" "$REPO_ROOT/memory/hook.mjs" post-commit >/dev/null 2>&1 || true"$NODE_BIN" "$REPO_ROOT/memory/codex-sync.mjs" --max-sessions 3 --max-events 120 >/dev/null 2>&1 || true"$NODE_BIN" "$REPO_ROOT/memory/cli.mjs" flush-remote >/dev/null 2>&1 || true# Auto-deploy landing page to silo when it changesif git diff-tree --no-commit-id --name-only -r HEAD | grep -q "feed/landing-page.html"; then echo "📺 Landing page changed — deploying to silo..." fish "$REPO_ROOT/feed/deploy-silo.fish" --landing 2>&1 | tail -3 &fi# Auto-deploy AT PDS frontend when tracked files changeAT_FRONTEND_FILES="at/index.html|at/user-page.html|at/media-modal.js|at/media-records.js"if git diff-tree --no-commit-id --name-only -r HEAD | grep -qE "^($AT_FRONTEND_FILES)$"; then echo "🔮 AT frontend changed — deploying to PDS..." bash "$REPO_ROOT/at/scripts/deploy-at-frontend.sh" 2>&1 | tail -3 &fi# 🏟️ Auto-deploy arena: lith (client) + session-server (multiplayer authority)# when any arena-touching file changes on main. Set AC_NO_AUTO_DEPLOY=1 in the# env to skip (e.g. while bisecting / hotfixing without going live).## Pipeline:# 1. push HEAD to knot (origin) so lith's pull matches local# 2. fire lith/deploy.fish — pulls knot, restarts service# 3. wait for the knot→github mirror (lith's 60s systemd timer)# 4. fire session-server/deploy.fish — VPS git pull + node restart## Both deploys run async so they don't block the commit. Logs land in# .git/arena-auto-deploy.log for postmortems.CURRENT_BRANCH="$(git -C "$REPO_ROOT" symbolic-ref --short HEAD 2>/dev/null || true)"if [ "${AC_NO_AUTO_DEPLOY:-}" != "1" ] && [ "$CURRENT_BRANCH" = "main" ]; then ARENA_TOUCH_RE='^(system/public/aesthetic.computer/disks/arena\.mjs|system/public/aesthetic.computer/lib/(arena-world|pmove|cam-doll)\.mjs|session-server/(arena-manager|session)\.mjs|shared/.*)$' if git diff-tree --no-commit-id --name-only -r HEAD | grep -qE "$ARENA_TOUCH_RE"; then echo "🏟️ arena change on main — auto-deploying lith + session-server in background…" DEPLOY_LOG="$REPO_ROOT/.git/arena-auto-deploy.log" ( printf "\n=== %s commit=%s ===\n" "$(date -Iseconds)" "$(git -C "$REPO_ROOT" rev-parse --short HEAD)" >> "$DEPLOY_LOG" # 1. Push to knot if local is ahead (idempotent if already pushed). LOCAL_HEAD=$(git -C "$REPO_ROOT" rev-parse HEAD) REMOTE_HEAD=$(git -C "$REPO_ROOT" rev-parse origin/main 2>/dev/null || echo none) if [ "$LOCAL_HEAD" != "$REMOTE_HEAD" ]; then echo "→ pushing $LOCAL_HEAD to origin/main" >> "$DEPLOY_LOG" git -C "$REPO_ROOT" push origin main >> "$DEPLOY_LOG" 2>&1 || \ echo "⚠ push to knot failed — skipping deploys" >> "$DEPLOY_LOG" fi # 2. lith (pulls from knot directly). echo "→ fish lith/deploy.fish" >> "$DEPLOY_LOG" fish "$REPO_ROOT/lith/deploy.fish" >> "$DEPLOY_LOG" 2>&1 || \ echo "⚠ lith deploy failed" >> "$DEPLOY_LOG" # 3. give knot→github mirror time to sync (lith systemd timer = 60s). sleep 75 # 4. session-server (pulls from github via VPS). echo "→ fish session-server/deploy.fish" >> "$DEPLOY_LOG" fish "$REPO_ROOT/session-server/deploy.fish" >> "$DEPLOY_LOG" 2>&1 || \ echo "⚠ session-server deploy failed" >> "$DEPLOY_LOG" echo "→ done" >> "$DEPLOY_LOG" ) & disown 2>/dev/null || true fifiexit 0