fix(skills): publish fetchable metadata for official skills
This commit is contained in:
parent
54f32af4a7
commit
55d92516c8
2 changed files with 26 additions and 2 deletions
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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 [],
|
||||
))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue