refactor(cli): centralize server resolution
This commit is contained in:
@@ -84,6 +84,7 @@ export const AttachCommand = cmd({
|
||||
const { createLegacyTuiPluginHost } = await import("@/plugin/tui/runtime")
|
||||
await Effect.runPromise(
|
||||
run({
|
||||
// @ts-expect-error V1 does not consume the V2-only server input.
|
||||
client: createOpencodeClient({ baseUrl: args.url, headers, directory }),
|
||||
api: OpenCode.make({ baseUrl: args.url, headers }),
|
||||
config,
|
||||
|
||||
@@ -112,6 +112,7 @@ export const RunCommand = effectCmd({
|
||||
file: args.file ?? [],
|
||||
title: args.title,
|
||||
server: args.server ?? args.attach,
|
||||
// @ts-expect-error V1 does not consume the V2-only resolved server input.
|
||||
password: args.password ?? process.env.OPENCODE_PASSWORD ?? process.env.OPENCODE_SERVER_PASSWORD,
|
||||
username: args.username ?? process.env.OPENCODE_SERVER_USERNAME,
|
||||
directory: args.dir,
|
||||
|
||||
@@ -159,6 +159,7 @@ export const TuiThreadCommand = cmd({
|
||||
const { createLegacyTuiPluginHost } = await import("@/plugin/tui/runtime")
|
||||
await Effect.runPromise(
|
||||
run({
|
||||
// @ts-expect-error V1 does not consume the V2-only server input.
|
||||
client: createOpencodeClient({ baseUrl: url, headers, directory: cwd }),
|
||||
api: OpenCode.make({ baseUrl: url, headers }),
|
||||
async onSnapshot() {
|
||||
|
||||
Reference in New Issue
Block a user