Skip to main content

AI-powered CLI tool that turns stack traces into root cause analysis instantly

Project description

debugai

For setup instructions, see SETUP_RUN.md

AI-powered CLI assistant for analyzing stack traces and debugging production errors.

debugai parses stack traces, extracts execution flow, and optionally uses an LLM to generate root cause analysis, suggested fixes, and prevention strategies.


✨ Features

  • Extract exception type from stack traces
  • Identify failure origin
  • Reconstruct execution chain
  • Guess likely source file
  • AI-powered root cause analysis
  • Clean terminal output using Rich

🧠 Example

Input stack trace:

System.NullReferenceException at TradeService.CalculatePnl() at PricingService.ProcessTrade() at TradeController.ExecuteTrade()

Run:

debugai error.log --ai

Output:

Exception Type NullReferenceException

Failure Origin TradeService.CalculatePnl()

Execution Chain TradeController.ExecuteTrade() ↓ PricingService.ProcessTrade() ↓ TradeService.CalculatePnl()

AI Root Cause Trade object was likely null when CalculatePnl() was invoked.

Suggested Fix Add defensive null checks before accessing trade properties.

Prevention Enable nullable reference types and validate inputs earlier.


⚙️ Installation

Clone the repository:

git clone https://github.com/yourusername/debugai.git cd debugai

Install locally:

pip install -e .


🚀 Usage

Analyze a stack trace file:

debugai error.log

Enable AI root cause analysis:

debugai error.log --ai


🔑 API Configuration

To enable AI analysis, set your API key as an environment variable.

Example using NVIDIA inference endpoint:

export NVIDIA_API_KEY="your_api_key"

The tool reads this value automatically.


📂 Project Structure

debugai/ │ ├── debugai/ │ ├── cli.py │ ├── analyzer.py │ ├── ai_analyzer.py │ └── init.py │ ├── examples/ │ └── error.log │ ├── pyproject.toml └── README.md


🧪 Example Stack Trace File

You can test the CLI with:

examples/error.log

Example:

System.NullReferenceException at TradeService.CalculatePnl() at PricingService.ProcessTrade() at TradeController.ExecuteTrade()


🧩 Phase 1 Scope

Phase 1 focuses on building a minimal AI-powered debugging CLI with:

  • stack trace parsing
  • execution chain extraction
  • structured terminal output
  • optional AI analysis

🚧 Future Improvements

Planned improvements:

  • analyze logs directly from stdin
  • support multiple languages (Python, Java, C#)
  • source code context extraction
  • GitHub issue search for similar bugs
  • CI/CD integration
  • Kubernetes log analysis

🤝 Contributing

Contributions and ideas are welcome.

Open an issue or submit a pull request.


📜 License

MIT License

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

debuai-0.1.0.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

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

debuai-0.1.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for debuai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c246cd32952ea13d6a810b06bbdf543a06fc369fa99c62269960d1acfebd5c5f
MD5 ffaa934ef38cda4e5030f82cd9675e33
BLAKE2b-256 9af031fa2a171cfe7a4e7906bafe926395f7abf70d941e5b37100b140c31d8d7

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for debuai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0689fc51ac262bc0045c6f3c2f6159d96a2746634eb30f6377474eea85d2cde6
MD5 bb3f9dcccdebccd8e81d73b36f618af4
BLAKE2b-256 889e082c73301e6173692f648fae91c708d03f268fcb7e036fb8f938002dea5c

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