| 974 | |
| 975 | |
| 976 | def write_outputs(report: Report, cfg: ToolConfig, out_dir: Path) -> tuple[Path, Path]: |
| 977 | out_dir.mkdir(parents=True, exist_ok=True) |
| 978 | json_path = out_dir / f"{OUTPUT_FILENAME}.json" |
| 979 | md_path = out_dir / f"{OUTPUT_FILENAME}.md" |
| 980 | |
| 981 | payload = report.model_dump(mode="json") |
| 982 | |
| 983 | json_path.write_text(json.dumps(payload, indent=2, ensure_ascii=False) + "\n", encoding="utf-8") |
| 984 | md_path.write_text(to_markdown(report, cfg), encoding="utf-8") |
| 985 | return json_path, md_path |
| 986 | |
| 987 | |
| 988 | # ----------------------------- |