muse-agent-example/tests/architecture/test_skills_index.py
zizi 091b66a9bb 重构: 收敛 Agent/Skill 运行时与创作质量闭环
将角色与 Skill 从 .claude 迁入 .agent,移除 Claude CLI 运行时并接入固定 Opus 角色 profile、完整 schema、预算 deadline、raw 与回执证据链。

同步拆分 Skill 职责、复利 lesson、Gate 回放、Dashboard 人审入口、数据库登记和机械门禁;候选设计正文不包含在本提交中。
2026-08-22 02:12:32 +08:00

43 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""门禁:`.agent/skills/_index.md` 必须与磁盘 skills、frontmatter、skills.json 一致。
总索引是生成物(`harness/skills_index.py`):skill_name / skill_file 来自磁盘与
`harness/manifests/skills.json`,skill_description 来自 SKILL.md frontmatter(SoT)。
skill 增删改名漏同步、手改索引造成的漂移都会被本测试拒绝;修复方式是
`.venv/bin/python harness/skills_index.py --write`。
"""
from __future__ import annotations
import pathlib
import subprocess
import sys
import unittest
ROOT = pathlib.Path(__file__).resolve().parents[2]
class SkillsIndexConsistencyTest(unittest.TestCase):
def test_index_matches_disk_and_manifest(self) -> None:
result = subprocess.run(
[
sys.executable,
str(ROOT / "harness" / "skills_index.py"),
"--root",
str(ROOT),
"--check",
],
capture_output=True,
text=True,
)
self.assertEqual(
result.returncode,
0,
"Skill 总索引与事实漂移,请运行 harness/skills_index.py --write 重新生成:\n"
+ result.stdout
+ result.stderr,
)
if __name__ == "__main__":
unittest.main()