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)
| 87 | /// (`serde_json::from_str` into a `Map`). A malformed frontmatter string is a |
| 88 | /// clean argument error rather than an internal panic. |
| 89 | pub 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. |
| 99 | pub fn read_memory(repo: &Repository, id_or_path: &str) -> CliResult<MemLiftInputs> { |