Classes
Severity
Severity levels for debug findings.
Severity
Severity levels for debug findings.
EnumMethods 2
emoji
property
Get emoji for severity level.
emoji
property def emoji(self) -> str
Get emoji for severity level.
Returns
str
color
property
Get Rich color token for severity.
color
property def color(self) -> str
Get Rich color token for severity.
Returns
str
DebugFinding
dataclass
A single finding from a debug tool.
Represents an observation, issue, or insight discovered during…
DebugFinding
dataclass A single finding from a debug tool.
Represents an observation, issue, or insight discovered during analysis. Findings can range from informational to critical and include actionable suggestions where applicable.
Attributes
| Name | Type | Description |
|---|---|---|
title |
str |
Short title describing the finding |
description |
str |
Detailed explanation of what was found |
severity |
Severity |
Severity level (info, warning, error, critical) |
category |
str |
Category for grouping (e.g., "cache", "dependency", "performance") |
location |
str | None |
Optional file path or identifier related to finding |
suggestion |
str | None |
Optional actionable suggestion for resolution |
metadata |
dict[str, Any] |
Additional context-specific data |
line |
int | None |
Optional line number for file-based findings |
Methods 2
format_short
Format as single line.
format_short
def format_short(self) -> str
Format as single line.
Returns
str
format_full
Format with full details.
format_full
def format_full(self) -> str
Format with full details.
Returns
str
DebugReport
dataclass
Structured output from a debug tool.
Aggregates findings, statistics, and recommendations from a d…
DebugReport
dataclass Structured output from a debug tool.
Aggregates findings, statistics, and recommendations from a debug analysis. Provides multiple output formats for CLI, JSON, and markdown export.
Attributes
| Name | Type | Description |
|---|---|---|
tool_name |
str |
Name of the tool that generated this report |
timestamp |
datetime |
When the report was generated |
findings |
list[DebugFinding] |
List of findings discovered during analysis |
summary |
str |
Brief summary of analysis results |
statistics |
dict[str, Any] |
Numeric statistics from analysis |
recommendations |
list[str] |
High-level recommendations based on findings |
execution_time_ms |
float |
How long the analysis took |
metadata |
dict[str, Any] |
Additional tool-specific data |
Methods 8
findings_by_severity
property
Group findings by severity level.
findings_by_severity
property def findings_by_severity(self) -> dict[Severity, list[DebugFinding]]
Group findings by severity level.
Returns
dict[Severity, list[DebugFinding]]
findings_by_category
property
Group findings by category.
findings_by_category
property def findings_by_category(self) -> dict[str, list[DebugFinding]]
Group findings by category.
Returns
dict[str, list[DebugFinding]]
has_issues
property
Check if report contains warnings or errors.
has_issues
property def has_issues(self) -> bool
Check if report contains warnings or errors.
Returns
bool
error_count
property
Count of error and critical findings.
error_count
property def error_count(self) -> int
Count of error and critical findings.
Returns
int
warning_count
property
Count of warning findings.
warning_count
property def warning_count(self) -> int
Count of warning findings.
Returns
int
add_finding
Add a finding to the report.
add_finding
def add_finding(self, title: str, description: str, severity: Severity = Severity.INFO, **kwargs: Any) -> DebugFinding
Add a finding to the report.
Parameters 3
title |
str |
|
description |
str |
|
severity |
Severity |
Returns
DebugFinding
to_dict
Convert report to dictionary for JSON serialization.
to_dict
def to_dict(self) -> dict[str, Any]
Convert report to dictionary for JSON serialization.
Returns
dict[str, Any]
format_summary
Format a brief summary for CLI output.
format_summary
def format_summary(self) -> str
Format a brief summary for CLI output.
Returns
str
DebugTool
abstract
Base class for all Bengal debug tools.
Provides common infrastructure for analysis tools including…
DebugTool
abstract Base class for all Bengal debug tools.
Provides common infrastructure for analysis tools including:
- Standardized report generation
- Access to site and cache data
- Consistent output formatting
Subclasses implement analyze() to perform their specific analysis.
Creation:
Subclass and implement analyze() method.
ABCAttributes
| Name | Type | Description |
|---|---|---|
name |
str |
|
description |
str |
Methods 3
create_report
Create a new report for this tool.
create_report
def create_report(self) -> DebugReport
Create a new report for this tool.
Returns
DebugReport
analyze
Perform analysis and return report.
Subclasses must implement this method to p…
analyze
def analyze(self) -> DebugReport
Perform analysis and return report.
Subclasses must implement this method to perform their specific analysis and return a DebugReport with findings.
Returns
DebugReport containing analysis resultsDebugReport
—
run
Run analysis with timing.
Wraps analyze() with timing measurement.
run
def run(self) -> DebugReport
Run analysis with timing.
Wraps analyze() with timing measurement.
Returns
DebugReport with execution time populatedDebugReport
—
Internal Methods 1
__init__
Initialize debug tool.
__init__
def __init__(self, site: Site | None = None, cache: BuildCache | None = None, root_path: Path | None = None)
Initialize debug tool.
Parameters 3
site |
Site | None |
Optional Site instance for analysis |
cache |
BuildCache | None |
Optional BuildCache for cache inspection |
root_path |
Path | None |
Root path of the project (defaults to cwd) |
DebugRegistry
Registry for debug tools.
Enables tool discovery and provides CLI integration point.
Usage:
>…
DebugRegistry
Registry for debug tools.
Enables tool discovery and provides CLI integration point.
Usage:
>>> registry = DebugRegistry()
>>> registry.register(IncrementalBuildDebugger)
>>> tool = registry.get("incremental")
Attributes
| Name | Type | Description |
|---|---|---|
_tools |
dict[str, type[DebugTool]] |
Methods 4
register
classmethod
Register a debug tool class.
Can be used as a decorator:
@DebugRegistry.r…
register
classmethod def register(cls, tool_class: type[DebugTool]) -> type[DebugTool]
Register a debug tool class.
Can be used as a decorator:
@DebugRegistry.register
class MyTool(DebugTool):
name = "my-tool"
...
Parameters 1
tool_class |
type[DebugTool] |
The tool class to register |
Returns
The tool class (for decorator usage)type[DebugTool]
—
get
classmethod
Get a tool class by name.
get
classmethod def get(cls, name: str) -> type[DebugTool] | None
Get a tool class by name.
Parameters 1
name |
str |
Returns
type[DebugTool] | None
list_tools
classmethod
List all registered tools with descriptions.
list_tools
classmethod def list_tools(cls) -> list[tuple[str, str]]
List all registered tools with descriptions.
Returns
list[tuple[str, str]]
create
classmethod
Create a tool instance by name.
create
classmethod def create(cls, name: str, site: Site | None = None, cache: BuildCache | None = None, **kwargs: Any) -> DebugTool | None
Create a tool instance by name.
Parameters 3
name |
str |
Tool name |
site |
Site | None |
Optional Site instance |
cache |
BuildCache | None |
Optional BuildCache instance **kwargs: Additional arguments passed to tool |
Returns
Tool instance or None if not foundDebugTool | None
—