#!/usr/bin/env python3 """Mechanically validate a migrated Lightning Out 2.0 host page. The six non-negotiable LO 2.0 rules (Workflow B, Step B4) plus the core library/component checklist items are all *deterministic code-structure* checks. This script runs them against a migrated HTML host page so the workflow gates on a repeatable pass/fail instead of prose interpretation. Usage: python3 scripts/validate-lo20-page.py Prints one PASS/FAIL line per rule. Exits 0 only when every rule passes; exits 1 if any rule fails, 2 on a usage/IO error. """ import re import sys def check(src: str): """Return a list of (ok: bool, label: str, detail: str).""" results = [] def add(ok, label, detail=""): results.append((ok, label, detail)) # --- Library / Beta removal ------------------------------------------- # Locate the versioned library path, then scan back to the opening #