Skip to main content

Remove auto-generated comments from code files

Project description

devibe

Remove auto-generated comments from your codebase. A simple, extensible library for cleaning up AI-generated and IDE-generated comments.

Installation

PyPI (Coming Soon!)

🚀 PyPI package coming soon! We're preparing to publish devibe to the Python Package Index. Once available, you'll be able to install it with:

# Coming soon!
pip install devibe

Once published, you'll be able to run devibe ./myfile.py directly from anywhere.

Local Development Install

Clone the repository and install in development mode:

git clone https://github.com/nhunter0/devibe.git
cd devibe
pip install -e .

After installation, you can run devibe either:

  1. As a Python module (works anywhere):

    python -m devibe myfile.py
    
  2. Direct command (if pip Scripts directory is in PATH):

    devibe myfile.py
    

Usage

Command Line

Clean a single file:

devibe myfile.py

Clean a directory recursively:

devibe ./src -r

Dry run to see exactly what lines would be removed:

devibe myfile.py --dry-run

This will show output like:

myfile.py - Would remove 3 line(s):

  1. # Generated by Claude
  2.     x = 1  # ✅ AI-generated
  3. # ... rest of implementation

Process only specific file types:

devibe ./src -r -e .py .js .java

Python API

from devibe import CommentRemover

remover = CommentRemover()

# Clean a single file
removed_count, removed_comments = remover.clean_file("myfile.py")

# Clean a directory
stats = remover.clean_directory("./src", recursive=True, extensions=[".py", ".js"])
print(f"Removed {stats['comments_removed']} comments from {stats['files_modified']} files")

Default Rules

devibe comes with intelligent rules to detect and remove:

AI-Generated Comments

  • generated by Claude, AI-generated, Created by GPT
  • Comments from Copilot, Codeium, TabNine, and other AI assistants

IDE-Generated Comments

  • Auto-generated code stubs and boilerplate
  • IDE template comments from VSCode, IntelliJ, Eclipse

Status Markers & Emojis

  • Emoji indicators (✅, 🔒, 🚀, etc.)
  • Status prefixes (FIXED:, REMOVED:, ENHANCED:, SIMPLIFIED:)
  • Case-insensitive matching with or without colons

Placeholder Comments

  • ... rest of code, ... existing methods
  • your code here, insert logic here
  • TODO: implement, stub, placeholder

List active rules:

devibe --list-rules

Adding Custom Rules

I have definetly missed rules so if you have any feel free to go to: /devibe/rules.py add a custom rule send a PR.

Via Command Line

Add custom patterns on the fly:

devibe myfile.py --add-pattern "my_rule" "pattern_to_match"

Via Python

from devibe import CommentRemover, PatternRule

remover = CommentRemover()

# Add a custom pattern rule
custom_rule = PatternRule(
    name="custom_assistant",
    description="Remove specific assistant comments",
    patterns=[r"generated by my-assistant", r"my-assistant wrote this"]
)
remover.rule_registry.add_rule(custom_rule)

# Now clean files with your custom rule active
remover.clean_file("myfile.py")

Creating Your Own Rule Class

from devibe.rules import Rule

class KeywordRule(Rule):
    def __init__(self, keywords):
        super().__init__("keyword_rule", "Remove comments with specific keywords")
        self.keywords = [k.lower() for k in keywords]

    def matches(self, comment):
        comment_lower = comment.lower()
        return any(keyword in comment_lower for keyword in self.keywords)

# Use your custom rule
remover = CommentRemover()
remover.rule_registry.add_rule(KeywordRule(["autogen", "placeholder"]))

Requirements

  • Python 3.7+
  • No external dependencies for core functionality

Development

Install in development mode with:

git clone https://github.com/nhunter0/devibe.git
cd devibe
pip install -e .

Run tests:

pytest tests/

Contributing

We welcome contributions! To add support for new languages or improve detection rules:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Add your parser or rule to the appropriate registry
  4. Write tests for your changes
  5. Submit a pull request

Roadmap

  • PyPI package publication
  • Devibe UI & UX !
  • VS Code extension
  • More language-specific rules

License

MIT

Author

Created with ❤️ to keep codebases clean and professional.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

devibe-0.1.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

devibe-0.1.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file devibe-0.1.0.tar.gz.

File metadata

  • Download URL: devibe-0.1.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for devibe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9beb67db76bd7972261617c6bdb6b6bdad254891215c3307750048aab9e3e9d1
MD5 2b0187d0da4633f24dce416fecdb5fd5
BLAKE2b-256 6aec33c57ceb32b2b8a94aad1366dcb4d40c22fb593462c38e9fdb3c56da4aa1

See more details on using hashes here.

File details

Details for the file devibe-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: devibe-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for devibe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57fee731056b9321aeb58c79d66c3e48ac78931aa7a19364d04dbcf077882b68
MD5 759afcbc23e1169bd6d87836dd1caec3
BLAKE2b-256 906d5d3d1f1155aec96f921b665fd282e3dd6ddb7af75ce2573e4fd2609bfb78

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page