fix(ralph-loop): add cross-platform support using Node.js launcher #305
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.
Summary
Adds true cross-platform support for the ralph-loop plugin by introducing Node.js launchers that detect the platform at runtime and invoke the appropriate native script (PowerShell on Windows, Bash on Unix/macOS).
Problem
The current ralph-loop plugin only works on Unix/macOS systems. Windows users cannot use the plugin because:
.shfilesThere are currently 4 open PRs attempting to fix this (#89, #99, #124, #127), but each has limitations.
Why This Approach is Superior
Comparison with Existing PRs
bash)Why Node.js?
Zero additional dependencies - Claude Code is a Node.js application. Every user who can run Claude Code already has Node.js installed. Unlike PR fix(ralph-wiggum): Add Windows compatibility for stop hook #89 which requires Git Bash/WSL, this works out of the box.
Doesn't break Unix - PR feat(ralph-wiggum): Add Windows PowerShell support #99 changes hooks.json to call PowerShell directly, which breaks Unix/macOS entirely. Our approach keeps the existing bash scripts working.
Better than Python - Other official plugins (hookify, security-guidance) use
python3for cross-platform hooks, but Python is not guaranteed on Windows. Node.js is guaranteed because Claude Code requires it.Single configuration - One
hooks.jsonand one command file works on all platforms. No need for platform-specific plugin versions.Native execution - Windows users get native PowerShell (fast, full Windows API access). Unix users get native bash (no changes to existing behavior).
Architecture
The launchers are minimal and simply detect
os.platform()then spawn the appropriate script.Changes
hooks/hooks.jsonhooks/stop-hook-launcher.jshooks/stop-hook.ps1commands/ralph-loop.mdscripts/setup-ralph-loop-launcher.jsscripts/setup-ralph-loop.ps1Testing
Tested on Windows 11 with PowerShell 5.1 using this test command:
Results:
<promise>DONE</promise>, loop completedFinal file contents:
/ralph-loop)Compatibility
Security
Invoke-Expressionor evalConvertTo-Json-ExecutionPolicy Bypassonly for the specific script, not system-wide