Onboard a repository

Your team's rules only help if every assistant reads them and every pull request is checked against them. Onboarding puts both in place with one command, delivered as a pull request your team reviews like any other change.

This is the reference for onboarding your own repository: the full sequence, what it installs, and what to do when your token cannot do everything. New to Redline? The Learn path walks the same thing on a practice repository, one step at a time.

terminal
$ npx redlinegate@latest init --profile web-react
  profile web-react

  Files  … written
   + AGENTS.md
   + CLAUDE.md
   + .github/copilot-instructions.md
   …
   + .github/workflows/redline.yml
   + .github/pull_request_template.md
   + .redline.json

  Repository settings  … in place · 1 refused
   ✓ applied     secret-scanning    secret scanning
   ✓ applied     push-protection    secret scanning push protection
   ✗ denied      dependency-alerts  dependabot alerts (vulnerability alerts) (needs repository admin)
   …

  Pull request
   https://github.com/acme/checkout-service/pull/42

  What's left  1 for an administrator
   1. dependency-alerts — dependabot alerts (vulnerability alerts) (needs repository admin)
      → ask a repository administrator to grant admin on this repository, then re-run: redline init --repair

Before you start

✓

redlinegate@0.2.11 is the version on npm's latest tag, published 2026-10-13. Every command on this page installs it.

  • Node.js 18.11 or newer on the machine running the CLI.
  • A git repository whose remote points at GitHub — including GitHub Enterprise Server, if the hostname contains github — or Azure DevOps. A self-hosted host on a hostname that carries neither is not auto-detected. No remote yet? init still installs the rules and the local review; the gate and host settings follow when you add one and run it again.
  • The first run fetches the CLI for that one command: npx redlinegate@latest init, or pnpm dlx, yarn dlx or bunx. The npm package is redlinegate; the command it installs is redline. init pins it by default — pass --no-pin-cli to skip it — and it adds redlinegate to devDependencies at that exact version in the same pull request. From then on every command runs the project's own copy, such as pnpm redline verify, so the team, its assistants and its hooks all run one known Redline.

Two versions appear in the output, and they are separate. The package version is the CLI release on npm. The standards version is the version of the rules themselves, currently 0.2.2. Every rendered file names the standards version, so a repository can always say which rules it was given.

The whole sequence

redline init is one command, but onboarding is not one step. Step 4 is the one most often skipped, and skipping it leaves a repository that reports as onboarded while anyone with push access can still go around the gate.

#StepWho
1npx redlinegate@latest init --dry-run — read the plan. Writes nothing, needs no credential, contacts no host.anyone
2npx redlinegate@latest init — files, whatever repository settings your token allows, and a pull request. Never a direct push.anyone with push
3Review and merge that pull request. Until it merges, the gate exists only on its own branch.a reviewer
4pnpm redline init --repair with an admin token — applies the settings the first run was refused, which .redline.json lists under pendingAdmin, including the branch ruleset. See After the pull request merges.repo admin
5Prove it — watch the gate pass, block, and refuse to be waived.anyone with push
6Soak at observe, then promote with pnpm redline init --rung block-blocker once recorded evidence supports it. A promotion the evidence does not support is refused — see the enforcement ladder.the team

Step 4 is not optional cleanup. A non-admin run installs the workflow and opens the pull request, so the gate runs — but no branch ruleset is applied, so nothing stops a push straight to the default branch. The repository looks onboarded on the dashboard and the gate can be walked around.

What it installs

  • Rendered standards for the detected profile, plus the review output contract, in the files each enabled assistant reads — Adaptors lists them per tool.
  • Context sections, where selected — background about how this repository works, rendered into the same artifacts as the rules and carrying no rule ids, because they are chosen per repository rather than by stack. Spec-first is on by default; TM Forum is opt-in.
  • Security floor — secret scanning with push protection and dependency alerts on the host, and dependency review plus a secret scan in the gate. Anything it could not enable is reported, not silently skipped. The floor fails the gate at every rung and no label waives it — see the gate.
  • Merge gate, advisory — the gate reports on every pull request as redline-gate / gate, and a branch ruleset requires a pull request to merge. Required approvals default to none (--approvals). Until the gate is a required check (--blocking), a red gate does not stop a merge. Once it is required, the rung decides what turns it red: at observe, only the security floor.
  • .redline.json — profile, vendors, menu choices, pending-admin list, and the standards/CLI versions that produced it. This is what makes the repo visible to central telemetry — read-only, no secret is ever written to the repo.
Private repository Dependency review needs GitHub Code Security

On a public repository GitHub provides every part of the floor. On a private one, the gate's dependency review needs GitHub Code Security, and secret scanning with push protection needs GitHub Secret Protection. Without Code Security the dependency review job fails, and because it is on the floor it turns the gate red at every rung. Learn 01 walks through the two ways to answer it.

Every choice has a default, and init asks about the ones that matter when run interactively. Each is also a flag, and each is recorded in .redline.json so the next run keeps it. redline init lists every flag. The two that deserve a decision before you run it are where the gate lives and, if you protect the gate with CODEOWNERS, who owns it.

Name an owner that exists

--with review-ownership is the mitigation for a vendored gate, and the single most common way to install it wrong is to accept the default owner.

GitHub ignores a CODEOWNERS owner it cannot resolve, and it does so without erroring: no failed push, no warning in the UI. The file installs, the ruleset requires code-owner review, and the review is required of nobody. That is worse than not installing it, because the dashboard now says the control is on.

  • A team must be written @org/team and must actually exist. A bare @platform-engineering is read as a user, and a user that does not exist makes GitHub mark the whole file erroneous — at which point require_code_owner_review degrades to the silent no-op above.
  • A repository under a personal account has no teams at all. @you/platform-engineering cannot exist there, so pass your own handle: --review-owners @you.
  • redline verify reports review-ownership, which resolves every owner in the file against the host. It is the check that tells an enforcing CODEOWNERS from a decorative one.

Where the gate lives

By default the caller workflow Redline writes references a reusable workflow published once at <org>/.github. One merge there reaches every onboarded repository, and the gate sits outside the blast radius of the pull requests it judges — nobody raising a pull request can change the thing reviewing it.

ℹ

On GitHub, publish it once before the first repository onboards. Copy workflows/redline-gate.yml into your organisation's .github repository as .github/workflows/redline-gate.yml, so uses: <org>/.github/.github/workflows/redline-gate.yml@main resolves for every repo that follows. The secret-scan action ships pinned to a full commit SHA, and scripts/check-pins.mjs keeps it honest. Azure DevOps needs no equivalent step: redline init writes the whole pipeline template into the repository as .azuredevops/redline-gate.yml.

Most organisations do not have that repository on day one, and “go and get a shared .github repo created” is a long way to travel before finding out whether any of this is worth having. So --gate-source local vendors the gate into the repository itself at .github/workflows/redline-gate.yml and points the caller at it. It is the same file the organisation copy is published from. The required check name does not change — a local reusable workflow still reports as redline-gate / gate — so rulesets, branch policy and redline verify are identical either way, and moving between the two is a re-run with a different flag.

A vendored gate is the weaker control, not an equal one. A workflow triggered by pull_request runs from the pull request's own head commit, so a pull request that edits .github/workflows/redline-gate.yml changes the gate judging it — including standing down the dependency and secret jobs, which are the two checks no label can waive. Protect .github/workflows/ with --with review-ownership --review-owners <team> so that edit needs an owner's approval, and move to --gate-source org once the organisation publishes a gate.

A vendored gate is a copy, so it does not update itself the way the organisation one does. Raising redlinegate in devDependencies does not change it either: only init rewrites it. To take a newer gate, bump the dependency, run pnpm redline init and merge the pull request — the same update as Learn 10 describes. redline verify --repo <owner/name> reports a gate-vendored check comparing the version stamped in the file against the CLI running the check.

A profile is the set of stacks whose rules a repository gets. One repository can combine several: --profile web,infra renders a React app's rules and its Terraform rules together. See Profiles & stacks for the full table.

When your token cannot do everything

The engineer running redline init usually is not a repository admin. That is expected. The files always land and the pull request always opens; only the repository settings that need admin are refused. The command still exits 0.

Each setting in the Repository settings part of the report, and in verify, is in one of these states:

StateMeansWhat to do
applied, alreadyThe setting is on.Nothing.
deniedThe host refused it, usually for lack of admin. It is recorded in .redline.json under pendingAdmin.An admin runs pnpm redline init --repair.
unsupportedThis repository cannot have it, for example a feature its plan or licence does not include.Nothing an admin can do; it is not recorded as admin work.
unknownThe host gave no clear answer, usually because a token without admin cannot see the setting.Read it again with an admin token: pnpm redline verify.

Verify

verify reads back what the host actually has and compares it with what .redline.json says was installed. It asks the host, so it needs gh auth login or GH_TOKEN.

terminal
$ pnpm redline verify

ok    onboarded              profile web-react, standards v0.2.2
ok    capabilities           every capability selected
ok    merge-policy           policy is advisory as configured, 0 approval(s), code-owner review off
ok    gate-machinery         .github/workflows/redline.yml publishes redline-gate / gate
ok    check-name-reported    no required check configured yet (advisory gate) — PR #42 reported: redline-gate / gate
ok    security-floor         security floor enabled
ok    artifacts-current      rendered artifacts match standards v0.2.2
ok    review-ownership       no CODEOWNERS on this host
ok    commands-current       slash commands match what this CLI renders
ok    pull-request-template  .github/pull_request_template.md — maintained inside REDLINE markers
FAIL  pending-admin          partially onboarded — an administrator must still enable: dependency-alerts

Eleven checks, each named after what it reads. Three are worth knowing before you see them: check-name-reported passes rather than fails on a repository with no pull request yet — a fresh repo is not drifted, it is new; review-ownership resolves every owner in CODEOWNERS against the host, which is what tells an enforcing file from a decorative one; and pending-admin is the one that stays red until a person acts. Run it on demand, or wire redline verify --gate into CI — the same checks, exiting non-zero on failure. Troubleshooting has what ok, FAIL and ?? each oblige you to do. Once the gate is required (--blocking), check-name-reported becomes a real assertion: a required name nothing reports is the “waiting for status” hang.

After the pull request merges

Merging installs the files. It does not grant the permissions the first run was refused, and a plain re-run will not retry them — a capability already recorded as pending is treated as settled, which is exactly what --repair exists to override. Run it with a token that has repository admin:

terminal
$ pnpm redline init --repair

Everything under pendingAdmin in .redline.json is retried, the Repository settings section of the report shows each one as applied or still denied, and the file is rewritten with what actually stuck.

Approvals are your choice. Redline's job is to fail the pipeline, so a new onboarding requires no approving review: a solo engineer can merge their own pull request once the checks pass. To require reviews, run pnpm redline init --approvals 1 (or any number up to 10). The count is recorded as requiredApprovals in .redline.json, and a later run keeps it unless you pass the flag again.

Everything up to this point proves the gate is installed; only a pull request the gate actually stopped proves it is a gate. That is the last section.

Exit codes

CodeMeaning
0Success.
1The thing being checked is wrong — verification failed, drift found.
2Usage error — bad flag, unknown profile, not a git repository.
3Permission denied outright — nothing could be done at all.
4Host or network error.

3 is for total failure only. A partial permission failure is the normal path above: exit 0, with the refusals reported.

Known limitations

  • The gate installs advisory-only on both hosts. Promoting it is a deliberate second step on the enforcement ladder, after a soak period.
  • redline sync runs from a checkout of the Redline source repository, not from a product repo, and only reaches repositories in the register — see Distribution & drift. One that is not in it picks up a standards change by bumping redlinegate and re-running redline init.
  • No offline single-file executable yet, which matters for air-gapped Azure agents without npm registry access.

Prove it

A merge gate that never runs looks exactly like a merge gate that finds nothing: both are green. The difference shows up on the pull request you needed it to stop, which is the worst moment to find out. So before you trust the gate, watch it pass, block, and refuse to be waived — on a branch you throw away.

The Learn path shows most of that on a real pull request. Run the same on your repository, or at least confirm each line:

  • A failing process check does not fail the gate at observe. Learn 02.
  • The security floor fails the gate at every rung, label or not. Learn 06.
  • The gate stops the merge once it is required. Learn 07.
  • The redline-exempt label alone is refused. Without a ## Redline exemption block it fails at a blocking rung. Learn 08.
  • A BLOCKER fails the gate at block-blocker. The same finding that merged at observe. Learn 09.

A stood-down job reads as a pass

The one behaviour the Learn path does not show. When a repository already runs a tool that covers one of the gate's jobs, init writes that job into stand-down: in the caller, and the job is skipped. The aggregate must read a skip as a pass — if it fails instead, the repository is punished for narrowing the gate to match tooling it already runs. Check it on a throwaway branch:

terminal
$ git checkout -b redline/prove-stand-down
# in .github/workflows/redline.yml, change   stand-down: ''   to   stand-down: policy
$ git commit -am "test(redline): stand the policy job down"
$ git push -u origin redline/prove-stand-down
$ gh pr create --draft --title "Do not merge: prove a stand-down" --body-file .github/pull_request_template.md
$ gh pr checks --watch

Expected: Deterministic policy reports skipped, and gate passes. If the aggregate fails on a skip, do not stand anything down until it is fixed. Close the pull request without merging and delete the branch.

What a branch can change about its own gate

The rung and the stand-down list are inputs in the caller, .github/workflows/redline.yml, and the caller runs from the pull request's own head commit. A pull request can therefore change both for itself — on an organisation gate as much as a vendored one. Learn 09 uses exactly that to try a blocking rung on a branch.

The job definitions are different. With --gate-source org they live in <org>/.github, and a pull request here cannot reach them. With a vendored gate they are in .github/workflows/redline-gate.yml, so a pull request can edit the secret-scan job — one of the two checks no label can waive — and the gate judging it will run the edited copy.

The mitigation is the /.github/workflows/ entry in .github/CODEOWNERS, and it does nothing until the branch ruleset is applied — admin work a non-admin redline init leaves in pendingAdmin (step 4). Until then, anyone with push access can do this on purpose.

Run these again after promoting a rung, after moving between --gate-source local and org, and after standing a job down or adding one of your own.