fix: extract denied commands from correct JSON path (Issue #143)
The permission_denials array from Claude CLI has commands nested under tool_input.command, not directly as .command: Before: jq '[.permission_denials[].command]' After: jq '[.permission_denials[].tool_input.command]' This fixes the "Permission denied for N command(s)" message to actually display the denied commands instead of showing empty/unknown. Also updated test fixture to match real Claude CLI output structure.
This commit is contained in:
parent
2e6026aced
commit
627ad7d9a5
2 changed files with 5 additions and 3 deletions
|
|
@ -982,12 +982,13 @@ EOF
|
|||
@test "parse_json_response extracts denied_commands list" {
|
||||
local output_file="$LOG_DIR/test_output.log"
|
||||
|
||||
# Use real Claude CLI output structure with tool_input.command
|
||||
cat > "$output_file" << 'EOF'
|
||||
{
|
||||
"result": "Permission denied for npm install",
|
||||
"sessionId": "session-extract-cmds",
|
||||
"permission_denials": [
|
||||
{"tool": "Bash", "command": "npm install express", "reason": "Not allowed"}
|
||||
{"tool_name": "Bash", "tool_use_id": "toolu_123", "tool_input": {"command": "npm install express"}}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
|
@ -998,7 +999,7 @@ EOF
|
|||
local result_file="$RALPH_DIR/.json_parse_result"
|
||||
[[ -f "$result_file" ]]
|
||||
|
||||
# Should extract the denied commands
|
||||
# Should extract the denied commands from tool_input.command
|
||||
local denied_cmds=$(jq -r '.denied_commands[0]' "$result_file")
|
||||
[[ "$denied_cmds" == *"npm install"* ]]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue