move render_node() to memory.rs
This commit is contained in:
parent
4b4271f618
commit
3e0c6b039f
2 changed files with 7 additions and 8 deletions
|
|
@ -89,13 +89,6 @@ pub fn cmd_node_rename(old_key: &str, new_key: &str) -> Result<(), String> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Render a node to a string: content + deduped footer links.
|
|
||||||
/// Used by both the CLI command and agent placeholders.
|
|
||||||
pub fn render_node(store: &store::Store, key: &str) -> Option<String> {
|
|
||||||
crate::hippocampus::memory::MemoryNode::from_store(store, key)
|
|
||||||
.map(|node| node.render())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn cmd_render(key: &[String]) -> Result<(), String> {
|
pub fn cmd_render(key: &[String]) -> Result<(), String> {
|
||||||
if key.is_empty() {
|
if key.is_empty() {
|
||||||
return Err("render requires a key".into());
|
return Err("render requires a key".into());
|
||||||
|
|
@ -300,4 +293,3 @@ pub fn cmd_lookups(date: Option<&str>) -> Result<(), String> {
|
||||||
resolved.iter().map(|(_, c)| *c as u64).sum::<u64>());
|
resolved.iter().map(|(_, c)| *c as u64).sum::<u64>());
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,3 +91,10 @@ impl MemoryNode {
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Render a node to a string: content + deduped footer links.
|
||||||
|
/// Used by both the CLI command and agent placeholders.
|
||||||
|
pub fn render_node(store: &Store, key: &str) -> Option<String> {
|
||||||
|
crate::hippocampus::memory::MemoryNode::from_store(store, key)
|
||||||
|
.map(|node| node.render())
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue