#!/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. Do not attempt any other deletion methods like find -delete or python" >&2;; esac exit 2