"""Audit current state of 21 target sites."""
import json
import subprocess

result = subprocess.run(
    ["uv", "run", "python", "scripts/audit_exception_handling.py", "--src", "src", "--verbose", "--json"],
    capture_output=True, text=True,
)
data = json.loads(result.stdout)

target_files = [
    "warmup", "startup_profiler", "project_manager", "orchestrator_pm",
    "file_cache", "api_hooks", "log_registry", "models", "multi_agent_conductor", "theme_2",
]
for f in data["files"]:
    fname = f["filename"].replace("\\", "/").split("/")[-1].replace(".py", "")
    if fname in target_files:
        print(f"=== {fname} ===")
        for finding in f["findings"]:
            if finding["kind"] == "EXCEPT":
                print(f"  L{finding['line']} {finding['context']} = {finding['category']}")