Skip to main content

AI-powered CLI debugging and auto-repair tool with RAG, automatic patch generation, and validation.

Project description

๐Ÿ BugBee

AI-powered CLI debugging assistant that automatically analyzes runtime errors, retrieves relevant documentation using RAG, and suggests or applies intelligent fixes.

BugBee wraps your terminal commands, intercepts runtime failures, analyzes the traceback, retrieves relevant documentation from official sources, and uses an LLM to explain and optionally fix the issue.


โœจ Features

  • ๐Ÿค– AI-powered debugging using DeepSeek-R1
  • ๐Ÿ“š Retrieval-Augmented Generation (RAG) using ChromaDB
  • ๐Ÿ” Automatic traceback parsing
  • ๐Ÿง  Context-aware code analysis
  • ๐Ÿ“– Retrieval from official framework documentation
  • โšก SHA256-based intelligent response caching
  • ๐Ÿฉน Automatic code patch generation
  • โœ… Validation after applying fixes
  • ๐Ÿ“Š Metrics collection
  • ๐Ÿ’ป Cross-platform support (Windows, Linux, macOS)
  • ๐Ÿš€ Packaged for PyPI

Architecture

                 User Command
                       โ”‚
                       โ–ผ
            Execute Target Program
                       โ”‚
                       โ–ผ
               Capture stderr
                       โ”‚
                       โ–ผ
          Parse Traceback & Context
                       โ”‚
                       โ–ผ
             Compute Error Hash
                       โ”‚
            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
            โ”‚                     โ”‚
            โ–ผ                     โ–ผ
       Cache Hit             Cache Miss
            โ”‚                     โ”‚
            โ”‚             Retrieve Docs
            โ”‚                     โ”‚
            โ”‚                     โ–ผ
            โ”‚              ChromaDB Search
            โ”‚                     โ”‚
            โ”‚                     โ–ผ
            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ DeepSeek-R1 โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
                             โ”‚
                             โ–ผ
                  AI Diagnosis + Fix
                             โ”‚
                             โ–ผ
                 Optional Auto Patch
                             โ”‚
                             โ–ผ
                   Validation Run
                             โ”‚
                             โ–ผ
                        Metrics

Installation

pip install bugbee

Configuration

Create a .env file in your project.

HF_TOKEN=your_huggingface_api_key

You can obtain a Hugging Face token from:

https://huggingface.co/settings/tokens


Usage

Analyze a Python script:

bugbee run python app.py

Analyze any command:

bugbee run pytest
bugbee run uv run main.py

Display help:

bugbee --help

Example

Original error

name = "BugBee"

print(nmae)

BugBee output

๐Ÿ BugBee Analysis

Root Cause
-----------
NameError: name 'nmae' is not defined

Suggested Fix
-------------

Replace

print(nmae)

with

print(name)

After confirmation, BugBee automatically:

  • Updates the file
  • Creates a backup
  • Executes a validation run
  • Reports success or failure

How It Works

  1. Execute the requested command.
  2. Capture stderr output.
  3. Parse traceback to identify the source file and line number.
  4. Extract surrounding source code.
  5. Generate a unique hash of the error.
  6. Check the local cache.
  7. Retrieve relevant documentation using ChromaDB.
  8. Send the prompt to DeepSeek-R1.
  9. Parse the structured response.
  10. Display the diagnosis.
  11. Optionally apply the generated fix.
  12. Validate the updated program.
  13. Record metrics.

Technologies

  • Python
  • Typer
  • LangChain
  • ChromaDB
  • Sentence Transformers
  • Hugging Face
  • DeepSeek-R1
  • Pydantic
  • Rich

Metrics

BugBee records useful runtime metrics including:

  • Successful analyses
  • Cache hit rate
  • Average latency
  • Token usage
  • Auto-fix count
  • Validation success rate

Roadmap

v0.2

  • Multiple LLM providers
  • Better framework detection
  • Improved retrieval pipeline

v0.3

  • AST-based patch generation
  • Framework-specific fix templates
  • Smarter patch validation

v1.0

  • VS Code extension
  • Plugin system
  • Multi-language support
  • Interactive terminal UI

Contributing

Contributions are welcome!

Please read CONTRIBUTING.md before submitting pull requests.


License

Apache License 2.0


Author

Pranav Kurmadasu

If you found BugBee useful, consider giving the repository a โญ.

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

bugbee-0.1.0.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

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

bugbee-0.1.0-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bugbee-0.1.0.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bugbee-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3d512cfa7dad0a19bff8575592517463f05e31b25d11aa05361421e22993be07
MD5 f1529c7d58499de04b4e0be4cde37693
BLAKE2b-256 e379d317e0a63e287a0f96b3c64a4731de9dbb650234b6c6bc496287dbed15a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for bugbee-0.1.0.tar.gz:

Publisher: main.yml on KurmadasuPranav7/BugBee

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: bugbee-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bugbee-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c469b921e21762863cfdefc464484cd3eb723a819605b8c562643a9a7f3a0189
MD5 3e96d1558e4e25b09b6953bcf4c644fd
BLAKE2b-256 431e92115a58e60ffae3562d2facbb482f0e1f6d5869db8214ef629d899bf62e

See more details on using hashes here.

Provenance

The following attestation bundles were made for bugbee-0.1.0-py3-none-any.whl:

Publisher: main.yml on KurmadasuPranav7/BugBee

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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