Skip to content

fix(windows): install Claude Code hook shims as .cmd wrappers#926

Open
jseramn wants to merge 1 commit into
DeusData:mainfrom
jseramn:fix/windows-hook-cmd-wrappers
Open

fix(windows): install Claude Code hook shims as .cmd wrappers#926
jseramn wants to merge 1 commit into
DeusData:mainfrom
jseramn:fix/windows-hook-cmd-wrappers

Conversation

@jseramn

@jseramn jseramn commented Jul 7, 2026

Copy link
Copy Markdown

Summary

  • On Windows, Cursor and Claude Code spawn hook commands without a shell. Extensionless bash shims in ~/.claude/hooks/ trigger the "Open with" dialog and block workflows (especially on every Grep/Glob PreToolUse hook).
  • Install .cmd wrappers on Windows and wire settings.json to the absolute .cmd path so CreateProcess can execute hooks directly.
  • Add tests/windows/test_hook_scripts.py regression test and enable smoke-test coverage for Windows (previously skipped).

Root cause

cbm_install_hook_gate_script() always wrote #!/usr/bin/env bash scripts without a file extension. Windows has no default handler for extensionless files, so the OS prompts the user to pick an app. The smoke test explicitly skipped Windows (MINGW64_NT), so CI never caught this.

Test plan

  • python tests/windows/test_hook_scripts.py <binary> fails on current release, passes with this patch
  • CI smoke on windows-latest
  • Manual: install on Windows, run Grep in Cursor — no "Open with" dialog

Notes

Existing Unix installs are unchanged. Re-running codebase-memory-mcp install -y on Windows migrates settings to the .cmd path.

Extensionless bash hook scripts trigger Windows Open with dialogs when Cursor/Claude Code spawn PreToolUse/SessionStart commands without a shell. Write .cmd wrappers on Windows, point settings.json at the absolute .cmd path, and add a regression test plus smoke-test coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jseramn jseramn requested a review from DeusData as a code owner July 7, 2026 02:13
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.

1 participant