From aabfb2fca65c5ffb4ce698f246b5d2378d766b6c Mon Sep 17 00:00:00 2001 From: Max Novich Date: Fri, 27 Jun 2025 09:39:22 -0700 Subject: [PATCH] add scheduler type setting (#3119) --- crates/goose-cli/src/commands/configure.rs | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/crates/goose-cli/src/commands/configure.rs b/crates/goose-cli/src/commands/configure.rs index 47ca545b..f6180fd3 100644 --- a/crates/goose-cli/src/commands/configure.rs +++ b/crates/goose-cli/src/commands/configure.rs @@ -856,6 +856,11 @@ pub async fn configure_settings_dialog() -> Result<(), Box> { "Goose recipe github repo", "Goose will pull recipes from this repo if not found locally.", ) + .item( + "scheduler", + "Scheduler Type", + "Choose between built-in cron scheduler or Temporal workflow engine", + ) .interact()?; match setting_type { @@ -877,6 +882,9 @@ pub async fn configure_settings_dialog() -> Result<(), Box> { "recipe" => { configure_recipe_dialog()?; } + "scheduler" => { + configure_scheduler_dialog()?; + } _ => unreachable!(), }; @@ -1227,3 +1235,57 @@ fn configure_recipe_dialog() -> Result<(), Box> { } Ok(()) } + +fn configure_scheduler_dialog() -> Result<(), Box> { + let config = Config::global(); + + // Check if GOOSE_SCHEDULER_TYPE is set as an environment variable + if std::env::var("GOOSE_SCHEDULER_TYPE").is_ok() { + let _ = cliclack::log::info("Notice: GOOSE_SCHEDULER_TYPE environment variable is set and will override the configuration here."); + } + + // Get current scheduler type from config for display + let current_scheduler: String = config + .get_param("GOOSE_SCHEDULER_TYPE") + .unwrap_or_else(|_| "legacy".to_string()); + + println!( + "Current scheduler type: {}", + style(¤t_scheduler).cyan() + ); + + let scheduler_type = cliclack::select("Which scheduler type would you like to use?") + .items(&[ + ("legacy", "Built-in Cron (Default)", "Uses Goose's built-in cron scheduler. Simple and reliable for basic scheduling needs."), + ("temporal", "Temporal", "Uses Temporal workflow engine for advanced scheduling features. Requires Temporal CLI to be installed.") + ]) + .interact()?; + + match scheduler_type { + "legacy" => { + config.set_param("GOOSE_SCHEDULER_TYPE", Value::String("legacy".to_string()))?; + cliclack::outro( + "Set to Built-in Cron scheduler - simple and reliable for basic scheduling", + )?; + } + "temporal" => { + config.set_param( + "GOOSE_SCHEDULER_TYPE", + Value::String("temporal".to_string()), + )?; + cliclack::outro( + "Set to Temporal scheduler - advanced workflow engine for complex scheduling", + )?; + println!(); + println!("📋 {}", style("Note:").bold()); + println!(" • Temporal scheduler requires Temporal CLI to be installed"); + println!(" • macOS: brew install temporal"); + println!(" • Linux/Windows: https://github.com/temporalio/cli/releases"); + println!(" • If Temporal is unavailable, Goose will automatically fall back to the built-in scheduler"); + println!(" • The scheduling engines do not share the list of schedules"); + } + _ => unreachable!(), + }; + + Ok(()) +}