25 lines
2.9 KiB
Python
25 lines
2.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Generate grouped implementation plans for all remaining planned APIs."""
|
|
from __future__ import annotations
|
|
import hashlib
|
|
import json
|
|
from collections import defaultdict
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
source_path = ROOT / "docs/p6/python-api-manifest.json"
|
|
rows = json.loads(source_path.read_text(encoding="utf-8"))["records"]
|
|
selected = [row for row in rows if row["disposition"] == "planned"]
|
|
routes = {"Part": ("part.worker.ts", "part.pythonApi"), "PartDesign": ("partdesign-python.worker.ts", "partdesign.pythonApi"), "Sketcher": ("sketcher-python.worker.ts", "sketcher.pythonApi"), "TechDraw": ("techdraw-python.worker.ts", "techdraw.pythonApi"), "Import": ("import.worker.ts", "import.pythonApi"), "Mesh": ("mesh.worker.ts", "mesh.pythonApi"), "Measure": ("measure.worker.ts", "measure.pythonApi"), "OpenSCAD": ("openscad.worker.ts", "openscad.pythonApi"), "Points": ("points.worker.ts", "points.pythonApi"), "Robot": ("robot-python.worker.ts", "robot.pythonApi"), "Surface": ("surface-python.worker.ts", "surface.pythonApi"), "Spreadsheet": ("spreadsheet-python.worker.ts", "spreadsheet.pythonApi"), "Sandbox": ("sandbox-python.worker.ts", "sandbox.pythonApi"), "Material": ("material-python.worker.ts", "material.pythonApi"), "TemplatePyMod": ("templatepymod-python.worker.ts", "templatepymod.pythonApi"), "Plot": ("plot-python.worker.ts", "plot.pythonApi"), "ReverseEngineering": ("reverseengineering-python.worker.ts", "reverseengineering.pythonApi")}
|
|
groups = defaultdict(list)
|
|
for row in selected: groups[f"{row['module']}:{row['tier']}:{row['family']}"].append(row)
|
|
plans = []
|
|
for key, group in sorted(groups.items()):
|
|
module, tier, family = key.split(":", 2)
|
|
worker, command = routes.get(module, (None, None))
|
|
plans.append({"key": key, "module": module, "tier": tier, "family": family, "count": len(group), "route": {"worker": worker, "command": command}, "adapterStatus": "module_adapter_ready_pending_method" if command else "module_adapter_pending", "apiIds": sorted(row["id"] for row in group)})
|
|
output = {"schema": "freecad-web-api-adapter-fill-manifest/v1", "taskId": "FW-P6-FPA-IMPL-API-ADAPTER-FILL", "source": {"manifest": "docs/p6/python-api-manifest.json", "manifestSha256": hashlib.sha256(source_path.read_bytes()).hexdigest()}, "disposition": "planned", "count": len(selected), "groupCount": len(plans), "groups": plans, "boundaries": ["route readiness is not method-level API completion", "module_adapter_pending groups require native facade/probe before implementation"]}
|
|
out = ROOT / "docs/p6/api-adapter-fill-manifest.json"
|
|
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), "groups": len(plans), "bytes": out.stat().st_size, "sha256": hashlib.sha256(out.read_bytes()).hexdigest()}, ensure_ascii=False))
|