01 · Onboard

One command reads the repository, works out its stack, and installs the rules, the review commands and a merge gate. You review what it wrote, then open a pull request so the team reviews the change like any other.

About 5 minutesNeeds GitHubFiles after this step ↗Pull request #1 ↗

✓

You will learn

  • What redline init installs, and where each piece acts
  • What a merge gate and a rung are
  • Why every repository starts at observe, where findings are reported but nothing is blocked

Why

Step 00 ended with two gaps. Nothing checks how the code is written, only that it compiles and the tests pass. And nothing tells a coding assistant what this team expects, so it guesses. init closes both: it writes the rules where every assistant reads them, and adds a gate that checks every pull request against the same rules, whoever or whatever wrote the code.

New term Merge gate

One check on every pull request, redline-gate / gate, that combines five jobs into one pass or fail: the rule checker, the pull request checklist, the decision-record check, dependency review and a secret scan. You meet each job in the next steps. For now the gate is advice: a red gate shows on the pull request, but GitHub still lets you merge. Step 07 makes it required.

Run it

From the root of your repository, on an up-to-date main, with the package manager you picked in step 00:

terminal
$ pnpm dlx redlinegate@latest init

Each runs Redline once without installing it; init then adds it to your project. If it asks to download redlinegate first, answer y. Then init asks a few questions about the repository. Space ticks a box, Enter moves on. Keep the default everywhere except the three in bold:

It asksAnswer
Which standards apply here?Tick javascript-typescript (JavaScript, TypeScript). Nothing is ticked for you: which rules a repository is held to is your decision.
Where does this repository live?GitHub
What runs your pull request checks?GitHub Actions
Which assistants should read the standards?The ones already ticked
Extra context to render beside the rulesSpec-driven development, already ticked
What should Redline set up alongside its own checks?Nothing. GitHub's own secret scanning and dependency alerts don't need a box: Redline switches them on when it applies repository settings, in step 07.
What should Redline install?gate, merge-policy and labels, already ticked
Where should the merge gate live?in this repository. See below for why.
How hard should the check bite?observe: findings are reported, and only the dependency and secret checks can fail the gate. The end of this page explains why.
Add Redline to this project's devDependencies?yes, pin it, already selected. Your package manager adds redlinegate at this exact version, so you, your team and your assistant all run the same Redline.
Ready?Write the files, commit nothing. You read what it wrote before anything reaches GitHub; the commit and the pull request come after.
New term Where the merge gate lives

The merge gate is a GitHub Actions workflow, and init can put it in one of two places:

  • in the organisation, the default. The gate lives once, in the organisation's .github repository, and every repository calls it from there. A pull request cannot edit the gate that judges it, and fixing the gate fixes it everywhere. It needs the organisation to publish a gate first, which is what a real team should do.
  • in this repository. The gate is copied into the repository itself, so it works with no organisation set up: right for a personal account, and for this path. It is weaker: the gate runs from the pull request's own commit, so a pull request can edit the gate judging it, even to switch off the secret and dependency checks. init says so on every run.

Choosing the organisation when it publishes no gate is not a dead end: init notices, and asks again whether to skip the gate for now or copy it in.

Once you answer the last question, it writes the files and stops:

terminal
# after Ready?

  profile javascript-typescript
  opted out: review-ownership
  ▲ the gate is vendored at .github/workflows/redline-gate.yml rather than
    referenced from <you>/.github. It runs from the pull request's own head
    commit, so a pull request that edits it changes the gate judging it …
  ▲ nothing requires review on .github/workflows/ here, so that edit needs no
    owner's approval …
  ▲ this repository already has .github/workflows/ci.yml — if one of them is
    already your merge gate, re-run with --skip gate …
  ▲ redlinegate@… is a devDependency now (pnpm add …)

  Files  … written
   + package.json
   + AGENTS.md
   + CLAUDE.md
   + .github/copilot-instructions.md
   + .github/instructions/redline-javascript.instructions.md
   + .github/instructions/redline-typescript.instructions.md
   + .cursor/rules/redline-core.mdc
   + .cursor/rules/redline-javascript.mdc
   + .cursor/rules/redline-typescript.mdc
   + .claude/commands/redline-review.md
   + .github/prompts/redline-review.prompt.md
   + .cursor/commands/redline-review.md
   …
   + .github/workflows/redline.yml
   + .github/workflows/redline-gate.yml
   + .github/pull_request_template.md
   + .redline.json

  not committed — the files are in your working tree, and you are on main …

The ▲ lines are warnings, not errors, and none needs action on this path:

  • The gate is vendored, meaning copied into this repository. That is the answer you chose; Where the merge gate lives above explains the cost.
  • Nothing requires review on .github/workflows/: no owner has to approve a change to the gate. A team names one with --with review-ownership --review-owners <team>. Alone on a personal account, there is nobody else to name.
  • The repository already has ci.yml: Redline checks it is not about to add a second gate. Yours only runs the tests, so keep the Redline gate.

Nothing has reached GitHub yet: no commit, no pull request, no repository setting. Running it from a script, with no questions? Add --gate-source local --pin-cli --no-commit to the same command for the same result.

Redline is in your package.json now, so from here on every command runs your project's own copy: pnpm redline <command>, or npx redlinegate, yarn redline or bun run redline.

What it wrote

Every file is in your working tree, so git status lists them and your editor opens them. They catch mistakes at three different moments: while the assistant writes the code, when you ask for a review, and when the pull request asks to merge. Take a tab at a time, and open each file beside it.

The same rules, written once per assistant in the form that assistant reads on every request. They act while the code is written.

FileRead by
AGENTS.mdCodex and every assistant that reads AGENTS.md. The core rules and the JavaScript and TypeScript rules, in one file.
CLAUDE.mdClaude Code. It imports AGENTS.md with @AGENTS.md, so the rules exist once.
.github/copilot-instructions.mdGitHub Copilot, on every request: the core rules.
.github/instructions/redline-*.instructions.mdGitHub Copilot, by file type: its applyTo line loads the TypeScript rules only for .ts and .tsx files.
.cursor/rules/redline-*.mdcCursor: redline-core.mdc always, the others by their globs line.

Open AGENTS.md and read a few rules. Each has an id in backticks, like core/hardcoded-secrets, and a severity: BLOCKER, HIGH or SUGGESTION. Because you kept spec-driven development ticked, each file also carries a short section on working spec-first.

Redline's part of each file sits between REDLINE:BEGIN and REDLINE:END markers, and the next init rewrites it. Rules of your own go in .redline/local.md, which init renders into every one of these files.

Commit it and open the pull request

Once you have read the files, take them to a pull request the way you would any change.

1. Commit on a branch

terminal
$ git checkout -b redline/standards
$ git add -A
$ git commit -m "chore: onboard to Redline"

git add -A is safe here because the repository was clean before init. On a repository with work in progress, add only the files init listed.

2. Open the pull request

terminal
$ git push -u origin redline/standards
$ gh label create no-adr --description "Large change with no architecture decision"
$ gh pr create --title "chore: onboard to Redline" --body-file .github/pull_request_template.md --label no-adr
$ gh pr comment --body "Generated by redline init: rules, review commands and gate. No design decision."
  • The description is the pull request template init just wrote. GitHub only fills a new pull request from the template once it is on main, and this pull request is the one that puts it there, so it is passed in by hand.
  • The no-adr label. A change over 300 lines must link an architecture decision record, so a large change carries the reasoning behind it. This one is about 2,000 lines but decides nothing: it is generated. The label says so, and the comment says why, so the next reader does not have to guess. The label is new to the repository, so it is created first. Step 05 covers the decision records themselves.

3. Watch the checks

The gate starts the moment the pull request opens. Follow it from the terminal, or open the pull request in the browser:

terminal
$ gh pr checks --watch
$ gh pr view --web

It goes red

Your first pull request under Redline has a red check. That is expected, and it teaches the first thing about the gate:

terminal
$ gh pr checks

X  redline-gate / PR checklist
✓  redline-gate / ADR required for significant changes
✓  redline-gate / Deterministic policy
✓  redline-gate / Dependency review
✓  redline-gate / Secret scan (diff)
✓  redline-gate / gate                             passes, with a warning

The ADR check passes on the label. The checklist failed, and the gate still passed. The checklist is a process check: at observe it is reported, and the gate stays green. Open it and the reason is one line:

terminal
# PR checklist

- [ ] No secrets, keys, or customer data in code, logs, or fixtures
…
Error: 7 unchecked launch-readiness item(s). Tick each one, or delete the line
and say why in the PR description.

The section is in the description, but nobody has vouched for it. That is the point of the check: a person, not the template, says each item is true. Open the pull request on GitHub and read the seven boxes under ## Launch readiness. Tick each one that is true of this change; boxes in a description can be ticked without editing it. If one does not apply, delete the line and say why in the summary. Each change to the description runs the job again, and it goes green.

Private repository Dependency review and the gate are red too

On a private repository, two more checks fail:

terminal
$ gh pr checks

X  redline-gate / PR checklist
X  redline-gate / Dependency review
X  redline-gate / gate
✓  redline-gate / ADR required for significant changes
✓  redline-gate / Deterministic policy
✓  redline-gate / Secret scan (diff)

Open Dependency review and the reason is one line:

terminal
# Dependency review

Error: Dependency review is not supported on this repository. Please ensure
that Dependency graph is enabled along with GitHub Advanced Security

Dependency review is part of the security floor: the checks that fail the gate at every rung, observe included, so this one turns the gate red where the checklist did not. Step 06 is about the floor. On a public repository GitHub gives all of it away. On a private one, two pieces are part of GitHub Advanced Security, which an organisation buys on a Team or Enterprise plan, per active committer:

  • GitHub Code Security runs dependency review: a pull request that adds a package with a known high or critical vulnerability is stopped before it reaches main.
  • GitHub Secret Protection runs secret scanning and push protection: a key pushed to GitHub is refused at the push, before it lands in history and has to be rotated.

That is what a breach costs to prevent. A vulnerable package or a leaked token caught here costs a commit; the same one found in production costs an incident, a rotation and an explanation. Redline does not skip the job quietly when the licence is missing: a floor that switches itself off is not a floor. Answer it one of two ways.

Switch Advanced Security on. The right fix for a team's real repositories. An organisation owner makes GitHub Code Security and GitHub Secret Protection available to the repository; until then the options are greyed out. Then, in Settings → Advanced Security, enable Code Security, Secret Protection and Push protection, and on the pull request's Checks tab choose Re-run failed jobs. On a personal account there is no Code Security to switch on; making the repository public is the equivalent.

Hand it to Dependabot. When Advanced Security is not available. Dependabot is free on private repositories. On your branch:

terminal
$ pnpm redline init --setup dependabot --integrations dependabot --no-commit
terminal
# after init

  ▲ this repository already runs Dependabot (you said so …), so the gate's
    dependencies job is stood down here rather than run a second time …
  Files  3 written
   + .github/workflows/redline.yml
   + .github/dependabot.yml
   + .redline.json

.github/dependabot.yml switches on Dependabot's version updates, and redline.yml now passes stand-down: 'dependencies', so the gate skips the job and counts it as passed. Read the three files, then push them:

terminal
$ git add -A
$ git commit -m "chore: hand dependency checks to Dependabot"
$ git push

Be clear about what that trades away:

  • A vulnerable dependency is no longer blocked in the pull request. It merges, then Dependabot raises an alert and opens a pull request to update it. Step 06 shows the difference on a real change.
  • Secret scanning and push protection stay off. The gate's own secret scan still runs on every pull request.

In Settings → Advanced Security, switch on Dependabot alerts, Dependabot security updates, the one that opens the fix pull request, and Malware alerts. Having the dependency graph and Dependabot alerts on is not Code Security: the gate's dependency review still cannot run. When the repository gets Code Security, or goes public, put the job back with pnpm redline init --integrations "" --no-commit.

ℹ

Redline can do this part for you. At init's last question, Write, commit and open a pull request commits on redline/onboard, opens the pull request with the template filled in, the checklist ticked and the no-adr label applied, and switches on the GitHub settings: a branch ruleset on main, secret scanning, push protection and Dependabot alerts. You did it by hand once, so you know what it does when it does it for you. Step 07 runs it to make the gate required.

Merge it

With the checks green, review the diff on GitHub, merge it, and bring the merged files back to your machine:

terminal
$ gh pr merge --squash
$ git checkout main
$ git pull

Every later step starts from this main, so the rules and review commands are in place before you write any code.

Every repository starts at observe

New term Rung

How strict the gate is. The enforcement ladder has three rungs: observe, block-blocker and block-high. At observe a broken rule is reported, and the gate stays green. Moving up needs evidence that the rules are right, which step 09 covers.

The one exception is the security floor (step 06): a vulnerable dependency or a leaked secret fails the gate at every rung, observe included.

Starting at observe means the team sees what Redline would block before anything is blocked. Nobody's afternoon is ruined by a rule the team has never discussed. Ask the repository where it stands:

terminal
$ pnpm redline status

profile      javascript-typescript (javascript, typescript)
host         github
checks       GitHub Actions
rung         observe — findings are reported, only the security floor fails the check
…

Check your understanding

Onboarding put the rules in AGENTS.md and also installed a merge gate. Why both?