The repository standard
Twenty repositories that each invent their own layout cost a new engineer a week in each. The
standard is one agreed shape, shipped with the engine and versioned with it: where deployable
programs live, where shared libraries live, what the root holds and what a unit contains. You
declare it once in replicator.config.ts, and replicator standard check tells you where the
tree differs.
It checks structure, not tools: it does not care which package manager, bundler or test runner a unit uses.
The monorepo standard
apps/<name>/ a program that is deployed on its own
src/ package.json tsconfig.json
packages/<name>/ a library other units import
src/ package.json tsconfig.json
package.json the root, with the package manager pinned in `packageManager`
pnpm-workspace.yaml the workspace: apps/* and packages/*
pnpm-lock.yaml the one lockfile
tsconfig.base.json the one base every unit's tsconfig extends
README.md .gitignore CLAUDE.md or AGENTS.md
.github/workflows/ci.yml
Build output and caches are checked like everything else: a gitignored folder at the root is an error, because a build writes inside the unit that makes it (apps/<name>/dist, apps/client/web-build). Three root folders are tool folders the standard names and allows (.local for scratch space, .expo for the Expo CLI’s cache, .factory for the engine’s own checkout in a pipeline); node_modules is installed tooling and is not checked. Folders that are not units stay where they are: docs, scripts, examples, images, deploy,
migrations, tests, e2e, schema, public, hosts and workspace.
| Rule | Level | What it checks |
|---|---|---|
root-required | fix | The root files above exist. |
root-gitignore | warn | .gitignore lists node_modules. |
workspaces | fix | Every dependency a unit declares is installed by one lockfile: the unit is a workspace member (pnpm-workspace.yaml lists apps/* or packages/*), a standalone unit with its own lockfile, workspace file and pin, or it names only what the root package.json declares too. |
package-manager | fix | One package manager: packageManager pins an exact pnpm version, the lockfile is pnpm-lock.yaml, and no other manager’s lockfile exists at the root or in a unit. |
unit-location | fix | No folder at the root holds a package.json or tsconfig.json outside apps/ and packages/. |
root-folder | warn | No root folder is unknown to the standard: code goes under apps/ or packages/. |
unit-contract | fix | Each unit holds package.json and src. |
unit-tsconfig | fix | A unit with TypeScript holds a tsconfig.json that extends the root’s tsconfig.base.json. |
unit-name | warn | Unit folders are lowercase words joined by dashes. |
managed-file | fix | A file the engine owns is the engine’s bytes: .github/scripts/read-replicator-secret.mjs, the reader of the replicator’s store that runs before the engine can be checked out, is the same file in every repository. A repository without it is not asked to add one. |
Declare it
In replicator.config.ts:
export default replicator.app({
name: "my-app",
stages: { production: {} },
standard: {
profile: "monorepo",
exempt: [
{
path: "legacy-api",
reason: "keeps its own lockfile until its migration ends",
},
],
},
run(ctx) {
/* … */
},
});
An exemption names a path (legacy-api, or tools/* for every folder under tools), carries a
reason, and can be limited to one rule (rule: "root-folder"). The reason is required: an
exception nobody can explain is a finding. An exemption that excuses nothing is reported too, so
the list shrinks as the tree is fixed.
version is optional; it names the standard’s version you read last. When the engine ships a newer one,
the check says so and you decide when to move. Version 3 added managed-file.
One package manager
The standard’s package manager is pnpm, and the package-manager rule holds a repository to it:
- the root
package.jsonpins one exact version inpackageManager, and every machine gets that version throughcorepack, which ships with Node (corepack enable pnpmonce); - the lockfile is
pnpm-lock.yaml; apackage-lock.json,yarn.lockorbun.lockanywhere is a finding; - settings live in
pnpm-workspace.yamland nowhere else: the member list, held versions (overrides), registry retries (fetchRetries,fetchTimeout) and the install scripts that may run (onlyBuiltDependencies). A dependency’s install script does not run unless it is listed.
A unit that must install on its own (a program with its own lockfile) is a workspace root of its
own: it carries its own pnpm-workspace.yaml, pnpm-lock.yaml and packageManager. Without its
own workspace file, an install run inside the unit installs the root instead.
Commands: pnpm install --frozen-lockfile in a pipeline, pnpm add and pnpm remove to change
dependencies, pnpm exec <tool> for a tool the repository declares, pnpm dlx <package> for a
one-off. Arguments after a script name go straight to the script: pnpm run test --watch, with no
-- in between.
Start with it
replicator init --profile monorepo --ref <release commit> # a new repository
replicator standard new app web # a program under apps/
replicator standard new package core # a library under packages/
replicator standard sync --write # the root files an existing repository lacks
init --profile monorepo writes the root files, a config that declares the standard and the CI
caller; the result passes standard check --strict untouched. standard sync creates a missing
file and never overwrites one of yours, so it is safe to run again. The one exception is a file the
engine owns (managed-file): where a repository already holds one that differs, sync --write
refreshes it to the engine’s copy and says so; it never adds one a repository does not hold.
Bring an existing repository to it
replicator standard adopt
prints a plan and changes nothing: the files to add, every folder at the root with a git mv line
for each place it could go and how many other files mention it, and the edits a person makes. Move
what can move; for what cannot yet, add an exemption with its reason and drop it when the folder
moves. replicator doctor --dir . reports the standard beside its other checks.
The pipeline
The CI caller init and sync write calls the shared workflow replicator-ci.yml, pinned to one
release commit. It runs replicator standard check --strict, installs the workspace, runs the
root lint, check:types and test scripts when they exist, and is one job named CI passed: the
single status a branch rule or a deploy waits for. Move the pin with replicator fleet bump.
Check it
replicator standard check
replicator standard check --strict --json
Run it in your pipeline with --strict and a layout change that breaks the standard fails the
change that made it. The full list of options is in The command line.
Across a fleet
replicator doctor --fleet clanker.yml
Each repository of the fleet that declares a standard gets one layout line, read at its pinned
ref through the host’s API: the commit’s file listing, and the text of the few files a rule reads
(the root package.json and .gitignore, each unit’s package.json and tsconfig.json). Nothing
is cloned, and it is the same check standard check runs in a checkout, so the fleet’s report and
a repository’s own agree. A repository that declares no standard is listed as not checked. A
declaration the fleet cannot read from the file’s text (a computed value) and a listing the host
cut short are warnings that name the repository: run standard check there.