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

Function vault_path_for

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

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)

Source from the content-addressed store, hash-verified

314/// case-insensitively (the manifest keys are the normalized IDs, e.g.
315/// `"PIMO-1"`). Returns `None` if the intent has no manifest entry / path.
316pub fn vault_path_for(repo: &Repository, id: &str) -> CliResult<Option<String>> {
317 let manifest = repo.vault_manifest().map_err(CliError::Repository)?;
318 Ok(manifest
319 .intents
320 .iter()
321 .find(|(key, _)| key.eq_ignore_ascii_case(id))
322 .map(|(_, summary)| summary.vault_path.clone())
323 .filter(|p| !p.is_empty()))
324}
325
326#[cfg(test)]
327mod tests {

Callers 2

runMethod · 0.85
stale_is_stale_and_naFunction · 0.85

Calls 4

vault_manifestMethod · 0.80
iterMethod · 0.45
cloneMethod · 0.45
is_emptyMethod · 0.45

Tested by 2

runMethod · 0.68
stale_is_stale_and_naFunction · 0.68