import subprocess import sys import tempfile import unittest from pathlib import Path ROOT = Path(__file__).resolve().parents[1] SCRIPT = ROOT / "scripts" / "playbook.py" def run_cli(*args): return subprocess.run( [sys.executable, str(SCRIPT), *args], capture_output=True, text=True, ) class VendorSnapshotTemplatesTests(unittest.TestCase): def test_vendor_includes_core_templates(self): with tempfile.TemporaryDirectory() as tmp_dir: config_body = f""" [playbook] project_root = "{tmp_dir}" [vendor] langs = ["tsl"] """ config_path = Path(tmp_dir) / "playbook.toml" config_path.write_text(config_body, encoding="utf-8") result = run_cli("-config", str(config_path)) self.assertEqual(result.returncode, 0, msg=result.stderr) snapshot = Path(tmp_dir) / "docs/standards/playbook" self.assertTrue((snapshot / "templates/AGENTS.template.md").is_file()) self.assertTrue((snapshot / "templates/AGENT_RULES.template.md").is_file()) self.assertTrue((snapshot / "templates/README.md").is_file()) self.assertTrue((snapshot / "templates/memory-bank").is_dir()) self.assertTrue((snapshot / "templates/prompts").is_dir()) if __name__ == "__main__": unittest.main()