Load and validate the manifest from a package directory.
(pkg_dir: &Path)
| 64 | impl IntegrationManifest { |
| 65 | /// Load and validate the manifest from a package directory. |
| 66 | pub fn load(pkg_dir: &Path) -> AgentResult<Self> { |
| 67 | let path = pkg_dir.join(MANIFEST_FILE); |
| 68 | let text = std::fs::read_to_string(&path).map_err(|e| AgentError::Integration { |
| 69 | agent: agent_name_guess(pkg_dir), |
| 70 | reason: format!("cannot read {}: {}", path.display(), e), |
| 71 | })?; |
| 72 | let manifest: IntegrationManifest = |
| 73 | toml::from_str(&text).map_err(|e| AgentError::Integration { |
| 74 | agent: agent_name_guess(pkg_dir), |
| 75 | reason: format!("invalid {}: {}", MANIFEST_FILE, e), |
| 76 | })?; |
| 77 | manifest.check_schema()?; |
| 78 | Ok(manifest) |
| 79 | } |
| 80 | |
| 81 | /// Reject manifests from a newer schema than this CLI understands. |
| 82 | pub fn check_schema(&self) -> AgentResult<()> { |
nothing calls this directly
no test coverage detected