Review PR
Overview
Perform a read-only review and produce both human and machine-readable outputs.
Inputs
- •Ask for PR number or URL.
- •If missing, always ask.
Safety
- •Never push, merge, or modify code intended to keep.
- •Work only in
.worktrees/pr-<PR>.
Execution Contract
- •Run wrapper setup:
sh
scripts/pr-review <PR>
- •Use explicit branch mode switches:
- •Main baseline mode:
scripts/pr review-checkout-main <PR> - •PR-head mode:
scripts/pr review-checkout-pr <PR>
- •Before writing review outputs, run branch guard:
sh
scripts/pr review-guard <PR>
- •Write both outputs:
- •
.local/review.mdwith sections A through J. - •
.local/review.jsonwith structured findings.
- •Validate artifacts semantically:
sh
scripts/pr review-validate-artifacts <PR>
Steps
- •Setup and metadata
sh
scripts/pr-review <PR> ls -la .local/pr-meta.json .local/pr-meta.env .local/review-context.env .local/review-mode.env
- •Existing implementation check on main
sh
scripts/pr review-checkout-main <PR> rg -n "<keyword>" -S src extensions apps || true git log --oneline --all --grep "<keyword>" | head -20
- •Claim PR
sh
gh_user=$(gh api user --jq .login) gh pr edit <PR> --add-assignee "$gh_user" || echo "Could not assign reviewer, continuing"
- •Read PR description and diff
sh
scripts/pr review-checkout-pr <PR> gh pr diff <PR> source .local/review-context.env git diff --stat "$MERGE_BASE"..pr-<PR> git diff "$MERGE_BASE"..pr-<PR>
- •Produce review outputs
Fill .local/review.md and .local/review.json.
Minimum JSON shape:
json
{
"recommendation": "READY FOR /prepare-pr",
"findings": [
{
"id": "F1",
"severity": "IMPORTANT",
"title": "...",
"area": "path/or/component",
"fix": "Actionable fix"
}
],
"tests": {
"ran": [],
"gaps": [],
"result": "pass"
},
"docs": "up_to_date|missing|not_applicable",
"changelog": "required"
}
- •Guard + validate before final output
sh
scripts/pr review-guard <PR> scripts/pr review-validate-artifacts <PR>
Guardrails
- •Keep review read-only.
- •Do not delete worktree.
- •Use merge-base scoped diff for local context to avoid stale branch drift.
Workflow completo
Ver PR_WORKFLOW.md para el flujo completo review → prepare → merge.