cargo-broomv0.1.0

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-broom
cargo install --git https://github.com/casoon/broom
MITv0.1.0Cargo subcommandRust 1.89+
cargo broom --dry-run ~/code
cargo-broom Summary (Dry Run)
 cargo-broom

  Reclaimable: 2.89 MiBLevel 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

  1. Nothing happens by default

    A cleanup needs --dry-run, --interactive or --yes on the command line. The configuration file cannot supply the confirmation.

  2. Only plain local targets go whole

    A full removal is limited to <workspace>/target. Shared, overridden, symlinked and locked targets are skipped.

  3. 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.

  4. Selective cleanup for active projects

    Remove incremental caches and generated docs from targets you still use. Fingerprint pruning is opt-in and marked experimental.

  5. 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
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.txt

Quickstart

Inspect, preview, then clean. The first two steps change nothing on disk.

  1. Install the crate; Cargo runs it as cargo broom.
  2. Run inspect and a --dry-run over the directory that holds your projects.
  3. When the selection is right, clean with --interactive or --yes.
terminalShell
# 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