#!/usr/bin/env python3
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
SKILL = ROOT / "skills" / "gpt-orchestrator" / "SKILL.md"

assert SKILL.is_file(), f"missing global skill source: {SKILL}"
text = SKILL.read_text(encoding="utf-8")

required = (
    "name: gpt-orchestrator",
    "description: use when",
    "audience: ai coding agents first.",
    "ask-gpt --effort pro",
    "55–75 seconds",
    "never redispatch",
    "--resume",
    "--download-attachments",
    "real downloadable zip",
    "prose is not artifact evidence",
    "isolated worktree",
    "sequentially",
    "durable ledger",
    "current receipt",
    "correction_required",
    "done",
    "conversation title contract",
    "validate every new/resumed prompt before send",
    "validation failure must block send",
    "record exact validated line 1",
    "create <theme-name> wordpress theme",
    "line 1 must not begin attachment-reading instructions",
    "line 1 must not mention `task.md` or `prompt.md`",
    "line 2 onward must contain attachment-reading",
    "do not — reject before send",
    "read attached context/task.md",
)
normalized = text.lower()
missing = [item for item in required if item not in normalized]
assert not missing, f"missing required skill contracts: {missing}"

assert "inline source dump" in text
assert "shared/default checkout" in text
assert "secret" in text.lower()
assert "archive" in text.lower()
assert "deploy" in text.lower()
assert len(text.splitlines()) < 500, "SKILL.md exceeds progressive-disclosure limit"
assert "--mode" not in text, "skill must not expose legacy UI selection"
assert "--visible" not in text, "skill must not expose human-only UI selection"

print("gpt-orchestrator skill contract: PASS")
