From 690e0ee9c5a0956880cecef2ead7662f28855354 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 23 May 2026 23:19:21 +0900 Subject: claude: fix hook settings --- bin/__claude-code-block-bash-tool | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'bin/__claude-code-block-bash-tool') diff --git a/bin/__claude-code-block-bash-tool b/bin/__claude-code-block-bash-tool index b95771f..372d1f6 100755 --- a/bin/__claude-code-block-bash-tool +++ b/bin/__claude-code-block-bash-tool @@ -1,8 +1,14 @@ #!/usr/bin/env bash +block_target_command="$1" +actual_command="$(jq -r '.tool_input.command // ""')" + +if ! printf '%s' "$actual_command" | grep -q "\\b${block_target_command}\\b"; then + exit 0 +fi + case "$1" in rm) - echo "The command 'rm' is denied. Use 'git rm' if the file or the directory is tracked by git. If not, request deletion to user.";; + echo "The command 'rm' is denied. Use 'git rm' if the file or the directory is tracked by git. If not, request deletion to user. Do not attempt any other deletion methods like find -delete or python" >&2;; esac - exit 2 -- cgit v1.3.1