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)
| 792 | /// falls back to scanning `intents/` for a file whose frontmatter `id` |
| 793 | /// (human key) matches. |
| 794 | fn find_intent_path(&self, full_id: &str) -> Result<Option<String>, RepositoryError> { |
| 795 | // Fast path: check the manifest for a stored vault_path |
| 796 | let manifest = self.vault_manifest()?; |
| 797 | if let Some(summary) = manifest.intents.get(full_id) { |
| 798 | if !summary.vault_path.is_empty() { |
| 799 | // Verify the path still exists |
| 800 | if self.vault_retrieve(&summary.vault_path)?.is_some() { |
| 801 | return Ok(Some(summary.vault_path.clone())); |
| 802 | } |
| 803 | } |
| 804 | } |
| 805 | |
| 806 | // Slow path: scan all intents (paths are now flat `intents/<ulid>/`). |
| 807 | let prefixes = ["intents/".to_string(), "intents/manual/".to_string()]; |
| 808 | for prefix in &prefixes { |
| 809 | let entries = self.vault_list(prefix, None)?; |
| 810 | for meta in entries { |
| 811 | if !meta.path.ends_with("/intent.md") { |
| 812 | continue; |
| 813 | } |
| 814 | if let Some(entry) = self.vault_retrieve(&meta.path)? { |
| 815 | if let Ok(fm) = serde_json::from_str::<serde_json::Map<String, serde_json::Value>>( |
| 816 | &entry.frontmatter_json, |
| 817 | ) { |
| 818 | if fm.get("id").and_then(|v| v.as_str()) == Some(full_id) { |
| 819 | return Ok(Some(meta.path)); |
| 820 | } |
| 821 | } |
| 822 | } |
| 823 | } |
| 824 | } |
| 825 | Ok(None) |
| 826 | } |
| 827 | |
| 828 | /// Resolve a user-supplied intent reference to its manifest key (human |
| 829 | /// key). Public entry point so callers outside the repository (e.g. the |
no test coverage detected