CASOON Open Source
Sweep cold Cargo targets, not your work.
cargo-broom finds the build output of every Rust project below a directory and removes what has gone cold. It refuses to delete without an explicit flag, and it never removes a shared, overridden or running target as a whole.
cargo install cargo-broomcargo install --git https://github.com/casoon/broomcargo-broom Summary (Dry Run) ℹ cargo-broom Reclaimable: 2.89 MiB ● Level A — Full Target Clean (Coarse) (2) - blog-engine (1.86 MiB) at ~/code/blog-engine/target - weather-api (1.03 MiB) at ~/code/weather-api/target Next steps: • Run `cargo broom -y` to reclaim 2.89 MiB $ cargo broom -y
- flags that allow a cleanup: --dry-run, --interactive, --yes
- 3
- default age before a whole target qualifies
- 14 days
- subcommands, four of them read-only
- 6
- CI platforms: Linux, macOS, Windows
- 3
What it does
Nothing happens by default
A cleanup needs --dry-run, --interactive or --yes on the command line. The configuration file cannot supply the confirmation.
Only plain local targets go whole
A full removal is limited to <workspace>/target. Shared, overridden, symlinked and locked targets are skipped.
One command for every checkout
Recursive discovery resolves each workspace and its real target directory with cargo metadata, then judges every project by age and size.
Selective cleanup for active projects
Remove incremental caches and generated docs from targets you still use. Fingerprint pruning is opt-in and marked experimental.
Recoverable and scriptable
--trash sends removed targets to the OS trash, --format json feeds scripts, --history tracks whether targets grow back.
Generated at build time
All examples →cargo-broom Inspect — ~/code Found 5 Rust target directories occupying 8.86 MiB • blog-engine 1.86 MiB ~/code/blog-engine/target • invoice-cli 2.83 MiB ~/code/invoice-cli/target • plugin-a (+1 more, shared target) 2.06 MiB ~/code/plugins/shared-target [Target Override] • toolkit-core 1.07 MiB ~/code/toolkit/target • weather-api 1.03 MiB ~/code/weather-api/target
Captured from cargo-broom 0.1.0 over five sample projects that examples/generate.sh builds in a temporary directory. Only the temporary path is shortened to ~/code.
examples/inspect.txtQuickstart
Inspect, preview, then clean. The first two steps change nothing on disk.
- Install the crate; Cargo runs it as
cargo broom. - Run
inspectand a--dry-runover the directory that holds your projects. - When the selection is right, clean with
--interactiveor--yes.
# What is there? Read-only.
cargo broom inspect ~/code
# What would go? Deletes nothing.
cargo broom --dry-run --keep-days 30 --keep-size 50MB ~/code
# Clean up, recoverably
cargo broom --yes --trash --keep-days 30 --keep-size 50MB ~/code