๐ง AI-Powered Debugging ToolsMarch 4, 2026โ
Tests passing
AI Debugger CLI
A command-line tool that leverages Claude AI to analyze Python stack traces and error messages, providing detailed explanations of errors and suggested fixes. This is useful for developers looking to quickly understand and resolve issues without context switching to online searches or documentation.
What It Does
- Parses Python stack traces and runtime errors.
- Sends error context to Claude AI for debugging insights.
- Provides detailed explanations and fix recommendations.
- Supports input via file or stdin.
Installation
1. Clone the repository:
git clone https://github.com/yourusername/ai_debugger_cli.git
cd ai_debugger_cli2. Install dependencies:
pip install -r requirements.txtUsage
Analyze Error Logs from a File
python ai_debugger_cli.py --file error_log.txtAnalyze Error Logs from Stdin
cat error_log.txt | python ai_debugger_cli.pyExample Input
Traceback (most recent call last):
File "example.py", line 1, in <module>
1/0
ZeroDivisionError: division by zeroExample Output
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ AI Debugger Response โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ The error is a ZeroDivisionError, which occurs when โ
โ you attempt to divide a number by zero. To fix this โ
โ issue, ensure that the denominator is not zero. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏSource Code
import sys
import json
import click
from rich.console import Console
from rich.panel import Panel
from openai import ChatCompletion, OpenAIError
# Initialize rich console for pretty printing
console = Console()
@click.command()
@click.option('--file', type=click.Path(exists=True), help='Path to the file containing the error log.')
def main(file):
"""AI Debugger CLI: Analyze Python stack traces and errors with AI."""
if not file and sys.stdin.isatty():
console.print("[bold red]Error:[/] No input provided. Use --file or pipe error logs to stdin.")
sys.exit(1)
# Read input from file or stdin
try:
if file:
with open(file, 'r') as f:
error_log = f.read()
else:
error_log = sys.stdin.read()
if not error_log.strip():
console.print("[bold red]Error:[/] Empty input provided.")
sys.exit(1)
except Exception as e:
console.print(f"[bold red]Error:[/] Unable to read input: {e}")
sys.exit(1)
# Process the error log with AI
try:
response = analyze_with_ai(error_log)
console.print(Panel(response, title="AI Debugger Response", expand=False))
except OpenAIError as e:
console.print(f"[bold red]Error:[/] Failed to communicate with AI: {e}")
sys.exit(1)
except Exception as e:
console.print(f"[bold red]Unexpected Error:[/] {e}")
sys.exit(1)
def analyze_with_ai(error_log):
"""Send the error log to Claude AI for analysis and return the response."""
# Replace with your OpenAI API key
api_key = "your_openai_api_key"
if not api_key:
raise ValueError("OpenAI API key is not set.")
ChatCompletion.api_key = api_key
messages = [
{"role": "system", "content": "You are an expert Python debugger."},
{"role": "user", "content": f"Here is a Python error log: {error_log}"}
]
response = ChatCompletion.create(
model="gpt-4",
messages=messages
)
return response['choices'][0]['message']['content']
if __name__ == "__main__":
main()Community
Downloads
ยทยทยท
Rate this tool
No ratings yet โ be the first!
Details
- Tool Name
- ai_debugger_cli
- Category
- AI-Powered Debugging Tools
- Generated
- March 4, 2026
- Tests
- Passing โ
Quick Install
Clone just this tool:
git clone --depth 1 --filter=blob:none --sparse \ https://github.com/ptulin/autoaiforge.git cd autoaiforge git sparse-checkout set generated_tools/2026-03-04/ai_debugger_cli cd generated_tools/2026-03-04/ai_debugger_cli pip install -r requirements.txt 2>/dev/null || true python ai_debugger_cli.py