You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Write tool produces LF-only line endings on Windows, breaking batch (.bat) files #31224
The write tool produces LF-only (\n) line endings on Windows when writing .bat/.cmd files. Cmd.exe requires CRLF (\r\n) line endings; LF-only causes the batch file to exit immediately with no visible error.
Root Cause
packages/opencode/src/tool/write.ts passes content directly to writeWithDirs() 鈫?writeFileString() in packages/core/src/fs-util.ts with no line ending conversion. Contrast with edit.ts:46-56 which already has detectLineEnding()/convertToLineEnding() helpers.
Expected Behavior
Windows .bat/.cmd files: CRLF line endings, UTF-8 without BOM
Other files: no transformation needed
Suggested Fix
In write.ts, detect .bat/.cmd extensions on process.platform === 'win32' and normalize line endings to CRLF before writing. For encoding, write UTF-8 without BOM (BOM before @echo off causes cmd.exe to crash on some Windows configurations).
See also the companion discussion in #31275 (closed as out-of-scope 鈥?AGENTS.md rules are user/AI-authored, not program-bundled).
Activity
github-actions commentedon Jun 7, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is distinct from these, please add a comment explaining how it differs.