🐛 fix(playbook): address reported repo issues
normalize Windows path-like TOML config values, regenerate .agents/index.md on sync, keep the SKILLS.md superpowers section route-only, and ignore generated Python cache dirs. add regression coverage for load_config() and the standards sync behavior touched by these fixes.
This commit is contained in:
@@ -4,6 +4,7 @@ from pathlib import Path
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SKILLS_MD = ROOT / "SKILLS.md"
|
||||
SOURCES_LIST = ROOT / "codex" / "skills" / ".sources" / "superpowers.list"
|
||||
SOURCE_REF = "来源:`codex/skills/.sources/superpowers.list`(第三方来源清单)。"
|
||||
|
||||
|
||||
def read_sources_list() -> list[str]:
|
||||
@@ -14,28 +15,20 @@ def read_sources_list() -> list[str]:
|
||||
]
|
||||
|
||||
|
||||
def read_skills_md_list() -> list[str]:
|
||||
lines = SKILLS_MD.read_text(encoding="utf-8").splitlines()
|
||||
start = "<!-- superpowers:skills:start -->"
|
||||
end = "<!-- superpowers:skills:end -->"
|
||||
try:
|
||||
start_idx = lines.index(start) + 1
|
||||
end_idx = lines.index(end)
|
||||
except ValueError as exc:
|
||||
raise AssertionError("superpowers markers missing in SKILLS.md") from exc
|
||||
|
||||
items = []
|
||||
for line in lines[start_idx:end_idx]:
|
||||
stripped = line.strip()
|
||||
if not stripped.startswith("-"):
|
||||
continue
|
||||
items.append(stripped.lstrip("- ").strip())
|
||||
return items
|
||||
def read_skills_md() -> str:
|
||||
return SKILLS_MD.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
class SuperpowersListSyncTests(unittest.TestCase):
|
||||
def test_superpowers_list_matches_skills_md(self):
|
||||
self.assertEqual(read_sources_list(), read_skills_md_list())
|
||||
def test_superpowers_section_routes_to_source_list(self):
|
||||
self.assertTrue(read_sources_list())
|
||||
|
||||
text = read_skills_md()
|
||||
|
||||
self.assertIn(SOURCE_REF, text)
|
||||
self.assertEqual(text.count("Third-party Skills (superpowers)"), 1)
|
||||
self.assertNotIn("<!-- superpowers:skills:start -->", text)
|
||||
self.assertNotIn("<!-- superpowers:skills:end -->", text)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user