feat: update CwdMetaPlugin to use new MetaPluginResponse interface

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-26 17:14:22 -03:00
parent 13ea7159e3
commit 5661b78919

View File

@@ -57,29 +57,44 @@ impl MetaPlugin for CwdMetaPlugin {
true
}
fn finalize(&mut self) -> Result<MetaPluginResponse> {
// Since we save during initialize(), return Ok to avoid duplicate saves
Ok(MetaPluginResponse::default())
fn finalize(&mut self) -> MetaPluginResponse {
MetaPluginResponse {
metadata: Vec::new(),
is_finalized: true,
}
}
fn update(&mut self, _data: &[u8]) -> Result<PluginResponse> {
// No update needed
Ok(PluginResponse::default())
fn update(&mut self, _data: &[u8]) -> MetaPluginResponse {
MetaPluginResponse {
metadata: Vec::new(),
is_finalized: false,
}
}
fn meta_name(&self) -> String {
self.meta_name.clone()
}
fn initialize(&mut self, conn: &Connection, item_id: i64) -> Result<MetaPluginResponse> {
fn initialize(&mut self) -> MetaPluginResponse {
let mut metadata = Vec::new();
let cwd = match env::current_dir() {
Ok(path) => path.to_string_lossy().to_string(),
Err(_) => "unknown".to_string(),
};
// Use central output handler
self.save_meta(conn, item_id, "cwd", cwd)?;
self.is_saved = true;
Ok(())
// Use process_metadata_outputs to handle output mapping
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
"cwd",
cwd,
&self.outputs
) {
metadata.push(meta_data);
}
MetaPluginResponse {
metadata,
is_finalized: false,
}
}
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {