@@ -149,6 +149,7 @@ PostToolUse:
149149 actions :
150150 - type : command
151151 command : " gofmt -w {.tool_input.file_path}"
152+ output_format : text # gofmt outputs plain text, not JSON
152153
153154# Guide users to use better alternatives
154155PreToolUse :
@@ -241,6 +242,7 @@ PostToolUse:
241242 actions:
242243 - type: command
243244 command: "gofmt -w {.tool_input.file_path}"
245+ output_format: text # gofmt outputs plain text, not JSON
244246
245247 - matcher: "Write|Edit"
246248 conditions:
@@ -249,6 +251,7 @@ PostToolUse:
249251 actions:
250252 - type: command
251253 command: "black {.tool_input.file_path}"
254+ output_format: text # black outputs plain text, not JSON
252255` ` `
253256
254257Run pre-commit hooks automatically :
@@ -262,6 +265,7 @@ PostToolUse:
262265 actions:
263266 - type: command
264267 command: "pre-commit run --files {.tool_input.file_path}"
268+ output_format: text # pre-commit outputs plain text, not JSON
265269` ` `
266270
267271Warn about sensitive file modifications :
@@ -631,6 +635,12 @@ All conditions return proper error messages for unknown condition types, ensurin
631635 - Solves issues with special characters (quotes, backslashes, newlines) in data
632636 - Safer than shell string interpolation for complex data
633637 - Example : ` jq -r .tool_input.content` to extract content from JSON via stdin
638+ - `output_format : text` (optional)
639+ - Treat command's stdout as plain text instead of JSON
640+ - Without this, non-JSON output causes fail-safe block/deny behavior
641+ - Use for standard CLI tools like `gofmt`, `black`, `pre-commit run` that output plain text
642+ - Non-zero exit code still triggers fail-safe behavior regardless of this setting
643+ - Supported events : PreToolUse, PostToolUse, SessionStart, SessionEnd
634644- ` output`
635645 - Print message
636646 - Default `exit_status` :
@@ -702,8 +712,10 @@ PostToolUse:
702712 actions:
703713 - type: command
704714 command: "ruff format {.tool_input.file_path}"
715+ output_format: text
705716 - type: command
706717 command: "ruff check --fix {.tool_input.file_path}"
718+ output_format: text
707719` ` `
708720
709721# ## Multi-Step Workflows
@@ -717,8 +729,10 @@ PostToolUse:
717729 actions:
718730 - type: command
719731 command: "gofmt -w {.tool_input.file_path}"
732+ output_format: text # gofmt outputs plain text, not JSON
720733 - type: command
721734 command: "go vet {.tool_input.file_path}"
735+ output_format: text # go vet outputs plain text, not JSON
722736 - type: output
723737 message: "✅ Go file formatted and vetted: {.tool_input.file_path}"
724738` ` `
0 commit comments