Skip to Content

Contributing

Set up the repo, run the checks, and add rules.

bun install      # dependencies and git hooks
bun run check    # format, oxlint, typecheck, knip, tests + coverage, build, package checks

Node.js 22+ and Bun are needed. bun run check is the same gate CI and releases run, and takes seconds.

Conventions

  • Tests use real temporary directories (test/tree.ts). Never scan or delete a shared directory (/tmp, $HOME). Anything that deletes needs old fixtures: backdate(root) or minAge: 0.
  • Assert paths with rel(), never literal /, and don't hard-code sizes: allocated sizes depend on the filesystem.
  • Only src/tui/ may import react or ink (oxlint enforces it); bun run doctor must stay clean.
  • Deletion goes through clean() → inspect() only. Never weaken a guard to make a test pass.

Add an ecosystem

  1. Create src/rules/catalog/<name>.ts exporting readonly RuleDefinition[].
  2. Spread it into RULE_CATALOG in catalog/index.ts.
  3. If it is a new category, add it to RuleCategory, CATEGORY_LABELS and CATEGORY_ORDER in catalog/types.ts.
  4. Run bun run generate — the rules reference is generated from the catalog.

Use safe only for names that are unambiguous everywhere. Anything generic (build, out, bin) must be gated on a manifest.

Generated files

purgeit.schema.json and docs/src/generated/* are generated from the code: run bun run generate after changing src/config/schema.ts, the CLI's options, or the rule catalog (tests fail if they are stale).

The docs site

The site lives in docs/ — a Fumadocs app on Next.js with its own dependencies.

cd docs
npm ci
npm run dev

Releasing

Bump version, commit, push main, then git tag vX.Y.Z && git push origin vX.Y.Z. The tag runs the full check gate and publishes to npm with trusted publishing and provenance — no tokens involved.

On this page