From dd5600fb30f28f1390cebdeb288041eb1aad3cc7 Mon Sep 17 00:00:00 2001 From: Wendy Tang Date: Thu, 20 Feb 2025 13:38:15 -0800 Subject: [PATCH] goose modes --- crates/goose-cli/src/commands/configure.rs | 75 ++++++++++++++++++++-- 1 file changed, 70 insertions(+), 5 deletions(-) diff --git a/crates/goose-cli/src/commands/configure.rs b/crates/goose-cli/src/commands/configure.rs index c57f23ce0..7ccbe13a6 100644 --- a/crates/goose-cli/src/commands/configure.rs +++ b/crates/goose-cli/src/commands/configure.rs @@ -151,9 +151,9 @@ pub async fn handle_configure() -> Result<(), Box> { ) .item("remove", "Remove Extension", "Remove an extension") .item( - "tool_output", - "Adjust Tool Output", - "Show more or less tool output", + "settings", + "Adjust Goose Settings", + "Set the Goose Mode, Tool Output, and more", ) .interact()?; @@ -161,7 +161,7 @@ pub async fn handle_configure() -> Result<(), Box> { "toggle" => toggle_extensions_dialog(), "add" => configure_extensions_dialog(), "remove" => remove_extension_dialog(), - "tool_output" => configure_tool_output_dialog(), + "settings" => configure_settings_dialog(), "providers" => configure_provider_dialog().await.and(Ok(())), _ => unreachable!(), } @@ -621,12 +621,77 @@ pub fn remove_extension_dialog() -> Result<(), Box> { Ok(()) } +pub fn configure_settings_dialog() -> Result<(), Box> { + let setting_type = cliclack::select("What setting would you like to configure?") + .item( + "goose_mode", + "Goose Mode", + "Configure Goose mode", + ) + .item( + "tool_output", + "Tool Output", + "Show more or less tool output", + ) + .interact()?; + + match setting_type { + "goose_mode" => { + configure_goose_mode_dialog()?; + } + "tool_output" => { + configure_tool_output_dialog()?; + } + _ => unreachable!(), + }; + + Ok(()) +} + +pub fn configure_goose_mode_dialog() -> Result<(), Box> { + let config = Config::global(); + let mode = cliclack::select("Which Goose mode would you like to configure?") + .item( + "auto", + "Auto Mode", + "Full file modification, extension usage, edit, create and delete files freely" + ) + .item( + "approve", + "Approve Mode", + "Editing, creating, deleting files and using extensions will require human approval" + ) + .item( + "chat", + "Chat Mode", + "Engage with the selected provider without using tools, extensions, or file modification" + ) + .interact()?; + + match mode { + "auto" => { + config.set("GOOSE_MODE", Value::String("auto".to_string()))?; + cliclack::outro("Set to Auto Mode - full file modification enabled")?; + } + "approve" => { + config.set("GOOSE_MODE", Value::String("approve".to_string()))?; + cliclack::outro("Set to Approve Mode - modifications require approval")?; + } + "chat" => { + config.set("GOOSE_MODE", Value::String("chat".to_string()))?; + cliclack::outro("Set to Chat Mode - no tools or modifications enabled")?; + } + _ => unreachable!(), + }; + Ok(()) +} + pub fn configure_tool_output_dialog() -> Result<(), Box> { let config = Config::global(); let tool_log_level = cliclack::select("Which tool output would you like to show?") .item("high", "High Importance", "") .item("medium", "Medium Importance", "Ex. results of file-writes") - .item("all", "All", "Ex. shell command output") + .item("all", "All (default)", "Ex. shell command output") .interact()?; match tool_log_level {