diff --git a/src/core/error.rs b/src/core/error.rs index 9e21fb7..90202f1 100644 --- a/src/core/error.rs +++ b/src/core/error.rs @@ -30,7 +30,7 @@ pub enum CoreError { impl From for CoreError { fn from(err: rusqlite_migration::Error) -> Self { match err { - rusqlite_migration::Error::Rusqlite(e) => CoreError::Database(e), + rusqlite_migration::Error::RusqliteError(e) => CoreError::Database(e), e => CoreError::Other(e.into()), } } diff --git a/src/modes/info.rs b/src/modes/info.rs index bf61d29..a5689c8 100644 --- a/src/modes/info.rs +++ b/src/modes/info.rs @@ -154,9 +154,10 @@ fn show_item_structured( data_path: PathBuf, output_format: OutputFormat, ) -> Result<()> { + let item_tags: Vec = item_with_meta.tags.iter().map(|t| t.name.clone()).collect(); + let meta_map = item_with_meta.meta_as_map(); let item = item_with_meta.item; let item_id = item.id.unwrap(); - let item_tags: Vec = item_with_meta.tags.iter().map(|t| t.name.clone()).collect(); let mut item_path_buf = data_path.clone(); item_path_buf.push(item_id.to_string()); @@ -172,8 +173,6 @@ fn show_item_structured( None => "Missing".to_string(), }; - let meta_map = item_with_meta.meta_as_map(); - let item_info = ItemInfo { id: item_id, timestamp: item diff --git a/src/modes/list.rs b/src/modes/list.rs index 7eac340..2eb678a 100644 --- a/src/modes/list.rs +++ b/src/modes/list.rs @@ -70,9 +70,9 @@ pub fn mode_list( table.set_titles(title_row); for item_with_meta in items_with_meta { - let item = item_with_meta.item; let tags: Vec = item_with_meta.tags.iter().map(|t| t.name.clone()).collect(); let meta = item_with_meta.meta_as_map(); + let item = item_with_meta.item; let mut item_path = data_path.clone(); item_path.push(item.id.unwrap().to_string()); @@ -295,10 +295,10 @@ fn show_list_structured( let mut list_items = Vec::new(); for item_with_meta in items_with_meta { - let item = item_with_meta.item; - let item_id = item.id.unwrap(); let tags: Vec = item_with_meta.tags.iter().map(|t| t.name.clone()).collect(); let meta = item_with_meta.meta_as_map(); + let item = item_with_meta.item; + let item_id = item.id.unwrap(); let mut item_path = data_path.clone(); item_path.push(item_id.to_string()); diff --git a/src/modes/server/mcp/tools.rs b/src/modes/server/mcp/tools.rs index 31a9548..fddd4b2 100644 --- a/src/modes/server/mcp/tools.rs +++ b/src/modes/server/mcp/tools.rs @@ -98,10 +98,10 @@ impl KeepTools { Err(e) => return Err(ToolError::Other(anyhow::Error::from(e))), }; - let item = item_with_content.item_with_meta.item; let content = String::from_utf8_lossy(&item_with_content.content).to_string(); let tags: Vec = item_with_content.item_with_meta.tags.iter().map(|t| t.name.clone()).collect(); let metadata = item_with_content.item_with_meta.meta_as_map(); + let item = item_with_content.item_with_meta.item; let response = serde_json::json!({ "id": item_id, @@ -135,10 +135,10 @@ impl KeepTools { let item_id = item_with_meta.item.id.ok_or_else(|| anyhow!("Item missing ID after find"))?; let item_with_content = service.get_item_content(item_id).await.map_err(|e| ToolError::Other(anyhow::Error::from(e)))?; - let item = item_with_content.item_with_meta.item; let content = String::from_utf8_lossy(&item_with_content.content).to_string(); let tags: Vec = item_with_content.item_with_meta.tags.iter().map(|t| t.name.clone()).collect(); let metadata = item_with_content.item_with_meta.meta_as_map(); + let item = item_with_content.item_with_meta.item; let response = serde_json::json!({ "id": item_id, @@ -181,10 +181,10 @@ impl KeepTools { let items_info: Vec<_> = items_with_meta .into_iter() .map(|item_with_meta| { - let item = item_with_meta.item; - let item_id = item.id.unwrap_or(0); let item_tags: Vec = item_with_meta.tags.iter().map(|t| t.name.clone()).collect(); let item_meta = item_with_meta.meta_as_map(); + let item = item_with_meta.item; + let item_id = item.id.unwrap_or(0); serde_json::json!({ "id": item_id, @@ -233,10 +233,10 @@ impl KeepTools { let items_info: Vec<_> = items_with_meta .into_iter() .map(|item_with_meta| { - let item = item_with_meta.item; - let item_id = item.id.unwrap_or(0); let item_tags: Vec = item_with_meta.tags.iter().map(|t| t.name.clone()).collect(); let item_meta = item_with_meta.meta_as_map(); + let item = item_with_meta.item; + let item_id = item.id.unwrap_or(0); serde_json::json!({ "id": item_id,