feat(playbook): add no_backup deploy controls

remove obsolete main_language placeholders and language summary template text

limit generated .agents guidance to configured langs and normalize AGENT_RULES trailing newlines

document install_skills no_backup behavior and refresh tests for deployment links and sync flows
This commit is contained in:
csh
2026-04-24 10:06:03 +08:00
parent 8609d59d4a
commit a2e3cb07de
12 changed files with 138 additions and 90 deletions
+32 -1
View File
@@ -27,7 +27,29 @@ def run_script(script_path: Path, *args, cwd: Path | None = None):
class SyncTemplatesPlaceholdersTests(unittest.TestCase):
def test_main_language_placeholder_replaced(self):
def test_templates_no_longer_expose_main_language_placeholder(self):
example_text = (ROOT / "playbook.toml.example").read_text(encoding="utf-8")
self.assertNotIn("main_language", example_text)
templates_readme = (ROOT / "templates" / "README.md").read_text(
encoding="utf-8"
)
self.assertNotIn("{{MAIN_LANGUAGE}}", templates_readme)
self.assertNotIn("{{LANGUAGE_1}}", templates_readme)
agents_template = (ROOT / "templates" / "AGENTS.template.md").read_text(
encoding="utf-8"
)
self.assertNotIn("{{MAIN_LANGUAGE}}", agents_template)
tech_stack_template = (
ROOT / "templates" / "memory-bank" / "tech-stack.template.md"
).read_text(encoding="utf-8")
self.assertNotIn("{{MAIN_LANGUAGE}}", tech_stack_template)
self.assertNotIn("{{LANGUAGE_1}}", tech_stack_template)
self.assertNotIn("**主要语言**", tech_stack_template)
def test_sync_templates_replaces_playbook_scripts_without_main_language_support(self):
with tempfile.TemporaryDirectory() as tmp_dir:
config_body = f"""
[playbook]
@@ -36,6 +58,8 @@ deploy_root = "{DEFAULT_DEPLOY_ROOT}"
[sync_rules]
[sync_memory_bank]
[sync_standards]
langs = [\"cpp\", \"tsl\"]
"""
@@ -50,6 +74,12 @@ langs = [\"cpp\", \"tsl\"]
self.assertIn(".agents/cpp/index.md", text)
self.assertNotIn("{{MAIN_LANGUAGE}}", text)
tech_stack = Path(tmp_dir) / "memory-bank" / "tech-stack.md"
tech_stack_text = tech_stack.read_text(encoding="utf-8")
self.assertNotIn("{{LANGUAGE_1}}", tech_stack_text)
self.assertNotIn("{{MAIN_LANGUAGE}}", tech_stack_text)
self.assertNotIn("**主要语言**", tech_stack_text)
rules_md = Path(tmp_dir) / "AGENT_RULES.md"
rules_text = rules_md.read_text(encoding="utf-8")
self.assertIn("docs/standards/playbook/scripts/main_loop.py claim", rules_text)
@@ -57,6 +87,7 @@ langs = [\"cpp\", \"tsl\"]
self.assertIn("不得直接使用 `$executing-plans`", rules_text)
self.assertIn("不得直接使用 `$subagent-driven-development`", rules_text)
self.assertNotIn("{{PLAYBOOK_SCRIPTS}}", rules_text)
self.assertFalse(rules_text.endswith("\n\n"))
def test_sync_standards_rewrites_typescript_docs_prefix_for_vendored_playbook(self):
with tempfile.TemporaryDirectory() as tmp_dir: