Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DebugLens

Visual Code Debugger — Paste an error, see an interactive call stack graph, get fix suggestions.

DebugLens parses Python tracebacks, JavaScript/TypeScript error stacks, and generic error formats. It classifies errors, detects common patterns, scores severity, and suggests fixes — all rendered as an interactive visual interface.

Python FastAPI D3.js License

Quick Start

# Install dependencies
pip install -r requirements.txt

# Start the server
python server.py

# Open in browser
http://localhost:8503

Paste any error traceback into the textarea and press Analyze (or Ctrl+Enter).

Features

Error Parsing

  • Python tracebacks — full chain parsing (__cause__, __context__)
  • JavaScript/TypeScript — Chrome and Node.js stack formats
  • Generic errors — regex-based extraction for any language
  • Local variable extraction from Python Traceback
  • Chained exception support

Error Analysis

  • Classification — syntax, runtime, type, import, logic, resource, network, permission
  • Pattern detection — 12+ built-in patterns (NoneType access, key errors, import cycles, etc.)
  • Severity scoring — 1-10 scale with category-aware weighting
  • Fix suggestions — actionable code examples with confidence scores
  • Stack Overflow search — auto-generated search URLs

Visual Interface

  • Interactive D3.js call stack graph (click nodes to expand)
  • Color-coded severity badge (low/medium/high/critical)
  • Code context panel with highlighted error line
  • Dark theme, responsive layout

API

POST /analyze

Parse and analyze error text.

curl -X POST http://localhost:8503/analyze \
  -H "Content-Type: application/json" \
  -d '{"error_text": "Traceback...\nKeyError: \"missing\""}'

Response:

{
  "parsed": { "error_type": "KeyError", "frames": [...], ... },
  "analysis": { "severity": 5, "category": "runtime", "fix_suggestions": [...] },
  "stackoverflow_urls": [...]
}

POST /analyze/file

Analyze error with source file code context.

{
  "error_text": "TypeError: ...",
  "file_path": "/path/to/source.py",
  "error_line": 42
}

GET /patterns

List all known error patterns and their metadata.

POST /suggest

Get AI-powered fix suggestions (uses BHAASM Core if available, else rule-based).

{
  "error_text": "...",
  "context": "Optional additional context",
  "file_path": "/optional/path"
}

GET /health

Service health check.

Architecture

debuglens/
├── parser.py          # Error traceback parser (Python, JS, generic)
├── analyzer.py        # Pattern matching, classification, fix generation
├── server.py          # FastAPI server (port 8503)
├── static/
│   └── index.html     # Visual debugger UI (D3.js)
├── requirements.txt   # Python dependencies
└── README.md

parser.py

  • PythonTracebackParser — regex-based extraction of frames, chained exceptions, local variables
  • JavaScriptParser — Chrome/Node stack format parser
  • GenericParser — fallback for unknown languages
  • ErrorParser — auto-detects language and delegates

analyzer.py

  • 12 built-in error patterns with fixes (AttributeError, TypeError, KeyError, IndexError, ImportError, NameError, FileNotFoundError, ValueError, RecursionError, SyntaxError, ZeroDivisionError, PermissionError, ConnectionError)
  • ErrorAnalyzer.analyze() — pattern matching + severity scoring
  • ErrorAnalyzer.analyze_with_code() — adds file context
  • ErrorAnalyzer.get_known_patterns() — pattern registry

server.py

  • FastAPI with auto-generated Swagger docs at /docs
  • Integration with BHAASM Core (optional, auto-detected)
  • CORS enabled for development

Supported Error Patterns

Error Type Category Severity
AttributeError type 6
TypeError type 6
KeyError runtime 5
IndexError runtime 5
ImportError import 7
NameError runtime 5
FileNotFoundError resource 6
ValueError type 5
RecursionError logic 8
SyntaxError syntax 10
ZeroDivisionError logic 6
PermissionError permission 7
ConnectionError network 7

Requirements

  • Python 3.9+
  • FastAPI
  • Uvicorn
  • Pydantic
  • Pygments (syntax highlighting)

License

MIT

About

Visual code debugger — traces through time, finds the bug

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages