opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: support MSYS forward slashes with experimental flag

Open pschiel opened this issue 1 week ago • 3 comments

WIP

issues:

  • git rev-parse --show-toplevel returns E:/x/y forward slash format
  • path.resolve(), path.relative(), realpathSync.native(), realpath (bash) break when git bash (msys) paths are used
    • /d/x within C drive (/c/) results in things like C:\d\x
    • relative paths not working like expected using cross-drive
    • some path matching issues (relative, contains, ..)
    • /tmp inside git bash is something else outside of it
  • tools break using backslash paths (some backslashes get "eaten")
  • escaping hell for agents
  • observed in all win32 native shells

patch tries to fix:

  • convert to forward slash format at all places where things break (tool calls and bash mostly)
  • in Filesystem as wrapper functions (path.resolve -> Filesystem.resolvePath)
  • configurable with flag (otherwise backslash paths are guaranteed - but still some bugs with these)

todo:

  • clean up Filesystem functions (relativePath, overlaps, possibly add dirpath)
  • add tests for Filesystem
  • maybe change flag with SHELL detection
  • test all tools, incl. permission checks

pschiel avatar Jan 03 '26 17:01 pschiel