Add a vendor

An assistant Redline does not support yet needs an adaptor: a function that renders the standard into the files that assistant reads. This page is the complete list of what to change in the Redline repository, in order.

Before you start

Answer three questions about the assistant. The answers decide the shape of the adaptor:

  1. Which files does it read? Use the paths the tool documents. A file only Redline believes in is worse than no file, because the rules look installed and nothing reads them. If the tool already reads a file another adaptor writes, reuse that renderer, as codex does with AGENTS.md. If the tool's file only points at another file, write that file too: the claude renderer spreads agents(ctx).files into its own map, so its @AGENTS.md import always has a file to point at.
  2. Can a file be scoped to some paths? If yes, write one file per stack with the stack's globs in the tool's own frontmatter, like Copilot and Cursor. If no, write one file and add the _Applies to: line per stack, like AGENTS.md.
  3. Might a team already have that file? If the path is fixed and well known (like CLAUDE.md), Redline must merge into it with a marker block. If you can choose the name, give it the redline- prefix and let Redline own it whole.

You work in the Redline repository, not in a product repository. Every adaptor lives in cli/render/vendors.ts.

1. Write the renderer

A renderer receives the render context and returns the files to write and what to prune:

cli/render/vendors.ts (types)
export interface RenderContext {
  manifest: Manifest;
  root: string;
  profile: string;
  stacks: string[];
  contexts: string[];
  local: string | null;
}

export interface RenderedFile {
  body: string;
  merge?: boolean;
  localRules?: boolean;
}

export interface PruneRule {
  dir: string;
  matches: (filename: string) => boolean;
  directories?: boolean;
}

export interface VendorOutput {
  files: Map<string, RenderedFile>;
  prune: PruneRule[];
}

export type VendorRenderer = (ctx: RenderContext) => VendorOutput;
  • ctx.root is the standards package and ctx.manifest its manifest. Read rule text with the file's own helpers: read(ctx.root, ctx.manifest.core.source) for the core standard, stackBody(ctx, id) for a stack, and header(ctx, stacks) for the version comment.
  • ctx.stacks are the stack ids for the repository's profile; ctx.manifest.stacks[id].globs and .title give each one's globs and name.
  • ctx.contexts are the org context sections selected for the repository, and ctx.local is the repository's .redline/local.md, or null.

A minimal adaptor for a tool that reads scoped markdown files from a folder:

cli/render/vendors.ts
const myvendor: VendorRenderer = (ctx) => {
  const files = new Map<string, RenderedFile>();
  files.set(`.myvendor/rules/${PREFIX}core.md`, {
    localRules: true,
    body: withLocal(ctx, `${header(ctx, ctx.stacks)}\n\n${read(ctx.root, ctx.manifest.core.source)}`),
  });
  for (const id of ctx.stacks) {
    files.set(`.myvendor/rules/${PREFIX}${id}.md`, {
      body: `${header(ctx, [id])}\n\n${stackBody(ctx, id)}`,
    });
  }
  return {
    files,
    prune: [{ dir: '.myvendor/rules', matches: (f) => f.startsWith(PREFIX) && f.endsWith('.md') }],
  };
};

export const VENDORS: Record<string, VendorRenderer> = { copilot, agents, codex, claude, cursor, myvendor };

The fields of each file decide how Redline treats it:

FieldSet it whenWhat happens
merge: trueA team may already own the file at that pathThe body is wrapped in the marker block and everything outside it is kept. The file starts with the BEGIN marker, so a tool that needs frontmatter on the first line needs an owned file instead, as Cursor's are.
merge unsetThe file is Redline's alone, under a redline- nameThe file is overwritten whole on every run. Give it a prune rule, or a file from a dropped stack is never cleaned up.
localRules: trueThe file is always on, and its body went through withLocalredline verify knows this file carries .redline/local.md, and can say so when it is stale because that file changed.

Wrap the always-on file's body in withLocal(ctx, body). It appends the org context sections and the repository's own rules. Without it, your assistant silently ignores every team rule in .redline/local.md while the other assistants apply them.

prune is a list of { dir, matches }, where matches is a function of the file name, not a glob. Match on the PREFIX constant and your extension, so a team's own files in that folder are never touched. Every vendor's prune rules run on every render, selected or not, which is how a deselected vendor's owned files get removed.

Then add the function to the VENDORS record at the bottom of the file. Its key is the vendor id people type in --vendors.

2. Register it in the manifest

Add an entry under vendors in standards/manifest.json, with the same id. title is the hint the init menu shows beside the id; enabled is the organisation's ceiling. A renderer with no manifest entry, or with enabled: false, is never rendered.

standards/manifest.json
"myvendor": {
  "title": "My Vendor rules",
  "enabled": true
}

This is a change under standards/, so it is a release: bump version in the same file and add a CHANGELOG.md entry in the same pull request.

3. Teach init to detect it

Add the paths the tool's own configuration lives at to VENDOR_MARKERS in cli/commands/init.ts. A repository that already uses the tool then gets the adaptor without anyone passing --vendors. Pick paths only that tool uses: a path another tool shares selects your vendor in repositories that never asked for it.

cli/commands/init.ts
const VENDOR_MARKERS: { vendor: string; paths: string[] }[] = [
  …
  { vendor: 'myvendor', paths: ['.myvendor/rules'] },
];

4. List it in the help

The --vendors line of redline init --help lists every id. Add yours to it in cli/bin/commands.ts.

5. Slash commands, if the tool has them

If the assistant supports custom commands or prompt files, add an entry to COMMAND_HOSTS in cli/render/commands.ts under the same key as the vendor id. init renders commands only for selected, enabled vendors whose id is also a command host. Each entry returns the path, a header and the body:

  • The path is the tool's command folder plus ${cmd.name}, which is redline-init, redline-review or redline-verify.
  • The header is the tool's frontmatter, written above the marker block. Include the MANAGED_BY line inside it, as the Copilot and Claude hosts do: it is how a later run tells Redline's file from a team's file of the same name.

Skip this step if the tool has no command format. agents and codex have none.

6. Add tests

Renderer tests are in cli/render/__tests__/vendors.test.ts, and the existing vendors show the pattern. Add:

  • The exact list of paths your renderer returns for a known profile, and which of them have merge: true.
  • The exact frontmatter of a stack file, globs included, for one profile.
  • That your prune rule matches a redline- file and does not match a team's file in the same folder.
  • If the always-on file goes through withLocal: that a context with local set puts the # Repository-local rules heading in it.

Two existing tests will need updating:

  • If any of your files has merge: true, the merged-vendor list asserted in vendors.test.ts changes, and so does what web/components/journey.tsx says about the files init writes.
  • If you added a command host, extend the host layout test in cli/render/__tests__/commands.test.ts.

7. Re-render this repository and check

CI runs node scripts/render-self.mjs --check, which renders this repository's own profile with every enabled vendor and fails if the committed files differ. An enabled new vendor therefore has files to commit here. It does not render other profiles, so the tests in step 6 are what cover those. From the root of the Redline repository:

terminal
$ node scripts/render-self.mjs
$ npm test
$ npm run typecheck
$ git status

git status should show your vendor's files for this repository and nothing you did not mean to change.

8. Ship it

Merge, and publish the new standards version. Repositories pick up the adaptor the way they pick up any standards change, described in Distribution and drift. An already-onboarded repository keeps the vendors it recorded, so it gets the new adaptor only when someone re-runs init with it in --vendors.

What you do not need to change

  • redline verify re-renders through the same VENDORS record, and redline remove iterates it, so both check and remove your files without changes.
  • Measurement does not know vendors. Your adaptor renders the core standard, which carries the output contract, so findings from the new assistant are counted per rule id like any other. See Telemetry and validation to compare it against the others.