23 lines
1.1 KiB
Python
23 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
from pathlib import Path
|
|
import re
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
skill = ROOT / "SKILL.md"
|
|
text = skill.read_text(encoding="utf-8")
|
|
assert text.startswith("---\n"), "frontmatter must start at byte zero"
|
|
match = re.match(r"---\n(.*?)\n---\n(.+)", text, re.S)
|
|
assert match, "invalid frontmatter/body framing"
|
|
frontmatter, body = match.groups()
|
|
assert re.search(r"^name:\s*vssa-clients\s*$", frontmatter, re.M), "wrong skill name"
|
|
description = re.search(r'^description:\s*["\']?(.*?)["\']?\s*$', frontmatter, re.M)
|
|
assert description and 0 < len(description.group(1)) <= 1024, "invalid description"
|
|
assert len(text) <= 100_000, "SKILL.md exceeds Hermes limit"
|
|
assert body.strip(), "skill body is empty"
|
|
links = re.findall(r"\[[^]]+\]\((references/[^)]+)\)", text)
|
|
assert links, "no linked references"
|
|
unique_links = sorted(set(links))
|
|
missing = [link for link in unique_links if not (ROOT / link).is_file()]
|
|
assert not missing, f"missing linked references: {missing}"
|
|
print(f"OK skill=vssa-clients chars={len(text)} references={len(unique_links)}")
|