chore: share game-studio hermes plugin
This commit is contained in:
38
.hermes/plugins/game-studio/__init__.py
Normal file
38
.hermes/plugins/game-studio/__init__.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""Hermes wrapper for the OpenAI Codex Game Studio plugin.
|
||||
|
||||
This plugin was imported from a Codex curated plugin cache. It exposes the
|
||||
plugin's bundled SKILL.md files as Hermes plugin skills using qualified names
|
||||
like `game-studio:phaser-2d-game`.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def _read_description(skill_md: Path) -> str:
|
||||
try:
|
||||
text = skill_md.read_text(encoding="utf-8")[:4000]
|
||||
except Exception:
|
||||
return ""
|
||||
if text.startswith("---"):
|
||||
end = text.find("\n---", 3)
|
||||
if end != -1:
|
||||
frontmatter = text[3:end]
|
||||
for line in frontmatter.splitlines():
|
||||
if line.strip().startswith("description:"):
|
||||
return line.split(":", 1)[1].strip().strip("\"'")
|
||||
return ""
|
||||
|
||||
|
||||
def register(ctx) -> None:
|
||||
root = Path(__file__).resolve().parent
|
||||
skills_root = root / "skills"
|
||||
if not skills_root.exists():
|
||||
return
|
||||
for skill_md in sorted(skills_root.glob("*/SKILL.md")):
|
||||
ctx.register_skill(
|
||||
name=skill_md.parent.name,
|
||||
path=skill_md,
|
||||
description=_read_description(skill_md),
|
||||
)
|
||||
Reference in New Issue
Block a user