Menu
Public repository / 7c2481f3029b7b2f8b01818af3d8e5fa55a3ea0b
AkurAI-Platform / scripts/validate-page.py
Latest change ff9da97d52660e56a2e087564bf233f3dcb2dfee - AKURAI-PLATFORM-3 consolidate page contract by Ólafur Búi Ólafsson
#!/usr/bin/env python3
"""Validate the fields consumed by the static platform template."""
from __future__ import annotations
import json
from pathlib import Path
page = json.loads((Path(__file__).parents[1] / "backend" / "page.json").read_text())
required = {
"title",
"brand",
"year",
"host",
"vm_ip",
"updated",
"summary",
"github",
"proof",
"trust",
"cta",
"methodology",
"sources",
}
missing = sorted(required - page.keys())
if missing:
raise SystemExit(f"missing page fields: {', '.join(missing)}")
for card in ("card1", "card2", "card3", "card4"):
value = page["proof"].get(card)
if not isinstance(value, dict) or not value.get("akur_memory") or not value.get("other_memory") or not value.get("source_url"):
raise SystemExit(f"invalid proof.{card}")
if len(page["trust"]) != 4 or len(page["sources"]) != 3:
raise SystemExit("unexpected trust/source collection size")
print("page contract: ok")