rskiller 0.1.0

Find and clean Rust project build artifacts and caches
rskiller-0.1.0 is not a library.

๐Ÿฆ€ 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/yourusername/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!

๐ŸŽฏ 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

๐Ÿ›ก๏ธ 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/yourusername/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

  • 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)
  • Statistics: Historical cleanup statistics and trends
  • Configuration: Configuration file support for default options
  • Integration: IDE/Editor plugins
  • Cross-platform: Better Windows support and testing

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