fix(attach): allow remote --dir
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 --dir parameter. In these examples docs is my hostname in Tailnet.
If I ran opencode attach docs:4096 --dir ./perry from 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 ./perry
opencode attach docs:4096 --dir /home/workspace/perry
both 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.
Issue: #8981