Python 3.8 compatibility, routines.py --mark YAML spacing and comments, OKF --out and Starlight image paths confined to their folders, script counts in AGENTS.md/READMEs/manuals, and the tests/unit/ suite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.4 KiB
Python
36 lines
1.4 KiB
Python
"""AGENTS.md is loaded into every session; what it says about the skills must
|
|
match what ships."""
|
|
import re
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
AGENTS = (ROOT / "AGENTS.md").read_text(encoding="utf-8")
|
|
WORDS = {3: "Three", 4: "Four", 5: "Five", 6: "Six", 7: "Seven", 8: "Eight",
|
|
9: "Nine", 10: "Ten", 11: "Eleven", 12: "Twelve"}
|
|
|
|
|
|
def core_skills():
|
|
return sorted(p.name for p in (ROOT / ".agents/skills").iterdir() if (p / "SKILL.md").is_file())
|
|
|
|
|
|
def skills_with_scripts():
|
|
return sorted(p.name for p in (ROOT / ".agents/skills").iterdir() if list((p / "scripts").glob("*.py")))
|
|
|
|
|
|
class AgentsMd(unittest.TestCase):
|
|
def test_script_sentence_matches_disk(self):
|
|
m = re.search(r"(\w+) skills ship a deterministic Python script \(([^)]*)\)", AGENTS)
|
|
self.assertIsNotNone(m, "the 'N skills ship a deterministic Python script' sentence is missing")
|
|
named = sorted(re.findall(r"`(ckb-[\w-]+)`", m.group(2)))
|
|
self.assertEqual(named, skills_with_scripts())
|
|
self.assertEqual(m.group(1), WORDS.get(len(named)), "count word does not match the list")
|
|
|
|
def test_every_core_skill_is_routed(self):
|
|
routing = AGENTS.split("## 3. SKILL ROUTING", 1)[1].split("### Scripts", 1)[0]
|
|
missing = [s for s in core_skills() if f"`{s}`" not in routing]
|
|
self.assertEqual(missing, [], "skills with no routing-table row")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|