opencode
opencode copied to clipboard
feat: add --dir flag to opencode run --attach
Summary
- Add
--dirflag toopencode runcommand - When used with
--attach, passes directory to SDK client viax-opencode-directoryheader - Enables sessions attached to a global server to run in the correct project directory
Use Case
When using opencode-pilot to spawn sessions that attach to a running OpenCode Desktop with worktree="/", sessions now run in the correct project directory instead of the server's home directory.
# Before: sessions run in wrong directory
opencode run --attach http://localhost:4096 "fix bug"
# Working directory: /Users/me (wrong!)
# After: sessions run in correct directory
opencode run --attach http://localhost:4096 --dir /path/to/project "fix bug"
# Working directory: /path/to/project (correct!)
Closes #7376