diff --git a/scripts/playbook.py b/scripts/playbook.py index a85cfbe..1489ea2 100644 --- a/scripts/playbook.py +++ b/scripts/playbook.py @@ -518,7 +518,9 @@ def render_agents_block(langs: list[str]) -> list[str]: langs_line = "、".join(entries) if entries else "" lines = [ "", + "", "请以 `.agents/` 下的规则为准:", + "", "- 入口:`.agents/index.md`", f"- 语言规则:{langs_line}" if langs_line else "- 语言规则:", "", diff --git a/tests/cli/test_playbook_cli.py b/tests/cli/test_playbook_cli.py index eec82c0..f4dd2c7 100644 --- a/tests/cli/test_playbook_cli.py +++ b/tests/cli/test_playbook_cli.py @@ -101,6 +101,30 @@ langs = ["tsl"] self.assertEqual(result.returncode, 0) self.assertTrue(agents_index.is_file()) + def test_sync_standards_agents_block_has_blank_lines(self): + with tempfile.TemporaryDirectory() as tmp_dir: + config_body = f""" +[playbook] +project_root = "{tmp_dir}" + +[sync_standards] +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) + + agents_md = Path(tmp_dir) / "AGENTS.md" + lines = agents_md.read_text(encoding="utf-8").splitlines() + start_idx = lines.index("") + end_idx = lines.index("") + block = lines[start_idx : end_idx + 1] + self.assertEqual(block[1], "") + bullet_idx = next(i for i, line in enumerate(block) if line.startswith("- ")) + self.assertEqual(block[bullet_idx - 1], "") + def test_install_skills(self): with tempfile.TemporaryDirectory() as tmp_dir: target = Path(tmp_dir) / "codex"