Skip to content

fix(install): emit hook exe paths with forward slashes so Git Bash does not strip them#1988

Closed
varuntej07 wants to merge 1 commit into
Graphify-Labs:v8from
varuntej07:fix/hook-exe-forward-slashes
Closed

fix(install): emit hook exe paths with forward slashes so Git Bash does not strip them#1988
varuntej07 wants to merge 1 commit into
Graphify-Labs:v8from
varuntej07:fix/hook-exe-forward-slashes

Conversation

@varuntej07

Copy link
Copy Markdown
Contributor

On Windows, graphify claude install wrote the PreToolUse hook command as a raw backslash path (quoted only when it contained a space). Claude Code runs command-type hooks through Git Bash by default on Windows ("Defaults to bash, or to powershell on Windows when Git Bash isn't installed"), and bash strips the unquoted backslashes, so C:\Users\me\graphify.EXE hook-guard search becomes C:Usersmegraphify.EXE: command not found. Every graph guard silently fails.

Fix: normalize the resolved exe to forward slashes in _resolve_graphify_exe(), which feeds the Claude/CodeBuddy, Gemini, and Codex hook emitters. Forward slashes work under Git Bash, cmd.exe, and PowerShell, and the replacement is a no-op on POSIX. Added a cross-platform regression test that monkeypatches a backslash path and asserts the emitted command has none.

Closes #1987

…es not strip them

Claude Code runs command-type PreToolUse hooks through Git Bash by default on
Windows. The resolved exe was emitted as a raw backslash path and quoted only
when it contained a space, so a space-free path like C:\Users\me\graphify.EXE
reached settings.json unquoted. Git Bash treats the unquoted backslashes as
escapes and strips them, producing 'C:Usersmegraphify.EXE: command not found',
so every graph guard silently fails. Normalize the path to forward slashes in
_resolve_graphify_exe (a no-op on POSIX), fixing the Claude, Gemini, and Codex
hook emitters at once.
@safishamsi

Copy link
Copy Markdown
Collaborator

Landed on v8 and shipped in 0.9.20 (faa0ac2), cherry-picked to preserve your authorship. Thanks @varuntej07 — hook exe paths are normalized to forward slashes at the single choke point (_resolve_graphify_exe), so Git Bash no longer strips them; covers all emitters and preserves quoting + the --strict suffix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PreToolUse hooks fail on Windows with "command not found", claude install writes backslash exe paths that Git Bash strips

2 participants