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

Function inputs_from_entry

atomic-cli/src/commands/memory/bridge.rs:89–96  ·  view source on GitHub ↗

Parse a memory `VaultEntry` into the frontmatter map + body the lift consumes. `frontmatter_json` is parsed exactly as the repository parses it (`serde_json::from_str` into a `Map`). A malformed frontmatter string is a clean argument error rather than an internal panic.

(entry: &VaultEntry)

Source from the content-addressed store, hash-verified

87/// (`serde_json::from_str` into a `Map`). A malformed frontmatter string is a
88/// clean argument error rather than an internal panic.
89pub fn inputs_from_entry(entry: &VaultEntry) -> CliResult<MemLiftInputs> {
90 let frontmatter: Map<String, Value> =
91 serde_json::from_str(&entry.frontmatter_json).map_err(|e| CliError::InvalidArgument {
92 message: format!("memory frontmatter is not valid JSON: {e}"),
93 })?;
94 let body = String::from_utf8_lossy(&entry.content_bytes).into_owned();
95 Ok(MemLiftInputs { frontmatter, body })
96}
97
98/// Read a memory by id (or path) from the vault and return its lift inputs.
99pub fn read_memory(repo: &Repository, id_or_path: &str) -> CliResult<MemLiftInputs> {

Callers 1

read_memoryFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected