Bases: AXMTool
Analyze documentation impact for symbols.
Registered as ast_doc_impact via axm.tools entry point.
Caveat — the matching is purely lexical, never semantic: a symbol counts
as mentioned when its bare name appears between backticks or in a
Markdown heading, and a bare name-drop anywhere in the prose is enough
to clear it from undocumented. Read the output as a list of
pages to read, not a proof that the documentation is correct or up
to date.
Source code in packages/axm-ast/src/axm_ast/tools/doc_impact.py
| Python |
|---|
| class DocImpactTool(AXMTool):
"""Analyze documentation impact for symbols.
Registered as ``ast_doc_impact`` via axm.tools entry point.
Caveat — the matching is purely lexical, never semantic: a symbol counts
as mentioned when its bare name appears between backticks or in a
Markdown heading, and a bare name-drop anywhere in the prose is enough
to clear it from ``undocumented``. Read the output as a list of
pages to read, not a proof that the documentation is correct or up
to date.
"""
@property
def name(self) -> str:
"""Return tool name for registry lookup."""
return "ast_doc_impact"
@safe_execute
def execute(
self,
*,
path: str = ".",
symbols: list[str] | None = None,
**kwargs: object,
) -> ToolResult:
"""Analyze doc impact for symbols.
Caveat — the matching is purely lexical, never semantic: a symbol
counts as mentioned when its bare name appears between backticks or
in a Markdown heading, and a bare name-drop anywhere in the prose is
enough to clear it from ``undocumented``. Read the output as a list
of pages to read, not a proof that the documentation is correct or
up to date.
Args:
path: Project root directory.
symbols: Symbol names to analyze.
**kwargs: Reserved for future use.
Returns:
ToolResult with doc impact data.
"""
if not symbols:
return ToolResult(success=False, error="symbols parameter is required")
project_path = Path(path).resolve()
if not project_path.is_dir():
return ToolResult(success=False, error=f"Not a directory: {project_path}")
from axm_ast.core.doc_impact import analyze_doc_impact
try:
result: DocImpactResult = analyze_doc_impact(project_path, symbols)
except Exception as exc: # noqa: BLE001
return ToolResult(success=False, error=str(exc))
from axm_ast.tools.doc_impact_text import (
DocImpactResult as DocImpactTextResult,
)
from axm_ast.tools.doc_impact_text import render_doc_impact_text
text = (
render_doc_impact_text(cast("DocImpactTextResult", result))
if isinstance(result, dict)
else None
)
return ToolResult(
success=True,
data=cast("dict[str, object]", result),
text=text,
)
|
Return tool name for registry lookup.
Analyze doc impact for symbols.
Caveat — the matching is purely lexical, never semantic: a symbol
counts as mentioned when its bare name appears between backticks or
in a Markdown heading, and a bare name-drop anywhere in the prose is
enough to clear it from undocumented. Read the output as a list
of pages to read, not a proof that the documentation is correct or
up to date.
Parameters:
| Name |
Type |
Description |
Default |
path
|
str
|
|
'.'
|
symbols
|
list[str] | None
|
|
None
|
**kwargs
|
object
|
|
{}
|
Returns:
| Type |
Description |
ToolResult
|
ToolResult with doc impact data.
|
Source code in packages/axm-ast/src/axm_ast/tools/doc_impact.py
| Python |
|---|
| @safe_execute
def execute(
self,
*,
path: str = ".",
symbols: list[str] | None = None,
**kwargs: object,
) -> ToolResult:
"""Analyze doc impact for symbols.
Caveat — the matching is purely lexical, never semantic: a symbol
counts as mentioned when its bare name appears between backticks or
in a Markdown heading, and a bare name-drop anywhere in the prose is
enough to clear it from ``undocumented``. Read the output as a list
of pages to read, not a proof that the documentation is correct or
up to date.
Args:
path: Project root directory.
symbols: Symbol names to analyze.
**kwargs: Reserved for future use.
Returns:
ToolResult with doc impact data.
"""
if not symbols:
return ToolResult(success=False, error="symbols parameter is required")
project_path = Path(path).resolve()
if not project_path.is_dir():
return ToolResult(success=False, error=f"Not a directory: {project_path}")
from axm_ast.core.doc_impact import analyze_doc_impact
try:
result: DocImpactResult = analyze_doc_impact(project_path, symbols)
except Exception as exc: # noqa: BLE001
return ToolResult(success=False, error=str(exc))
from axm_ast.tools.doc_impact_text import (
DocImpactResult as DocImpactTextResult,
)
from axm_ast.tools.doc_impact_text import render_doc_impact_text
text = (
render_doc_impact_text(cast("DocImpactTextResult", result))
if isinstance(result, dict)
else None
)
return ToolResult(
success=True,
data=cast("dict[str, object]", result),
text=text,
)
|