Skip to content

Commit ed13813

Browse files
committed
fix(tests): exclude YAML frontmatter source metadata from path rewrite check
The codex and kimi SKILL.md files have 'source: templates/commands/...' in their YAML frontmatter — this is provenance metadata, not a runtime path that needs rewriting. Strip frontmatter before checking for bare scripts/ and templates/ paths.
1 parent 9d32234 commit ed13813

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

tests/test_core_pack_scaffold.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,19 +382,31 @@ def test_argument_token_format(agent, scaffolded_sh):
382382

383383
@pytest.mark.parametrize("agent", _TESTABLE_AGENTS)
384384
def test_path_rewrites_applied(agent, scaffolded_sh):
385-
"""Bare scripts/ and templates/ paths must be rewritten to .specify/ variants."""
385+
"""Bare scripts/ and templates/ paths must be rewritten to .specify/ variants.
386+
387+
YAML frontmatter 'source:' metadata fields are excluded — they reference
388+
the original template path for provenance, not a runtime path.
389+
"""
386390
project = scaffolded_sh(agent)
387391

388392
cmd_dir = _expected_cmd_dir(project, agent)
389393
for f in cmd_dir.rglob("*"):
390394
if not f.is_file():
391395
continue
392396
content = f.read_text(encoding="utf-8")
397+
398+
# Strip YAML frontmatter before checking — source: metadata is not a runtime path
399+
body = content
400+
if content.startswith("---"):
401+
parts = content.split("---", 2)
402+
if len(parts) >= 3:
403+
body = parts[2]
404+
393405
# Should not contain bare (non-.specify/) script paths
394-
assert not re.search(r'(?<!\.specify/)scripts/', content), (
406+
assert not re.search(r'(?<!\.specify/)scripts/', body), (
395407
f"Bare scripts/ path found in '{f.relative_to(project)}' for agent '{agent}'"
396408
)
397-
assert not re.search(r'(?<!\.specify/)templates/', content), (
409+
assert not re.search(r'(?<!\.specify/)templates/', body), (
398410
f"Bare templates/ path found in '{f.relative_to(project)}' for agent '{agent}'"
399411
)
400412

0 commit comments

Comments
 (0)