Repository navigation
Conversation
Cursor runs plugin hook commands under CMD.exe. Invoking the extensionless bash script session-start directly triggers the Windows file-association dialog. Delegate to the existing polyglot run-hook.cmd (same pattern as hooks.json for Claude Code) so Git Bash runs session-start. Made-with: Cursor
There was a problem hiding this comment.
Pull request overview
Updates Cursor’s sessionStart hook command to execute the existing Windows-compatible run-hook.cmd wrapper so the session-start script runs under Git Bash instead of being handled by CMD file-association behavior.
Changes:
- Switch Cursor
sessionStarthook from./hooks/session-startto./hooks/run-hook.cmd session-start.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "sessionStart": [ | ||
| { | ||
| "command": "./hooks/session-start" | ||
| "command": "./hooks/run-hook.cmd session-start" |
There was a problem hiding this comment.
The command path isn’t quoted. If the plugin root path contains spaces (common on Windows, e.g. under "Program Files"), CMD will treat ./hooks/run-hook.cmd as multiple tokens and the hook won’t run. Quote the script path (as done in hooks/hooks.json) so run-hook.cmd is invoked reliably, then pass session-start as the argument.
Suggested change
| "command": "./hooks/run-hook.cmd session-start" | |
| "command": "\"./hooks/run-hook.cmd\" session-start" |
Collaborator
4 of 5 tasks
3 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows, Cursor runs plugin
sessionStarthook commands under CMD. The Cursor hooks file pointed at./hooks/session-start, an extensionless bash script. CMD does not execute it as bash; Windows shows the file-association / Open with dialog when a new agent session starts.Fix
Use the same
run-hook.cmdpolyglot wrapper already used byhooks/hooks.jsonfor Claude Code SessionStart:./hooks/run-hook.cmd session-start. That locates Git Bash and runs the script.Plugin-relative
./hooks/...matches the Cursor plugins reference pattern for hook commands.Testing
From the plugin root,
cmd /c ".\hooks\run-hook.cmd session-start"returns valid JSON withadditional_contexton Windows with Git for Windows installed.