Skip to content

Workflow: main → worktree → PR → prod

Workflow: main → worktree → PR → prod

Section titled “Workflow: main → worktree → PR → prod”

All local agent work happens in a worktree from a fresh origin/main. No direct pushes to main. Production changes (Worker, Pages) go through CI.

Terminal window
git fetch origin main --quiet
git checkout main
git rebase origin/main # keep local main in sync
Terminal window
SLUG=<short-task-slug> # e.g. "fix/cors", "feat/sell-page"
WT="$HOME/.local/share/gondolier/worktrees/$SLUG"
git worktree add -b "$SLUG" "$WT" origin/main
cd "$WT"
  1. Edit files in $WT only. Never edit the shared repo root.
  2. Validate before committing:
Terminal window
go vet ./tests/unit/api/... ./tests/unit/cron/... ./tests/unit/crypto/... ./tests/unit/forge/... ./tests/unit/lease/... ./internal/api/... ./internal/auth/... ./internal/cron/... ./pkg/...
go test -race -count=1 ./tests/unit/api/... ./tests/unit/cron/... ./tests/unit/crypto/... ./tests/unit/forge/... ./tests/unit/lease/...
go build ./cmd/... ./internal/api/... ./internal/auth/... ./internal/cron/... ./pkg/...
wrangler deploy --dry-run # verify Worker deploys cleanly
node scripts/validate-site.cjs site/ # verify Pages site is valid
  1. Commit with the shared cloudkoopa git identity:
Terminal window
git add -A
git commit -m "scope: description
One-line summary. What changed. Why."
  1. Push and create PR:
Terminal window
git push origin "$SLUG"
curl -X POST "https://git.rbtr.dev/api/v1/repos/laputacloudco/gondolier/pulls" \
-H "Authorization: token $GONDOLIER_GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"title\":\"$SLUG: description\",\"head\":\"$SLUG\",\"base\":\"main\"}"

Only main triggers production deploys:

  • Worker: wrangler deploy runs on push to main (via CI deploy-prod job)
  • Pages: wrangler pages deploy site/ --branch=main runs on push to main

CI checks on PRs run on the PR branch — no production impact.

After PR is merged:

Terminal window
# Local
git fetch origin main
git checkout main
git branch -D <branch-name>
# Remote
git push origin --delete <branch-name>
# Worktree
git worktree remove "$WT"
  • Never push directly to main — use PRs
  • Never edit from the shared repo root — use worktrees
  • Never touch Pages config directly — use wrangler pages deploy with --branch=main
  • Never change Cloudflare DNS/proxy settings — those are infrastructure
  • Never bypass shunt — the mq/** branch is shunt’s merge queue