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 checksNode.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)orminAge: 0. - Assert paths with
rel(), never literal/, and don't hard-code sizes: allocated sizes depend on the filesystem. - Only
src/tui/may importreactorink(oxlint enforces it);bun run doctormust stay clean. - Deletion goes through
clean()→inspect()only. Never weaken a guard to make a test pass.
Add an ecosystem
- Create
src/rules/catalog/<name>.tsexportingreadonly RuleDefinition[]. - Spread it into
RULE_CATALOGincatalog/index.ts. - If it is a new category, add it to
RuleCategory,CATEGORY_LABELSandCATEGORY_ORDERincatalog/types.ts. - 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 devReleasing
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.