feat: alphabetize extensions in goose CLI (#2966)

This commit is contained in:
Best Codes
2025-06-17 18:03:38 -05:00
committed by GitHub
parent 8483d0136c
commit 0f09bbcbaa

View File

@@ -442,11 +442,14 @@ pub fn toggle_extensions_dialog() -> Result<(), Box<dyn Error>> {
} }
// Create a list of extension names and their enabled status // Create a list of extension names and their enabled status
let extension_status: Vec<(String, bool)> = extensions let mut extension_status: Vec<(String, bool)> = extensions
.iter() .iter()
.map(|entry| (entry.config.name().to_string(), entry.enabled)) .map(|entry| (entry.config.name().to_string(), entry.enabled))
.collect(); .collect();
// Sort extensions alphabetically by name
extension_status.sort_by(|a, b| a.0.cmp(&b.0));
// Get currently enabled extensions for the selection // Get currently enabled extensions for the selection
let enabled_extensions: Vec<&String> = extension_status let enabled_extensions: Vec<&String> = extension_status
.iter() .iter()
@@ -503,21 +506,22 @@ pub fn configure_extensions_dialog() -> Result<(), Box<dyn Error>> {
// TODO we'll want a place to collect all these options, maybe just an enum in goose-mcp // TODO we'll want a place to collect all these options, maybe just an enum in goose-mcp
"built-in" => { "built-in" => {
let extension = cliclack::select("Which built-in extension would you like to enable?") let extension = cliclack::select("Which built-in extension would you like to enable?")
.item(
"developer",
"Developer Tools",
"Code editing and shell access",
)
.item( .item(
"computercontroller", "computercontroller",
"Computer Controller", "Computer Controller",
"controls for webscraping, file caching, and automations", "controls for webscraping, file caching, and automations",
) )
.item(
"developer",
"Developer Tools",
"Code editing and shell access",
)
.item( .item(
"googledrive", "googledrive",
"Google Drive", "Google Drive",
"Search and read content from google drive - additional config required", "Search and read content from google drive - additional config required",
) )
.item("jetbrains", "JetBrains", "Connect to jetbrains IDEs")
.item( .item(
"memory", "memory",
"Memory", "Memory",
@@ -528,7 +532,6 @@ pub fn configure_extensions_dialog() -> Result<(), Box<dyn Error>> {
"Tutorial", "Tutorial",
"Access interactive tutorials and guides", "Access interactive tutorials and guides",
) )
.item("jetbrains", "JetBrains", "Connect to jetbrains IDEs")
.interact()? .interact()?
.to_string(); .to_string();
@@ -773,11 +776,14 @@ pub fn remove_extension_dialog() -> Result<(), Box<dyn Error>> {
let extensions = ExtensionConfigManager::get_all()?; let extensions = ExtensionConfigManager::get_all()?;
// Create a list of extension names and their enabled status // Create a list of extension names and their enabled status
let extension_status: Vec<(String, bool)> = extensions let mut extension_status: Vec<(String, bool)> = extensions
.iter() .iter()
.map(|entry| (entry.config.name().to_string(), entry.enabled)) .map(|entry| (entry.config.name().to_string(), entry.enabled))
.collect(); .collect();
// Sort extensions alphabetically by name
extension_status.sort_by(|a, b| a.0.cmp(&b.0));
if extensions.is_empty() { if extensions.is_empty() {
cliclack::outro( cliclack::outro(
"No extensions configured yet. Run configure and add some extensions first.", "No extensions configured yet. Run configure and add some extensions first.",
@@ -1052,6 +1058,9 @@ pub async fn configure_tool_permissions_dialog() -> Result<(), Box<dyn Error>> {
.collect(); .collect();
extensions.push("platform".to_string()); extensions.push("platform".to_string());
// Sort extensions alphabetically by name
extensions.sort();
let selected_extension_name = cliclack::select("Choose an extension to configure tools") let selected_extension_name = cliclack::select("Choose an extension to configure tools")
.items( .items(
&extensions &extensions