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