(node: &MemoryNode)
| 311 | } |
| 312 | |
| 313 | fn render_memory_cli(node: &MemoryNode) -> String { |
| 314 | let mut s = String::new(); |
| 315 | |
| 316 | // Header: memory kind + @id. |
| 317 | s.push_str(&format!("Memory ({}) {}\n", node.memory_kind, node.id)); |
| 318 | s.push_str(&"─".repeat(48)); |
| 319 | s.push('\n'); |
| 320 | |
| 321 | // Status is REGENERATED here from the spine, never read from prose. |
| 322 | s.push_str(&format!("Status: {}\n", node.status)); |
| 323 | |
| 324 | // About — the INPUT edges (modules/domains this memory is relevant to). |
| 325 | if !node.about.is_empty() { |
| 326 | s.push_str("\nAbout\n"); |
| 327 | for a in &node.about { |
| 328 | s.push_str(&format!(" • {a}\n")); |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | if !node.derived_from.is_empty() { |
| 333 | s.push_str("\nDerived From\n"); |
| 334 | for source in &node.derived_from { |
| 335 | s.push_str(&format!(" • {source}\n")); |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | // Revision chain (only if present). |
| 340 | if node.supersedes.is_some() || node.previous_revision.is_some() { |
| 341 | s.push_str("\nRevision\n"); |
| 342 | if let Some(sup) = &node.supersedes { |
| 343 | s.push_str(&format!(" supersedes: {sup}\n")); |
| 344 | } |
| 345 | if let Some(prev) = &node.previous_revision { |
| 346 | s.push_str(&format!(" previousRevision: {prev}\n")); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | // The open text body (never graded). |
| 351 | s.push('\n'); |
| 352 | s.push_str(&node.text); |
| 353 | s.push('\n'); |
| 354 | |
| 355 | // Provenance footer. |
| 356 | s.push('\n'); |
| 357 | s.push_str(&format!("id: {}\n", node.id)); |
| 358 | if let Some(a) = &node.attributed_to { |
| 359 | s.push_str(&format!("author: {a}\n")); |
| 360 | } |
| 361 | if let Some(h) = &node.content_hash { |
| 362 | s.push_str(&format!("hash: {h}\n")); |
| 363 | } |
| 364 | s.push_str(&format!( |
| 365 | "signed: {}\n", |
| 366 | if node.proof.is_some() { "yes" } else { "no" } |
| 367 | )); |
| 368 | |
| 369 | s |
| 370 | } |
no test coverage detected