from __future__ import annotations import unittest from pathlib import Path REPO_ROOT = Path(__file__).resolve().parents[1] class AckSkillContentTests(unittest.TestCase): def test_ack_skill_owns_resources_without_modifying_agent_instructions(self) -> None: content = (REPO_ROOT / "skills" / "ack" / "SKILL.md").read_text(encoding="utf-8") for expected in ( "skiff init ack --project ", "docs/ack/project.md", "docs/ack/tasks.yaml", "docs/ack/knowledge.yaml", "docs/ack/delivery.yaml", "tasks: []", "validate_tasks.py", "validate_knowledge.py", "validate_delivery.py", "select_tasks.py", "select_knowledge.py", "references/kickoff.md", "不要修改项目的 `AGENTS.md`", "当前会话担任 Coordinator", ): self.assertIn(expected, content) def test_ack_skill_is_explicit_only(self) -> None: metadata = (REPO_ROOT / "skills" / "ack" / "agents" / "openai.yaml").read_text( encoding="utf-8" ) self.assertIn('display_name: "ACK"', metadata) self.assertIn("allow_implicit_invocation: false", metadata) def test_model_routing_is_fingerprint_bound_and_does_not_trust_receipt_reuse(self) -> None: content = ( REPO_ROOT / "skills" / "ack" / "references" / "model-routing.md" ).read_text(encoding="utf-8") self.assertIn("--expected-launch-fingerprint", content) self.assertIn("allowlist-v1", content) self.assertIn("禁止根据持久化 receipt 自动复用", content) self.assertIn("launcher 身份证明", content) def test_ack_knowledge_resources_and_version_are_present(self) -> None: ack_dir = REPO_ROOT / "skills" / "ack" for relative_path in ( "templates/knowledge.template.yaml", "templates/knowledge.schema.json", "examples/knowledge.example.yaml", "scripts/validate_knowledge.py", "scripts/select_tasks.py", "scripts/select_knowledge.py", "scripts/run_verification.py", "scripts/worker_profiles.py", "scripts/launch_worker.py", "templates/delivery.template.yaml", "templates/delivery.schema.json", "examples/delivery.example.yaml", "references/delivery.md", ): self.assertTrue((ack_dir / relative_path).is_file(), relative_path) version = (ack_dir / "VERSION").read_text(encoding="utf-8").strip() self.assertEqual(version, "0.13.0") self.assertIn( f'ackVersion: "{version}"', (ack_dir / "examples" / "tasks.example.yaml").read_text(encoding="utf-8"), ) self.assertIn( f"ack v{version}", (ack_dir / "examples" / "project.example.md").read_text(encoding="utf-8"), ) self.assertIn( 'ackVersion: "<接入时的 ack skill 版本>"', (ack_dir / "templates" / "tasks.template.yaml").read_text( encoding="utf-8" ), ) self.assertTrue((ack_dir / "references" / "feishu-bug-intake.md").is_file()) if __name__ == "__main__": unittest.main()