from __future__ import annotations import json from pathlib import Path from refactor_master_helpers import ROOT, read_text def main() -> int: report = read_text(ROOT / "Temp" / "operational_report.md") violations = 0 for line in report.splitlines(): if any(tok in line for tok in ("원", "%")) and "[src:" not in line and "|" in line: violations += 1 result = { "formula_id": "NUMBER_PROVENANCE_STRICT_V2", "ungrounded_number_count": violations, "gate": "PASS" if violations == 0 else "FAIL", } out = ROOT / "Temp" / "number_provenance_strict_v2.json" out.write_text(json.dumps(result, ensure_ascii=False, indent=2), encoding="utf-8") print(json.dumps(result, ensure_ascii=True, indent=2)) return 0 if violations == 0 else 1 if __name__ == "__main__": raise SystemExit(main())