React PlumberInstall package

Guides

Adopting on a big repo

You can turn Plumber on in a big repo before fixing its drift. It records what you have today as debt and fails on what is new. You lower the debt as you fix it.

1. Look first

sh
npx plumber check

Before setup this exits 0. It shows how much of each family is on your tokens and what to fix first, with the command that lists each group. This is the output for a small app:

text
On your tokens
  motion       0%  2 off
  spacing     33%  2 off
  color       33%  2 off

Fix first
  ✗ 1 broken style               browser drops them             npx plumber check --broken
  ! 1 setup gap                  tokens missing                 npx plumber check --rule config
  · 4 values off your tokens     most in spacing                npx plumber check --rule provenance

This is your first run, so all of this counts as new.
  npx plumber init          set up, and record today's drift as debt; then only new drift fails
  Alt+B in dev          see every drift on the page and fix it there

--all prints every finding. A setup gap means that a family has no tokens to check against yet.

2. Set up and record today

sh
npx plumber init
text
Wrote plumber.config.ts with your token sources.
Components: 0 found from directory:src/components/ui.
Baseline: 8 places recorded as known debt in .plumber/ledger.jsonl.
Accepted 3 tokens as inferred.
Next:
  npx plumber install --overlay --write   see and fix drift on the page, in dev (Vite or Next.js)
  npx plumber install --ci                fail CI only on new drift

init finds your tokens and components, writes the config, turns on four habits and records every current finding as debt. The config lists the other habits too, switched off, each with the number of places that would break it.

From here, plumber check passes until someone adds a new error.

3. Review your tokens

init marks the token sources it found as inferred. Go through them with whoever owns the design system. Check that the sources are right and that the tokens have reasons. Then accept them:

sh
npx plumber accept-decisions

4. Check new work

sh
npx plumber install --ci                # check every pull request
npx plumber install --agent claude      # check every agent edit

See CI and pull requests and Agents.

5. Lower the debt

Fix debt in slices that are small enough to review, such as one component or one family. npx plumber check --debt lists it, and the overlay shows it on the page. After a batch of fixes, update the ledger and commit it with them:

sh
npx plumber ledger --ratchet   # lower each debt count to what's left
npx plumber ledger --prune     # drop entries for drift and tokens that are gone

Limits on the ledger