docs
This commit is contained in:
@@ -1,6 +1,39 @@
|
||||
"""
|
||||
Outline Tool - Hierarchical code outline extraction via stdlib ast.
|
||||
|
||||
This module provides the CodeOutliner class for generating a hierarchical
|
||||
outline of Python source code, showing classes, methods, and functions
|
||||
with their line ranges and docstrings.
|
||||
|
||||
Key Features:
|
||||
- Uses Python's built-in ast module (no external dependencies)
|
||||
- Extracts class and function definitions with line ranges
|
||||
- Includes first line of docstrings for each definition
|
||||
- Distinguishes between methods and top-level functions
|
||||
|
||||
Usage:
|
||||
outliner = CodeOutliner()
|
||||
outline = outliner.outline(python_code)
|
||||
|
||||
Output Format:
|
||||
[Class] ClassName (Lines 10-50)
|
||||
"""First line of class docstring"""
|
||||
[Method] __init__ (Lines 11-20)
|
||||
[Method] process (Lines 22-35)
|
||||
[Func] top_level_function (Lines 55-70)
|
||||
|
||||
Integration:
|
||||
- Used by mcp_client.py for py_get_code_outline tool
|
||||
- Used by simulation tests for code structure verification
|
||||
|
||||
See Also:
|
||||
- src/file_cache.py for ASTParser (tree-sitter based)
|
||||
- src/summarize.py for heuristic file summaries
|
||||
"""
|
||||
import ast
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class CodeOutliner:
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user