refactor(cli): centralize server resolution

This commit is contained in:
Dax Raad 2026-07-08 22:09:59 -04:00
parent be7a684791
commit cccd013801
13 changed files with 152 additions and 292 deletions

View file

@ -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,

View file

@ -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,

View file

@ -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() {