Read a memory by id (or path) from the vault and return its lift inputs.
(repo: &Repository, id_or_path: &str)
| 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> { |
| 100 | let path = normalize_memory_path(id_or_path); |
| 101 | let entry = repo |
| 102 | .vault_retrieve(&path) |
| 103 | .map_err(CliError::Repository)? |
| 104 | .ok_or_else(|| CliError::InvalidArgument { |
| 105 | message: format!("memory not found: {id_or_path} (create with `atomic memory new`)"), |
| 106 | })?; |
| 107 | inputs_from_entry(&entry) |
| 108 | } |
| 109 | |
| 110 | /// Lift the given inputs into a canonical `MemoryNode`, mapping a lift failure |
| 111 | /// (missing `uid`, missing `memoryKind`, …) to a clean argument error. |