From 6dc1c2cb3163db6d72546941f18b8c9bbf22299f Mon Sep 17 00:00:00 2001 From: Lucas Eichhorn Date: Tue, 3 Feb 2026 13:27:35 +0100 Subject: [PATCH] fix: improve permission denial display to show tool names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous fix (#143) only extracted `.tool_input.command`, which works for Bash denials but shows nothing for non-Bash tool denials like AskUserQuestion (which has no command field). This fix handles both cases: - Bash denials: shows "Bash(git commit -m ...)" with truncated command - Non-Bash tool denials: shows the tool name like "AskUserQuestion" Example output: 🚫 Permission denied for 1 command(s): AskUserQuestion 🚫 Permission denied for 2 command(s): Bash(git commit -m "..."), Bash(npm install) Co-Authored-By: Claude Opus 4.5 --- lib/response_analyzer.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/response_analyzer.sh b/lib/response_analyzer.sh index d127880..886f7b1 100644 --- a/lib/response_analyzer.sh +++ b/lib/response_analyzer.sh @@ -200,11 +200,13 @@ parse_json_response() { has_permission_denials="true" fi - # Extract denied commands for logging/display - # Note: Commands are nested under tool_input.command in the permission_denials array + # Extract denied tool names and commands for logging/display + # Shows tool_name for non-Bash tools, and for Bash tools shows the command that was denied + # This handles both cases: AskUserQuestion denial shows "AskUserQuestion", + # while Bash denial shows "Bash(git commit -m ...)" with truncated command local denied_commands_json="[]" if [[ $permission_denial_count -gt 0 ]]; then - denied_commands_json=$(jq -r '[.permission_denials[].tool_input.command // empty]' "$output_file" 2>/dev/null || echo "[]") + denied_commands_json=$(jq -r '[.permission_denials[] | if .tool_name == "Bash" then "Bash(\(.tool_input.command // "?" | split("\n")[0] | .[0:60]))" else .tool_name // "unknown" end]' "$output_file" 2>/dev/null || echo "[]") fi # Normalize values