cleard
npkill, but for everything — an interactive terminal tool that finds
regenerable build / dependency / cache directories across many ecosystems and
lets you delete them to reclaim disk space.
It recursively scans a directory, streams matches into a live list sorted by size, and deletes the ones you pick — with a running total of space reclaimed.
Why it's safe
Unlike a plain name match, cleard is marker-aware: an ambiguous directory
is only flagged when its project marker is a sibling. target/ is only a
candidate when a Cargo.toml (or pom.xml) sits next to it; a hand-written
build/ source folder with no build-system marker is left untouched.
Unambiguous names (node_modules, __pycache__, .terraform, …) need no marker.
Deletion is bounded to the scan root and always asks for confirmation.
Supported out of the box
Node (node_modules, .next, .nuxt, .svelte-kit, .turbo), Rust (target),
Java/Gradle/Maven (build, .gradle, target), Python (.venv, venv,
__pycache__, .pytest_cache, .mypy_cache, .ruff_cache, *.egg-info),
Go & PHP (vendor), .NET (bin, obj), CocoaPods (Pods), Terraform
(.terraform), Elixir (_build, deps), Elm (elm-stuff), Dart/Flutter
(.dart_tool). Extendable via config.
Install
cleard ships one binary through whichever ecosystem you already use — npm,
PyPI, and the curl script all deliver the same prebuilt binary; Cargo and Nix
build from source.
cargo install cleard # crates.io (compiles from source)
npm install -g @ervan0707/cleard # prebuilt binary via npm
pip install cleard # prebuilt binary in a Python wheel
curl -fsSL https://raw.githubusercontent.com/ervan0707/cleard/main/install.sh | bash
nix profile install github:ervan0707/cleard
Run
With Nix flakes, run it straight from GitHub (nothing to clone, no Rust needed):
# run once against a directory
nix run github:ervan0707/cleard -- ~/code
# run the current directory
nix run github:ervan0707/cleard
# pin a tag/branch/commit
nix run github:ervan0707/cleard/v0.1.0 -- ~/code
Install it into your profile:
nix profile install github:ervan0707/cleard
cleard ~/code
Binary cache (skip the build)
CI publishes prebuilt outputs to Cachix, so you can
download the binary instead of compiling Rust. The flake advertises the cache
via nixConfig, which Nix uses automatically if you're a trusted user.
Otherwise, opt in once:
cachix use skinnyvans
Or add it to your Nix config by hand:
substituters = https://skinnyvans.cachix.org
trusted-public-keys = skinnyvans.cachix.org-1:sgaZPgRhzsU4YScjc2U5Imc+4E3y9Ov/G/q8p/csX+o=
Or add it to your own flake:
{
inputs.cleard.url = "github:ervan0707/cleard";
# then use cleard.packages.${system}.default in your outputs
}
Don't have Nix? Build from source with Cargo:
git clone https://github.com/ervan0707/cleard
cd cleard
cargo build --release # binary at ./target/release/cleard
Usage
cleard # scan the current directory
cleard ~/code # scan a specific directory
cleard --dry-run # show what would be reclaimed, delete nothing
cleard --min-size 100M # hide candidates smaller than 100 MiB
cleard -x .git -x dist # skip directories by name
Keys
| Key | Action |
|---|---|
↑/k, ↓/j |
move cursor |
g / G |
top / bottom |
space |
toggle selection |
a / c |
select all / clear selection |
d / Del |
delete selected (or focused) |
Enter |
delete focused |
s |
cycle sort (size / age / path) |
/ |
filter by path or ecosystem |
? |
help |
q |
quit |
Config
Optional, at ~/.config/cleard/config.toml (or pass --config <path>). Use it to
add your own detection rules, or to replace the built-in catalog entirely. If the
file doesn't exist, the built-in rules are used.
Each rule has:
ecosystem— the label shown in the list.dir_names— directory names to match.markers— sibling files that must exist for a match. With markers, the dir is only flagged when one sits next to it (so a hand-writtenzig-out/with nobuild.zigis left alone). Omitmarkersto match the name anywhere ("safe by name") — only do that for unambiguous names.
dir_names and markers accept a single * glob (e.g. *.csproj, *.egg-info).
Your rules are checked before the built-ins, so they win on overlapping names.
Add a few ecosystems on top of the built-ins:
# use_default_rules = true # default; keep the built-in catalog
[[rules]]
ecosystem = "Zig"
dir_names = ["zig-cache", "zig-out"]
markers = ["build.zig"]
[[rules]]
ecosystem = "Bazel"
dir_names = ["bazel-bin", "bazel-out", "bazel-testlogs"]
markers = ["WORKSPACE", "WORKSPACE.bazel", "MODULE.bazel"]
[[rules]]
ecosystem = "CMake"
dir_names = ["CMakeFiles"] # unambiguous name, no marker needed
Or replace the built-ins entirely and clean only what you list:
use_default_rules = false
[[rules]]
ecosystem = "Node"
dir_names = ["node_modules"]
[[rules]]
ecosystem = "Rust"
dir_names = ["target"]
markers = ["Cargo.toml"]
Develop (Nix)
nix develop # dev shell with the pinned Rust toolchain + rust-analyzer
cargo run -- ./path
cargo test
nix build # build the release binary -> ./result/bin/cleard
nix run . -- ~/code # build and run
(With direnv, direnv allow loads the dev shell automatically.)
License
MIT
Release files for cleard 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cleard-1.0.3.tar.gz | 39.1 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| cleard-1.0.3-py3-none-win_arm64.whl | Python 3 | none | Windows ARM64 | Details |
| cleard-1.0.3-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| cleard-1.0.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details |
| cleard-1.0.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| cleard-1.0.3-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details |
| cleard-1.0.3-py3-none-macosx_10_12_x86_64.whl | Python 3 | none | macOS 10.12+ x86-64 | Details |
Total release size: 5.1 MB
Release files / cleard-1.0.3.tar.gz
| Download URL | cleard-1.0.3.tar.gz |
|---|---|
| Size | 39.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68ab109cd739065c93d8489fa0f78ccdfe422b34824dce985a6c90014d474895
|
|
BLAKE2b-256 checksum How to use checksums |
0bd476946cb576764acd87dd83dc2a5ac56a5de33e146d92be9829ba7d958e91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.14.1
|
Release files / cleard-1.0.3-py3-none-win_arm64.whl
| Download URL | cleard-1.0.3-py3-none-win_arm64.whl |
|---|---|
| Size | 774.1 kB |
| Tags | Python 3 Windows ARM64 |
|
SHA-256 checksum How to use checksums |
cd6bf9931f0a1c81c987b1adb4fec71a1c6adfb3f4795255bf6e393b8ee45aa2
|
|
BLAKE2b-256 checksum How to use checksums |
fd537f073074523c3c571231b6985e83af4cf6c689661c5fa448cff3e95daf12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.14.1
|
Release files / cleard-1.0.3-py3-none-win_amd64.whl
| Download URL | cleard-1.0.3-py3-none-win_amd64.whl |
|---|---|
| Size | 805.6 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b75c7e9cbb24983660381ca3c2026233ada84e618df1d2fe24c844b8ac7e3e50
|
|
BLAKE2b-256 checksum How to use checksums |
27941479aaa1d20dab0953c6e94c743c673f320ad2578f3609b1c5c94995be52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.14.1
|
Release files / cleard-1.0.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | cleard-1.0.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 891.8 kB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
efc14b8430742cb6c724a743cbcca59135d0cab7dadd5db2ec3d732613a94f7c
|
|
BLAKE2b-256 checksum How to use checksums |
d509d5bb13690ea897b7dc272596f54667922e3e7e9f2e7345c397ea0bc485b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.14.1
|
Release files / cleard-1.0.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | cleard-1.0.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 856.4 kB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
1fb189ac1fe0cf1763028a5aaf8a2d7b1018f8dfad44eec6ba5d17451e4e119a
|
|
BLAKE2b-256 checksum How to use checksums |
47fada860de0f29e892be21192600ddaf80022ff945c4a4b51206382d4b97c65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.14.1
|
Release files / cleard-1.0.3-py3-none-macosx_11_0_arm64.whl
| Download URL | cleard-1.0.3-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 834.8 kB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b3941f914af78053d9945a1018c01f71eb224460dd7fe6c1d2dd94efbedbcb5f
|
|
BLAKE2b-256 checksum How to use checksums |
25d5071f8f90913670eeaafbbe2dcef818a8e1eee6a6b759fd5f4942c6478802
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.14.1
|
Release files / cleard-1.0.3-py3-none-macosx_10_12_x86_64.whl
| Download URL | cleard-1.0.3-py3-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 867.7 kB |
| Tags | Python 3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
c8c24ac4c8113de5136b1eebd8296d14060ef85354eb185a8dd00c4ddc6f89a6
|
|
BLAKE2b-256 checksum How to use checksums |
cd7182e4148458f79b5a82640e92b76d9098b9312b8b275ecdb7b4854b961df3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.14.1
|