@@ -592,6 +592,37 @@ enum SchedulerCommand {
592592 CronHelp { } ,
593593}
594594
595+ #[ derive( Subcommand ) ]
596+ enum GatewayCommand {
597+ #[ command( about = "Show gateway status" ) ]
598+ Status { } ,
599+
600+ #[ command( about = "Start a gateway" ) ]
601+ Start {
602+ #[ arg( help = "Gateway type (e.g., 'telegram')" ) ]
603+ gateway_type : String ,
604+
605+ #[ arg(
606+ long = "bot-token" ,
607+ help = "Bot token for the gateway platform" ,
608+ long_help = "Authentication token for the gateway platform (e.g., Telegram bot token)"
609+ ) ]
610+ bot_token : String ,
611+ } ,
612+
613+ #[ command( about = "Stop a running gateway" ) ]
614+ Stop {
615+ #[ arg( help = "Gateway type to stop (e.g., 'telegram')" ) ]
616+ gateway_type : String ,
617+ } ,
618+
619+ #[ command( about = "Generate a pairing code for a gateway" ) ]
620+ Pair {
621+ #[ arg( help = "Gateway type to generate pairing code for" ) ]
622+ gateway_type : String ,
623+ } ,
624+ }
625+
595626#[ derive( Subcommand ) ]
596627enum RecipeCommand {
597628 /// Validate a recipe file
@@ -785,6 +816,16 @@ enum Command {
785816 command : SchedulerCommand ,
786817 } ,
787818
819+ /// Manage gateways for external platform integrations (e.g., Telegram)
820+ #[ command(
821+ about = "Manage gateways for external platform integrations" ,
822+ visible_alias = "gw"
823+ ) ]
824+ Gateway {
825+ #[ command( subcommand) ]
826+ command : GatewayCommand ,
827+ } ,
828+
788829 /// Update the goose CLI version
789830 #[ command( about = "Update the goose CLI version" ) ]
790831 Update {
@@ -959,6 +1000,7 @@ fn get_command_name(command: &Option<Command>) -> &'static str {
9591000 Some ( Command :: Project { } ) => "project" ,
9601001 Some ( Command :: Projects ) => "projects" ,
9611002 Some ( Command :: Run { .. } ) => "run" ,
1003+ Some ( Command :: Gateway { .. } ) => "gateway" ,
9621004 Some ( Command :: Schedule { .. } ) => "schedule" ,
9631005 Some ( Command :: Update { .. } ) => "update" ,
9641006 Some ( Command :: Recipe { .. } ) => "recipe" ,
@@ -1350,6 +1392,23 @@ async fn handle_run_command(
13501392 }
13511393}
13521394
1395+ async fn handle_gateway_command ( command : GatewayCommand ) -> Result < ( ) > {
1396+ use crate :: commands:: gateway;
1397+
1398+ match command {
1399+ GatewayCommand :: Status { } => gateway:: handle_gateway_status ( ) . await ,
1400+ GatewayCommand :: Start {
1401+ gateway_type,
1402+ bot_token,
1403+ } => {
1404+ let platform_config = serde_json:: json!( { "bot_token" : bot_token } ) ;
1405+ gateway:: handle_gateway_start ( gateway_type, platform_config) . await
1406+ }
1407+ GatewayCommand :: Stop { gateway_type } => gateway:: handle_gateway_stop ( gateway_type) . await ,
1408+ GatewayCommand :: Pair { gateway_type } => gateway:: handle_gateway_pair ( gateway_type) . await ,
1409+ }
1410+ }
1411+
13531412async fn handle_schedule_command ( command : SchedulerCommand ) -> Result < ( ) > {
13541413 match command {
13551414 SchedulerCommand :: Add {
@@ -1513,6 +1572,7 @@ pub async fn cli() -> anyhow::Result<()> {
15131572 )
15141573 . await
15151574 }
1575+ Some ( Command :: Gateway { command } ) => handle_gateway_command ( command) . await ,
15161576 Some ( Command :: Schedule { command } ) => handle_schedule_command ( command) . await ,
15171577 Some ( Command :: Update {
15181578 canary,
0 commit comments