summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-06-27 16:09:33 -0400
committerJay V <[email protected]>2025-06-27 19:10:42 -0400
commit8b400515ea5ab4637866cd14a30423b7c7dc9b77 (patch)
treef21e2d0885ebb3401f21464f6fe82f6762235e44
parent289797f56dbe7a7b51bc74ef8413da1a41a1b95b (diff)
downloadopencode-8b400515ea5ab4637866cd14a30423b7c7dc9b77.tar.gz
opencode-8b400515ea5ab4637866cd14a30423b7c7dc9b77.zip
smooth out initial onboarding flow
-rw-r--r--packages/opencode/src/cli/cmd/tui.ts13
-rw-r--r--packages/opencode/src/index.ts9
2 files changed, 13 insertions, 9 deletions
diff --git a/packages/opencode/src/cli/cmd/tui.ts b/packages/opencode/src/cli/cmd/tui.ts
index b66aca6bd..87f6f982e 100644
--- a/packages/opencode/src/cli/cmd/tui.ts
+++ b/packages/opencode/src/cli/cmd/tui.ts
@@ -9,7 +9,6 @@ import fs from "fs/promises"
import { Installation } from "../../installation"
import { Config } from "../../config/config"
import { Bus } from "../../bus"
-import { AuthLoginCommand } from "./auth"
export const TuiCommand = cmd({
command: "$0 [project]",
@@ -100,11 +99,15 @@ export const TuiCommand = cmd({
if (result === "needs_provider") {
UI.empty()
UI.println(UI.logo(" "))
+ const result = await Bun.spawn({
+ cmd: [process.execPath, "auth", "login"],
+ cwd: process.cwd(),
+ stdout: "inherit",
+ stderr: "inherit",
+ stdin: "inherit",
+ }).exited
+ if (result !== 0) return
UI.empty()
- await AuthLoginCommand.handler(args)
- UI.empty()
- UI.println("Provider configured - please run again")
- return
}
}
},
diff --git a/packages/opencode/src/index.ts b/packages/opencode/src/index.ts
index fca13655e..8a684ae91 100644
--- a/packages/opencode/src/index.ts
+++ b/packages/opencode/src/index.ts
@@ -74,15 +74,15 @@ try {
...obj.data,
})
}
-
+
if (e instanceof Error) {
Object.assign(data, {
name: e.name,
message: e.message,
cause: e.cause?.toString(),
})
- }
-
+ }
+
if (e instanceof ResolveMessage) {
Object.assign(data, {
name: e.name,
@@ -92,7 +92,7 @@ try {
referrer: e.referrer,
position: e.position,
importKind: e.importKind,
- });
+ })
}
Log.Default.error("fatal", data)
const formatted = FormatError(e)
@@ -101,6 +101,7 @@ try {
UI.error(
"Unexpected error, check log file at " + Log.file() + " for more details",
)
+ process.exitCode = 1
}
cancel.abort()