Find the vault path for an intent by its resolved manifest key. First checks the manifest's `vault_path` field (fast path), then falls back to scanning `intents/` for a file whose frontmatter `id` (human key) matches.
(&self, full_id: &str)
| 1103 | /// falls back to scanning `intents/` for a file whose frontmatter `id` |
| 1104 | /// (human key) matches. |
| 1105 | fn find_intent_path(&self, full_id: &str) -> Result<Option<String>, RepositoryError> { |
| 1106 | // Fast path: check the manifest for a stored vault_path |
| 1107 | let manifest = self.vault_manifest()?; |
| 1108 | if let Some(summary) = manifest.intents.get(full_id) { |
| 1109 | if !summary.vault_path.is_empty() { |
| 1110 | // Verify the path still exists |
| 1111 | if self.vault_retrieve(&summary.vault_path)?.is_some() { |
| 1112 | return Ok(Some(summary.vault_path.clone())); |
| 1113 | } |
| 1114 | } |
| 1115 | } |
| 1116 | |
| 1117 | // Slow path: scan all intents (paths are now flat `intents/<ulid>/`). |
| 1118 | let prefixes = ["intents/".to_string(), "intents/manual/".to_string()]; |
| 1119 | for prefix in &prefixes { |
| 1120 | let entries = self.vault_list(prefix, None)?; |
| 1121 | for meta in entries { |
| 1122 | if !meta.path.ends_with("/intent.md") { |
| 1123 | continue; |
| 1124 | } |
| 1125 | if let Some(entry) = self.vault_retrieve(&meta.path)? { |
| 1126 | if let Ok(fm) = serde_json::from_str::<serde_json::Map<String, serde_json::Value>>( |
| 1127 | &entry.frontmatter_json, |
| 1128 | ) { |
| 1129 | if fm.get("id").and_then(|v| v.as_str()) == Some(full_id) { |
| 1130 | return Ok(Some(meta.path)); |
| 1131 | } |
| 1132 | } |
| 1133 | } |
| 1134 | } |
| 1135 | } |
| 1136 | Ok(None) |
| 1137 | } |
| 1138 | |
| 1139 | /// Resolve a user-supplied intent reference to its manifest key (human |
| 1140 | /// key). Public entry point so callers outside the repository (e.g. the |
no test coverage detected