Skip to content

Comments

feat(ralph-wiggum): Add Windows PowerShell support#99

Open
WeSolveX wants to merge 1 commit intoanthropics:mainfrom
WeSolveX:feature/ralph-wiggum-windows-support
Open

feat(ralph-wiggum): Add Windows PowerShell support#99
WeSolveX wants to merge 1 commit intoanthropics:mainfrom
WeSolveX:feature/ralph-wiggum-windows-support

Conversation

@WeSolveX
Copy link

@WeSolveX WeSolveX commented Jan 2, 2026

Add Windows PowerShell support for Ralph Wiggum plugin

Summary

Added PowerShell (.ps1) scripts for full Windows compatibility, replacing the Unix shell scripts with native Windows equivalents.

Problem

The Ralph Wiggum plugin was originally designed for Unix/macOS systems using .sh shell scripts. Windows users could not use the plugin as-is.

Solution

Created PowerShell equivalents of all scripts that:

  • Work natively on Windows (PowerShell 5.1 and 7+)
  • Handle both CRLF and LF line endings
  • Include comprehensive error handling
  • Follow PowerShell best practices

Changes

New/Modified Scripts:

  • scripts/setup-ralph-loop.ps1 - Windows version of setup script
  • scripts/cancel-ralph-loop.ps1 - Windows version of cancel script
  • hooks/stop-hook.ps1 - Windows version of stop hook
  • hooks/hooks.json - Updated to invoke PowerShell with -ExecutionPolicy Bypass
  • commands/ralph-loop.md - Updated to invoke PowerShell script
  • commands/cancel-ralph.md - Updated to invoke PowerShell script

Documentation Fix:

  • commands/help.md - Fixed typo: .claude/.ralph-loop.local.md.claude/ralph-loop.local.md (lines 49, 69)

Testing

Thoroughly tested on Windows 11 with both PowerShell 5.1 and PowerShell 7+:

Test Case Result
Loop activation (/ralph-loop) ✅ Pass
State file creation ✅ Pass
State file updates (iteration counter) ✅ Pass
Stop hook intercepts exit ✅ Pass
Prompt fed back correctly ✅ Pass
Cancel command (/cancel-ralph) ✅ Pass
Max iterations limit ✅ Pass
Completion promise detection ✅ Pass
Error handling (12+ edge cases) ✅ Pass
CRLF/LF line ending handling ✅ Pass

Live test: Successfully ran 12 consecutive iterations proving full functionality.

Compatibility

  • ✅ PowerShell 5.1 (Windows default)
  • ✅ PowerShell 7+
  • ✅ Windows 10/11
  • ✅ Handles CRLF (Windows) and LF (Unix) line endings via \r?\n regex patterns

Security

  • No use of Invoke-Expression or similar dangerous cmdlets
  • Proper JSON escaping via ConvertTo-Json
  • No command injection vulnerabilities
  • Hardcoded paths prevent path traversal

Notes

The PowerShell scripts are functionally equivalent to the original shell scripts, maintaining the same:

  • State file format (YAML frontmatter in .claude/ralph-loop.local.md)
  • Hook JSON output format
  • Command-line argument parsing
  • Error messages and user feedback

- Add PowerShell scripts for Windows compatibility
- scripts/setup-ralph-loop.ps1: Windows setup script
- scripts/cancel-ralph-loop.ps1: Windows cancel script
- hooks/stop-hook.ps1: Windows stop hook
- Update hooks.json to invoke PowerShell with ExecutionPolicy Bypass
- Update command files to invoke PowerShell scripts
- Fix documentation typo in help.md (incorrect state file path)

Tested on Windows 11 with PowerShell 5.1 and 7+
@reisen7
Copy link

reisen7 commented Feb 3, 2026

good fix

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