Skip to content

fix: replace dispatch.sh with direct node command for Windows compatibility#70

Open
abeshbh wants to merge 1 commit into
secondsky:mainfrom
abeshbh:fix/windows-hook-dispatch
Open

fix: replace dispatch.sh with direct node command for Windows compatibility#70
abeshbh wants to merge 1 commit into
secondsky:mainfrom
abeshbh:fix/windows-hook-dispatch

Conversation

@abeshbh
Copy link
Copy Markdown

@abeshbh abeshbh commented Apr 9, 2026

Summary

  • On Windows, child_process.spawn() without shell: true cannot execute .sh scripts, so ./hooks/dispatch.sh fails with ENOENT
  • dispatch.sh is a runtime detector that tries node, then falls back to python3/python/py
  • Since Claude Code requires Node.js, node is always available -- the Python fallback is unnecessary
  • Replace ./hooks/dispatch.sh with node "${CLAUDE_PLUGIN_ROOT}/hooks/validator.mjs" in all 7 affected plugins

This calls the same validator.mjs that dispatch.sh was calling, just without the bash wrapper. Works on all platforms -- Mac and Linux are unaffected since node is in PATH there too.

Affected plugins

  • sap-cap-capire (2 hooks)
  • sap-datasphere (2 hooks)
  • sap-sac-custom-widget (1 hook)
  • sap-sac-planning (2 hooks)
  • sap-sac-scripting (2 hooks)
  • sap-sqlscript (1 hook)
  • sapui5 (3 hooks)

Related issues

Test plan

  • Tested on Windows 11 with Claude Code -- all 7 plugin hooks execute successfully after fix
  • Verify no regression on Mac/Linux (node is in PATH, ${CLAUDE_PLUGIN_ROOT} resolves correctly)

Summary by CodeRabbit

  • Chores
    • Improved validation infrastructure across multiple SAP plugins (CAP CAPIRE, Datasphere, SAC Custom Widget, SAC Planning, SAC Scripting, SQLScript, SAPUI5). All existing timeouts and configurations are preserved with no changes to current functionality.

…bility

On Windows, child_process.spawn() without shell:true cannot execute
.sh scripts. dispatch.sh is a runtime detector that tries node first,
then falls back to python. Since Claude Code requires Node.js, node
is always available -- the Python fallback is unnecessary.

Replace ./hooks/dispatch.sh with:
  node "${CLAUDE_PLUGIN_ROOT}/hooks/validator.mjs"

This uses the same validator.mjs that dispatch.sh calls, just without
the bash wrapper. Works on all platforms (Mac, Linux, Windows).

Affected plugins: sap-cap-capire, sap-datasphere, sap-sac-custom-widget,
sap-sac-planning, sap-sac-scripting, sap-sqlscript, sapui5

Fixes: Windows spawn ENOENT for hook scripts
Related: anthropics/claude-code#19658, anthropics/claude-code#27061

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@abeshbh abeshbh requested a review from secondsky as a code owner April 9, 2026 03:15
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 074d6e8d-8485-4ef3-9bb2-72ccd022c05b

📥 Commits

Reviewing files that changed from the base of the PR and between 62507f5 and 8d43822.

📒 Files selected for processing (7)
  • plugins/sap-cap-capire/hooks/hooks.json
  • plugins/sap-datasphere/hooks/hooks.json
  • plugins/sap-sac-custom-widget/hooks/hooks.json
  • plugins/sap-sac-planning/hooks/hooks.json
  • plugins/sap-sac-scripting/hooks/hooks.json
  • plugins/sap-sqlscript/hooks/hooks.json
  • plugins/sapui5/hooks/hooks.json

Walkthrough

Seven SAP plugins' hook configuration files are updated to invoke a centralized Node.js validator module (validator.mjs) instead of local shell scripts (dispatch.sh) for PreToolUse and/or PostToolUse hook entries. All timeout values remain unchanged.

Changes

Cohort / File(s) Summary
Hook Command Configuration
plugins/sap-cap-capire/hooks/hooks.json, plugins/sap-datasphere/hooks/hooks.json, plugins/sap-sac-custom-widget/hooks/hooks.json, plugins/sap-sac-planning/hooks/hooks.json, plugins/sap-sac-scripting/hooks/hooks.json, plugins/sap-sqlscript/hooks/hooks.json, plugins/sapui5/hooks/hooks.json
Updated hook commands from ./hooks/dispatch.sh to node "${CLAUDE_PLUGIN_ROOT}/hooks/validator.mjs" for PreToolUse and/or PostToolUse hook entries across all plugins. Timeouts and matchers remain unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: replacing dispatch.sh with a direct node command to fix Windows compatibility issues.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@secondsky
Copy link
Copy Markdown
Owner

Node.js is not always available if claude code is used. actually, the recommended installation method is the bun native installer, which doesnt need installed node.js
So the fallback with python is a valid and sometimes needed way.

Will see what we can do with this regarding windows.

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.

2 participants