Description
When using opencode attach with the --dir flag to connect to a remote server, the command fails because it attempts to change the directory on the local client machine rather than sending the directory path to the server.
The attach command handler calls process.chdir(args.dir) locally before connecting, which fails if the specified directory doesn't exist on the client. Even if it does exist, it passes process.cwd() as the directory to the tui function, so the resolved local path is sent to the server, which is unexpected.
Expected behavior
The --dir flag should be passed to the remote server, which resolves the path relative to where opencode serve was started.
Plugins
N/A
OpenCode version
dev @ 88fd6a2
Steps to reproduce
- Start opencode serve on a remote server (e.g., Linux machine in /home/user)
- On the remote server, ensure a project directory exists (e.g., my-project)
- From a local machine (e.g., macOS), run opencode attach http://:4096 --dir my-project
- Observe the error: ENOENT: no such file or directory, chdir '' -> 'my-project'
Screenshot and/or share link
No response
Operating System
N/A
Terminal
N/A
Description
When using opencode attach with the --dir flag to connect to a remote server, the command fails because it attempts to change the directory on the local client machine rather than sending the directory path to the server.
The attach command handler calls
process.chdir(args.dir)locally before connecting, which fails if the specified directory doesn't exist on the client. Even if it does exist, it passesprocess.cwd()as the directory to thetuifunction, so the resolved local path is sent to the server, which is unexpected.Expected behavior
The --dir flag should be passed to the remote server, which resolves the path relative to where opencode serve was started.
Plugins
N/A
OpenCode version
dev @ 88fd6a2
Steps to reproduce
Screenshot and/or share link
No response
Operating System
N/A
Terminal
N/A