-
-
Notifications
You must be signed in to change notification settings - Fork 3k
fix: add Windows compatibility for SessionStart hook #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The bash-based session-start hook fails on Windows because:
1. ${CLAUDE_PLUGIN_ROOT} expands to Windows paths with backslashes
2. When passed through shell command parsing, backslashes are
interpreted as escape characters and stripped
3. Result: malformed path like C:Usersdan... instead of C:\Users\dan\...
This adds a cross-platform Node.js implementation of the session-start
hook. Since Claude Code runs on Node.js, node is guaranteed to be
available on all platforms where the plugin runs.
The Node.js script:
- Uses path.join() for proper cross-platform path handling
- Has identical functionality to the bash version
- Properly reads SKILL.md and checks for legacy skills directory
- Outputs the same JSON structure for hook injection
Tested on Windows with Git Bash environment - hook now executes
without errors and properly injects skill context.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
WalkthroughThe PR replaces the SessionStart hook from executing a shell script ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10–15 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code graph analysis (1)hooks/session-start.js (1)
🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for working on this! We've just released v3.6.0 which includes Windows hook support via a polyglot wrapper approach. Could you try updating the plugin and let us know if it resolves your Windows issues? The new approach uses a If this works for you, we can close this PR. If you're still seeing issues, please let us know! |
Summary
session-starthookProblem
On Windows, the bash-based
session-start.shhook fails with:Root cause:
${CLAUDE_PLUGIN_ROOT}expands to Windows paths with backslashes (e.g.,C:\Users\dan\...). When passed through shell command parsing, backslashes are interpreted as escape characters and stripped, resulting in malformed paths likeC:Usersdan....Solution
Added
session-start.js- a Node.js implementation that:path.join()for proper cross-platform path handlingTest plan
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.