aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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