A Node.js + TypeScript review-context pipeline for generic repositories.
The agent builds a bounded context pack for an LLM reviewer. It keeps toolwork narrow and deterministic, then lets the reviewer decide from that pack instead of exploring the whole codebase by default.
- Read changed files and hunks from
git diffor a supplied diff file. - Locate nearby code structures with lightweight syntax heuristics.
- Discover likely tests with path heuristics plus import/reference search.
- Route stable repo knowledge from
REVIEW_CONTEXT.md,REVIEW_RULES.yaml,KNOWN_IMPACTS.yaml,DOC_ROUTING.yaml, and agent-made reference files. - Assemble a bounded JSON context pack.
- Optionally invoke PR-Agent or another reviewer command with the completed pack.
- Tools gather bounded evidence.
- The context pack is the primary review input.
- The LLM reviewer decides what matters.
- Extra repo exploration should happen only when the pack exposes a concrete gap.
The repository also includes a Codex-style skill at codex-pr-review/SKILL.md that shows how to instruct an agent to use the pack.
The generated context pack also includes a reviewPrompt field so any downstream LLM runner can consume a ready-to-use prompt along with the structured evidence.
Single-input mode:
npm install
npm run build
node dist/cli.js <pr-number-or-url>Examples:
node dist/cli.js 123
node dist/cli.js https://github.com/acme/api/pull/123
node dist/cli.js ./artifacts/pr-123.diffIn single-input mode the CLI:
- takes the PR as the only required input
- fetches the diff with
gh pr diffwhen needed - builds the context pack automatically
- runs the configured reviewer automatically when one is configured
Advanced mode is still available when you want to drive the diff manually:
node dist/cli.js --repo /path/to/repo --base main --head HEAD \
--out context-pack.json \
--skill-file codex-pr-review/SKILL.md \
--run-review{contextPack}, {repo}, and {skillFile} placeholders are replaced before the command runs.
Create .pr-context-agent.json in the target repo:
{
"maxFileBytes": 24000,
"skillFile": "codex-pr-review/SKILL.md",
"reviewer": {
"command": "pr-agent",
"args": ["--context-file", "{contextPack}", "--skill", "{skillFile}"]
}
}REVIEW_CONTEXT.md: architecture rules, invariants, subsystem notes, risky areasREVIEW_RULES.yaml: blocking rules, severity rules, test/evidence requirementsKNOWN_IMPACTS.yaml: mappings like "if X changes, inspect Y"DOC_ROUTING.yaml: path and file-role rules for docs.pr-agent/refs/**/*.mdorreview-references/**/*.md: agent-made reference files