(node: &MemoryNode)
| 148 | } |
| 149 | |
| 150 | fn render_memory_cli(node: &MemoryNode) -> String { |
| 151 | let mut s = String::new(); |
| 152 | |
| 153 | // Header: memory kind + @id. |
| 154 | s.push_str(&format!("Memory ({}) {}\n", node.memory_kind, node.id)); |
| 155 | s.push_str(&"─".repeat(48)); |
| 156 | s.push('\n'); |
| 157 | |
| 158 | // Status is REGENERATED here from the spine, never read from prose. |
| 159 | s.push_str(&format!("Status: {}\n", node.status)); |
| 160 | |
| 161 | // About — the INPUT edges (modules/domains this memory is relevant to). |
| 162 | if !node.about.is_empty() { |
| 163 | s.push_str("\nAbout\n"); |
| 164 | for a in &node.about { |
| 165 | s.push_str(&format!(" • {a}\n")); |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | if !node.derived_from.is_empty() { |
| 170 | s.push_str("\nDerived From\n"); |
| 171 | for source in &node.derived_from { |
| 172 | s.push_str(&format!(" • {source}\n")); |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | // Revision chain (only if present). |
| 177 | if node.supersedes.is_some() || node.previous_revision.is_some() { |
| 178 | s.push_str("\nRevision\n"); |
| 179 | if let Some(sup) = &node.supersedes { |
| 180 | s.push_str(&format!(" supersedes: {sup}\n")); |
| 181 | } |
| 182 | if let Some(prev) = &node.previous_revision { |
| 183 | s.push_str(&format!(" previousRevision: {prev}\n")); |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | // The open text body (never graded). |
| 188 | s.push('\n'); |
| 189 | s.push_str(&node.text); |
| 190 | s.push('\n'); |
| 191 | |
| 192 | // Provenance footer. |
| 193 | s.push('\n'); |
| 194 | s.push_str(&format!("id: {}\n", node.id)); |
| 195 | if let Some(a) = &node.attributed_to { |
| 196 | s.push_str(&format!("author: {a}\n")); |
| 197 | } |
| 198 | if let Some(h) = &node.content_hash { |
| 199 | s.push_str(&format!("hash: {h}\n")); |
| 200 | } |
| 201 | s.push_str(&format!( |
| 202 | "signed: {}\n", |
| 203 | if node.proof.is_some() { "yes" } else { "no" } |
| 204 | )); |
| 205 | |
| 206 | s |
| 207 | } |
no test coverage detected