2.4: Strip frontmatter in press_release.py _load_skill()
The _load_skill() function now strips YAML frontmatter (--- ... ---) before returning skill content. This prevents the execution brain from receiving metadata intended for the skill registry. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>cora-start
parent
5311731855
commit
724ccfebd6
|
|
@ -49,11 +49,19 @@ def _set_status(ctx: dict | None, message: str) -> None:
|
||||||
|
|
||||||
|
|
||||||
def _load_skill(filename: str) -> str:
|
def _load_skill(filename: str) -> str:
|
||||||
"""Read a markdown skill file from the skills/ directory."""
|
"""Read a markdown skill file from the skills/ directory, stripping frontmatter."""
|
||||||
path = _SKILLS_DIR / filename
|
path = _SKILLS_DIR / filename
|
||||||
if not path.exists():
|
if not path.exists():
|
||||||
raise FileNotFoundError(f"Skill file not found: {path}")
|
raise FileNotFoundError(f"Skill file not found: {path}")
|
||||||
return path.read_text(encoding="utf-8")
|
text = path.read_text(encoding="utf-8")
|
||||||
|
|
||||||
|
# Strip YAML frontmatter (--- ... ---) if present
|
||||||
|
if text.startswith("---"):
|
||||||
|
end = text.find("---", 3)
|
||||||
|
if end != -1:
|
||||||
|
text = text[end + 3 :].strip()
|
||||||
|
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
def _load_file_if_exists(path: Path) -> str:
|
def _load_file_if_exists(path: Path) -> str:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue