mirror of
https://github.com/sst/opencode.git
synced 2025-07-08 00:25:00 +00:00
smooth out initial onboarding flow
This commit is contained in:
parent
1c3c74bd36
commit
c0773dc7c5
2 changed files with 13 additions and 9 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue