|
| 1 | +--- |
| 2 | +name: review |
| 3 | +description: Review a GitHub pull request; defaults to the current branch's PR when no number is given |
| 4 | +user-invocable: true |
| 5 | +argument-hint: "[#N]" |
| 6 | +allowed-tools: Bash, Read, Grep, Glob |
| 7 | +--- |
| 8 | + |
| 9 | +# Review a Pull Request |
| 10 | + |
| 11 | +Review a GitHub PR. When no number is given, review the PR for the current branch. |
| 12 | + |
| 13 | +> For reviewing your uncommitted working diff instead, use `/code-review`. |
| 14 | +
|
| 15 | +## Current Branch Context |
| 16 | +- Branch: !`git branch --show-current` |
| 17 | +- PR for this branch: !`gh pr view --json number,title,state,url --jq '"#\(.number) \(.title) [\(.state)] \(.url)"' 2>/dev/null || echo "none"` |
| 18 | + |
| 19 | +## Arguments |
| 20 | +- `$ARGUMENTS` - PR number to review (optional, e.g., `#42` or `42`). |
| 21 | + |
| 22 | +## Instructions |
| 23 | + |
| 24 | +1. **Resolve which PR to review:** |
| 25 | + - If `$ARGUMENTS` contains a number, review that PR. |
| 26 | + - Otherwise, use the current branch's PR shown in the context above. |
| 27 | + - If neither yields a PR (no argument and the branch has no open PR), run `gh pr list` and ask the user which one to review. Do NOT guess. |
| 28 | + |
| 29 | +2. **Load the PR:** |
| 30 | + ```bash |
| 31 | + gh pr view <number> --json number,title,body,state,headRefName,baseRefName,url |
| 32 | + gh pr diff <number> |
| 33 | + ``` |
| 34 | + |
| 35 | +3. **Review the diff** against this project's standards (see `.claude/CLAUDE.md` and `.claude/rules/`): |
| 36 | + - Bash 3.0+ compatibility (no `declare -A`, `[[ ]]`, `${var,,}`, negative indexing, `&>>`) |
| 37 | + - Tests exist and follow TDD; both success and failure paths covered |
| 38 | + - Naming, namespacing (`bashunit::*` / `_private`), and dynamic-scope safety |
| 39 | + - ShellCheck cleanliness and `shfmt` formatting |
| 40 | + - CHANGELOG.md updated for user-facing changes |
| 41 | + |
| 42 | +4. **Report findings** grouped by severity (blocker / suggestion / nit), each as `path:line — problem. fix.`. No praise, no scope creep. State plainly if the PR looks good. |
0 commit comments