redline policy

Evaluate the rules a checker can decide, with no model call.

Some rules need no judgement: a TODO has a ticket reference or it does not. policy checks those rules against the added lines of a diff, with no model, and fails on a BLOCKER. The gate runs it as the policy job on every pull request. Run it yourself to reproduce that job. It also says how many rules it could not decide; redline review covers those.

Where it runs: Inside the product repository, or anywhere you have a diff. The gate runs it in CI.

Synopsis

synopsis
redline policy --diff-file <path> [--fail-on <severity>] [--json]

Flags

FlagDefaultWhat it does
--diff-file <path>requiredThe unified diff to evaluate. Only added lines are checked.
--fail-on <severity>BLOCKERThe lowest severity that fails the run: BLOCKER, HIGH or SUGGESTION.
--jsonoffok, findings, the rules evaluated, and how many need a model, as JSON on stdout.

--help prints the same list from the CLI you have installed.

Examples

Check your branch

terminal
$ git diff main...HEAD > change.diff
$ pnpm redline policy --diff-file change.diff

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) from 53 deterministic rule(s)
443 of the 496 rule(s) in the catalogue cannot be decided without a model and were not checked here — run `redline review` for those

Fail on HIGH as well

terminal
$ pnpm redline policy --diff-file change.diff --fail-on HIGH

Exit codes

CodeMeaning
0No finding at or above --fail-on. The example above exits 0: one HIGH does not fail the BLOCKER default.
1At least one finding at or above --fail-on.
2No --diff-file, or an unknown severity.