Skip to content

Commit 3b68272

Browse files
authored
Merge pull request #140 from 1thanMoon/fix/s05-frontmatter-multiline-yaml
fix: skill description not fully loaded from SKILL.md frontmatter
2 parents 7eca7bc + 93ccf2a commit 3b68272

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

agents/s05_skill_loading.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import os
3939
import re
4040
import subprocess
41+
import yaml
4142
from pathlib import Path
4243

4344
from anthropic import Anthropic
@@ -75,11 +76,10 @@ def _parse_frontmatter(self, text: str) -> tuple:
7576
match = re.match(r"^---\n(.*?)\n---\n(.*)", text, re.DOTALL)
7677
if not match:
7778
return {}, text
78-
meta = {}
79-
for line in match.group(1).strip().splitlines():
80-
if ":" in line:
81-
key, val = line.split(":", 1)
82-
meta[key.strip()] = val.strip()
79+
try:
80+
meta = yaml.safe_load(match.group(1)) or {}
81+
except yaml.YAMLError:
82+
meta = {}
8383
return meta, match.group(2).strip()
8484

8585
def get_descriptions(self) -> str:

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
anthropic>=0.25.0
22
python-dotenv>=1.0.0
3+
pyyaml>=6.0

0 commit comments

Comments
 (0)