Automation
Run purgeit unattended with cron, launchd, systemd or CI, and act on its exit codes.
Unattended runs should be conservative and leave a trail.
# everything in projects you have not worked on for 30+ days, over 100 MB
purgeit clean ~/dev --stale --min-size 100MB --yesclean already skips recent activity (default 7 days), re-verifies every path, logs to purgeit history, and reports problems through its exit code, so a scheduler can notice.
Exit codes
| Code | Meaning |
|---|---|
0 | success |
1 | some paths were skipped or failed, or you declined the confirmation |
2 | bad arguments, config or plan |
70 | internal error |
130 | interrupted (SIGINT/SIGTERM) |
Without a terminal and without --yes, clean refuses to delete rather than guessing.
Schedulers
0 3 * * 0 /usr/local/bin/purgeit clean ~/dev --min-age 30d --yes >> ~/purgeit.log 2>&1Reviewed automation
When a person must approve what an unattended job deletes, split the job in two (see Clean safely): the first writes a plan with scan --format json; the second runs clean --plan after approval.
Machine-readable output
scan --format json|ndjson and clean --format json are documented in Output formats.