@@ -105,7 +105,16 @@ async fn main() -> Result<()> {
105105 }
106106 }
107107 None => {
108- if args. ui {
108+ // Determine whether to launch the GPUI frontend. The graphical
109+ // interface is the default when compiled in; otherwise we fall
110+ // back to the terminal frontend so the binary stays useful in
111+ // headless builds (e.g. `--no-default-features`).
112+ #[ cfg( feature = "gpui-frontend" ) ]
113+ let use_gpui = !args. tui ;
114+ #[ cfg( not( feature = "gpui-frontend" ) ) ]
115+ let use_gpui = false ;
116+
117+ if use_gpui {
109118 // GPUI mode - use stderr to keep stdout clean
110119 setup_logging ( args. verbose , false ) ;
111120 } else {
@@ -120,7 +129,7 @@ async fn main() -> Result<()> {
120129
121130 // In GUI mode, allow starting without a valid model config
122131 // (the settings screen will guide the user through setup).
123- let model_name = if args . ui {
132+ let model_name = if use_gpui {
124133 args. get_model_name ( ) . unwrap_or_default ( )
125134 } else {
126135 args. get_model_name ( ) ?
@@ -140,18 +149,15 @@ async fn main() -> Result<()> {
140149 sandbox_policy,
141150 } ;
142151
143- if args . ui {
152+ if use_gpui {
144153 #[ cfg( feature = "gpui-frontend" ) ]
145154 {
146155 app:: gpui:: run ( config)
147156 }
148157 #[ cfg( not( feature = "gpui-frontend" ) ) ]
149158 {
150159 let _ = config;
151- anyhow:: bail!(
152- "This binary was built without the GPUI frontend \
153- (feature `gpui-frontend`)"
154- )
160+ unreachable ! ( "use_gpui is only true when the gpui-frontend feature is enabled" )
155161 }
156162 } else {
157163 #[ cfg( feature = "terminal-frontend" ) ]
0 commit comments