Skip to content

hakuxyz/comclean

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

comclean

A blazing fast, minimalist CLI tool written in Rust to purge AI leftovers, lazy testing artifacts, and terminal log dumps from your source code.

Features

  • 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-commit installation.
  • 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.

Installation

Prerequisites

Ensure you have the Rust toolchain installed.

git clone https://github.com/hakuxyz/comclean.git
cd comclean
cargo build --release

Move the compiled binary from target/release/comclean into your system $PATH (e.g., /usr/local/bin/).


Command Reference

Primary Execution Loops

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.

Configuration & Tool Rules

Target Junkwords

# 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"

Path Exclusions

# Print current runtime static bypass lists
comclean exception list

# Isolate critical files from scanner iterations
comclean exception add "generated_schema.sql"

Context Scopes

# 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

Automation Hook Setup

# Mount a pre-commit shield script inside your local .git ecosystem
comclean hook install

Complete CLI Examples

Scanning & Cleaning Files

# 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

Managing Junkwords (Trigger Terms)

# 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"

Excluding Files (Exceptions)

# 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"

Profile & Automation Control

# 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

Diagnostics Engine Output Format

Dry-Run Scan Preview

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

Interactive Decision Matrix

[MATCH] src/main.rs:42 -> // TODO: delete this lazy fix before push
   Discard line? [y]es / [n]o / [a]ll / [q]uit: _

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages