๐ง AI-Powered Coding AgentsMarch 16, 2026โ
Tests passing
AI Debug Assist
A CLI tool that integrates with AI coding agents like Gemini CLI to analyze error logs, tracebacks, or bugs in your code, and provide intelligent debugging suggestions directly in the terminal. The tool automates troubleshooting by combining AI reasoning with contextual awareness of your project.
What It Does
- Analyze error logs and tracebacks.
- Provide step-by-step debugging suggestions.
- Contextual awareness of your codebase.
Installation
Install the required Python packages:
pip install openai richUsage
Run the tool using the following command:
python ai_debug_assist.py --api-key YOUR_API_KEY --error-log PATH_TO_ERROR_LOG --code-path PATH_TO_CODE_DIRECTORYArguments
--api-key: Your OpenAI API key.--error-log: Path to the error log file.--code-path: Path to the code directory for context.
Source Code
import argparse
import os
import openai
from rich.console import Console
from rich.table import Table
def analyze_error_log(api_key, error_log, code_path):
"""
Analyze the error log and provide debugging suggestions using OpenAI API.
Args:
api_key (str): OpenAI API key.
error_log (str): The error log content.
code_path (str): Path to the code files for context.
Returns:
str: AI-generated debugging suggestions.
"""
openai.api_key = api_key
# Prepare the prompt for the AI model
prompt = f"""
You are an expert software engineer. Analyze the following error log and provide debugging suggestions.
Error Log:
{error_log}
Additionally, consider the context of the code in the following directory:
{code_path}
Provide step-by-step debugging suggestions.
"""
try:
response = openai.Completion.create(
engine="text-davinci-003",
prompt=prompt,
max_tokens=500
)
return response.choices[0].text.strip()
except openai.error.OpenAIError as e:
return f"Error communicating with OpenAI API: {e}"
def read_file(file_path):
"""
Read the content of a file.
Args:
file_path (str): Path to the file.
Returns:
str: Content of the file.
"""
if not os.path.exists(file_path):
raise FileNotFoundError(f"File not found: {file_path}")
with open(file_path, 'r', encoding='utf-8') as file:
return file.read()
def main():
parser = argparse.ArgumentParser(description="AI Debug Assist: Analyze error logs and provide debugging suggestions.")
parser.add_argument('--api-key', type=str, required=True, help="Your OpenAI API key.")
parser.add_argument('--error-log', type=str, required=True, help="Path to the error log file.")
parser.add_argument('--code-path', type=str, required=True, help="Path to the code directory for context.")
args = parser.parse_args()
console = Console()
try:
error_log_content = read_file(args.error_log)
suggestions = analyze_error_log(args.api_key, error_log_content, args.code_path)
table = Table(title="AI Debugging Suggestions")
table.add_column("Suggestions", style="cyan")
table.add_row(suggestions)
console.print(table)
except FileNotFoundError as e:
console.print(f"[red]Error:[/red] {e}")
except Exception as e:
console.print(f"[red]Unexpected error:[/red] {e}")
if __name__ == "__main__":
main()Community
Downloads
ยทยทยท
Rate this tool
No ratings yet โ be the first!
Details
- Tool Name
- ai_debug_assist
- Category
- AI-Powered Coding Agents
- Generated
- March 16, 2026
- Tests
- Passing โ
- Fix Loops
- 3
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-16/ai_debug_assist cd generated_tools/2026-03-16/ai_debug_assist pip install -r requirements.txt 2>/dev/null || true python ai_debug_assist.py