mirror of
https://github.com/shareAI-lab/analysis_claude_code.git
synced 2026-05-07 00:36:18 +08:00
Merge pull request #140 from 1thanMoon/fix/s05-frontmatter-multiline-yaml
fix: skill description not fully loaded from SKILL.md frontmatter
This commit is contained in:
@@ -38,6 +38,7 @@ Key insight: "Don't put everything in the system prompt. Load on demand."
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import yaml
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from anthropic import Anthropic
|
from anthropic import Anthropic
|
||||||
@@ -75,11 +76,10 @@ class SkillLoader:
|
|||||||
match = re.match(r"^---\n(.*?)\n---\n(.*)", text, re.DOTALL)
|
match = re.match(r"^---\n(.*?)\n---\n(.*)", text, re.DOTALL)
|
||||||
if not match:
|
if not match:
|
||||||
return {}, text
|
return {}, text
|
||||||
meta = {}
|
try:
|
||||||
for line in match.group(1).strip().splitlines():
|
meta = yaml.safe_load(match.group(1)) or {}
|
||||||
if ":" in line:
|
except yaml.YAMLError:
|
||||||
key, val = line.split(":", 1)
|
meta = {}
|
||||||
meta[key.strip()] = val.strip()
|
|
||||||
return meta, match.group(2).strip()
|
return meta, match.group(2).strip()
|
||||||
|
|
||||||
def get_descriptions(self) -> str:
|
def get_descriptions(self) -> str:
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
anthropic>=0.25.0
|
anthropic>=0.25.0
|
||||||
python-dotenv>=1.0.0
|
python-dotenv>=1.0.0
|
||||||
|
pyyaml>=6.0
|
||||||
Reference in New Issue
Block a user