Skip to content

niraj56465/pr-pipe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generic PR Context Agent

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.

Pipeline

  1. Read changed files and hunks from git diff or a supplied diff file.
  2. Locate nearby code structures with lightweight syntax heuristics.
  3. Discover likely tests with path heuristics plus import/reference search.
  4. Route stable repo knowledge from REVIEW_CONTEXT.md, REVIEW_RULES.yaml, KNOWN_IMPACTS.yaml, DOC_ROUTING.yaml, and agent-made reference files.
  5. Assemble a bounded JSON context pack.
  6. Optionally invoke PR-Agent or another reviewer command with the completed pack.

Review Model

  • 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.

Usage

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.diff

In single-input mode the CLI:

  • takes the PR as the only required input
  • fetches the diff with gh pr diff when 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.

Optional Repository Config

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}"]
  }
}

Repo Knowledge Files

  • REVIEW_CONTEXT.md: architecture rules, invariants, subsystem notes, risky areas
  • REVIEW_RULES.yaml: blocking rules, severity rules, test/evidence requirements
  • KNOWN_IMPACTS.yaml: mappings like "if X changes, inspect Y"
  • DOC_ROUTING.yaml: path and file-role rules for docs
  • .pr-agent/refs/**/*.md or review-references/**/*.md: agent-made reference files

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors