@@ -65,6 +65,7 @@ use fig_util::{
6565 system_info,
6666} ;
6767use internal:: InternalSubcommand ;
68+ use macos_utils:: bundle:: get_bundle_path_for_executable;
6869use serde:: Serialize ;
6970use tokio:: signal:: ctrl_c;
7071use tracing:: {
@@ -195,14 +196,16 @@ pub enum CliRootCommands {
195196 /// Open the dashboard
196197 Dashboard ,
197198 /// AI assistant in your terminal
199+ #[ command( disable_help_flag = true ) ]
198200 Chat {
199- /// Args for the chat command
201+ /// Args for the chat subcommand
200202 #[ arg( trailing_var_arg = true , allow_hyphen_values = true ) ]
201203 args : Vec < String > ,
202204 } ,
203205 /// Model Context Protocol (MCP)
206+ #[ command( disable_help_flag = true ) ]
204207 Mcp {
205- /// Args for the MCP subcommand (passed through to `qchat mcp …`)
208+ /// Args for the MCP subcommand
206209 #[ arg( trailing_var_arg = true , allow_hyphen_values = true ) ]
207210 args : Vec < String > ,
208211 } ,
@@ -351,8 +354,20 @@ impl Cli {
351354 CliRootCommands :: Telemetry ( subcommand) => subcommand. execute ( ) . await ,
352355 CliRootCommands :: Version { changelog } => Self :: print_version ( changelog) ,
353356 CliRootCommands :: Dashboard => launch_dashboard ( false ) . await ,
354- CliRootCommands :: Chat { args } => Self :: execute_chat ( "chat" , Some ( args) , true ) . await ,
355- CliRootCommands :: Mcp { args } => Self :: execute_chat ( "mcp" , Some ( args) , true ) . await ,
357+ CliRootCommands :: Chat { args } => {
358+ if args. iter ( ) . any ( |arg| [ "--help" , "-h" ] . contains ( & arg. as_str ( ) ) ) {
359+ return Self :: execute_chat ( "chat" , Some ( vec ! [ "--help" . to_owned( ) ] ) , false ) . await ;
360+ }
361+
362+ Self :: execute_chat ( "chat" , Some ( args) , true ) . await
363+ } ,
364+ CliRootCommands :: Mcp { args } => {
365+ if args. iter ( ) . any ( |arg| [ "--help" , "-h" ] . contains ( & arg. as_str ( ) ) ) {
366+ return Self :: execute_chat ( "mcp" , Some ( vec ! [ "--help" . to_owned( ) ] ) , false ) . await ;
367+ }
368+
369+ Self :: execute_chat ( "mcp" , Some ( args) , true ) . await
370+ } ,
356371 CliRootCommands :: Inline ( subcommand) => subcommand. execute ( & cli_context) . await ,
357372 } ,
358373 // Root command
@@ -361,6 +376,14 @@ impl Cli {
361376 }
362377
363378 pub async fn execute_chat ( subcmd : & str , args : Option < Vec < String > > , enforce_login : bool ) -> Result < ExitCode > {
379+ cfg_if:: cfg_if! {
380+ if #[ cfg( target_os = "macos" ) ] {
381+ let path = get_bundle_path_for_executable( CHAT_BINARY_NAME ) . unwrap_or( home_local_bin( ) ?. join( CHAT_BINARY_NAME ) ) ;
382+ } else {
383+ let path = home_local_bin( ) ?. join( CHAT_BINARY_NAME ) ;
384+ }
385+ }
386+
364387 if enforce_login {
365388 assert_logged_in ( ) . await ?;
366389 }
@@ -376,7 +399,7 @@ impl Cli {
376399 }
377400 }
378401
379- let mut cmd = tokio:: process:: Command :: new ( home_local_bin ( ) ? . join ( CHAT_BINARY_NAME ) ) ;
402+ let mut cmd = tokio:: process:: Command :: new ( & path ) ;
380403 cmd. arg ( subcmd) ;
381404 if let Some ( args) = args {
382405 cmd. args ( args) ;
0 commit comments