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
let extension_status: Vec<(String, bool)> = extensions
let mut extension_status: Vec<(String, bool)> = extensions
.iter()
.map(|entry| (entry.config.name().to_string(), entry.enabled))
.collect();
// Sort extensions alphabetically by name
extension_status.sort_by(|a, b| a.0.cmp(&b.0));
// Get currently enabled extensions for the selection
let enabled_extensions: Vec<&String> = extension_status
.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
"built-in" => {
let extension = cliclack::select("Which built-in extension would you like to enable?")
.item(
"developer",
"Developer Tools",
"Code editing and shell access",
)
.item(
"computercontroller",
"Computer Controller",
"controls for webscraping, file caching, and automations",
)
.item(
"developer",
"Developer Tools",
"Code editing and shell access",
)
.item(
"googledrive",
"Google Drive",
"Search and read content from google drive - additional config required",
)
.item("jetbrains", "JetBrains", "Connect to jetbrains IDEs")
.item(
"memory",
"Memory",
@@ -528,7 +532,6 @@ pub fn configure_extensions_dialog() -> Result<(), Box<dyn Error>> {
"Tutorial",
"Access interactive tutorials and guides",
)
.item("jetbrains", "JetBrains", "Connect to jetbrains IDEs")
.interact()?
.to_string();
@@ -773,11 +776,14 @@ pub fn remove_extension_dialog() -> Result<(), Box<dyn Error>> {
let extensions = ExtensionConfigManager::get_all()?;
// 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()
.map(|entry| (entry.config.name().to_string(), entry.enabled))
.collect();
// Sort extensions alphabetically by name
extension_status.sort_by(|a, b| a.0.cmp(&b.0));
if extensions.is_empty() {
cliclack::outro(
"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();
extensions.push("platform".to_string());
// Sort extensions alphabetically by name
extensions.sort();
let selected_extension_name = cliclack::select("Choose an extension to configure tools")
.items(
&extensions