@@ -6,6 +6,8 @@ import path from "path"
66import { UI } from "@/cli/ui"
77import { iife } from "@/util/iife"
88import { Log } from "@/util/log"
9+ import { withNetworkOptions , resolveNetworkOptions } from "@/cli/network"
10+ import { Config } from "@/config/config"
911
1012declare global {
1113 const OPENCODE_WORKER_PATH : string
@@ -15,7 +17,7 @@ export const TuiThreadCommand = cmd({
1517 command : "$0 [project]" ,
1618 describe : "start opencode tui" ,
1719 builder : ( yargs ) =>
18- yargs
20+ withNetworkOptions ( yargs )
1921 . positional ( "project" , {
2022 type : "string" ,
2123 describe : "path to start opencode in" ,
@@ -36,23 +38,12 @@ export const TuiThreadCommand = cmd({
3638 describe : "session id to continue" ,
3739 } )
3840 . option ( "prompt" , {
39- alias : [ "p" ] ,
4041 type : "string" ,
4142 describe : "prompt to use" ,
4243 } )
4344 . option ( "agent" , {
4445 type : "string" ,
4546 describe : "agent to use" ,
46- } )
47- . option ( "port" , {
48- type : "number" ,
49- describe : "port to listen on" ,
50- default : 0 ,
51- } )
52- . option ( "hostname" , {
53- type : "string" ,
54- describe : "hostname to listen on" ,
55- default : "127.0.0.1" ,
5647 } ) ,
5748 handler : async ( args ) => {
5849 // Resolve relative paths against PWD to preserve behavior when using --cwd flag
@@ -87,10 +78,9 @@ export const TuiThreadCommand = cmd({
8778 process . on ( "unhandledRejection" , ( e ) => {
8879 Log . Default . error ( e )
8980 } )
90- const server = await client . call ( "server" , {
91- port : args . port ,
92- hostname : args . hostname ,
93- } )
81+ const config = await Config . get ( )
82+ const networkOpts = resolveNetworkOptions ( args , config )
83+ const server = await client . call ( "server" , networkOpts )
9484 const prompt = await iife ( async ( ) => {
9585 const piped = ! process . stdin . isTTY ? await Bun . stdin . text ( ) : undefined
9686 if ( ! args . prompt ) return piped
0 commit comments