Skip to content

Built-in rules

purgeit ships with a default ruleset ported from the original CLEANUP.sh. These rules are grouped into always-safe names (deleted anywhere they appear) and gated names (deleted only when a sibling manifest proves the directory is generated output).

These directory names are matched wherever they appear in a project tree. Once found, the walker stops descending into them.

NameWhat it is
node_modulesnpm / yarn / pnpm dependencies
.nextNext.js build output
.nuxtNuxt build output
.astroAstro build cache
.docusaurusDocusaurus build cache
.angularAngular build cache
.svelte-kitSvelteKit build output
distGeneric build output
outGeneric build output
.turboTurborepo cache
.cacheGeneric framework cache
.swcSWC compiler cache
.viteVite cache
.parcel-cacheParcel cache
.expoExpo cache
storybook-staticStorybook build output
playwright-reportPlaywright report output
test-resultsPlaywright test results
coverageTest coverage reports
.nyc_outputNYC coverage data
NameWhat it is
targetCargo build output
NameWhat it is
__pycache__Python bytecode cache
.venvVirtual environment
venvVirtual environment
.pytest_cachepytest cache
.mypy_cachemypy cache
.ruff_cacheRuff cache
.toxtox environments
.buildGeneric Python build output
NameWhat it is
DerivedDataXcode derived data

These names are too generic to trust blindly. purgeit only reports them when a sibling file in the same parent directory matches the gate.

NameGate conditionWhy it’s gated
PodsA sibling Podfile existsPods/ is only meaningful in CocoaPods projects
buildA sibling Podfile, *.xcodeproj, *.xcworkspace, CMakeLists.txt, package.json, pyproject.toml, requirements.txt, build.gradle, or build.gradle.kts existsbuild/ is used by many ecosystems
.gradleA sibling build.gradle, build.gradle.kts, settings.gradle, or settings.gradle.kts existsGradle project metadata
binA sibling *.csproj or *.sln exists.NET build output
objA sibling *.csproj or *.sln exists.NET build output

These directories are treated like version-control metadata and are never descended into while scanning:

  • .git
  • .hg
  • .svn

You can extend, replace, or narrow these defaults with a purgeit.config.ts.

Restrict the CLI to a subset of rules:

Terminal window
purgeit --targets node_modules,dist

Disable all gated rules and only match always-safe directories:

Terminal window
purgeit --no-gated

The built-in names are defined in src/rules/default-rules.ts and src/rules/gate-conditions.ts. They are merged into a ResolvedRuleSet at runtime via defaultRuleSet().