mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-08 13:33:21 +00:00
refactor(cli): centralize server resolution
This commit is contained in:
parent
be7a684791
commit
cccd013801
13 changed files with 152 additions and 292 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue