141 lines
4.9 KiB
Python
Executable File
141 lines
4.9 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Validate Svrnty Vision child workspace governance shell."""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.dont_write_bytecode = True
|
|
|
|
GENERATED_ARTIFACT_DIRS = [
|
|
"src/svrnty_vision/__pycache__",
|
|
"tools/__pycache__",
|
|
".pytest_cache",
|
|
]
|
|
REQUIRED = [
|
|
"AGENTS.md",
|
|
"INDEX.md",
|
|
"README.md",
|
|
"WORKBOARD.yaml",
|
|
"CONTEXT.md",
|
|
"docs/VISION-PACKAGE-CANDIDATE.md",
|
|
"docs/VISUAL-EVIDENCE-CONTRACT.md",
|
|
"docs/VISION-HOST-ADAPTER-CANDIDATES.md",
|
|
"candidate-manifests/vision-package-candidate.json",
|
|
"candidate-manifests/vision-tool-grants.json",
|
|
"candidate-manifests/visual-evidence-contract.json",
|
|
"outputs/2026-06-12-svrnty-vision-workboard-readiness-reconciliation.md",
|
|
"outputs/2026-06-12-svrnty-vision-workboard-readiness-reconciliation.json",
|
|
"Dockerfile",
|
|
".dockerignore",
|
|
"tools/validate_vision_package_docker_context.py",
|
|
]
|
|
VALIDATORS = [
|
|
"tools/validate_vision_package_candidate.py",
|
|
"tools/validate_vision_tool_grants.py",
|
|
"tools/validate_visual_evidence_contract.py",
|
|
"tools/validate_vision_host_adapter_candidates.py",
|
|
"tools/validate_vision_package_docker_context.py",
|
|
]
|
|
|
|
|
|
def main() -> int:
|
|
errors: list[str] = []
|
|
validator_outputs: dict[str, str] = {}
|
|
for rel in REQUIRED:
|
|
if not (ROOT / rel).exists():
|
|
errors.append(f"missing:{rel}")
|
|
checks = {
|
|
"AGENTS.md": [
|
|
"## Universal Cortex OS Agent Contract",
|
|
"## Repo-Custom Agent Contract",
|
|
"Svrnty Vision is a child-local sovereign vision HTTP gateway",
|
|
"Do not start Runtime, start Docker, build or run containers",
|
|
"child-local",
|
|
"not Cortex OS Core authority",
|
|
"python3 tools/validate_svrnty_vision_child.py",
|
|
],
|
|
"README.md": [
|
|
"## Cortex OS Boundary",
|
|
"child-local sovereign vision gateway source",
|
|
"not start Runtime, start Docker",
|
|
"call VLM",
|
|
"call Spark/ComfyUI/vLLM services",
|
|
"write durable Hindsight memory",
|
|
"operator/developer docs, not cleanup-route authorization",
|
|
],
|
|
"INDEX.md": [
|
|
"Route: `svrnty-vision`.",
|
|
"Category: child-local sovereign vision HTTP gateway and Visual Perception Package Candidate workspace.",
|
|
"Svrnty Vision owns child-local VLM, FLUX, palette, and cutout gateway source",
|
|
"Svrnty Vision is not Core authority, Seed installation authority, Runtime startup authority",
|
|
"Stage: CLEAN.",
|
|
"Clean score: 100.",
|
|
"Docker, FastAPI/Uvicorn, endpoint calls",
|
|
],
|
|
"WORKBOARD.yaml": [
|
|
"SVRNTY-VISION-WORK-001",
|
|
"SVRNTY-VISION-WORK-003",
|
|
"SVRNTY-VISION-WORK-005",
|
|
"SVRNTY-VISION-WORK-006",
|
|
"Svrnty Vision Navigation Index",
|
|
"source: INDEX.md",
|
|
"status: complete",
|
|
'owner: ""',
|
|
],
|
|
"CONTEXT.md": ["Visual Perception Package Candidate", "Research Handoff"],
|
|
"docs/VISION-PACKAGE-CANDIDATE.md": ["Research reads sources; Vision sees media", "wildcard grant"],
|
|
"docs/LEGACY-INGEST.md": ["Generated Cache Custody", "svrnty-vision-python-cache-preserved-141800"],
|
|
"outputs/2026-06-12-svrnty-vision-workboard-readiness-reconciliation.md": [
|
|
"No Core promotion",
|
|
"Seed consumption",
|
|
"Runtime start",
|
|
],
|
|
}
|
|
for rel, snippets in checks.items():
|
|
path = ROOT / rel
|
|
if path.exists():
|
|
text = path.read_text(encoding="utf-8")
|
|
for snippet in snippets:
|
|
if snippet not in text:
|
|
errors.append(f"{rel}:missing:{snippet}")
|
|
for rel in VALIDATORS:
|
|
path = ROOT / rel
|
|
if not path.exists():
|
|
errors.append(f"missing:{rel}")
|
|
continue
|
|
env = os.environ.copy()
|
|
env["PYTHONDONTWRITEBYTECODE"] = "1"
|
|
completed = subprocess.run(
|
|
[sys.executable, str(path)],
|
|
cwd=ROOT,
|
|
env=env,
|
|
text=True,
|
|
capture_output=True,
|
|
check=False,
|
|
)
|
|
validator_outputs[rel] = completed.stdout.strip()
|
|
if completed.returncode != 0:
|
|
errors.append(f"validator_failed:{rel}:{completed.stderr.strip()}")
|
|
for rel in GENERATED_ARTIFACT_DIRS:
|
|
if (ROOT / rel).exists():
|
|
errors.append(f"generated_artifact_residue:{rel}")
|
|
result = {
|
|
"ok": not errors,
|
|
"validator": "svrnty-vision-child-v1",
|
|
"checked": REQUIRED + VALIDATORS,
|
|
"errors": errors,
|
|
"warnings": [],
|
|
"validator_outputs": validator_outputs,
|
|
}
|
|
print(json.dumps(result, indent=2, sort_keys=True))
|
|
return 0 if result["ok"] else 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|