feat(mma): Integrate AST skeleton extraction into Tier 3 context build
This commit is contained in:
13
aggregate.py
13
aggregate.py
@@ -17,6 +17,7 @@ import glob
|
||||
from pathlib import Path, PureWindowsPath
|
||||
import summarize
|
||||
import project_manager
|
||||
from file_cache import ASTParser
|
||||
|
||||
def find_next_increment(output_dir: Path, namespace: str) -> int:
|
||||
pattern = re.compile(rf"^{re.escape(namespace)}_(\d+)\.md$")
|
||||
@@ -255,7 +256,17 @@ def build_tier3_context(file_items: list[dict], screenshot_base_dir: Path, scree
|
||||
sections.append("### `" + (entry or path_str) + "`\n\n" +
|
||||
f"```{path.suffix.lstrip('.') if path and path.suffix else 'text'}\n{item.get('content', '')}\n```")
|
||||
else:
|
||||
sections.append(summarize.summarise_file(path, item.get("content", "")))
|
||||
content = item.get("content", "")
|
||||
if path and path.suffix == ".py" and not item.get("error"):
|
||||
try:
|
||||
parser = ASTParser("python")
|
||||
skeleton = parser.get_skeleton(content)
|
||||
sections.append(f"### `{entry or path_str}` (AST Skeleton)\n\n```python\n{skeleton}\n```")
|
||||
except Exception as e:
|
||||
# Fallback to summary if AST parsing fails
|
||||
sections.append(summarize.summarise_file(path, content))
|
||||
else:
|
||||
sections.append(summarize.summarise_file(path, content))
|
||||
|
||||
parts.append("## Files (Tier 3 - Focused)\n\n" + "\n\n---\n\n".join(sections))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user