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

Function kind_status_about

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

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