ALZ-F01 Discovery sub-agent pattern: report phase and fetch in code

Orchestrator report phase (ADR 0013) and fetching in code (ADR 0014), with the report renderer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-05 22:13:25 +00:00
parent e22d037ab0
commit 8bb62a4a42
33 changed files with 1449 additions and 128 deletions

View File

@@ -0,0 +1,31 @@
#!/usr/bin/env python3
"""Write the clean Discovery report for an approved run, from the report step's output.
Usage: render_discovery_report.py <step output.json> <report.md> [notice] also writes <report>.html; refuses to overwrite
"""
import importlib.util
import json
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
spec = importlib.util.spec_from_file_location("report", ROOT / "cp1-alz-discovery-orchestrator-agent/app/report.py")
report = importlib.util.module_from_spec(spec)
spec.loader.exec_module(report)
def main() -> int:
source, target = Path(sys.argv[1]), Path(sys.argv[2])
page = target.with_suffix(".html")
if target.exists() or page.exists():
raise SystemExit(f"{target} or {page} exists; reports are never overwritten")
notice = sys.argv[3] if len(sys.argv) > 3 else None
data = json.loads(source.read_text())["report_data"]
target.write_text(report.render(data, notice))
page.write_text(report.render_html(data, notice))
print(f"wrote {target} and {page}")
return 0
if __name__ == "__main__":
sys.exit(main())