Files
FreeCADWasmDev/tools/generate_geometry_runtime_index.py
wangdequan 9a7c4f0335 Save FreeCAD Web workspace sources and user validation evidence
IFC native binding remains incomplete; preserve accurate test results.
2026-09-15 22:01:58 +08:00

18 lines
1.3 KiB
Python

#!/usr/bin/env python3
"""Generate geometry-recompute runtime records from the object matrix."""
from __future__ import annotations
import hashlib
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
source_path = ROOT / "docs/p6/object-contract-matrix.json"
rows = json.loads(source_path.read_text(encoding="utf-8"))["records"]
selected = [row for row in rows if row["adapterFamily"] == "geometry-recompute"]
output = {"schema": "freecad-web-geometry-runtime-index/v1", "source": {"matrix": "docs/p6/object-contract-matrix.json", "matrixSha256": hashlib.sha256(source_path.read_bytes()).hexdigest()}, "count": len(selected), "records": [{"id": row["id"], "module": row["module"], "objectType": row["name"], "status": row["status"], "capabilities": row["capabilities"]} for row in selected], "boundaries": ["route readiness is separated from geometry gate status", "blocked/planned records remain explicit until native fixture evidence exists"]}
out = ROOT / "web/public/api/geometry-runtime-index.json"
out.parent.mkdir(parents=True, exist_ok=True)
out.write_text(json.dumps(output, ensure_ascii=False, separators=(",", ":")) + "\n", encoding="utf-8")
print(json.dumps({"output": str(out.relative_to(ROOT)), "count": len(selected), "bytes": out.stat().st_size, "sha256": hashlib.sha256(out.read_bytes()).hexdigest()}, ensure_ascii=False))