CLI tool to clean development caches and free disk space
Project description
dev-cleaner
A CLI tool to clean development caches and free disk space. Supports npm, pip, Cargo, Docker, Homebrew, Claude Code, and more.
Installation
Using pipx (recommended)
pipx install dev-cleaner
Using uv
uv tool install dev-cleaner
Using pip
pip install dev-cleaner
Quick Start
# Show status of all cleaners with disk usage
dev-cleaner status
# Show status for a specific cleaner
dev-cleaner status npm
# Clean all safe targets (dry run)
dev-cleaner clean --dry-run
# Clean all safe targets
dev-cleaner clean
# Clean a specific cleaner
dev-cleaner clean npm
# Clean with confirmation prompts disabled
dev-cleaner clean -y
# List all available cleaners
dev-cleaner list
Supported Cleaners
| Cleaner | Description | Default Risk |
|---|---|---|
npm |
npm package cache (~/.npm/_cacache, ~/.npm/_logs) |
Safe |
yarn |
Yarn package cache | Safe |
pnpm |
pnpm store and cache | Moderate |
pip |
pip package cache | Safe |
uv |
uv Python package cache | Safe |
cargo |
Cargo (Rust) registry and git cache | Safe |
go |
Go module and build cache | Safe |
gradle |
Gradle caches and daemon | Moderate |
cocoapods |
CocoaPods cache and repos (macOS) | Moderate |
homebrew |
Homebrew download cache (macOS) | Safe |
docker |
Docker build cache, images, system prune | Dangerous |
claude |
Claude Code debug logs, telemetry, transcripts | Safe/Moderate |
Commands
status [CLEANER]
Show disk usage for all cleaners or a specific one.
dev-cleaner status # All cleaners
dev-cleaner status npm # Only npm
dev-cleaner status --json # JSON output
clean [CLEANER]
Clean caches. By default, only cleans targets with risk level "safe".
dev-cleaner clean # Clean all safe targets
dev-cleaner clean npm # Clean only npm
dev-cleaner clean --dry-run # Preview without deleting
dev-cleaner clean --include-moderate # Include moderate-risk targets
dev-cleaner clean --force # Include dangerous targets (use with caution!)
dev-cleaner clean -y # Skip confirmation prompts
list
List all available cleaners.
dev-cleaner list
Risk Levels
Each clean target has a risk level that determines when it will be cleaned:
| Level | Description | When Cleaned |
|---|---|---|
| Safe | Quick to rebuild, no significant impact | Default (clean) |
| Moderate | May take time to rebuild | With --include-moderate |
| Dangerous | Significant impact, data loss possible | With --force |
Examples by Risk Level
Safe:
- npm/pip/cargo download caches
- Build caches (Go, Docker builder)
- Log files
Moderate:
- pnpm content-addressable store
- Gradle dependency cache
- Claude Code conversation transcripts
Dangerous:
- Docker system prune (removes all unused images/containers)
Safety Features
- Dry run mode: Preview what will be deleted with
--dry-run - Risk-based filtering: Only safe targets are cleaned by default
- Confirmation prompts: Interactive confirmation before destructive operations
- Detailed output: Shows exactly what's being cleaned and how much space is freed
Examples
Free up disk space quickly
# See what's taking space
dev-cleaner status
# Clean all safe caches
dev-cleaner clean -y
# If you need more space, include moderate-risk targets
dev-cleaner clean --include-moderate -y
Clean specific tool caches
# After npm issues, clear the cache
dev-cleaner clean npm
# Clean Python package caches (pip + uv)
dev-cleaner clean pip
dev-cleaner clean uv
# Clean Rust build artifacts
dev-cleaner clean cargo
Docker cleanup
# Safe: only build cache
dev-cleaner clean docker
# Aggressive: full system prune (requires --force)
dev-cleaner clean docker --force
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Adding a New Cleaner
- Create a new file in
src/dev_cleaner/cleaners/ - Implement a class that inherits from
BaseCleaner - Implement the
get_targets()method - Register with
@register_cleanerdecorator
Example:
from dev_cleaner.core import (
BaseCleaner,
CleanMethod,
CleanTarget,
RiskLevel,
expand_path,
get_dir_size,
register_cleaner,
)
@register_cleaner
class MyCleaner(BaseCleaner):
name = "my-tool"
description = "My tool caches"
risk_level = RiskLevel.SAFE
def get_targets(self) -> list[CleanTarget]:
cache_path = expand_path("~/.my-tool/cache")
return [
CleanTarget(
name="my-tool/cache",
path=cache_path,
description="My tool download cache",
risk_level=RiskLevel.SAFE,
clean_method=CleanMethod.DELETE_DIR,
size_bytes=get_dir_size(cache_path) if cache_path.exists() else 0,
exists=cache_path.exists(),
)
]
License
MIT License - see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dev_cleaner-0.1.0.tar.gz.
File metadata
- Download URL: dev_cleaner-0.1.0.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8933991321921a60566a8c0ae47a44a69631177510ef15cace3dc487927cee60
|
|
| MD5 |
44e566715d7fa510d8c4000c132f94cb
|
|
| BLAKE2b-256 |
7facecbc73fcb5fb22e3ef5f89dfb4024bef4e9b9d3b66c004517c302cd32134
|
File details
Details for the file dev_cleaner-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dev_cleaner-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9f93e4c2d085f0dd93d028bc261da4bf0134278334cc41fe55780a5239e6035
|
|
| MD5 |
6f1e9fde7b0e193064fa71b38a3549e2
|
|
| BLAKE2b-256 |
2cad84a6757508106478aba0bfd2c53eaae27af9957b063f9d1db4530aadfa55
|