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

Function kind_status_about

atomic-cli/src/commands/memory/list.rs:254–279  ·  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

252/// prose — `lift_memory` does the lenient `:::memory` scan. A lift failure
253/// degrades to the raw frontmatter `memoryKind`/`status` (or `–`) and about 0.
254fn kind_status_about(
255 node: Option<&MemoryNode>,
256 inputs: &bridge::MemLiftInputs,
257) -> (String, String, usize) {
258 if let Some(node) = node {
259 return (
260 node.memory_kind.clone(),
261 node.status.clone(),
262 node.about.len(),
263 );
264 }
265 match bridge::lift(inputs) {
266 Ok(node) => (node.memory_kind, node.status, node.about.len()),
267 Err(_) => {
268 let fm = |k: &str| {
269 inputs
270 .frontmatter
271 .get(k)
272 .and_then(|v| v.as_str())
273 .map(str::to_owned)
274 .unwrap_or_else(|| NA.to_string())
275 };
276 (fm("memoryKind"), fm("status"), 0)
277 }
278 }
279}
280
281/// The node whose fields drive the display columns (kind/status/about) — only a
282/// 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