mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-09 07:09:11 +02:00
parent
f038cf3be7
commit
16a09f0151
2 changed files with 22 additions and 0 deletions
|
|
@ -39,6 +39,8 @@ def parse_frontmatter(content: str) -> tuple[dict[str, Any], str]:
|
|||
Returns:
|
||||
Tuple of (frontmatter dict, remaining content)
|
||||
"""
|
||||
content = content.removeprefix("\ufeff")
|
||||
|
||||
if not content.startswith("---"):
|
||||
return {}, content
|
||||
|
||||
|
|
|
|||
|
|
@ -92,6 +92,26 @@ This is my skill content.
|
|||
assert provider.skill_info.description == "A test skill"
|
||||
assert len(provider.skill_info.files) == 3
|
||||
|
||||
def test_loads_frontmatter_from_utf8_bom_skill(self, tmp_path: Path):
|
||||
skill_dir = tmp_path / "bom-skill"
|
||||
skill_dir.mkdir()
|
||||
(skill_dir / "SKILL.md").write_text(
|
||||
"\ufeff---\n"
|
||||
"name: bom-skill\n"
|
||||
"description: Skill saved with a UTF-8 BOM\n"
|
||||
"---\n"
|
||||
"# BOM Skill\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
provider = SkillProvider(skill_path=skill_dir)
|
||||
|
||||
assert provider.skill_info.description == "Skill saved with a UTF-8 BOM"
|
||||
assert provider.skill_info.frontmatter == {
|
||||
"name": "bom-skill",
|
||||
"description": "Skill saved with a UTF-8 BOM",
|
||||
}
|
||||
|
||||
def test_raises_if_directory_missing(self, tmp_path: Path):
|
||||
with pytest.raises(FileNotFoundError, match="Skill directory not found"):
|
||||
SkillProvider(skill_path=tmp_path / "nonexistent")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue