Maintainer scripts
The Node scripts in scripts/. Some keep this repository honest; the rest do the work behind redline metrics and redline registry.
For the platform team maintaining Redline. Engineers in a product repository never run these.
Why they exist
Redline holds every onboarded repository to a standard, so its own source has to meet one too. Four source checks do that. They confirm every rule has an id, the rendered files match standards/, the bundle is consistent, and every pinned dependency is what its comment says. CI runs them, and you run them while editing.
Nine measurement scripts do the estate-wide work. You never call them directly. You run redline metrics or redline registry, which validates the flags and then runs the script. Their flags and output are documented on those pages.
Two more are local helpers for maintainers.
All scripts
| Script | Kind | What it does | Who runs it | How |
|---|---|---|---|---|
validate.mjs | Source check | Bundle self-check: manifest integrity, rule ids, the output contract, ruleset and workflow files, the seeded corpus. | CI on every pull request and push to main (ci.yml), and release.yml before a publish. | node scripts/validate.mjs |
assign-rule-ids.mjs | Source check | Writes a permanent <stack>/<slug> id onto every rule in standards/ that lacks one; --check fails instead of writing. | You, after adding a rule. CI and release.yml run it with --check, which fails instead of writing. | node scripts/assign-rule-ids.mjs |
render-self.mjs | Source check | Renders this repository's own AGENTS.md, CLAUDE.md and Copilot files from standards/; --check fails if they are stale. | You, after editing standards/. CI, release.yml and redline-sync.yml run it with --check, which fails if the checked-in output is stale. | node scripts/render-self.mjs |
check-pins.mjs | Source check | Checks every SHA-pinned action and digest-pinned Docker image against the tag its comment names, and that every gate job asks for the same redlinegate version. Reports newer releases. | CI's pins job on every pull request and push to main, allowed to fail because it needs the network. | node scripts/check-pins.mjs |
score-seeds.mjs | Measurement | Scores a reviewer's comments on a seeded pull request: BLOCKER recall, false positives on clean code, rule attribution. | seed-canary.yml, weekly, in redline-metrics. | redline metrics score-seeds |
collect-telemetry.mjs | Measurement | Pulls review outcomes for merged pull requests across the org into monthly JSONL. | redline-collect.yml, daily, in redline-metrics. | redline metrics collect |
build-digest.mjs | Measurement | Builds the weekly Teams digest as an Adaptive Card from collected telemetry. | weekly-digest.yml, Mondays, in redline-metrics. | redline metrics digest |
build-inbox.mjs | Measurement | Builds the org-wide prioritised pull-request inbox as a static page. | inbox.yml, every 30 minutes on weekdays, in this repository. | redline metrics inbox |
build-dashboard.mjs | Measurement | Builds the telemetry dashboard as a static page from collected telemetry and the register. | dashboard.yml, daily and after each collect or canary run, in redline-metrics. | redline metrics dashboard |
build-registry.mjs | Measurement | Derives registry.json, the register of onboarded repositories, from the .redline.json each one carries. | .github/workflows/registry.yml, nightly, in this repository. | redline registry |
build-correlation.mjs | Measurement | Research: whether ignored findings were followed by reverts or hotfixes. Refuses to report below its sample threshold. | A human, by hand. No workflow runs it. | redline metrics correlate |
build-roi.mjs | Measurement | What AI review cost against what it caught: cost per BLOCKER, with the DORA figures beside it. | A human, by hand, with the spend figure. No workflow runs it. | redline metrics roi |
build-baseline.mjs | Measurement | The Phase 0 baseline later phases are judged against; every figure it cannot source says why. | The owner, once, with org credentials. No workflow runs it. | redline metrics baseline |
fetch-stars.mjs | Local helper | Refreshes the GitHub star snapshot the docs site renders, with the date it was taken. | A maintainer, by hand, with an authenticated gh. The site build never calls the network. | npm run stars |
publish-local.mjs | Local helper | Builds, packs and installs this working tree globally, then checks the redline on PATH is the one it just built. | A maintainer, by hand, to try the working tree as the installed redline. | npm run publish:local |
Running the source checks yourself
Run them from the root of a checkout of this repository. None needs an install or a build.
node scripts/validate.mjs— Before pushing any change to standards/, manifest.json, rulesets/, workflows/ or seeded/. It prints each failure as FAIL: and each warning as warn: on stderr, then a count, and exits 1 on any failure.node scripts/assign-rule-ids.mjs— After adding a rule bullet to a file in standards/. It writes the new id into the markdown; commit it with the rule. Never write an id by hand, and never change one.node scripts/render-self.mjs— After any change to standards/ or cli/render/. It imports the CLI's TypeScript renderer directly, so it needs a Node that runs .ts files (CI uses Node 24) but no build.node scripts/check-pins.mjs— After adding or bumping a pinned action, a Docker image digest or the gate's REDLINE_CLI_VERSION. The gate asks for redlinegate@latest on purpose, and the check accepts it. Set GH_TOKEN to avoid the GitHub API rate limit. Add --strict to fail on available updates as well as on mismatches.
The two local helpers run through npm: npm run stars refreshes web/lib/github-stars.json, and npm run publish:local installs the working tree as your global redline. npm run publish:local:clean removes it again.
Changing a script
Edit the .mjs file directly; nothing generates them. Then run npm test, which includes the tests under scripts/**/__tests__/. CI also parses every scripts/*.mjs with node --check.
If the script sits behind a metrics or registry command, its flags are declared in cli/metrics/options.ts. Change both in the same pull request.