MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / kind_status_about

Function kind_status_about

atomic-cli/src/commands/memory/list.rs:184–209  ·  view source on GitHub ↗

The `(kind, status, about)` display columns for a memory. Prefers the attested node when Fresh/Stale; falls back to a lenient lift of the raw memory when there is no attestation. NEVER runs closed-vocab directive parsing over the prose — `lift_memory` does the lenient `:::memory` scan. A lift failure degrades to the raw frontmatter `memoryKind`/`status` (or `–`) and about 0.

(
    node: Option<&MemoryNode>,
    inputs: &bridge::MemLiftInputs,
)

Source from the content-addressed store, hash-verified

182/// prose — `lift_memory` does the lenient `:::memory` scan. A lift failure
183/// degrades to the raw frontmatter `memoryKind`/`status` (or `–`) and about 0.
184fn kind_status_about(
185 node: Option<&MemoryNode>,
186 inputs: &bridge::MemLiftInputs,
187) -> (String, String, usize) {
188 if let Some(node) = node {
189 return (
190 node.memory_kind.clone(),
191 node.status.clone(),
192 node.about.len(),
193 );
194 }
195 match bridge::lift(inputs) {
196 Ok(node) => (node.memory_kind, node.status, node.about.len()),
197 Err(_) => {
198 let fm = |k: &str| {
199 inputs
200 .frontmatter
201 .get(k)
202 .and_then(|v| v.as_str())
203 .map(str::to_owned)
204 .unwrap_or_else(|| NA.to_string())
205 };
206 (fm("memoryKind"), fm("status"), 0)
207 }
208 }
209}
210
211/// The node whose fields drive the display columns (kind/status/about) — only a
212/// FRESH attestation. A Stale attestation is treated like None here so those

Callers 1

compute_rowFunction · 0.85

Calls 6

liftFunction · 0.70
getMethod · 0.65
fmFunction · 0.50
cloneMethod · 0.45
lenMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected