196df53a9b
- SPEC.md sectionized with stable ids (sectionize-markdown conventions) - src/phronesis: cli, registry, harnesses (modular, vibe first), state, formatting, completions; argcomplete completion; exit codes per SPEC - phronesis -> version line + skill table (name, version, category, description wrapped below, daedalus-style) - phronesis <category> -> filtered table; close-match typos for skills+categories - phronesis <skill> --install | --project [--harness <name>] [-f] installs whole skill dir; prompt when present; EOF/default = skip; -f no prompt - phronesis --update -> refresh every state entry; warns unbundled; reinstalls missing - state: <config>/phronesis/installed.json, unique by (name, harness, scope) - skill/python-tdd bumped 1.2.0 with category: development - test/ (56 tests, 92% cov) + autotest pytest check with 75% floor; all 7 autotest checks green Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
"""Registry tests: front matter contract and the bundled SKILLS scan (SPEC section 4)."""
|
|
import pytest
|
|
|
|
from phronesis import registry
|
|
|
|
GOOD = """---
|
|
name: python-tdd
|
|
version: 1.2.0
|
|
description: Minimalist TDD architect for Python work
|
|
category: development
|
|
---
|
|
"""
|
|
BAD_VERSION = GOOD.replace("1.2.0", "1.2")
|
|
BAD_CATEGORY = GOOD.replace("development", "Development")
|
|
|
|
|
|
def test_parse_frontmatter_reads_every_key():
|
|
data = registry.parse_frontmatter(GOOD)
|
|
assert data["name"] == "python-tdd"
|
|
assert data["version"] == "1.2.0"
|
|
assert data["category"] == "development"
|
|
|
|
|
|
@pytest.mark.parametrize("text", [
|
|
"no front matter at all",
|
|
GOOD.replace("---\n", "", 1),
|
|
"---\nname: x\nversion: 1.0.0\n",
|
|
BAD_VERSION,
|
|
BAD_CATEGORY,
|
|
])
|
|
def test_parse_frontmatter_rejects_malformed(text):
|
|
with pytest.raises(registry.RegistryError):
|
|
registry.parse_frontmatter(text)
|
|
|
|
|
|
def test_skills_loads_the_bundled_python_tdd():
|
|
assert "python-tdd" in registry.SKILLS
|
|
skill = registry.SKILLS["python-tdd"]
|
|
assert skill.version == "1.2.0"
|
|
assert skill.category == "development"
|
|
assert skill.description
|
|
assert (skill.source_dir / "SKILL.md").is_file()
|
|
|
|
|
|
def test_categories_list_the_packed_skills():
|
|
assert "python-tdd" in registry.CATEGORIES[registry.SKILLS["python-tdd"].category]
|
|
|
|
|
|
def test_skills_in_category_filters_by_label():
|
|
assert registry.skills_in_category("development") == {"python-tdd": registry.SKILLS["python-tdd"]}
|
|
assert registry.skills_in_category("nonesuch") == {}
|