Run focused tests first, then broader suite if reasonable.
Include lint/typecheck/build when conventional.
Capture exact commands and outcomes.
Report
Produce structured report:
PR summary
Checkout location + base/head SHAs
Review findings: blockers / warnings / notes with file:line refs
Tests run: command → pass/fail
Merge readiness: READY | NOT READY
Exact merge plan/command to run after OK
If not ready, list minimal required fixes.
Wait
Stop after report.
Ask for explicit OK to merge only if READY.
On OK: re-fetch, verify PR still current/mergeable, run critical checks if needed, then merge using repo convention (gh pr merge, platform tool, or local merge). Report final status.
After successful merge: remove worktree/branch of PR
---
description: Review, checkout, test, and prepare PR merge
argument-hint: "<pr-url|number|branch|ref> [test-command]"
---
Review PR end-to-end and prepare merge. Do **not** merge until explicit user OK.
**PR**: $1
**Test command override**: ${@:2}
Workflow:
1. **Identify**
- Detect host/tooling: GitHub `gh` if available; otherwise generic `git`.
- Resolve PR metadata: title, author, base, head, URL, status, CI, labels.
- Fetch latest base/head.
2. **Protect local work**
- Check `git status --short`.
- If dirty unrelated work exists: do not overwrite. Prefer isolated worktree.
- Detect repo style via `git worktree list`, existing branch/worktree conventions.
3. **Checkout**
- Prefer worktree when repo uses worktrees, current tree is dirty, or PR needs isolation.
- Use branch when repo convention/current state is clean and branch checkout is safe.
- GitHub path: `gh pr checkout <PR>` or fetch ref, then create branch/worktree.
- Generic path: fetch PR/head ref or remote branch, then create branch/worktree.
4. **Review diff**
- Compare PR head vs base.
- Read relevant files, tests, docs, configs.
- Check correctness, security, perf, API compat, migrations, UX, error handling.
- Verify PR matches issue/description.
5. **Test**
- If test override provided, run it.
- Else infer project commands from README, package files, lockfiles, CI, justfile, Makefile.
- Run focused tests first, then broader suite if reasonable.
- Include lint/typecheck/build when conventional.
- Capture exact commands and outcomes.
6. **Report**
- Produce structured report:
- PR summary
- Checkout location + base/head SHAs
- Review findings: blockers / warnings / notes with file:line refs
- Tests run: command → pass/fail
- Merge readiness: READY | NOT READY
- Exact merge plan/command to run after OK
- If not ready, list minimal required fixes.
7. **Wait**
- Stop after report.
- Ask for explicit OK to merge only if READY.
- On OK: re-fetch, verify PR still current/mergeable, run critical checks if needed, then merge using repo convention (`gh pr merge`, platform tool, or local merge). Report final status.
- After successful merge: remove worktree/branch of PR