Declarative disk cleanup for development projects. Tool-first, minimal, fast.
Scans a directory tree for development projects (Rust, Node, Python, etc.) and cleans their build artifacts using each project's native clean tool.
nimble build# Scan current directory
diskclean
# Scan with size info (slower — walks target dirs)
diskclean --size
# Scan specific directory
diskclean ~/projects
# Rust projects only
diskclean --only=rust
# Rust + Node only
diskclean --only=rust,node
# Preview what would be cleaned
diskclean --clean --dry-run
# Clean all found projects
diskclean --clean
# Exclude specific projects
diskclean --exclude=myapp --clean| Type | Marker | Clean Tool | Targets |
|---|---|---|---|
| Rust | Cargo.toml |
cargo clean |
target/ |
| Zig | build.zig |
- | zig-cache/, zig-out/ |
| Swift | Package.swift |
swift package clean |
.build/ |
| Gradle | build.gradle(.kts) |
gradle clean |
build/, .gradle/ |
| Maven | pom.xml |
mvn clean |
target/ |
| Node | package.json |
- | node_modules/ |
| Composer | composer.json |
- | vendor/ |
| Flutter | pubspec.yaml |
flutter clean |
build/, .dart_tool/ |
| Haskell | stack.yaml |
stack clean |
.stack-work/ |
| Elixir | mix.exs |
mix clean |
_build/, deps/ |
| Nim | *.nimble |
- | nimcache/ |
| Python | pyproject.toml, setup.py |
- | .venv/, dist/, etc. |
diskclean uses a tool-first strategy:
- If the project type has a native clean tool (e.g.
cargo clean), run it - If the tool is not installed or fails, the project is skipped
Projects without a native clean tool (Node, Zig, Python, etc.) are detected and reported, but not cleaned by default. This is a deliberate safety choice — recursive directory removal carries inherent risk (symlink traversal, permission issues, accidental data loss).
Warning: This feature performs recursive
removeDiron detected artifact directories. Use at your own risk.
To enable direct directory removal as a fallback for projects without a
native clean tool, build with the -d:experimentalRm compile flag:
# Build with rm fallback enabled
nimble buildExperimental
# Or manually:
nim c -d:release -d:experimentalRm -o:bin/diskclean src/diskclean.nimWhen experimentalRm is enabled:
- Projects without a tool fall back to
removeDirinstead of being skipped - Symlink targets are refused as a safety measure
--dry-runstill works and shows what would be removed
When experimentalRm is not enabled (default):
- Only tool-based cleaning is available
- Projects without a tool are reported as skipped
- No filesystem modifications beyond what the native tool does
nimble testExperimental-h, --help Show help
-v, --version Show version
-l, --list List supported project types
--size Calculate directory sizes (slower)
--clean Actually delete (default: scan only)
--dry-run Show what would be cleaned (with --clean)
--only=TYPE[,TYPE] Filter by type (comma-separated)
--exclude=PATH Exclude project path (substring match, repeatable)
MIT