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

Function inputs_from_entry

atomic-cli/src/commands/intent/bridge.rs:62–69  ·  view source on GitHub ↗

Parse a `VaultEntry` into the frontmatter map + body the lift consumes. `frontmatter_json` is parsed exactly as the repository itself 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

60/// (`serde_json::from_str` into a `Map`). A malformed frontmatter string is a
61/// clean argument error rather than an internal panic.
62pub fn inputs_from_entry(entry: &VaultEntry) -> CliResult<LiftInputs> {
63 let frontmatter: Map<String, Value> =
64 serde_json::from_str(&entry.frontmatter_json).map_err(|e| CliError::InvalidArgument {
65 message: format!("intent frontmatter is not valid JSON: {e}"),
66 })?;
67 let body = String::from_utf8_lossy(&entry.content_bytes).into_owned();
68 Ok(LiftInputs { frontmatter, body })
69}
70
71/// Read an intent by ID from the vault and return its lift inputs.
72///

Callers 1

read_intentFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected