Skill: Deploy
Description
Promotes test to main via a pull request. Creates the PR, runs tests, and merges if they pass. One approval, no extra prompts.
Trigger
- •Invoked by the
/deployslash command. - •Requires
testbranch to exist and be ahead ofmain.
Process
Phase 1: Preparation
- •Save current branch — Record it so we can return at the end.
- •Auto-stash if dirty — If
git status --porcelainshows changes, rungit stash --include-untracked -m "deploy-auto-stash". Do NOT ask — just stash and continue. - •Checkout test —
git checkout test. - •Push test —
git push origin testto ensure remote is up to date. - •Verify ahead of main —
git log main..test --oneline. If empty, report "Nothing to deploy", restore stash, return to original branch, exit.
Phase 2: Quality Gate
- •
Run tests —
uv run pyteston the test branch.- •If any fail: report failures, restore stash, return to original branch. Stop.
- •If all pass: record the count.
- •
Run ruff —
uv run ruff check foundry_app/. Record result.
Phase 3: Build Release Notes
- •
Identify beans — Parse
git log main..test --onelineforBEAN-NNN:messages. Cross-reference withai/beans/_index.mdfor titles. - •
Count branches to clean — List all
bean/*branches (local + remote). Count how many are merged into test.
Phase 4: User Approval — ONE prompt
- •
Present summary and ask once:
code=================================================== DEPLOY: test → main (via PR) =================================================== Beans: <list> Tests: N passed, 0 failed Ruff: clean / N violations Post-merge: N feature branches will be deleted On "go": create PR, merge it, delete branches, restore working tree. No further prompts. ===================================================
- •
Single approval with options: go / go with tag / abort.
CRITICAL: This is the ONLY user prompt. Everything after "go" runs without stopping.
Phase 5: Execute (no further prompts)
- •
Create PR:
bashgh pr create --base main --head test \ --title "Deploy: <date> — <bean list summary>" \ --body "<release notes>"
- •
Merge PR:
bashgh pr merge <pr-number> --merge --subject "Deploy: <date> — <bean list>"
Use
--merge(not squash/rebase) to preserve history. - •
Tag (optional) — If requested:
git tag <version> && git push origin --tags. - •
Delete local feature branches — All
bean/*branches merged into main:git branch -d. Stale/orphaned ones for Done beans:git branch -D. - •
Delete remote feature branches — Any
remotes/origin/bean/*:git push origin --delete. - •
Sync local main —
git checkout main && git pull origin main. - •
Restore stash — If we auto-stashed:
git stash pop. On conflict, prefer HEAD for files that came from test. - •
Report success — PR URL, merge commit, beans deployed, branches deleted.
Key Rules
- •One approval gate. User says "go" once. Everything after is automatic.
- •Auto-stash, auto-restore. Dirty working tree handled silently.
- •PR is created AND merged. Not just created — the full cycle completes.
- •Branch cleanup included. No separate step needed.
- •If a command is blocked by sandbox: print the exact command for the user to run manually, then continue with the rest.
Error Conditions
| Error | Resolution |
|---|---|
| Nothing to deploy | Report and exit |
| Tests fail | Report failures, restore stash, return. Fix first. |
| PR create fails | Report error. Check gh auth status. |
| PR merge fails | Report error. Check branch protection / conflicts. |
| User aborts | Restore stash, return to original branch |
| Command blocked | Print command for manual execution, continue |