Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions crates/goose-cli/src/commands/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,11 @@ pub async fn configure_settings_dialog() -> Result<(), Box<dyn Error>> {
"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 {
Expand All @@ -877,6 +882,9 @@ pub async fn configure_settings_dialog() -> Result<(), Box<dyn Error>> {
"recipe" => {
configure_recipe_dialog()?;
}
"scheduler" => {
configure_scheduler_dialog()?;
}
_ => unreachable!(),
};

Expand Down Expand Up @@ -1227,3 +1235,57 @@ fn configure_recipe_dialog() -> Result<(), Box<dyn Error>> {
}
Ok(())
}

fn configure_scheduler_dialog() -> Result<(), Box<dyn Error>> {
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(&current_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(())
}
Loading