(node: &MemoryNode)
| 269 | } |
| 270 | |
| 271 | fn render_memory_cli(node: &MemoryNode) -> String { |
| 272 | let mut s = String::new(); |
| 273 | |
| 274 | // Header: memory kind + @id. |
| 275 | s.push_str(&format!("Memory ({}) {}\n", node.memory_kind, node.id)); |
| 276 | s.push_str(&"─".repeat(48)); |
| 277 | s.push('\n'); |
| 278 | |
| 279 | // Status is REGENERATED here from the spine, never read from prose. |
| 280 | s.push_str(&format!("Status: {}\n", node.status)); |
| 281 | |
| 282 | // About — the INPUT edges (modules/domains this memory is relevant to). |
| 283 | if !node.about.is_empty() { |
| 284 | s.push_str("\nAbout\n"); |
| 285 | for a in &node.about { |
| 286 | s.push_str(&format!(" • {a}\n")); |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | if !node.derived_from.is_empty() { |
| 291 | s.push_str("\nDerived From\n"); |
| 292 | for source in &node.derived_from { |
| 293 | s.push_str(&format!(" • {source}\n")); |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | // Revision chain (only if present). |
| 298 | if node.supersedes.is_some() || node.previous_revision.is_some() { |
| 299 | s.push_str("\nRevision\n"); |
| 300 | if let Some(sup) = &node.supersedes { |
| 301 | s.push_str(&format!(" supersedes: {sup}\n")); |
| 302 | } |
| 303 | if let Some(prev) = &node.previous_revision { |
| 304 | s.push_str(&format!(" previousRevision: {prev}\n")); |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | // The open text body (never graded). |
| 309 | s.push('\n'); |
| 310 | s.push_str(&node.text); |
| 311 | s.push('\n'); |
| 312 | |
| 313 | // Provenance footer. |
| 314 | s.push('\n'); |
| 315 | s.push_str(&format!("id: {}\n", node.id)); |
| 316 | if let Some(a) = &node.attributed_to { |
| 317 | s.push_str(&format!("author: {a}\n")); |
| 318 | } |
| 319 | if let Some(h) = &node.content_hash { |
| 320 | s.push_str(&format!("hash: {h}\n")); |
| 321 | } |
| 322 | s.push_str(&format!( |
| 323 | "signed: {}\n", |
| 324 | if node.proof.is_some() { "yes" } else { "no" } |
| 325 | )); |
| 326 | |
| 327 | s |
| 328 | } |
no test coverage detected