aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-23 23:19:21 +0900
committernsfisis <nsfisis@gmail.com>2026-05-23 23:19:21 +0900
commit690e0ee9c5a0956880cecef2ead7662f28855354 (patch)
treeb08244d58187dc1fa39b8829d5544c54882f4355
parent7a2d76990919c23f80768a610a7fdc7920877710 (diff)
downloaddotfiles-690e0ee9c5a0956880cecef2ead7662f28855354.tar.gz
dotfiles-690e0ee9c5a0956880cecef2ead7662f28855354.tar.zst
dotfiles-690e0ee9c5a0956880cecef2ead7662f28855354.zip
claude: fix hook settings
-rw-r--r--.config/claude/settings.json2
-rwxr-xr-xbin/__claude-code-block-bash-tool10
2 files changed, 9 insertions, 3 deletions
diff --git a/.config/claude/settings.json b/.config/claude/settings.json
index 1dc9b1e..3c0e178 100644
--- a/.config/claude/settings.json
+++ b/.config/claude/settings.json
@@ -35,7 +35,7 @@
{
"type": "command",
"command": "__claude-code-block-bash-tool rm",
- "if": "Bash(rm *)"
+ "if": "Bash(rm:*)"
}
]
}
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