From 55d92516c8eac87dd4fecf2c68273e62e893ead0 Mon Sep 17 00:00:00 2001 From: LeonSGP43 Date: Sat, 23 May 2026 00:03:11 +0800 Subject: [PATCH] fix(skills): publish fetchable metadata for official skills --- tests/tools/test_skills_hub.py | 20 ++++++++++++++++++++ tools/skills_hub.py | 8 ++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/tests/tools/test_skills_hub.py b/tests/tools/test_skills_hub.py index 265a12287..987995066 100644 --- a/tests/tools/test_skills_hub.py +++ b/tests/tools/test_skills_hub.py @@ -1816,6 +1816,26 @@ class TestSkillMetaToDict: # --------------------------------------------------------------------------- +class TestOptionalSkillSourceMetadata: + def test_scan_all_emits_repo_root_relative_metadata(self, tmp_path): + optional_root = tmp_path / "optional-skills" + skill_dir = optional_root / "finance" / "3-statement-model" + skill_dir.mkdir(parents=True) + (skill_dir / "SKILL.md").write_text( + "---\nname: 3-statement-model\ndescription: test\n---\n\nBody\n", + encoding="utf-8", + ) + + src = OptionalSkillSource() + src._optional_dir = optional_root + + meta = src.inspect("official/finance/3-statement-model") + + assert meta is not None + assert meta.repo == "NousResearch/hermes-agent" + assert meta.path == "optional-skills/finance/3-statement-model" + + class TestOptionalSkillSourceBinaryAssets: def test_fetch_preserves_binary_assets(self, tmp_path): optional_root = tmp_path / "optional-skills" diff --git a/tools/skills_hub.py b/tools/skills_hub.py index d0ebecd25..0cf6a4550 100644 --- a/tools/skills_hub.py +++ b/tools/skills_hub.py @@ -3052,6 +3052,8 @@ class OptionalSkillSource(SkillSource): (search / install / inspect) and labelled "official" with "builtin" trust. """ + OFFICIAL_REPO = "NousResearch/hermes-agent" + def __init__(self): from hermes_constants import get_optional_skills_dir @@ -3183,7 +3185,7 @@ class OptionalSkillSource(SkillSource): if isinstance(hermes_meta, dict): tags = hermes_meta.get("tags", []) - rel_path = str(parent.relative_to(self._optional_dir)) + rel_path = parent.relative_to(self._optional_dir).as_posix() results.append(SkillMeta( name=name, @@ -3191,7 +3193,9 @@ class OptionalSkillSource(SkillSource): source="official", identifier=f"official/{rel_path}", trust_level="builtin", - path=rel_path, + repo=self.OFFICIAL_REPO, + # The centralized skills index consumes repo-root-relative paths. + path=f"optional-skills/{rel_path}", tags=tags if isinstance(tags, list) else [], ))