@@ -6,8 +6,6 @@ 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"
119
1210declare global {
1311 const OPENCODE_WORKER_PATH : string
@@ -17,7 +15,7 @@ export const TuiThreadCommand = cmd({
1715 command : "$0 [project]" ,
1816 describe : "start opencode tui" ,
1917 builder : ( yargs ) =>
20- withNetworkOptions ( yargs )
18+ yargs
2119 . positional ( "project" , {
2220 type : "string" ,
2321 describe : "path to start opencode in" ,
@@ -38,12 +36,23 @@ export const TuiThreadCommand = cmd({
3836 describe : "session id to continue" ,
3937 } )
4038 . option ( "prompt" , {
39+ alias : [ "p" ] ,
4140 type : "string" ,
4241 describe : "prompt to use" ,
4342 } )
4443 . option ( "agent" , {
4544 type : "string" ,
4645 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" ,
4756 } ) ,
4857 handler : async ( args ) => {
4958 // Resolve relative paths against PWD to preserve behavior when using --cwd flag
@@ -78,9 +87,10 @@ export const TuiThreadCommand = cmd({
7887 process . on ( "unhandledRejection" , ( e ) => {
7988 Log . Default . error ( e )
8089 } )
81- const config = await Config . get ( )
82- const networkOpts = resolveNetworkOptions ( args , config )
83- const server = await client . call ( "server" , networkOpts )
90+ const server = await client . call ( "server" , {
91+ port : args . port ,
92+ hostname : args . hostname ,
93+ } )
8494 const prompt = await iife ( async ( ) => {
8595 const piped = ! process . stdin . isTTY ? await Bun . stdin . text ( ) : undefined
8696 if ( ! args . prompt ) return piped
0 commit comments