broom-cli

command module
v0.0.0-...-a915086 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: MIT Imports: 1 Imported by: 0

README ΒΆ

broom 🧹

Reclaim disk space stolen by dependency caches and build artifacts β€” across every ecosystem, in one command.

Go License Platform


The Problem

Every developer machine is slowly eaten alive by caches:

  • ~/.cargo/registry and target/ directories from Rust grow to 20+ GB before you notice
  • node_modules trees scattered across dozens of cloned repos balloon to tens of gigabytes
  • Go module caches, Maven repositories, Gradle wrapper downloads, pip wheels β€” all silently accumulating
  • No single tool shows you the full picture across ecosystems
  • Existing options are either ecosystem-specific, destructive without warning, or require root

A typical developer machine carries 30–100 GB of reclaimable cache data. It grows invisibly, hurts SSD longevity, slows backups, and fills CI build agents.


The Solution

broom is a fast, safe, cross-platform CLI that:

  1. Scans your machine in parallel across all major ecosystems
  2. Surfaces exactly what's taking space and where
  3. Lets you choose what to delete with an interactive picker
  4. Confirms before acting β€” no silent deletions, ever
  5. Tells you how to restore caches you've cleaned
$ broom scan

  Ecosystem        Location                              Size
  ─────────────────────────────────────────────────────────────
  Go modules       ~/.gopath/pkg/mod                    4.2 GB
  Rust crates      ~/.cargo/registry                    2.8 GB
  Rust build       ~/code/**/target (14 dirs)           18.3 GB
  npm cache        ~/.npm/_cacache                      1.1 GB
  node_modules     ~/code/**/node_modules (23 dirs)     6.7 GB
  Maven            ~/.m2/repository                     3.4 GB
  Gradle           ~/.gradle/caches                     900 MB
  pip              ~/.cache/pip                         420 MB
  ─────────────────────────────────────────────────────────────
  Total reclaimable                                     37.9 GB

Run `broom clean` to free space.

Features

  • 11 ecosystems out of the box: Go, Rust, npm, Yarn, pnpm, Maven, Gradle, pip, uv, Bundler, Docker
  • Parallel scanning β€” full home directory scan in seconds, not minutes
  • Interactive multi-select picker β€” choose exactly what to delete
  • Dry-run mode β€” preview deletions before committing
  • CI-friendly β€” --yes flag for non-interactive automation
  • Recency filter β€” keep caches accessed within the last N days
  • JSON output β€” pipe results to jq or any other tool
  • No root required β€” runs entirely in user space
  • Undo hints β€” prints the restore command for every ecosystem you clean
  • Config file β€” persist your preferences in ~/.config/broom/config.toml

Supported Ecosystems

Ecosystem What Is Scanned
Go Module download cache ($GOPATH/pkg/mod, $GOMODCACHE)
Rust Cargo registry index, downloaded crates, per-project target/
npm Global cache (~/.npm/_cacache), per-project node_modules/
Yarn Global cache (~/.yarn/cache, .yarn/cache in repos)
pnpm Content-addressable store (~/.pnpm-store)
Maven Local repository (~/.m2/repository)
Gradle Caches and wrapper downloads (~/.gradle/caches, ~/.gradle/wrapper)
pip Wheel and HTTP caches (~/.cache/pip)
uv Package cache (~/.cache/uv)
Bundler / RubyGems Gem path and bundle cache (~/.bundle, ~/.gem)
Docker Dangling images and build cache (via docker system df)

Installation

Go
go install github.com/stefanosbou/broom-cli@latest

Usage

# Scan everything and show a summary table
broom scan

# Scan only Go and Rust caches
broom scan --ecosystems go,rust

# Interactive clean with a 30-day recency filter
broom clean --keep-recent 30d

# CI: non-interactive clean of npm and Gradle caches
broom clean --ecosystems npm,gradle --yes

# Preview deletions without actually deleting
broom clean --dry-run

# Machine-readable output for scripting
broom list --json | jq '.[] | select(.size_bytes > 1073741824)'
Commands
Command Description
scan Scan and report disk usage (default)
clean Interactively select and delete cached artifacts
list Print paths and sizes in machine-readable format
version Print version and build info
Global Flags
Flag Default Description
--ecosystems all Comma-separated ecosystems to include (e.g. go,rust,npm)
--exclude β€” Comma-separated ecosystems to skip
--path $HOME Root path for project-level artifact scanning
--depth 5 Max directory depth for project scanning
--min-size 10MB Only report items at or above this size
--json false Output results as JSON
clean Flags
Flag Default Description
--yes false Skip confirmation prompts (for CI)
--dry-run false Show what would be deleted without deleting
--keep-recent β€” Keep items accessed within this duration (e.g. 30d, 2w)
--select β€” Pre-select ecosystems, skip interactive picker

Configuration

Persist your preferences in ~/.config/broom/config.toml:

[scan]
min_size = "50MB"
depth    = 6

[ecosystems]
exclude = ["docker"]

[clean]
keep_recent = "14d"

Command-line flags always take precedence over the config file.


Safety

broom is designed to never surprise you:

  • No silent deletion. Every delete requires interactive confirmation or an explicit --yes flag.
  • Dry-run first. Use --dry-run to preview exactly what will be removed.
  • No root. broom refuses to run as root and skips paths it cannot read without elevated privileges.
  • Restore hints. After cleaning, the tool prints the command to regenerate each cache (e.g. cargo fetch, go mod download).
  • Warnings for network-dependent caches. Items that require a network round-trip to restore are flagged before deletion.

Contributing

Contributions welcome. New ecosystem scanners are especially easy to add β€” implement the Scanner interface and register it in internal/ecosystems/register.go.

type Scanner interface {
    Name() string
    Scan(ctx context.Context, opts ScanOptions) ([]ScanResult, error)
}

License

MIT β€” see LICENSE.

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis
internal
fs
ui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL