summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGreg Pstrucha <[email protected]>2026-01-22 11:19:08 -0800
committerGitHub <[email protected]>2026-01-22 13:19:08 -0600
commit8ebb7664702a18dcbb119e2cddf259a00ed4af9b (patch)
tree511919c63958af25fdbf137cfdb0c374edb078e1
parent46de1ed3b60c46d998a19e8a9979559d34a2765b (diff)
downloadopencode-8ebb7664702a18dcbb119e2cddf259a00ed4af9b.tar.gz
opencode-8ebb7664702a18dcbb119e2cddf259a00ed4af9b.zip
fix(attach): allow remote --dir (#8969)
-rw-r--r--packages/opencode/src/cli/cmd/tui/attach.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/attach.ts b/packages/opencode/src/cli/cmd/tui/attach.ts
index 3f9285f63..f641ff098 100644
--- a/packages/opencode/src/cli/cmd/tui/attach.ts
+++ b/packages/opencode/src/cli/cmd/tui/attach.ts
@@ -21,11 +21,19 @@ export const AttachCommand = cmd({
describe: "session id to continue",
}),
handler: async (args) => {
- if (args.dir) process.chdir(args.dir)
+ let directory = args.dir
+ if (args.dir) {
+ try {
+ process.chdir(args.dir)
+ directory = process.cwd()
+ } catch {
+ // If the directory doesn't exist locally (remote attach), pass it through.
+ }
+ }
await tui({
url: args.url,
args: { sessionID: args.session },
- directory: args.dir ? process.cwd() : undefined,
+ directory,
})
},
})