Merge commit '3d83740f88b6aaba6962256be517656496b83f25' into lsp-server

This commit is contained in:
csh
2026-05-24 13:04:22 +08:00
292 changed files with 30774 additions and 218828 deletions
@@ -6,6 +6,7 @@ from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
SCRIPT = ROOT / "scripts" / "playbook.py"
DEFAULT_DEPLOY_ROOT = "docs/standards/playbook"
def run_cli(*args):
@@ -26,6 +27,7 @@ class NoBackupFlagsTests(unittest.TestCase):
config_body = f"""
[playbook]
project_root = "{tmp_dir}"
deploy_root = "{DEFAULT_DEPLOY_ROOT}"
[sync_rules]
force = true
@@ -54,6 +56,7 @@ no_backup = true
config_body = f"""
[playbook]
project_root = "{tmp_dir}"
deploy_root = "{DEFAULT_DEPLOY_ROOT}"
[sync_standards]
langs = ["tsl"]
@@ -71,6 +74,36 @@ no_backup = true
git_backups = list(root.glob(".gitattributes.bak.*"))
self.assertEqual(git_backups, [])
def test_install_skills_no_backup_replaces_existing_skill_without_backup(self):
with tempfile.TemporaryDirectory() as tmp_dir:
root = Path(tmp_dir)
skills_root = root / "agents" / "skills"
existing = skills_root / "brainstorming"
existing.mkdir(parents=True)
(existing / "stale.txt").write_text("old", encoding="utf-8")
config_body = f"""
[playbook]
project_root = "{tmp_dir}"
deploy_root = "{DEFAULT_DEPLOY_ROOT}"
[install_skills]
agents_home = "{root / 'agents'}"
mode = "list"
skills = ["brainstorming"]
no_backup = true
"""
config_path = root / "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)
backups = list(skills_root.glob("brainstorming.bak.*"))
self.assertEqual(backups, [])
self.assertFalse((existing / "stale.txt").exists())
self.assertTrue((existing / "SKILL.md").is_file())
if __name__ == "__main__":
unittest.main()