@mitian233/devcleaner
v1.0.0
Published
CLI tool to clean development tool caches on Windows with TUI interface
Downloads
55
Maintainers
Readme
DevCleaner
⚠️ Windows Only: This tool is designed specifically for Windows. It targets Windows-specific paths and tools like Scoop, Winget, Chocolatey, and NuGet.
A powerful CLI tool for cleaning cache files generated by development tools on Windows, featuring a modern TUI interactive interface.
Features
- Modern TUI Interface - Elegant interactive experience using @clack/prompts
- Smart Detection - Automatically detect installed development tools and their caches
- Efficient Cleaning - Prioritizes using tool's built-in cleaning commands for safety
- Statistics - Before/after comparison showing cleaning results
- Risk Warnings - Labels high-risk operations to prevent accidental deletion of important files
Supported Cleaning Tools
Package Managers
- npm -
npm cache clean --force - Yarn -
yarn cache clean - pnpm -
pnpm store prune
Programming Languages / Build Tools
- pip -
pip cache purge - Gradle - Manual cache directory deletion
- Maven - Manual repository directory deletion (high risk)
- Cargo -
cargo cache -aor manual deletion - NuGet -
dotnet nuget locals all --clear - Go -
go clean -cache
System Cache
- System Temporary Files -
%LOCALAPPDATA%\Temp
Requirements
- Windows (PowerShell or Command Prompt)
- Node.js >= 18
Installation
# Using npx (no installation required)
npx devcleaner
# Global installation
npm install -g devcleaner
devcleaner
# Using pnpm
pnpm add -g devcleaner
devcleanerUsage
Run the command:
devcleanerOr use npx directly:
npx devcleanerThe program will automatically:
- Detect installed development tools in the system
- Scan cache directory sizes for each tool
- Display cache list for selection
- Prompt confirmation for high-risk operations
- Execute cleaning and display statistics report
Usage Example
┌ DevCleaner - Development Tool Cache Cleaner
│
◇ Detection complete
│
◆ Select caches to clean (Space to select, Enter to confirm)
│ ◻ npm Cache - 1.38 MB (✓ Low Risk)
│ ◻ pip Cache - 641.00 B
│ ◻ Gradle Cache - 749.65 MB
│ ◻ NuGet Packages - 649.11 KB
│ ◻ System Temp - 253.11 MBRisk Levels
- 🟢 Low Risk - Automatically regenerated after cleaning, no side effects
- 🟡 Medium Risk - May need to rebuild project after cleaning
- 🔴 High Risk - Need to re-download dependencies after cleaning (e.g., Maven repository)
Tech Stack
- TypeScript - Type-safe development experience
- @clack/prompts - Modern TUI interaction library
- execa - Powerful process execution tool
- picocolors - Terminal color library
Project Structure
DevCleaner/
├── src/
│ ├── index.ts # CLI entry and TUI interaction
│ ├── types.ts # TypeScript type definitions
│ ├── tools/ # Cleaner implementations for each tool
│ │ ├── base.ts # Base cleaner class
│ │ ├── npm.ts # npm cleaner
│ │ ├── yarn.ts # yarn cleaner
│ │ └── ... # Other cleaners
│ └── utils/ # Utility functions
│ ├── size.ts # Directory size calculation
│ ├── execute.ts # Command execution
│ └── format.ts # File system operations
├── dist/ # Compiled output
├── package.json
└── tsconfig.jsonHow It Works
Detection Phase
- Check if cache directories for each development tool exist
- Calculate cache directory sizes
- Detect if cleaning commands are available
Cleaning Phase
- Prioritize using tool's built-in cleaning commands (e.g.,
npm cache clean) - If no cleaning command available, safely delete cache directory
- Calculate space difference before and after cleaning
- Prioritize using tool's built-in cleaning commands (e.g.,
Reporting Phase
- Display cleaning results for each tool
- Statistics of total space freed
Safety
- ✅ Only cleans known safe directories
- ✅ High-risk operations require double confirmation
- ✅ Prioritizes using tool's built-in cleaning commands
- ✅ Detailed error handling and logging
Development
# Clone the repository
git clone <repository-url>
cd DevCleaner
# Install dependencies
pnpm install
# Run in development mode
pnpm dev
# Build
pnpm buildFAQ
Q: What to do after cleaning Maven repository?
A: After Maven repository is cleaned, dependencies will be automatically re-downloaded during the next build. It's recommended to do this in a good network environment.
Q: Why are some tools not detected?
A: The tool may not be installed, or the cache directory doesn't exist or is empty.
Q: What if the project build fails after cleaning?
A: Most caches can be rebuilt after cleaning. If you encounter issues, try cleaning the project's node_modules and other directories.
License
MIT
