Resolve the vault-relative path of a stored intent via the manifest. `vault_intent_show` normalizes and confirms existence but does not return a path; `normalize_intent_id` is private, so we match the manifest keys case-insensitively (the manifest keys are the normalized IDs, e.g. `"PIMO-1"`). Returns `None` if the intent has no manifest entry / path.
(repo: &Repository, id: &str)
| 295 | /// case-insensitively (the manifest keys are the normalized IDs, e.g. |
| 296 | /// `"PIMO-1"`). Returns `None` if the intent has no manifest entry / path. |
| 297 | pub fn vault_path_for(repo: &Repository, id: &str) -> CliResult<Option<String>> { |
| 298 | let manifest = repo.vault_manifest().map_err(CliError::Repository)?; |
| 299 | Ok(manifest |
| 300 | .intents |
| 301 | .iter() |
| 302 | .find(|(key, _)| key.eq_ignore_ascii_case(id)) |
| 303 | .map(|(_, summary)| summary.vault_path.clone()) |
| 304 | .filter(|p| !p.is_empty())) |
| 305 | } |
| 306 | |
| 307 | #[cfg(test)] |
| 308 | mod tests { |