From fc54b8ff8f6c269b75f1761ffc9b52a83303e2f6 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Wed, 27 Aug 2025 21:17:48 -0300 Subject: [PATCH] fix: remove duplicate meta_type and replace meta_name with meta_type Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) --- src/common/status.rs | 2 +- src/meta_plugin/command.rs | 3 +-- src/meta_plugin/mod.rs | 10 +++++++--- src/modes/common.rs | 2 +- src/services/meta_service.rs | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/common/status.rs b/src/common/status.rs index f6c0fec..fd6c280 100644 --- a/src/common/status.rs +++ b/src/common/status.rs @@ -110,7 +110,7 @@ pub fn generate_status_info( // Get meta name first to avoid borrowing issues log::debug!("STATUS: Getting meta name..."); - let meta_name = meta_plugin.meta_name(); + let meta_name = meta_plugin.meta_type().to_string(); log::debug!("STATUS: Got meta name: {}", meta_name); // Note: In status mode we don't have access to actual settings, diff --git a/src/meta_plugin/command.rs b/src/meta_plugin/command.rs index bad88de..a6d1dfb 100644 --- a/src/meta_plugin/command.rs +++ b/src/meta_plugin/command.rs @@ -3,7 +3,7 @@ use std::io::Write; use std::process::{Command, Stdio, Child}; use which::which; -use crate::meta_plugin::{MetaPlugin, MetaPluginResponse}; +use crate::meta_plugin::{MetaPlugin, MetaPluginResponse, MetaPluginType}; pub struct MetaPluginCommand { pub program: String, @@ -23,7 +23,6 @@ impl std::fmt::Debug for MetaPluginCommand { .field("program", &self.program) .field("args", &self.args) .field("supported", &self.supported) - .field("meta_name", &self.meta_name) .field("split_whitespace", &self.split_whitespace) .field("process", &self.process) .field("writer", &"Box") diff --git a/src/meta_plugin/mod.rs b/src/meta_plugin/mod.rs index cebe6fa..7d40134 100644 --- a/src/meta_plugin/mod.rs +++ b/src/meta_plugin/mod.rs @@ -95,6 +95,12 @@ impl BaseMetaPlugin { } impl MetaPlugin for BaseMetaPlugin { + fn meta_type(&self) -> MetaPluginType { + // This is a base implementation, so we need to return something + // This might not be used, but we need to satisfy the trait + MetaPluginType::Binary + } + fn outputs(&self) -> &std::collections::HashMap { &self.outputs } @@ -214,8 +220,6 @@ pub trait MetaPlugin where Self: 'static { is_finalized: true, } } - - fn meta_type(&self) -> MetaPluginType; // Get program information for display in status fn program_info(&self) -> Option<(&str, Vec<&str>)> { @@ -291,7 +295,7 @@ pub fn get_meta_plugin( // For command type, we need to parse the command from options let mut program_name = String::new(); let mut args = Vec::new(); - let meta_name = MetaPluginType::Command.to_string(); + let mut meta_name = MetaPluginType::Command.to_string(); let mut split_whitespace = true; if let Some(opts) = &options { diff --git a/src/modes/common.rs b/src/modes/common.rs index 5417000..c1d56d0 100644 --- a/src/modes/common.rs +++ b/src/modes/common.rs @@ -149,7 +149,7 @@ pub fn settings_meta_plugin_types(cmd: &mut Command, settings: &config::Settings let mut found = false; for meta_plugin_type in MetaPluginType::iter() { let meta_plugin = crate::meta_plugin::get_meta_plugin(meta_plugin_type.clone(), None, None); - if meta_plugin.meta_name() == trimmed_name { + if meta_plugin.meta_type().to_string() == trimmed_name { meta_plugin_types.push(meta_plugin_type); found = true; break; diff --git a/src/services/meta_service.rs b/src/services/meta_service.rs index 60c69d2..db5e48e 100644 --- a/src/services/meta_service.rs +++ b/src/services/meta_service.rs @@ -87,7 +87,7 @@ impl MetaService { let mut output_names: std::collections::HashMap> = std::collections::HashMap::new(); for plugin in plugins.iter() { - let plugin_name = plugin.meta_name(); + let plugin_name = plugin.meta_type().to_string(); // For each plugin, collect all the output names it might write to for (internal_name, output_config) in plugin.outputs() { let output_name = match output_config {