From 25789415a00c98e2c81bb0144cfc431cdb707f0a Mon Sep 17 00:00:00 2001 From: "Anthony D. Mays" Date: Wed, 29 Oct 2025 11:15:07 -0700 Subject: [PATCH] fix: shows the correct config file update path with cli configure (#5195) Signed-off-by: Anthony D. Mays --- crates/goose-cli/src/commands/configure.rs | 51 +++++++++++++++++++--- crates/goose-cli/src/commands/info.rs | 4 +- crates/goose/src/config/permission.rs | 5 +++ 3 files changed, 51 insertions(+), 9 deletions(-) diff --git a/crates/goose-cli/src/commands/configure.rs b/crates/goose-cli/src/commands/configure.rs index d4d4f8f0..bf0ef6a0 100644 --- a/crates/goose-cli/src/commands/configure.rs +++ b/crates/goose-cli/src/commands/configure.rs @@ -10,6 +10,7 @@ use goose::config::extensions::{ get_all_extension_names, get_all_extensions, get_enabled_extensions, get_extension_by_name, name_to_key, remove_extension, set_extension, set_extension_enabled, }; +use goose::config::paths::Paths; use goose::config::permission::PermissionLevel; use goose::config::signup_tetrate::TetrateAuth; use goose::config::{ @@ -195,15 +196,17 @@ pub async fn handle_configure() -> anyhow::Result<()> { } Ok(()) } else { + let config_dir = Paths::config_dir().display().to_string(); + println!(); println!( "{}", - style("This will update your existing config file").dim() + style("This will update your existing config files").dim() ); println!( "{} {}", - style(" if you prefer, you can edit it directly at").dim(), - config.path() + style(" if you prefer, you can edit them directly at").dim(), + config_dir ); println!(); @@ -486,7 +489,7 @@ pub async fn configure_provider_dialog() -> anyhow::Result { } else { config.set_param(&key.name, Value::String(env_value))?; } - let _ = cliclack::log::info(format!("Saved {} to config file", key.name)); + let _ = cliclack::log::info(format!("Saved {} to {}", key.name, config.path())); } } None => { @@ -648,7 +651,7 @@ pub async fn configure_provider_dialog() -> anyhow::Result { // Update config with new values only if the test succeeds config.set_param("GOOSE_PROVIDER", Value::String(provider_name.to_string()))?; config.set_param("GOOSE_MODEL", Value::String(model.clone()))?; - cliclack::outro("Configuration saved successfully")?; + print_config_file_saved()?; Ok(true) } Err(e) => { @@ -709,7 +712,11 @@ pub fn toggle_extensions_dialog() -> anyhow::Result<()> { ); } - cliclack::outro("Extension settings updated successfully")?; + let config = Config::global(); + cliclack::outro(format!( + "Extension settings saved successfully to {}", + config.path() + ))?; Ok(()) } @@ -1123,6 +1130,8 @@ pub fn configure_extensions_dialog() -> anyhow::Result<()> { _ => unreachable!(), }; + print_config_file_saved()?; + Ok(()) } @@ -1178,6 +1187,8 @@ pub fn remove_extension_dialog() -> anyhow::Result<()> { cliclack::outro(format!("Removed {} extension", style(name).green()))?; } + print_config_file_saved()?; + Ok(()) } @@ -1216,6 +1227,8 @@ pub async fn configure_settings_dialog() -> anyhow::Result<()> { ) .interact()?; + let mut should_print_config_path = true; + match setting_type { "goose_mode" => { configure_goose_mode_dialog()?; @@ -1225,6 +1238,8 @@ pub async fn configure_settings_dialog() -> anyhow::Result<()> { } "tool_permission" => { configure_tool_permissions_dialog().await.and(Ok(()))?; + // No need to print config file path since it's already handled. + should_print_config_path = false; } "tool_output" => { configure_tool_output_dialog()?; @@ -1241,6 +1256,10 @@ pub async fn configure_settings_dialog() -> anyhow::Result<()> { _ => unreachable!(), }; + if should_print_config_path { + print_config_file_saved()?; + } + Ok(()) } @@ -1547,6 +1566,11 @@ pub async fn configure_tool_permissions_dialog() -> anyhow::Result<()> { tool.name, permission_label ))?; + cliclack::outro(format!( + "Changes saved to {}", + permission_manager.get_config_path().display() + ))?; + Ok(()) } @@ -1893,5 +1917,18 @@ pub fn configure_custom_provider_dialog() -> anyhow::Result<()> { "add" => add_provider(), "remove" => remove_provider(), _ => unreachable!(), - } + }?; + + print_config_file_saved()?; + + Ok(()) +} + +fn print_config_file_saved() -> anyhow::Result<()> { + let config = Config::global(); + cliclack::outro(format!( + "Configuration saved successfully to {}", + config.path() + ))?; + Ok(()) } diff --git a/crates/goose-cli/src/commands/info.rs b/crates/goose-cli/src/commands/info.rs index baf972d7..0f0debc1 100644 --- a/crates/goose-cli/src/commands/info.rs +++ b/crates/goose-cli/src/commands/info.rs @@ -14,11 +14,11 @@ pub fn handle_info(verbose: bool) -> Result<()> { // Get paths using a stored reference to the global config let config = Config::global(); - let config_file = config.path(); + let config_dir = Paths::config_dir().display().to_string(); // Define the labels and their corresponding path values once. let paths = [ - ("Config file:", config_file.to_string()), + ("Config dir:", config_dir), ("Sessions dir:", sessions_dir.display().to_string()), ("Logs dir:", logs_dir.display().to_string()), ]; diff --git a/crates/goose/src/config/permission.rs b/crates/goose/src/config/permission.rs index 5c184a3e..b2f2b63b 100644 --- a/crates/goose/src/config/permission.rs +++ b/crates/goose/src/config/permission.rs @@ -91,6 +91,11 @@ impl PermissionManager { self.get_permission(SMART_APPROVE_PERMISSION, principal_name) } + /// Retrieves the config file path. + pub fn get_config_path(&self) -> &Path { + self.config_path.as_path() + } + /// Helper function to retrieve the permission level for a specific permission category and tool. fn get_permission(&self, name: &str, principal_name: &str) -> Option { // Check if the permission category exists in the map