Safety model
What purgeit checks before it deletes anything, and why you can trust a scan result you acted on later.
purgeit assumes every scan result is stale by the time you act on it, and that a directory's name never proves it is regenerable.
At scan time
Rules decide what is a candidate: names that are unmistakable anywhere (node_modules, .next), names proved by a manifest beside them (target needs a Cargo.toml or pom.xml; coverage, out and .cache need a project manifest), directories proved from the inside (venv needs the pyvenv.cfg a virtualenv always contains), and caches that declare themselves with a tag file. A name that is also a common word for authored folders is never trusted on its own.
Measure. One traversal per candidate gives allocated size, file count and the newest modification inside. Symlinks are never followed.
Protection marks a candidate as protected when it contains its own .git (a checkout, not output), a *-keypair.json within three levels (for example Anchor's target/deploy keys, a program's on-chain identity), or any file git tracks. If git cannot answer, the candidate is unverified and also protected. A protected candidate is listed with its reason and can never be selected.
Purgeit also records whether git ignores the directory — evidence it isn't authored — and whether it sits in a cloud-synced folder (Dropbox, iCloud, OneDrive, Google Drive), where deleting thousands of files triggers slow syncs. Both are shown in the UI and in purgeit explain.
At deletion time
Everything is re-derived from the filesystem as it is now. A path is refused, with a reason, unless all of this holds:
- It is not a filesystem root or your home directory.
- It still exists and resolves strictly inside a scanned root — this defeats a symlink swapped in after the scan.
- It is still a real directory (not a symlink) and a rule still claims it.
- The protection checks above still pass.
- Nothing inside changed within
--min-age(7 days forclean). - If it came from a scan or plan, nothing inside changed after that scan.
The delete then targets the verified real path, so an ancestor swapped for a symlink between the check and the delete cannot redirect it. Anything that cannot be verified is refused. One refusal never stops the rest.
Human in the loop
- The UI preselects nothing, and needs an explicit review (
enter) andy. cleanasks for confirmation unless--yes, and without a terminal it refuses to delete at all rather than guess.--dry-runruns every check and deletes nothing.
Records
Deletions and failures are appended to a history file (see purgeit history). The package itself is published with signed provenance, so you can verify what you install with npm audit signatures.
What it will not do
- It never follows symlinks while scanning or measuring.
- It never enters version-control directories.
- It never deletes the directory you scanned, or anything outside it.
- It does not send data anywhere: there is no telemetry and no network access.