From e3a56bcb210dcb81d4e22d7ab1f9306a15ce1ac9 Mon Sep 17 00:00:00 2001 From: Mike Swanson Date: Thu, 21 May 2026 17:00:30 -0700 Subject: [PATCH] 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 --- .claude/hooks/pre-bash-backslash.sh | 26 --------------------- .claude/standards/python/windows-runtime.md | 15 ------------ .claude/standards/ssh/windows-openssh.md | 18 +++++--------- 3 files changed, 6 insertions(+), 53 deletions(-) delete mode 100644 .claude/hooks/pre-bash-backslash.sh diff --git a/.claude/hooks/pre-bash-backslash.sh b/.claude/hooks/pre-bash-backslash.sh deleted file mode 100644 index ce00f26..0000000 --- a/.claude/hooks/pre-bash-backslash.sh +++ /dev/null @@ -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 diff --git a/.claude/standards/python/windows-runtime.md b/.claude/standards/python/windows-runtime.md index 10a19ad..9d681e9 100644 --- a/.claude/standards/python/windows-runtime.md +++ b/.claude/standards/python/windows-runtime.md @@ -58,21 +58,6 @@ urllib.request.urlopen(req) " ``` -## Sending HTTP requests via Python (avoids backslash hook) - -The pre-bash-backslash hook blocks commands with Windows-style backslash paths. Python's `urllib.request` is a clean alternative to curl for sending POST requests that include backslash-containing paths in the payload: - -```bash -py -c " -import urllib.request, json -url = 'http://172.16.3.30:8001/api/coord/messages' -data = json.dumps({'to_session': 'target', 'body': 'message'}).encode() -req = urllib.request.Request(url, data=data, headers={'Content-Type': 'application/json'}) -resp = urllib.request.urlopen(req) -print(resp.status, resp.read()) -" -``` - ## Unicode in log files When reading log files that may contain non-UTF8 bytes (Windows logs, PowerShell output): diff --git a/.claude/standards/ssh/windows-openssh.md b/.claude/standards/ssh/windows-openssh.md index 09cadb6..bad9e1a 100644 --- a/.claude/standards/ssh/windows-openssh.md +++ b/.claude/standards/ssh/windows-openssh.md @@ -1,6 +1,6 @@ --- name: windows-openssh -description: Use system OpenSSH (bare `ssh`); never Git for Windows SSH; the backslash hook blocks full Windows paths +description: Use system OpenSSH (bare `ssh`); never Git for Windows SSH; use forward slashes for all Windows paths in Git Bash applies-to: all --- @@ -17,24 +17,18 @@ Do not use Git for Windows SSH (`C:\Program Files\Git\usr\bin\ssh.exe`). The sys ## Use bare `ssh`, not the full path -The pre-bash-backslash hook at `.claude/hooks/pre-bash-backslash.sh` blocks any Bash command that contains Windows-style backslash paths (e.g., `C:\Windows\System32\OpenSSH\ssh.exe`). This hook exists to prevent accidental backslash path usage in Git Bash, which interprets `\` as escape sequences. - -The system OpenSSH is on `PATH` in Git Bash, so use the bare command: +The system OpenSSH is on `PATH` in Git Bash, so prefer the bare command. Always use forward slashes for any Windows path you do pass explicitly — Git Bash interprets backslashes as escape sequences. ```bash # Correct — uses system OpenSSH via PATH ssh guru@172.16.3.30 "sudo /opt/gururmm/build-server.sh" ssh -i C:/Users/guru/.ssh/id_ed25519 guru@172.16.3.30 "command" -# Wrong — full backslash path blocked by hook -C:\Windows\System32\OpenSSH\ssh.exe guru@172.16.3.30 "command" -``` - -Note: forward-slash paths are fine in Git Bash: -```bash -# This works (forward slashes) +# Also correct — forward slashes in full path "C:/Windows/System32/OpenSSH/ssh.exe" guru@172.16.3.30 "command" -# But bare ssh is simpler and preferred + +# Wrong — backslash path breaks in Git Bash +C:\Windows\System32\OpenSSH\ssh.exe guru@172.16.3.30 "command" ``` ## Key file paths