Plugins with bash scripts break on Windows due to CRLF line endings and path resolution

Resolved 💬 2 comments Opened Feb 17, 2026 by Hydro2114 Closed Feb 17, 2026

Bug Description

Plugins that include .sh shell scripts fail on Windows due to two issues:

1. CRLF Line Endings in Shell Scripts

When plugins are installed on Windows, git clone converts LF line endings to CRLF (due to core.autocrlf=true default). This causes the shebang line #!/bin/bash to become #!/bin/bash\r, which makes bash unable to find the interpreter:

Stop hook error: Failed with non-blocking status code: /bin/bash:
C:/Users/.../hooks/stop-hook.sh: No such file or directory

2. Hook System Path Resolution

The hook system invokes /bin/bash with Windows-style C:/ paths. On systems where /bin/bash resolves to WSL bash (instead of Git Bash), these paths cannot be resolved, causing "No such file or directory" errors even when the files exist.

Affected Plugins

Any plugin using .sh scripts in hooks or command templates, including:

  • ralph-loop (official) - stop-hook.sh in hooks, setup-ralph-loop.sh in command template
  • learning-output-style (official) - session-start.sh in hooks
  • claude-scientific-writer - review_poster.sh in skills
  • document-skills (anthropic-agent-skills) - init-artifact.sh, bundle-artifact.sh in skills

Steps to Reproduce

  1. Install Claude Code on Windows 11 with Git for Windows (default core.autocrlf=true)
  2. Install any plugin that uses .sh scripts (e.g., ralph-loop)
  3. Trigger the hook or command that invokes the .sh script
  4. Observe "No such file or directory" error

Expected Behavior

Plugins should work out of the box on Windows without manual fixes.

Suggested Fixes

  1. Set core.autocrlf=false when cloning plugin repos - prevents CRLF conversion for .sh files
  2. Or add a .gitattributes to plugin repos with *.sh text eol=lf to force LF on all platforms
  3. Or convert .sh files to LF after download in the plugin installer
  4. Or use Node.js instead of bash for hooks/scripts since Node.js handles Windows paths natively and is guaranteed to be available (Claude Code runs on Node.js)

Workaround

Converting .sh files to LF line endings after install:

node -e "const fs=require('fs'); const f='path/to/script.sh'; fs.writeFileSync(f, fs.readFileSync(f,'utf8').replace(/\r\n/g,'\n'))"

Or rewriting hooks in Node.js and updating hooks.json to use node instead of the .sh script.

Environment

  • Windows 11 Pro 10.0.26200
  • Git for Windows (default core.autocrlf=true)
  • Claude Code (latest)
  • Node.js v22.20.0

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗