extensions: add a display name field (#1759)

This commit is contained in:
Lily Delalande
2025-03-19 15:42:57 -04:00
committed by GitHub
parent 15f6973bcf
commit 70efaed793
14 changed files with 124 additions and 11 deletions

View File

@@ -10,6 +10,27 @@ use serde_json::{json, Value};
use std::collections::HashMap;
use std::error::Error;
fn get_display_name(extension_id: &str) -> String {
match extension_id {
"developer" => "Developer Tools".to_string(),
"computercontroller" => "Computer Controller".to_string(),
"googledrive" => "Google Drive".to_string(),
"memory" => "Memory".to_string(),
"tutorial" => "Tutorial".to_string(),
"jetbrains" => "JetBrains".to_string(),
// Add other extensions as needed
_ => {
extension_id
.chars()
.next()
.unwrap_or_default()
.to_uppercase()
.collect::<String>()
+ &extension_id[1..]
}
}
}
pub async fn handle_configure() -> Result<(), Box<dyn Error>> {
let config = Config::global();
@@ -39,6 +60,7 @@ pub async fn handle_configure() -> Result<(), Box<dyn Error>> {
enabled: true,
config: ExtensionConfig::Builtin {
name: "developer".to_string(),
display_name: Some(goose::config::DEFAULT_DISPLAY_NAME.to_string()),
timeout: Some(goose::config::DEFAULT_EXTENSION_TIMEOUT),
},
})?;
@@ -464,10 +486,13 @@ pub fn configure_extensions_dialog() -> Result<(), Box<dyn Error>> {
})
.interact()?;
let display_name = get_display_name(&extension);
ExtensionManager::set(ExtensionEntry {
enabled: true,
config: ExtensionConfig::Builtin {
name: extension.clone(),
display_name: Some(display_name),
timeout: Some(timeout),
},
})?;