A blazing fast, minimalist CLI tool written in Rust to purge AI leftovers, lazy testing artifacts, and terminal log dumps from your source code.
- Multi-Language Syntax Awareness: Autodetects C-style (Rust, Go, JS/TS, C/C++, Java, Swift), Python-style, HTML, CSS, and SQL code structures.
- Interactive Triage Mode (
-i/--interactive): Review matches on the fly with live options to drop, skip, accept all, or safely abort. - Git & Hook Architecture (
--staged): Integrated safety checks that halt on dirty working trees unless overridden. Supports automated local.git/hooks/pre-commitinstallation. - Hierarchical Scopes (
comclean.json): Prefers local workspace configuration overrides over the global home directory fallback automatically. - Zero-Clutter Visual Design: Strictly functional, emoji-free terminal diagnostics powered by terminal-colored flags.
Ensure you have the Rust toolchain installed.
git clone https://github.com/hakuxyz/comclean.git
cd comclean
cargo build --releaseMove the compiled binary from target/release/comclean into your system $PATH (e.g., /usr/local/bin/).
| Command / Flag | Action |
|---|---|
comclean |
Triggers a safe DRY-RUN scan of your current directory. |
comclean -a, comclean --apply |
Executes modifications directly, wiping target junk lines. |
comclean -i, comclean --interactive |
Prompts for confirmation step-by-step on line matches. |
comclean --staged |
Fast-tracks analysis exclusively for git staged file scopes. |
comclean --force |
Bypasses uncommitted change safety blocks on active work trees. |
# Display built-in core terms and custom rules
comclean junkword list
# Inject custom filter parameters
comclean junkword add "my_secret_token" "debug_print_v2"
# Remove target phrases from configuration memory
comclean junkword remove "debug_print_v2"# Print current runtime static bypass lists
comclean exception list
# Isolate critical files from scanner iterations
comclean exception add "generated_schema.sql"# Locate active configuration filepath and runtime scope
comclean config path
# Generate a local comclean.json for the current workspace
comclean config init
# Flush configurations back to default factory standards
comclean config reset# Mount a pre-commit shield script inside your local .git ecosystem
comclean hook install# Run a safe preview (Dry-Run) on the current folder
comclean
# Clean a specific file directly
comclean src/main.rs --apply
# Interactively clean only files that are currently staged in Git
comclean --staged --apply --interactive
# Force a clean run even if you have uncommitted git changes
comclean --apply --force# Add multiple custom words to look out for
comclean junkword add "console.warn" "FIXME_LATER" "test_token"
# List all active phrases (Core built-in rules + your custom ones)
comclean junkword list
# Remove a custom word you no longer need to track
comclean junkword remove "test_token"# Protect sensitive or vendor files from being modified
comclean exception add "jquery.min.js" "legacy_auth.py"
# See which files are currently safe from scanning
comclean exception list
# Remove protection from a file to include it in scans again
comclean exception remove "legacy_auth.py"# Check if you are currently using a [LOCAL] or [GLOBAL] configuration
comclean config path
# Initialize a local 'comclean.json' configuration for your current project team
comclean config init
# Reset everything back to default factory settings
comclean config reset
# Install the pre-commit hook into your local repository (.git/hooks/)
comclean hook install>> DRY-RUN ACTIVE: Previewing changes. Use -a / --apply to rewrite files.
-------------------------------------------------------------------------
[STALE] src/main.rs -> 3 target lines detected
[STALE] lib/utils.js -> 1 target lines detected
>> SCAN COMPLETE
-------------------------------------------------------------------------
Files analyzed: 14
Files modified: 2
Lines removed: 4
Execution time: 1.24ms
-------------------------------------------------------------------------
[MATCH] src/main.rs:42 -> // TODO: delete this lazy fix before push
Discard line? [y]es / [n]o / [a]ll / [q]uit: _