sync: auto-sync from DESKTOP-0O8A1RL at 2026-05-21 17:00:27

Author: Mike Swanson
Machine: DESKTOP-0O8A1RL
Timestamp: 2026-05-21 17:00:27
This commit is contained in:
2026-05-21 17:00:30 -07:00
parent f1d7b9dfae
commit e3a56bcb21
3 changed files with 6 additions and 53 deletions

View File

@@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Pre-tool hook: block Windows backslash paths in Bash commands.
#
# Blocks patterns like C:\Users\foo passed inside Bash command strings.
# Enforces forward slashes: C:/Users/foo
#
# Why: Git Bash mangles backslash paths — C:\tmp writes to a different
# directory than the Write tool's C:\tmp, causing stale payload bugs.
input=$(cat)
cmd=$(echo "$input" | jq -r '.tool_input.command // ""' 2>/dev/null)
# Match a drive letter followed by a literal backslash in the command.
# In the extracted command string (not JSON-escaped), backslash is just \.
if echo "$cmd" | grep -qE '[A-Za-z]:\\[A-Za-z/\\]'; then
echo "BLOCKED: Use forward slashes for Windows paths in Bash commands."
echo ""
echo " Wrong: C:\\Users\\guru\\file.txt"
echo " Correct: C:/Users/guru/file.txt"
echo ""
echo "Git Bash converts backslash paths unpredictably. PowerShell and Windows"
echo "APIs both accept forward slashes without issue."
exit 2
fi
exit 0