redline review
Review your change against only the rules that apply to the files it touches.
Reviews your change before you push, against the rules for the stacks your diff actually touches. At a terminal with no --engine, it prints what a checker can decide without a model, straight away. Inside an assistant's shell or a pipe, it prints a prompt for that assistant to apply. With --engine api, it sends the diff to a model endpoint you configure, which can be local. Results are never recorded and never fail anything.
Where it runs: Inside the product repository, through the copy pinned in its devDependencies. The profile comes from .redline.json unless you pass --profile.
Synopsis
redline review [--staged] [--diff-file <path>] [--base <ref>] [--engine <name>] [--print-prompt]
[--provider openai|anthropic] [--model <name>] [--base-url <url>] [--json]Flags
| Flag | Default | What it does |
|---|---|---|
--staged | off | Review only what is staged. |
--diff-file <path> | none | Review a unified diff from a file instead of the checkout. |
--base <ref> | the default branch | The branch to diff against. The diff is taken from the merge base, so commits that landed on the base since you branched are not reviewed. |
--profile <name> | from .redline.json | The profile whose rules apply. |
--engine embedded | see above | Print the bounded prompt for the assistant running the command. |
--engine api | off | Call a model endpoint and print its findings. Nothing is sent unless you pass this flag. |
--provider openai|anthropic | from the API key | Which API the api engine speaks. Inferred from OPENAI_API_KEY or ANTHROPIC_API_KEY. openai covers any OpenAI-compatible server, such as Ollama, LM Studio or vLLM. |
--model <name> | REDLINE_REVIEW_MODEL | The model the api engine calls. Required one way or the other. |
--base-url <url> | the provider's | The endpoint the api engine calls. A local OpenAI-compatible server needs no key. |
--print-prompt | off | Write only the prompt to stdout, everything else to stderr, so redline review --print-prompt | pbcopy copies the prompt alone. Not with --engine api. |
--json | off | Scope, prompt and findings as JSON on stdout. |
--help prints the same list from the CLI you have installed.
Examples
At a terminal
$ pnpm redline review profile javascript-typescript — rules in scope: core, typescript src/a.ts:2 Redline/HIGH [core/untracked-todo]: this TODO carries no ticket reference, so nothing will bring anyone back to it. Add the ticket id on the same line, or do the work now. 1 finding(s) that is every rule a checker can decide; the rest of the standard needs a model — run /redline-review in your assistant, or `redline review --engine api` local review — not recorded, and not counted in rule-tuning telemetry
$ npx redlinegate review profile javascript-typescript — rules in scope: core, typescript src/a.ts:2 Redline/HIGH [core/untracked-todo]: this TODO carries no ticket reference, so nothing will bring anyone back to it. Add the ticket id on the same line, or do the work now. 1 finding(s) that is every rule a checker can decide; the rest of the standard needs a model — run /redline-review in your assistant, or `redline review --engine api` local review — not recorded, and not counted in rule-tuning telemetry
$ yarn redline review profile javascript-typescript — rules in scope: core, typescript src/a.ts:2 Redline/HIGH [core/untracked-todo]: this TODO carries no ticket reference, so nothing will bring anyone back to it. Add the ticket id on the same line, or do the work now. 1 finding(s) that is every rule a checker can decide; the rest of the standard needs a model — run /redline-review in your assistant, or `redline review --engine api` local review — not recorded, and not counted in rule-tuning telemetry
$ bun run redline review profile javascript-typescript — rules in scope: core, typescript src/a.ts:2 Redline/HIGH [core/untracked-todo]: this TODO carries no ticket reference, so nothing will bring anyone back to it. Add the ticket id on the same line, or do the work now. 1 finding(s) that is every rule a checker can decide; the rest of the standard needs a model — run /redline-review in your assistant, or `redline review --engine api` local review — not recorded, and not counted in rule-tuning telemetry
With a local model
$ pnpm redline review --engine api --provider openai --base-url http://localhost:11434/v1 --model qwen2.5-coder:14b
$ npx redlinegate review --engine api --provider openai --base-url http://localhost:11434/v1 --model qwen2.5-coder:14b
$ yarn redline review --engine api --provider openai --base-url http://localhost:11434/v1 --model qwen2.5-coder:14b
$ bun run redline review --engine api --provider openai --base-url http://localhost:11434/v1 --model qwen2.5-coder:14b
Paste the prompt into any assistant
$ pnpm redline review --print-prompt | pbcopy
$ npx redlinegate review --print-prompt | pbcopy
$ yarn redline review --print-prompt | pbcopy
$ bun run redline review --print-prompt | pbcopy
Exit codes
| Code | Meaning |
|---|---|
0 | Always when the review ran, whatever it found. It is a pre-push check, not a gate. |
2 | Usage error: an unknown flag or value, or a Node version below 18.11. |
Related
- Reviewing before you push
- The output contract
- redline policy
- All commands and the shared exit codes
- Source:
cli/commands/review.ts