diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-23 23:19:21 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-23 23:19:21 +0900 |
| commit | 690e0ee9c5a0956880cecef2ead7662f28855354 (patch) | |
| tree | b08244d58187dc1fa39b8829d5544c54882f4355 /bin | |
| parent | 7a2d76990919c23f80768a610a7fdc7920877710 (diff) | |
| download | dotfiles-690e0ee9c5a0956880cecef2ead7662f28855354.tar.gz dotfiles-690e0ee9c5a0956880cecef2ead7662f28855354.tar.zst dotfiles-690e0ee9c5a0956880cecef2ead7662f28855354.zip | |
claude: fix hook settings
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/__claude-code-block-bash-tool | 10 |
1 files changed, 8 insertions, 2 deletions
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 |
