diff --git a/.claude/hooks/guard-write.sh b/.claude/hooks/guard-write.sh index 5aa42c8..ce3fc44 100755 --- a/.claude/hooks/guard-write.sh +++ b/.claude/hooks/guard-write.sh @@ -2,7 +2,17 @@ # Managed by: blue install # Blue PreToolUse hook - enforces RFC 0038 worktree protection -FILE_PATH=$(jq -r '.tool_input.file_path // empty') +# Read stdin with bash timeout (portable, no GNU timeout needed) +INPUT="" +while IFS= read -t 2 -r line; do + INPUT="${INPUT}${line}" +done + +if [ -z "$INPUT" ]; then + exit 0 +fi + +FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null || echo "") if [ -z "$FILE_PATH" ]; then exit 0 diff --git a/apps/blue-cli/src/main.rs b/apps/blue-cli/src/main.rs index 1d12105..c5a1caf 100644 --- a/apps/blue-cli/src/main.rs +++ b/apps/blue-cli/src/main.rs @@ -2744,7 +2744,17 @@ const GUARD_WRITE_HOOK: &str = r#"#!/bin/bash # Managed by: blue install # Blue PreToolUse hook - enforces RFC 0038 worktree protection -FILE_PATH=$(jq -r '.tool_input.file_path // empty') +# Read stdin with bash timeout (portable, no GNU timeout needed) +INPUT="" +while IFS= read -t 2 -r line; do + INPUT="${INPUT}${line}" +done + +if [ -z "$INPUT" ]; then + exit 0 +fi + +FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null || echo "") if [ -z "$FILE_PATH" ]; then exit 0