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

Function frontmatter_kind

atomic-cli/src/commands/vault/context.rs:663–673  ·  view source on GitHub ↗

Extract the canonical `memoryKind`, accepting legacy `kind`/`type` fields.

(frontmatter_json: &str)

Source from the content-addressed store, hash-verified

661
662/// Extract the canonical `memoryKind`, accepting legacy `kind`/`type` fields.
663fn frontmatter_kind(frontmatter_json: &str) -> String {
664 serde_json::from_str::<serde_json::Value>(frontmatter_json)
665 .ok()
666 .and_then(|v| {
667 ["memoryKind", "kind", "type"]
668 .iter()
669 .find_map(|key| v.get(key).and_then(|value| value.as_str()))
670 .map(String::from)
671 })
672 .unwrap_or_else(|| "project".to_string())
673}
674
675fn frontmatter_status(frontmatter_json: &str) -> Option<String> {
676 let value = serde_json::from_str::<serde_json::Value>(frontmatter_json).ok()?;

Callers 2

resolve_and_rankFunction · 0.85
is_eligible_memoryFunction · 0.85

Calls 3

getMethod · 0.65
iterMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected