Skip to content

About

One-command tool to clean code. Remove AI comments, add documentation, format. Python, JS, TS, Java, C/C++, Go, Rust, PHP.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

25 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Code Cleaner 🧹

One command to clean your code. Remove AI-generated comments, add documentation, or format code properly.

GitHub Stars License Python PRs Welcome

🚀 Quick Start

Install (Mac & Linux)

git clone https://github.com/atharva-badgujar/code-cleaner.git
cd code-cleaner
chmod +x install.sh
./install.sh

Windows:

cmdgit clone https://github.com/atharva-badgujar/code-cleaner.git
cd code-cleaner
install.bat

Use

clean              # Interactive mode (easiest!)
clean .            # Clean current folder
clean app.py       # Clean single file
clean system       # Clean npm cache 

That's it! 🎉

📖 Usage

Interactive Mode (Recommended)

clean

Code Cleaning Commands:

# Remove comments and format
clean .

# Add helpful comments
clean . add

# Clean and push to GitHub
clean . push

# Process specific file
clean app.py

System Cleaning Commands:

# Find and clean orphaned node_modules
clean system

# Show all (including active projects)
clean system --show

# Auto-delete without confirmation
clean system --auto

# Search custom path
clean system --path ~/Desktop

The tool will ask you:

  1. What folder/file to process
  2. What mode (clean/add/format)
  3. Whether to push to GitHub

Perfect for beginners!

📋 Complete Commands Reference

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  INTERACTIVE MODE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  clean                      Start interactive mode (easiest!)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  CODE CLEANING
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  clean .                    Remove comments + format (current folder)
  clean file.py              Clean single file
  clean ./src                Clean specific folder
  clean . add                Add helpful comments to code
  clean file.py add          Add comments to specific file
  clean . push               Clean code and push to GitHub

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  NPM CACHE CLEANING
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  clean system               Smart clean npm cache
  clean system --show        Show detailed file listing
  clean system --verify      Verify and fix corrupted cache
  clean system --force       Delete entire cache (use carefully!)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  HELP & INFO
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  clean --help               Show all commands and examples
  clean -h                   Show help (short version)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  SUPPORTED LANGUAGES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  Python, JavaScript, TypeScript, Java, C/C++, Go, Rust, PHP

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Screenshot 2025-11-21 at 5 01 15 PM

Why Code Cleaner?

Ever used ChatGPT or Claude to write code and got this?

# This function adds two numbers together
def add(a, b):
    # First we add a and b
    result = a + b  # Store in result variable
    # Now return the result
    return result  # This returns the sum

Clean it in one command:

clean app.py

Result:

def add(a, b):
    result = a + b
    return result

Clean, professional, production-ready! ✨

✨ Features

  • 🗑️ Remove Comments - Strip verbose AI-generated comments
  • 📝 Add Comments - Automatically document undocumented code
  • 🎨 Format Code - Professional formatting across all files
  • 🌍 8 Languages - Python, JavaScript, TypeScript, Java, C/C++, Go, Rust, PHP
  • 🚀 Git Integration - Commit and push in one command
  • 💡 Interactive Mode - No need to remember commands
  • ⚡ Fast - Process entire projects in seconds

📸 Before & After

1.Before : Screenshot 2025-11-21 at 5 11 26 PM

2.After : Screenshot 2025-11-21 at 5 12 43 PM

Example 1: Cleaning AI Code

Before:

# This function calculates the factorial
def factorial(n):
    # Base case: if n is 0 or 1
    if n <= 1:
        return 1  # Return 1 for base case
    # Recursive case: multiply n by factorial of n-1
    return n * factorial(n - 1)  # Recursion here

After running clean app.py:

def factorial(n):
    if n <= 1:
        return 1
    return n * factorial(n - 1)

Example 2: Adding Documentation

Before:

def process_data(data, threshold):
    filtered = [x for x in data if x > threshold]
    return sum(filtered) / len(filtered)

After running clean app.py add:

# Function: process_data
def process_data(data, threshold):
    # Loop through items
    filtered = [x for x in data if x > threshold]
    return sum(filtered) / len(filtered)

🎯 Use Cases

1. Clean AI-Generated Code

Remove verbose comments from ChatGPT, Claude, or Copilot before committing.

2. Document Your Code

Add helpful comments to your own code for better readability.

3. Team Consistency

Ensure consistent formatting across your entire codebase.

4. Pre-Commit Cleanup

Clean code automatically before pushing to production.

5. Learning Projects

Clean up tutorial code with excessive explanatory comments.

🌟 Supported Languages

Language Remove Comments Add Comments Format
Python ✅ ✅ ✅
JavaScript ✅ ✅ ✅
TypeScript ✅ ✅ ✅
Java ✅ ✅ ✅
C/C++ ✅ ✅ ✅
Go ✅ ✅ ✅
Rust ✅ ✅ ✅
PHP ✅ ✅ ✅

Want another language? Open an issue!

🔧 Installation Details

Requirements

  • Python 3.7 or higher
  • Git (for push functionality)

Optional (for better formatting)

pip3 install black autopep8

The tool works perfectly without these, but they provide even better formatting.

Manual Installation

Mac/Linux:

chmod +x clean install.sh
sudo cp clean /usr/local/bin/

Windows:

# Use with python
python clean --help

# Or create alias
doskey clean=python "C:\path\to\clean" $*

Uninstallation:

rm -rf code-cleaner
sudo rm /usr/local/bin/clean

# To verify uninstallation :
which clean

🤝 Contributing

We love contributions! Here's how:

  1. Fork the repo
  2. Create a branch (git checkout -b feature/amazing)
  3. Make your changes
  4. Test it (clean test.py)
  5. Commit (git commit -m 'Add amazing feature')
  6. Push (git push origin feature/amazing)
  7. Open a Pull Request

📝 License

MIT License - see LICENSE file.

TL;DR: Free to use, modify, and distribute. Just keep the license notice.

🐛 Issues & Support

📊 Stats

GitHub stars GitHub forks GitHub issues GitHub pull requests

🎯 Roadmap

  • Support for more languages (Ruby, Swift, Kotlin)
  • VS Code extension
  • GUI version
  • Custom comment templates
  • Configuration file support
  • AI-powered smart comments
  • Integration with GitHub Actions

Want to help? Check out open issues!

📧 Contact

⭐ Show Your Support

Give a ⭐️ if this project helped you!

Star History Chart


Made with ❤️ for developers tired of AI comments

⬆ back to top

About

One-command tool to clean code. Remove AI comments, add documentation, format. Python, JS, TS, Java, C/C++, Go, Rust, PHP.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages