diff --git a/src/extensions/discovery.rs b/src/extensions/discovery.rs index 04cb366b..721c8ed7 100644 --- a/src/extensions/discovery.rs +++ b/src/extensions/discovery.rs @@ -50,14 +50,14 @@ impl OnlineDiscovery { let mut candidates: Vec = Vec::new(); for entry in patterns { - let url = extract_url(&entry.source); + let url = extract_source(&entry.source); if seen_urls.insert(url) { candidates.push(entry); } } for entry in github.unwrap_or_default() { - let url = extract_url(&entry.source); + let url = extract_source(&entry.source); if seen_urls.insert(url) { candidates.push(entry); } @@ -242,12 +242,12 @@ async fn with_timeout( tokio::time::timeout(duration, future).await.ok() } -fn extract_url(source: &ExtensionSource) -> String { +fn extract_source(source: &ExtensionSource) -> String { match source { ExtensionSource::McpUrl { url } => url.clone(), ExtensionSource::Discovered { url } => url.clone(), ExtensionSource::WasmDownload { wasm_url, .. } => wasm_url.clone(), - ExtensionSource::WasmBuildable { repo_url, .. } => repo_url.clone(), + ExtensionSource::WasmBuildable { source_dir, .. } => source_dir.clone(), } } @@ -286,7 +286,7 @@ struct GitHubRepo { mod tests { use crate::extensions::ExtensionSource; use crate::extensions::discovery::{ - OnlineDiscovery, extract_url, titlecase, validate_mcp_url_with_client, + OnlineDiscovery, extract_source, titlecase, validate_mcp_url_with_client, }; #[test] @@ -297,16 +297,16 @@ mod tests { } #[test] - fn test_extract_url() { + fn test_extract_source() { let mcp = ExtensionSource::McpUrl { url: "https://mcp.notion.com".to_string(), }; - assert_eq!(extract_url(&mcp), "https://mcp.notion.com"); + assert_eq!(extract_source(&mcp), "https://mcp.notion.com"); let discovered = ExtensionSource::Discovered { url: "https://example.com".to_string(), }; - assert_eq!(extract_url(&discovered), "https://example.com"); + assert_eq!(extract_source(&discovered), "https://example.com"); } #[tokio::test] diff --git a/src/extensions/manager.rs b/src/extensions/manager.rs index e2c11077..ee79c1d0 100644 --- a/src/extensions/manager.rs +++ b/src/extensions/manager.rs @@ -2743,7 +2743,7 @@ mod tests { fn make_fallback_source() -> Option> { Some(Box::new(ExtensionSource::WasmBuildable { - repo_url: "tools-src/test".to_string(), + source_dir: "tools-src/test".to_string(), build_dir: Some("tools-src/test".to_string()), crate_name: Some("test-tool".to_string()), })) diff --git a/src/extensions/mod.rs b/src/extensions/mod.rs index 15b913d9..c0d45c90 100644 --- a/src/extensions/mod.rs +++ b/src/extensions/mod.rs @@ -83,9 +83,10 @@ pub enum ExtensionSource { #[serde(default)] capabilities_url: Option, }, - /// Build from source repository. + /// Build from local source directory. WasmBuildable { - repo_url: String, + #[serde(alias = "repo_url")] + source_dir: String, #[serde(default)] build_dir: Option, /// Crate name used to locate the build artifact binary. diff --git a/src/extensions/registry.rs b/src/extensions/registry.rs index 40f320e3..14fa63bc 100644 --- a/src/extensions/registry.rs +++ b/src/extensions/registry.rs @@ -605,7 +605,7 @@ mod tests { description: "Telegram Bot API channel".to_string(), keywords: vec!["messaging".into(), "bot".into()], source: ExtensionSource::WasmBuildable { - repo_url: "channels-src/telegram".to_string(), + source_dir: "channels-src/telegram".to_string(), build_dir: Some("channels-src/telegram".to_string()), crate_name: Some("telegram-channel".to_string()), }, @@ -620,7 +620,7 @@ mod tests { description: "Slack WASM tool".to_string(), keywords: vec!["messaging".into()], source: ExtensionSource::WasmBuildable { - repo_url: "tools-src/slack".to_string(), + source_dir: "tools-src/slack".to_string(), build_dir: Some("tools-src/slack".to_string()), crate_name: Some("slack-tool".to_string()), }, @@ -683,7 +683,7 @@ mod tests { description: "Telegram MTProto tool".to_string(), keywords: vec!["messaging".into()], source: ExtensionSource::WasmBuildable { - repo_url: "tools-src/telegram".to_string(), + source_dir: "tools-src/telegram".to_string(), build_dir: Some("tools-src/telegram".to_string()), crate_name: Some("telegram-tool".to_string()), }, @@ -697,7 +697,7 @@ mod tests { description: "Telegram Bot API channel".to_string(), keywords: vec!["messaging".into(), "bot".into()], source: ExtensionSource::WasmBuildable { - repo_url: "channels-src/telegram".to_string(), + source_dir: "channels-src/telegram".to_string(), build_dir: Some("channels-src/telegram".to_string()), crate_name: Some("telegram-channel".to_string()), }, @@ -759,7 +759,7 @@ mod tests { description: "A cached tool".to_string(), keywords: vec![], source: ExtensionSource::WasmBuildable { - repo_url: "tools-src/cached".to_string(), + source_dir: "tools-src/cached".to_string(), build_dir: None, crate_name: None, }, @@ -773,7 +773,7 @@ mod tests { description: "A cached channel".to_string(), keywords: vec![], source: ExtensionSource::WasmBuildable { - repo_url: "channels-src/cached".to_string(), + source_dir: "channels-src/cached".to_string(), build_dir: None, crate_name: None, }, @@ -816,7 +816,7 @@ mod tests { description: "Telegram messaging channel".to_string(), keywords: vec!["messaging".into()], source: ExtensionSource::WasmBuildable { - repo_url: "channels-src/telegram".to_string(), + source_dir: "channels-src/telegram".to_string(), build_dir: None, crate_name: None, }, @@ -830,7 +830,7 @@ mod tests { description: "Telegram API tool".to_string(), keywords: vec!["messaging".into()], source: ExtensionSource::WasmBuildable { - repo_url: "tools-src/telegram".to_string(), + source_dir: "tools-src/telegram".to_string(), build_dir: None, crate_name: None, }, @@ -878,7 +878,7 @@ mod tests { description: "Channel".to_string(), keywords: vec![], source: ExtensionSource::WasmBuildable { - repo_url: "x".to_string(), + source_dir: "x".to_string(), build_dir: None, crate_name: None, }, @@ -892,7 +892,7 @@ mod tests { description: "Tool".to_string(), keywords: vec![], source: ExtensionSource::WasmBuildable { - repo_url: "y".to_string(), + source_dir: "y".to_string(), build_dir: None, crate_name: None, }, diff --git a/src/registry/manifest.rs b/src/registry/manifest.rs index de84aa31..495bb8c6 100644 --- a/src/registry/manifest.rs +++ b/src/registry/manifest.rs @@ -155,7 +155,7 @@ impl ExtensionManifest { /// extension discovery system. pub fn to_registry_entry(&self) -> RegistryEntry { let buildable = ExtensionSource::WasmBuildable { - repo_url: self.source.dir.clone(), + source_dir: self.source.dir.clone(), build_dir: Some(self.source.dir.clone()), crate_name: Some(self.source.crate_name.clone()), };