From 296807442e5924771a787b234e8bbe2b268f52d7 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Fri, 29 Aug 2025 12:51:28 -0300 Subject: [PATCH] fix: add hostname metadata to response Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) --- src/meta_plugin/hostname.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/meta_plugin/hostname.rs b/src/meta_plugin/hostname.rs index b7baa39..3555044 100644 --- a/src/meta_plugin/hostname.rs +++ b/src/meta_plugin/hostname.rs @@ -237,8 +237,6 @@ impl MetaPlugin for HostnameMetaPlugin { }; } - let metadata = Vec::new(); - // Get the full hostname let full_hostname = self.get_hostname(); let short_hostname = full_hostname.split('.').next().unwrap_or(&full_hostname).to_string(); @@ -263,6 +261,20 @@ impl MetaPlugin for HostnameMetaPlugin { String::new() }; + // Prepare metadata to return + let mut metadata = Vec::new(); + + // Add enabled metadata to the response + if hostname_enabled { + metadata.push(("hostname".to_string(), serde_yaml::Value::String(hostname_value.clone()))); + } + if hostname_full_enabled { + metadata.push(("hostname_full".to_string(), serde_yaml::Value::String(full_hostname.clone()))); + } + if hostname_short_enabled { + metadata.push(("hostname_short".to_string(), serde_yaml::Value::String(short_hostname.clone()))); + } + // Update outputs based on enabled status // Handle hostname output if hostname_enabled { @@ -276,7 +288,7 @@ impl MetaPlugin for HostnameMetaPlugin { // Handle hostname_full output if hostname_full_enabled { if let Some(output_value) = self.outputs.get_mut("hostname_full") { - *output_value = serde_yaml::Value::String(full_hostname.clone()); + *output_value = serde_yaml::Value::String(full_hostname); } } else { self.outputs.insert("hostname_full".to_string(), serde_yaml::Value::Null);