|
@@ -100,7 +100,7 @@ export const TuiCommand = cmd({
|
|
|
UI.empty()
|
|
UI.empty()
|
|
|
UI.println(UI.logo(" "))
|
|
UI.println(UI.logo(" "))
|
|
|
const result = await Bun.spawn({
|
|
const result = await Bun.spawn({
|
|
|
- cmd: [process.execPath, "auth", "login"],
|
|
|
|
|
|
|
+ cmd: [...getOpencodeCommand(), "auth", "login"],
|
|
|
cwd: process.cwd(),
|
|
cwd: process.cwd(),
|
|
|
stdout: "inherit",
|
|
stdout: "inherit",
|
|
|
stderr: "inherit",
|
|
stderr: "inherit",
|
|
@@ -112,3 +112,25 @@ export const TuiCommand = cmd({
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * Get the correct command to run opencode CLI
|
|
|
|
|
+ * In development: ["bun", "run", "packages/opencode/src/index.ts"]
|
|
|
|
|
+ * In production: ["/path/to/opencode"]
|
|
|
|
|
+ */
|
|
|
|
|
+function getOpencodeCommand(): string[] {
|
|
|
|
|
+ // Check if OPENCODE_BIN_PATH is set (used by shell wrapper scripts)
|
|
|
|
|
+ if (process.env["OPENCODE_BIN_PATH"]) {
|
|
|
|
|
+ return [process.env["OPENCODE_BIN_PATH"]]
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const execPath = process.execPath.toLowerCase()
|
|
|
|
|
+
|
|
|
|
|
+ if (Installation.isDev()) {
|
|
|
|
|
+ // In development, use bun to run the TypeScript entry point
|
|
|
|
|
+ return [execPath, "run", process.argv[1]]
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // In production, use the current executable path
|
|
|
|
|
+ return [process.execPath]
|
|
|
|
|
+}
|