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)
| 919 | /// falls back to scanning `intents/` for a file whose frontmatter `id` |
| 920 | /// (human key) matches. |
| 921 | fn find_intent_path(&self, full_id: &str) -> Result<Option<String>, RepositoryError> { |
| 922 | // Fast path: check the manifest for a stored vault_path |
| 923 | let manifest = self.vault_manifest()?; |
| 924 | if let Some(summary) = manifest.intents.get(full_id) { |
| 925 | if !summary.vault_path.is_empty() { |
| 926 | // Verify the path still exists |
| 927 | if self.vault_retrieve(&summary.vault_path)?.is_some() { |
| 928 | return Ok(Some(summary.vault_path.clone())); |
| 929 | } |
| 930 | } |
| 931 | } |
| 932 | |
| 933 | // Slow path: scan all intents (paths are now flat `intents/<ulid>/`). |
| 934 | let prefixes = ["intents/".to_string(), "intents/manual/".to_string()]; |
| 935 | for prefix in &prefixes { |
| 936 | let entries = self.vault_list(prefix, None)?; |
| 937 | for meta in entries { |
| 938 | if !meta.path.ends_with("/intent.md") { |
| 939 | continue; |
| 940 | } |
| 941 | if let Some(entry) = self.vault_retrieve(&meta.path)? { |
| 942 | if let Ok(fm) = serde_json::from_str::<serde_json::Map<String, serde_json::Value>>( |
| 943 | &entry.frontmatter_json, |
| 944 | ) { |
| 945 | if fm.get("id").and_then(|v| v.as_str()) == Some(full_id) { |
| 946 | return Ok(Some(meta.path)); |
| 947 | } |
| 948 | } |
| 949 | } |
| 950 | } |
| 951 | } |
| 952 | Ok(None) |
| 953 | } |
| 954 | |
| 955 | /// Resolve a user-supplied intent reference to its manifest key (human |
| 956 | /// key). Public entry point so callers outside the repository (e.g. the |
no test coverage detected