Repository navigation
fix(attach): allow remote --dir - #8969
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate Found:
|
|
I'd not consider this a duplicate, I think this is a much simpler fix of existing functionality that just makes sure that intended behavior works properly. |
|
@rekram1-node @thdxr could I get a quick look at this? i spin up one server remotely on my docker containers right now, and having this validation disabled would let me start them in the right repositories, with proper skills/agents loaded up. I have to do a bit of a dance right now without it. sorry to bug multiple times about that |
The attach command now always passes client's cwd to the server via the directory parameter. This fork-specific enhancement regressed during upstream merge (PR anomalyco#8969, commit 8ebb766). Ensures file autocomplete, theme discovery, and exports use the client's directory when attaching to a remote server, not the server's launch dir. Preserves upstream's remote --dir path support by early-returning when the directory doesn't exist locally.
What does this PR do?
I spawn OpenCode directly on my dev servers in $HOME. I then try to attach to them from any of my machine, and because projects may be scattered and not at $HOME, I want to be able to use
--dirparameter. In these examplesdocsis my hostname in Tailnet.If I ran
opencode attach docs:4096 --dir ./perryfrom my machine earlier, it would consider it a local path and try to push that in. Absolute paths would also be caught with issues like:ENOENT: no such file or directory, chdir '/home/gricha/personal/opencode-gricha' -> '/home/workspace/perry'
I didn't want to break local-validation functionality you have, so I added gating for local vs. remote attach, and let remote pass through the dir to the upstream server.
How did you verify your code works?
opencode attach docs:4096 --dir ./perryopencode attach docs:4096 --dir /home/workspace/perryboth work properly now - I also tested for whether they are able to load up skills/subagents from those directories after that change and it works fine.
Fixes #8981