Automation & CI
JSON Output
Section titled “JSON Output”The --json flag produces machine-readable output:
clean-wizard clean --mode quick --json --yes{ "success": true, "freed_bytes": 2947483648, "duration_ms": 3100, "cleaners": { "homebrew": { "freed_bytes": 245000000, "success": true, "family": null, "code": null, "retryable": false }, "go": { "freed_bytes": 1204000000, "success": true, "family": null, "code": null, "retryable": false }, "node": { "freed_bytes": 380000000, "success": true, "family": null, "code": null, "retryable": false } }}Failed or skipped cleaners include error classification fields (family, code, retryable).
Skip Confirmation
Section titled “Skip Confirmation”Use --yes (or -y) to skip the interactive confirmation:
clean-wizard clean --mode quick --yesRetry Configuration
Section titled “Retry Configuration”Transient failures (exec timeouts, I/O errors) are automatically retried:
# Default: 3 retries with exponential backoffclean-wizard clean --mode standard
# Disable retriesclean-wizard clean --retries 0
# Use a retry profile presetclean-wizard clean --retry-profile aggressive| Profile | Attempts | Backoff |
|---|---|---|
default |
3 | Exponential |
aggressive |
5 | Short exponential |
conservative |
2 | Long exponential |
none |
0 | Disabled |
Exit Codes
Section titled “Exit Codes”Clean Wizard uses BSD sysexits codes for error classification:
| Code | Family | Meaning |
|---|---|---|
| 0 | — | Success |
| 1 | Rejection / Conflict | Bad config, invalid input, state conflict |
| 65 | Corruption | Nix store corruption |
| 69 | Infrastructure | Tool not installed (cleaner skipped) |
| 75 | Transient | Exec failure, timeout (retryable) |
GitHub Actions Example
Section titled “GitHub Actions Example”name: Cleanupon: schedule: - cron: "0 3 * * 0" # Weekly Sunday at 3 AM
jobs: cleanup: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: "1.26"
- name: Install Clean Wizard run: go install github.com/LarsArtmann/clean-wizard@latest
- name: Clean run: clean-wizard clean --mode quick --json --yesCron Job
Section titled “Cron Job”# Daily quick cleanup at 3 AM0 3 * * * /home/user/go/bin/clean-wizard clean --mode quick --yes >> /var/log/clean-wizard.log 2>&1Parsing Results with jq
Section titled “Parsing Results with jq”# Total freed bytesclean-wizard clean --json --yes | jq '.freed_bytes'
# Per-cleaner breakdownclean-wizard clean --json --yes | jq '.cleaners | to_entries[] | {cleaner: .key, freed: .value.freed_bytes}'