Skip to content

review-pr.mjs

Runs the forge review kit's review-pr entrypoint against this repository, resolving where that kit lives at run time.

Agent toolingreview-pr.mjs

What it does

Locates the forge review kit's review-pr.mjs entrypoint by checking FORGE_REVIEW_KIT first, then tools/forge-review-kit/, where a kit vendored into this repository would sit. Spawns that entrypoint as a child process with every argument forwarded and stdio connected directly to the caller's. Reports a readable error instead of a raw ENOENT when neither path holds the kit.

Usage

The review kit lives outside this repository, so every argument after the script path forwards to its entrypoint unchanged. The minimal invocation that works, reviewing one pull request:

bash
node tools/review-pr.mjs <PR#>

The review:pr npm script wraps the same call:

bash
npm run review:pr -- <PR#>

Options

No options.

Inputs and outputs

Reads FORGE_REVIEW_KIT first, which may name the kit's directory or its entrypoint. If it is unset, tools/forge-review-kit/ is probed for a review-pr.mjs entrypoint. No path outside this repository is guessed at. Every argument after the script path passes straight through to that entrypoint's own process.

On success, stdio is inherited directly from the kit's process, so its output is this script's output, and the exit code is exactly what the kit reported.

Exit codeMeaning
the kit's own exit codeThe kit ran to completion; this script exits with whatever it reported.
1Neither FORGE_REVIEW_KIT nor tools/forge-review-kit/ holds a review-pr.mjs entrypoint, or the child process failed to start.

Examples

Review a pull request with the kit already vendored at tools/forge-review-kit/:

bash
node tools/review-pr.mjs 42

Point at a kit that lives in another checkout, the form this file's own failure text prints:

bash
FORGE_REVIEW_KIT=/path/to/forge-review-kit npm run review:pr -- 42

Notes

package.json's review:pr script must stay exactly node tools/review-pr.mjs. The review kit's own installer rewrites that line to an absolute path into whichever checkout ran it. That path resolves on one machine and nowhere else — if it has been rewritten, restore the line rather than teach this file to follow the new path.

The gate catches the rewrite:

bash
npm run checks:covered

It fails on any script naming a path outside this repository, so nobody has to remember to look.

tools/auto-merge.mjs does not call this script through the npm alias. It spawns an entrypoint directly, defaulting to tools/review-pr.mjs and overridden by its own GW_REVIEW_KIT environment variable — a mechanism separate from FORGE_REVIEW_KIT, which only this script reads.

The kit is not a dependency of this repository; nothing here pins which version of it runs.

Source

tools/review-pr.mjs — part of Agent tooling