fix(skills): read name from SKILL.md frontmatter in skills_sync

_discover_bundled_skills() used the directory name to identify skills,
but skills_tool.py and skills_hub.py use the `name:` field from SKILL.md
frontmatter.  This mismatch caused 9 builtin skills whose directory name
differs from their SKILL.md name to be written to .bundled_manifest
under the wrong key, so `hermes skills list` showed them as "local"
instead of "builtin".

Read the frontmatter name field (with directory-name fallback) so the
manifest keys match what the rest of the codebase expects.

Closes #6835
This commit is contained in:
konsisumer 2026-04-10 02:04:54 +02:00 committed by Teknium
parent d442f25a2f
commit b87e0f59cc
2 changed files with 54 additions and 1 deletions

View file

@ -6,6 +6,7 @@ from unittest.mock import patch
from tools.skills_sync import (
_get_bundled_dir,
_read_manifest,
_read_skill_name,
_write_manifest,
_discover_bundled_skills,
_compute_relative_dest,
@ -132,6 +133,37 @@ class TestDiscoverBundledSkills:
assert skills == []
class TestReadSkillName:
def test_reads_name_from_frontmatter(self, tmp_path):
skill_md = tmp_path / "SKILL.md"
skill_md.write_text("---\nname: audiocraft-audio-generation\n---\n# Skill")
assert _read_skill_name(skill_md, "audiocraft") == "audiocraft-audio-generation"
def test_falls_back_to_dir_name_without_frontmatter(self, tmp_path):
skill_md = tmp_path / "SKILL.md"
skill_md.write_text("# Just a heading\nNo frontmatter here")
assert _read_skill_name(skill_md, "my-skill") == "my-skill"
def test_falls_back_when_name_field_empty(self, tmp_path):
skill_md = tmp_path / "SKILL.md"
skill_md.write_text("---\nname:\n---\n")
assert _read_skill_name(skill_md, "fallback") == "fallback"
def test_handles_quoted_name(self, tmp_path):
skill_md = tmp_path / "SKILL.md"
skill_md.write_text('---\nname: "serving-llms-vllm"\n---\n')
assert _read_skill_name(skill_md, "vllm") == "serving-llms-vllm"
def test_discover_uses_frontmatter_name(self, tmp_path):
skill_dir = tmp_path / "category" / "audiocraft"
skill_dir.mkdir(parents=True)
(skill_dir / "SKILL.md").write_text(
"---\nname: audiocraft-audio-generation\n---\n# Skill"
)
skills = _discover_bundled_skills(tmp_path)
assert skills[0][0] == "audiocraft-audio-generation"
class TestComputeRelativeDest:
def test_preserves_category_structure(self):
bundled = Path("/repo/skills")