/pr — Commit, Push & Create Pull Request
Complete the git workflow for the current feature branch: verify environment, run checks, commit, push, and open a PR.
Pre-flight Checks
- •gh CLI: Run
gh auth status. If not authenticated, STOP and tell the user to rungh auth login. - •Branch safety: Run
git branch --show-current. If onmain, STOP and tell the user to create a feature branch first (per CLAUDE.md:feat/,fix/,test/,docs/,refactor/,chore/). - •Remote exists: Run
git remote -vand verifyoriginis configured.
If any pre-flight check fails, report the issue clearly and stop.
Run Quality Checks
Detect which repo we're in and run the appropriate checks:
sof-backend (if fastify/server.js exists):
- •
npx vitest run
sof-alpha (if vite.config.js exists):
- •
npm run test(frontend tests) - •
npm run lint - •
npm run build - •If
contracts/exists:cd contracts && forge test && cd ..
If any check fails, STOP and report the failures. Do NOT proceed to commit.
Commit
- •Run
git statusandgit diff --stagedandgit diffto see all changes. - •Stage only relevant files — do NOT use
git add -A. Exclude.env, credentials, and large binaries. - •Draft a conventional commit message (
feat:,fix:,docs:,test:,refactor:,chore:) that explains the why, not the what. - •Show the user the proposed commit message and staged files. Wait for approval before committing.
- •Commit with Co-Authored-By trailer.
Push & Create PR
- •Push the branch:
git push -u origin <branch-name> - •Create the PR:
- •Title: short, under 70 chars
- •Body:
## Summarywith 1-3 bullet points +## Test planwith checklist
- •Report the PR URL to the user.
Important
- •NEVER merge the PR automatically. Only create it.
- •NEVER work on main. If on main, stop immediately.
- •If the user passes arguments (e.g.,
/pr fix: resolve wallet bug), use that as the commit message instead of drafting one.