feat: 优化运行时判定
This commit is contained in:
@@ -43,6 +43,21 @@ def test_claude_merge_is_idempotent_and_keeps_existing_hooks(tmp_path):
|
||||
for item in group["hooks"]
|
||||
]
|
||||
assert commands == [f'"{tmp_path / "runtime" / ".venv" / "bin" / "laya-hook"}" --client claude']
|
||||
for event, matcher in (
|
||||
("PreToolUse", "Bash|Edit|Write|MultiEdit|apply_patch"),
|
||||
("PostToolUse", "Bash|Edit|Write|MultiEdit|apply_patch|Read|Grep|Glob"),
|
||||
):
|
||||
ours = [
|
||||
group
|
||||
for group in saved["hooks"][event]
|
||||
if any("laya-hook" in item.get("command", "") for item in group.get("hooks", []))
|
||||
]
|
||||
assert ours[-1]["matcher"] == matcher
|
||||
assert any(
|
||||
"laya-hook" in item.get("command", "")
|
||||
for group in saved["hooks"]["Stop"]
|
||||
for item in group["hooks"]
|
||||
)
|
||||
assert list(path.parent.glob("settings.json.bak-*"))
|
||||
|
||||
assert client.uninstall() is True
|
||||
|
||||
Reference in New Issue
Block a user