feat(playbook): auto-create CLAUDE.md with path discovery

sync_claude_md now:
- Checks project root CLAUDE.md first, then .claude/CLAUDE.md
- Auto-creates if neither exists (default: project root)
- Supports playbook.claude_md config to override location
- Update test to verify auto-creation behavior

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
csh
2026-05-16 13:29:33 +08:00
co-authored by Claude Opus 4.6
parent 6ec9a45a83
commit 6518f0f554
2 changed files with 29 additions and 7 deletions
+6 -2
View File
@@ -487,7 +487,7 @@ skills = ["style-cleanup"]
root, agents_home, f"{CUSTOM_DEPLOY_ROOT}/docs"
)
def test_sync_claude_md_skips_when_no_claude_md(self):
def test_sync_claude_md_creates_when_no_claude_md(self):
with tempfile.TemporaryDirectory() as tmp_dir:
config_body = f"""
[playbook]
@@ -503,7 +503,11 @@ project_name = "Demo"
result = run_cli("-config", str(config_path))
self.assertEqual(result.returncode, 0)
self.assertFalse((Path(tmp_dir) / "CLAUDE.md").exists())
claude_md = Path(tmp_dir) / "CLAUDE.md"
self.assertTrue(claude_md.exists())
text = claude_md.read_text(encoding="utf-8")
self.assertIn("@AGENTS.md", text)
self.assertIn("<!-- playbook:claude:start -->", text)
def test_sync_claude_md_appends_block_to_existing_claude_md(self):
with tempfile.TemporaryDirectory() as tmp_dir: