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

Function frontmatter_labels

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

Extract `labels` (array of strings) from frontmatter JSON.

(frontmatter_json: &str)

Source from the content-addressed store, hash-verified

709
710/// Extract `labels` (array of strings) from frontmatter JSON.
711fn frontmatter_labels(frontmatter_json: &str) -> Vec<String> {
712 serde_json::from_str::<serde_json::Value>(frontmatter_json)
713 .ok()
714 .and_then(|v| {
715 v.get("labels").and_then(|l| l.as_array()).map(|arr| {
716 arr.iter()
717 .filter_map(|x| x.as_str().map(String::from))
718 .collect()
719 })
720 })
721 .unwrap_or_default()
722}
723
724fn is_eligible_memory(entry: &VaultEntry) -> bool {
725 if entry.entry_type != VaultEntryType::Memory {

Callers 1

seed_from_intentMethod · 0.85

Calls 3

getMethod · 0.65
iterMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected