This repository was archived by the owner on Apr 1, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
packages/opencode/src/cli/cmd/tui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,6 +30,9 @@ import { TuiEvent } from "./event"
3030import { KVProvider , useKV } from "./context/kv"
3131
3232async function getTerminalBackgroundColor ( ) : Promise < "dark" | "light" > {
33+ // can't set raw mode if not a TTY
34+ if ( ! process . stdin . isTTY ) return "dark"
35+
3336 return new Promise ( ( resolve ) => {
3437 let timeout : NodeJS . Timeout
3538
Original file line number Diff line number Diff line change @@ -52,6 +52,12 @@ export const TuiThreadCommand = cmd({
5252 default : "127.0.0.1" ,
5353 } ) ,
5454 handler : async ( args ) => {
55+ const prompt = await ( async ( ) => {
56+ const piped = ! process . stdin . isTTY ? await Bun . stdin . text ( ) : undefined
57+ if ( ! args . prompt ) return piped
58+ return piped ? piped + "\n" + args . prompt : args . prompt
59+ } ) ( )
60+
5561 const cwd = args . project ? path . resolve ( args . project ) : process . cwd ( )
5662 try {
5763 process . chdir ( cwd )
@@ -106,7 +112,7 @@ export const TuiThreadCommand = cmd({
106112 sessionID,
107113 model : args . model ,
108114 agent : args . agent ,
109- prompt : args . prompt ,
115+ prompt,
110116 onExit : async ( ) => {
111117 await client . call ( "shutdown" , undefined )
112118 } ,
You can’t perform that action at this time.
0 commit comments