rskiller 0.1.1

Find and clean Rust project build artifacts and caches
rskiller-0.1.1 is not a library.
Visit the last successful build: rskiller-0.2.1

rust-cleaner - Rust Project Cleaner

rust-cleaner 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.

Features

  • Find Rust Projects: Automatically scans for Cargo.toml files to locate Rust projects
  • Clean Build Artifacts: Remove target directories 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
  • 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

From Source

git clone https://github.com/NakaSato/rust-cleaner.git
cd rust-cleaner
cargo install --path .

Using Cargo

cargo install rust-cleaner

Usage

Interactive Mode (Default)

rskill

This opens an interactive terminal interface where you can:

  • Navigate with ↑↓ or j/k
  • Delete target directories with Space or Del
  • Open project directories with o
  • Refresh the list with r
  • Delete all targets with a
  • Quit with q or Esc

List Mode

rskill --list-only

Common Options

# Start from a specific directory
rskill --directory ~/projects

# Search from home directory
rskill --full

# Show sizes in gigabytes
rskill --gb

# Sort by different criteria
rskill --sort size    # Default
rskill --sort path
rskill --sort last-mod

# Exclude directories
rskill --exclude "target,node_modules"

# Include Cargo cache analysis
rskill --include-cargo-cache

# Dry run (don't actually delete)
rskill --dry-run

# Auto-delete all found target directories
rskill --delete-all --dry-run  # Test first!

# Future scheduling options (planned)
# rskill --schedule daily --time "02:00"
# rskill --schedule weekly --day sunday --time "00:00"
# rskill --schedule monthly --day 1 --time "01:00"
# rskill --schedule interval --hours 24

Command Line Options

Option Description
-d, --directory <PATH> Directory to start searching from (default: current 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

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

rskill 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
  • Size Warnings: Large deletions are highlighted
  • Confirmation Prompts: For important operations (in interactive mode)

What Gets Cleaned

rskill 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)

Screenshots

RUST-CLEANER - Rust Project Cleaner
────────────────────────────────────────────────────────────────────────────────

Navigate | Space/Del Delete | o Open | r Refresh | q Quit

► my-rust-project          15.30 MB     ~/projects/rust/my-app      2 days ago    Active
  old-experiment           245.67 MB    ~/old-projects/experiment   45 days ago   Stale
  web-server                89.12 MB    ~/work/backend             1 day ago     Active
  cli-tool                  12.45 MB    ~/tools/cli                7 days ago    Active
  
────────────────────────────────────────────────────────────────────────────────
4 projects | 362.54 MB cleanable | 2 deleted (180.23 MB)

/Users/username/projects/rust/my-app
Target: /Users/username/projects/rust/my-app/target
15 dependencies

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

# Clone the repository
git clone https://github.com/NakaSato/rskill.git
cd rskill

# Run in development mode
cargo run

# Run with arguments
cargo run -- --directory ~/projects --list-only

# Run tests
cargo test

# Build release
cargo build --release

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 .rskillrc or rskill.toml config files
  • 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

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

Happy cleaning! Keep your Rust projects lean and your disk space free!