18 lines
809 B
Python
18 lines
809 B
Python
"""Read only the explicitly required workflow reference for canonical impl skills."""
|
|
from pathlib import Path
|
|
|
|
NAMES = {"gitea-issue-implementation", "gitea-issue-rework"}
|
|
REQUIRED = "Required reference: [workflow](references/workflow.md)"
|
|
|
|
def read_contract(path):
|
|
path = Path(path)
|
|
text = path.read_text(encoding="utf-8")
|
|
if path.name == "SKILL.md" and path.parent.name in NAMES:
|
|
if REQUIRED not in text:
|
|
raise AssertionError("impl skill does not require its canonical workflow reference")
|
|
reference = path.parent / "references/workflow.md"
|
|
if reference.is_symlink() or not reference.is_file():
|
|
raise AssertionError("canonical workflow reference missing or symlinked")
|
|
text += "\n" + reference.read_text(encoding="utf-8")
|
|
return text
|