The open source coding agent.
TypeScript
fix(attach): allow remote --dir (#8969)
Greg Pstrucha8ebb7664702a
diff --git a/packages/opencode/src/cli/cmd/tui/attach.ts b/packages/opencode/src/cli/cmd/tui/attach.tsindex 3f9285f631c..f641ff09884 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,})},})