Branch review
Run a local multi-angle code review against the default branch and write a markdown report.
Report path
- •Default:
./code-review.md(repo root) - •Allow override when the user passes either:
- •
path=docs/review.md - •
docs/review.md
- •
Treat the argument as a path if it does not contain =. If path= is provided, use the value after =.
Workflow
- •Detect default branch
- •Try:
git symbolic-ref refs/remotes/origin/HEADand extract the branch name - •Fallback order:
main,master,develop,development
- •Try:
- •Compute diff
- •
git diff --name-only <base>...HEAD - •
git diff <base>...HEAD(use for hunks/line ranges)
- •
- •Locate AGENTS.md
- •
find . -name "AGENTS.md" 2>/dev/null - •Use repo-root AGENTS.md plus any AGENTS.md in directories containing changed files
- •
- •Run review passes (sequential is fine)
- •Policy / AGENTS compliance: check diff against AGENTS.md guidance
- •Bug scan: inspect diff only (avoid large context)
- •History / blame: use
git blame+git logon modified files/lines - •Prior PRs (optional):
- •If repo is on GitHub and
ghis available:- •Detect GitHub via
git remote get-url origincontaininggithub.com - •Use
ghto list recent merged PRs and check if they touched modified files (limit 20–50 PRs)
- •Detect GitHub via
- •If not on GitHub or
ghunavailable: skip this pass
- •If repo is on GitHub and
- •Comment compliance: read code comments in modified files and verify changes follow comment guidance
- •Score issues (0–100)
- •Use rubric: 0, 25, 50, 75, 100
- •Filter to >= 80 only
- •Report
- •If no issues >= 80: do not write the report file
- •Otherwise write the report with:
- •Summary (base branch, current branch, files reviewed)
- •AGENTS.md files used
- •Issues list: description, reason/type, confidence score, file path + line range + commit SHA
- •For commit SHA:
git blame -L start,end -- <file>and use the first SHA
Linking
Each issue must include file path + line range + commit SHA. Do not use GitHub URLs.