Skip to content

Commit c0773dc

Browse files
committed
smooth out initial onboarding flow
1 parent 1c3c74b commit c0773dc

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

packages/opencode/src/cli/cmd/tui.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import fs from "fs/promises"
99
import { Installation } from "../../installation"
1010
import { Config } from "../../config/config"
1111
import { Bus } from "../../bus"
12-
import { AuthLoginCommand } from "./auth"
1312

1413
export const TuiCommand = cmd({
1514
command: "$0 [project]",
@@ -100,11 +99,15 @@ export const TuiCommand = cmd({
10099
if (result === "needs_provider") {
101100
UI.empty()
102101
UI.println(UI.logo(" "))
102+
const result = await Bun.spawn({
103+
cmd: [process.execPath, "auth", "login"],
104+
cwd: process.cwd(),
105+
stdout: "inherit",
106+
stderr: "inherit",
107+
stdin: "inherit",
108+
}).exited
109+
if (result !== 0) return
103110
UI.empty()
104-
await AuthLoginCommand.handler(args)
105-
UI.empty()
106-
UI.println("Provider configured - please run again")
107-
return
108111
}
109112
}
110113
},

packages/opencode/src/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ try {
7474
...obj.data,
7575
})
7676
}
77-
77+
7878
if (e instanceof Error) {
7979
Object.assign(data, {
8080
name: e.name,
8181
message: e.message,
8282
cause: e.cause?.toString(),
8383
})
84-
}
85-
84+
}
85+
8686
if (e instanceof ResolveMessage) {
8787
Object.assign(data, {
8888
name: e.name,
@@ -92,7 +92,7 @@ try {
9292
referrer: e.referrer,
9393
position: e.position,
9494
importKind: e.importKind,
95-
});
95+
})
9696
}
9797
Log.Default.error("fatal", data)
9898
const formatted = FormatError(e)
@@ -101,6 +101,7 @@ try {
101101
UI.error(
102102
"Unexpected error, check log file at " + Log.file() + " for more details",
103103
)
104+
process.exitCode = 1
104105
}
105106

106107
cancel.abort()

0 commit comments

Comments
 (0)