Files
kdletters 9476ff7648
Project CI / Frontend tests (push) Successful in 4m5s
Project CI / Repository checks (push) Successful in 4m23s
Project CI / Backend tests (push) Successful in 5m1s
Project CI / Native shell tests (push) Failing after 10m54s
迁移仓库工具资源到 Codex 并固化执行边界
将 .hermes 工具资源迁移至 .codex

同步代码、文档与 RAG 路径引用

补充任务范围、验收与时间盒执行规则
2026-08-27 13:55:25 +08:00

39 lines
1.2 KiB
Python

"""Metadata bridge for the bundled Codex Game Studio project plugin.
The manifest and bundled ``SKILL.md`` files are the source of truth. This
module only exposes their descriptions to a compatible plugin host and keeps
the project resource bundle free of runtime-specific behavior.
"""
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),
)