rskiller
rskiller is a command-line tool inspired by npkill but designed specifically for Rust projects. It helps you find and clean up Rust project build artifacts, target directories, and other cache files to free up disk space.
Table of Contents
- Features
- Installation
- Usage
- Configuration
- Command Line Options
- Safety Features
- What Gets Cleaned
- Contributing
- License
- Roadmap
Features
- Find Rust Projects: Automatically scans for
Cargo.tomlfiles to locate Rust projects - Clean Build Artifacts: Remove
targetdirectories and their contents - Size Analysis: Shows the disk space used by each project's build artifacts
- Last Modified: Displays when projects were last modified to help identify stale projects
- Interactive Mode: Navigate through projects with keyboard shortcuts
- List Mode: Non-interactive listing of projects and their sizes
- Colorized Output: Beautiful terminal interface with customizable colors
- Configuration Files: Support for TOML and JSON configuration files with flexible priority system
- Parallel Processing: Multi-threaded scanning and cleanup operations for improved performance
- Safety Features: Warns about active projects and system directories
- Workspace Support: Detects and handles Cargo workspaces
- Cache Cleanup: Optional Cargo registry and git cache cleanup
Installation
Pre-built Binaries (Recommended)
Download pre-compiled binaries from the releases page:
macOS
# Download and install (Intel Mac)
|
# Download and install (Apple Silicon Mac)
|
# Or using Homebrew (when available)
Linux
# Download and install (x86_64)
|
# Download and install (ARM64)
|
# Or using package managers (when available)
# Debian/Ubuntu
# Arch Linux (AUR)
# Fedora/RHEL
Windows
# Download and extract
Invoke-WebRequest -Uri "https://github.com/NakaSato/rskiller/releases/latest/download/rskiller-windows-x64.zip" -OutFile "rskiller.zip"
Expand-Archive -Path "rskiller.zip" -DestinationPath "C:\Program Files\rskiller"
# Add to PATH manually or using PowerShell
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files\rskiller", "Machine")
# Or using Chocolatey (when available)
choco install rskiller
# Or using Scoop
scoop install rskiller
Manual Installation
- Go to releases page
- Download the appropriate binary for your platform
- Extract the archive
- Move the
rskillerbinary to a directory in your PATH:- macOS/Linux:
/usr/local/bin/or~/.local/bin/ - Windows:
C:\Program Files\rskiller\(and add to PATH)
- macOS/Linux:
Verify Installation
Shell Completions
After installation, you can enable shell completions:
# Bash (add to ~/.bashrc)
# Zsh (add to ~/.zshrc)
&&
# Fish (add to config.fish)
|
# PowerShell (add to profile)
| |
Quick Install Script
For automated installation, you can use this one-liner that detects your platform:
# Unix-like systems (macOS, Linux)
|
# Or with wget
|
# Windows (PowerShell)
iwr -useb https://raw.githubusercontent.com/NakaSato/rskiller/main/install.ps1 | iex
The install script will:
- Detect your operating system and architecture
- Download the appropriate binary
- Install it to the correct location
- Add it to your PATH if needed
From Source
Using Cargo
Building Your Own Binary
If you want to build an optimized binary yourself:
# Clone the repository
# Build optimized release binary
# The binary will be available at:
# ./target/release/rskiller (Unix)
# ./target/release/rskiller.exe (Windows)
# Install locally
# Or copy the binary manually to your preferred location
# or
Cross-compilation for Multiple Platforms
To build for different platforms:
# Install cross-compilation targets
# Build for specific targets
Usage
Interactive Mode (Default)
This opens an interactive terminal interface where you can:
- Navigate with
↑↓orj/k - Delete target directories with
SpaceorDel - Open project directories with
o - Refresh the list with
r - Delete all targets with
a - Quit with
qorEsc
List Mode
Common Options
# Start from a specific directory
# Search from home directory (default behavior)
# Show sizes in gigabytes
# Sort by different criteria
# Exclude directories
# Include Cargo cache analysis
# Dry run (don't actually delete)
# Auto-delete all found target directories
Configuration
rskiller supports configuration files to set default options and avoid repetitive command line arguments. Configuration files are loaded in the following priority order (highest to lowest):
- Command line arguments (highest priority)
./rskill.toml(project-local TOML config)./.rskillrc(project-local JSON config)~/.config/rskiller/rskill.toml(user TOML config)~/rskill.toml(home directory TOML config)~/.rskillrc(home directory JSON config)- Default values (lowest priority)
Configuration File Formats
TOML Format (rskill.toml)
[]
= "~/"
= "target"
= ["node_modules", "vendor", ".git"]
= true
= false
[]
= "size" # size, path, last-mod
= false
= "blue" # blue, cyan, magenta, white, red, yellow
= false
[]
= false
= false
= false
= false
[]
= true
= "1GB"
= false
= 3
[]
= true
= 0 # 0 = auto-detect
= 1000
= true
[]
= 0
= 365
= "1MB"
= true
= 24
JSON Format (.rskillrc)
Configuration Commands
# Generate sample configuration file
# Use specific configuration file
# Print effective configuration (after merging all sources)
# Validate a configuration file
# Show configuration file search paths and which ones exist
Performance Configuration
The [performance] section allows you to optimize rskiller's scanning and cleanup operations for your system:
enable_parallel_scanning: Enable multi-threaded scanning of directories (default:true)max_parallel_threads: Maximum number of threads to use. Set to0for auto-detection based on CPU cores (default:0)chunk_size: Number of projects to process per parallel chunk (default:1000)enable_parallel_cleanup: Enable parallel cleanup operations for future use (default:true)
Example performance tuning:
[]
= true
= 8 # Use 8 threads explicitly
= 500 # Smaller chunks for better load balancing
= true
Note: Parallel processing significantly improves performance when scanning large directory trees with many Rust projects. The optimal thread count depends on your CPU and storage type (SSDs benefit more than HDDs).
Command Line Options
| Option | Description |
|---|---|
-d, --directory <PATH> |
Directory to start searching from (default: home directory) |
-f, --full |
Search from user's home directory |
-t, --target <NAME> |
Target directory name to search for (default: "target") |
-s, --sort <TYPE> |
Sort by: size, path, or last-mod |
--gb |
Show sizes in gigabytes instead of megabytes |
-E, --exclude <DIRS> |
Exclude directories (comma-separated) |
-x, --exclude-hidden |
Exclude hidden directories |
-e, --hide-errors |
Hide error messages |
-D, --delete-all |
Automatically delete all found directories |
--dry-run |
Don't actually delete anything |
-l, --list-only |
Non-interactive mode, just list projects |
--include-cargo-cache |
Include Cargo registry and git cache analysis |
-c, --color <COLOR> |
Interface color: blue, cyan, magenta, white, red, yellow |
--config <FILE> |
Use specific configuration file |
--print-config |
Print effective configuration (after merging all sources) |
--init-config |
Generate sample configuration file |
--format <FORMAT> |
Configuration file format for --init-config (toml, json) |
--global |
Generate global user configuration instead of project-local |
--validate-config <FILE> |
Validate configuration file |
--config-info |
Show configuration file locations and precedence |
Future Scheduling Options (Planned)
| Option | Description |
|---|---|
--schedule <TYPE> |
Schedule automatic cleanup: daily, weekly, monthly, interval |
--time <HH:MM> |
Time for scheduled cleanup (24-hour format) |
--day <DAY> |
Day for weekly (monday-sunday) or monthly (1-31) cleanup |
--hours <N> |
Interval in hours for recurring cleanup |
--threshold <SIZE> |
Only run if total cleanable size exceeds threshold |
--schedule-config <FILE> |
Load schedule configuration from file |
--list-schedules |
List all configured schedules |
--remove-schedule <ID> |
Remove a scheduled cleanup task |
Safety Features
rskiller includes several safety features to prevent accidental deletion of important files:
- Active Project Detection: Projects modified recently are marked as "Active"
- System Directory Protection: Avoids scanning system directories
- Workspace Awareness: Understands Cargo workspaces
- Dry Run Mode: Test deletions before actually removing files (use
--dry-run) - Size Warnings: Large deletions are highlighted
- Confirmation Prompts: For important operations (in interactive mode)
- Configuration Validation: Validates config files before use
What Gets Cleaned
rskiller can clean the following Rust-related artifacts:
Project Level
target/directories (build outputs)target/debug/(debug builds)target/release/(release builds)target/deps/(compiled dependencies)- Incremental compilation cache
Global Level (with --include-cargo-cache)
~/.cargo/registry/(crate registry cache)~/.cargo/git/(git dependency cache)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Development Setup
# Clone the repository
# Set up development environment
# Run in development mode
# Run with arguments
# Run tests
# Build release
Building and Releasing
The project uses GitHub Actions for automated building and releasing:
- CI Pipeline: Runs tests, clippy, formatting, and security audits on every push
- Release Pipeline: Creates multi-platform binaries when a new tag is pushed
- Package Publishing: Automatically updates package managers (Homebrew, etc.)
Manual Release Process
# Create a new release
# This will:
# 1. Update Cargo.toml version
# 2. Create a git tag
# 3. Push to GitHub
# 4. Trigger automated build and release
Package Managers
The release process automatically:
- ✅ Creates binaries for Linux (x64, ARM64), macOS (x64, ARM64), Windows (x64)
- ✅ Updates Homebrew formula via PR to homebrew-tap
- ✅ Publishes to crates.io for
cargo install - ✅ Generates packages (DEB, RPM) for Linux distributions
- ⏳ Chocolatey and Scoop packages (manual PR required)
- ⏳ AUR package for Arch Linux (manual upload)
Automated Publishing
The project includes automated publishing to crates.io:
- Automatic Detection: Publishes when version in
Cargo.tomlis bumped - Safety Checks: Runs full test suite before publishing
- Duplicate Prevention: Skips if version already exists on crates.io
- Smart Triggers: Only triggers on relevant file changes (src/, Cargo.toml, etc.)
See docs/AUTO_PUBLISH.md for detailed setup instructions.
Development Tools
# Security audit
# Generate shell completions
# Cross-compile for multiple platforms
# Create distribution packages
# View documentation
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Inspired by npkill for Node.js projects
- Built with the amazing Rust ecosystem
- Thanks to all contributors and users
Roadmap
Core Features
- Advanced Filtering: Filter by project age, size, or activity
- Batch Operations: Select multiple projects for batch deletion
- Project Templates: Detect and handle different project types (bin, lib, workspace)
- Smart Cleanup: Analyze dependencies and suggest cleaning unused crates
- Regex Support: Use regex patterns for custom target directory names
- Symlink Handling: Better support for symbolic links and junction points
User Experience
- Configuration File: Support for
.rskillrcorrskill.tomlconfig files with flexible priority system - Themes: Multiple color themes and customizable UI layouts
- Progress Indicators: Real-time progress bars for large operations
- Undo Operations: Ability to restore recently deleted target directories
- Search/Filter: Real-time search and filtering in interactive mode
- Bookmarks: Save and quick-access to frequently cleaned directories
TUI (Terminal User Interface)
- Modern TUI Framework: Migrate from basic crossterm to advanced TUI framework (ratatui/tui-rs)
- Multi-Panel Layout: Split-screen view with project list, details, and actions
- Real-time Monitoring: Live disk usage updates and project activity tracking
- Advanced Navigation:
- Tree view for nested project hierarchies
- Breadcrumb navigation for deep directory structures
- Quick jump to bookmarked directories
- Fuzzy search with instant filtering
- Interactive Widgets:
- Progress bars for scanning and cleanup operations
- Sortable tables with column headers
- Interactive charts for size distribution
- Checkbox selection for batch operations
- Enhanced Project Details:
- Dependency tree visualization
- Build artifact breakdown (debug/release/tests)
- Git status integration (branch, uncommitted changes)
- Last build time and compiler version
- Smart Panels:
- Project overview panel with key metrics
- File browser for target directory contents
- Cleanup confirmation dialog with impact preview
- Help panel with context-sensitive shortcuts
- Customizable Interface:
- Configurable keybindings and shortcuts
- Theme system with multiple color schemes
- Layout presets (compact, detailed, developer)
- Font and terminal compatibility optimization
- Advanced Interactions:
- Drag-and-drop project selection
- Context menus for project actions
- Modal dialogs for complex operations
- Clipboard integration for paths and commands
Statistics & Reporting
- Historical Data: Track cleanup history and disk space trends
- Cleanup Reports: Generate detailed reports of cleaned projects
- Size Analytics: Visualize disk usage patterns and recommendations
- Project Health: Score projects based on activity and cleanliness
- Export Data: Export project lists and statistics to CSV/JSON
Integration & Automation
- IDE Plugins: VS Code, IntelliJ IDEA, and Vim/Neovim extensions
- Git Hooks: Automatic cleanup on branch switching or commits
- CI/CD Integration: Cleanup commands for continuous integration
- Scheduled Cleanup: Cron-like scheduling for automatic maintenance
- Daily cleanup at specified time (e.g., 2:00 AM)
- Weekly cleanup on specific days (e.g., Sunday midnight)
- Monthly cleanup on first day of month
- Custom interval scheduling (every N days/hours)
- Conditional scheduling (only if disk usage > threshold)
- Schedule configuration via config file or CLI
- Integration with system schedulers (cron, Task Scheduler, launchd)
- Docker Support: Cleanup containerized Rust development environments
Cross-Platform & Performance
- Windows Improvements: Better Windows support and testing
- Network Drives: Support for network-mounted project directories
- Parallel Processing: Multi-threaded scanning and cleanup operations
- Memory Optimization: Reduce memory usage for large project collections
- Incremental Scanning: Only rescan changed directories
Advanced Features
- Workspace Intelligence: Detect and respect Cargo workspace hierarchies
- Dependency Analysis: Show which projects share dependencies
- Build Profile Awareness: Distinguish between debug/release/custom profiles
- Cache Management: Smart handling of incremental compilation caches
- Project Migration: Help migrate projects between Rust versions
- Audit Mode: Check for security issues in cached dependencies
Community & Ecosystem
- Plugin System: Allow community-developed extensions
- Package Manager Integration: Work with alternative package managers
- Cloud Storage: Backup/restore configurations across machines
- Team Sharing: Share cleanup policies across development teams
- Metrics Dashboard: Web-based dashboard for team cleanup statistics
TUI Implementation Roadmap
Phase 1: Foundation (v0.3.0) - Q4 2025
- Framework Migration: Replace crossterm with ratatui for advanced TUI capabilities
- Basic Multi-Panel Layout: Implement split-screen with project list and details
- Enhanced Navigation: Tree view and improved keyboard shortcuts
- Progress Indicators: Real-time progress bars for operations
Phase 2: Interactive Features (v0.4.0) - Q1 2026
- Advanced Widgets: Sortable tables, interactive charts, checkbox selection
- Smart Panels: Project overview, file browser, confirmation dialogs
- Search and Filter: Fuzzy search with instant filtering
- Theme System: Multiple color schemes and layout presets
Phase 3: Intelligence (v0.5.0) - Q2 2026
- Git Integration: Show branch status and uncommitted changes
- Dependency Visualization: Interactive dependency tree viewer
- Build Analysis: Detailed breakdown of build artifacts and profiles
- Real-time Monitoring: Live updates of disk usage and project activity
Phase 4: Advanced UX (v0.6.0) - Q3 2026
- Customization: Configurable keybindings and interface layouts
- Context Awareness: Smart suggestions based on project patterns
- Batch Operations: Advanced multi-project selection and operations
- Accessibility: Screen reader support and high contrast themes
Dependencies for TUI Implementation
Required Crates:
= "0.24" # Modern TUI framework
= "0.27" # Terminal manipulation (already included)
= "0.17" # Tree view component
= "0.3" # Fuzzy search functionality
= "0.18" # Git integration
= "1.0" # Enhanced config serialization
= { = "1.0", = ["full"] } # Async runtime (already included)
Development Tools:
- Prototyping: Use
tui-loggerfor debug overlays during development - Testing: Terminal automation testing with
expectrl - Documentation: Interactive demos using
asciinemarecordings
Happy cleaning! Keep your Rust projects lean and your disk space free!