Load and validate the manifest from a package directory.
(pkg_dir: &Path)
| 170 | impl IntegrationManifest { |
| 171 | /// Load and validate the manifest from a package directory. |
| 172 | pub fn load(pkg_dir: &Path) -> AgentResult<Self> { |
| 173 | let path = pkg_dir.join(MANIFEST_FILE); |
| 174 | let text = std::fs::read_to_string(&path).map_err(|e| AgentError::Integration { |
| 175 | agent: agent_name_guess(pkg_dir), |
| 176 | reason: format!("cannot read {}: {}", path.display(), e), |
| 177 | })?; |
| 178 | let manifest: IntegrationManifest = |
| 179 | toml::from_str(&text).map_err(|e| AgentError::Integration { |
| 180 | agent: agent_name_guess(pkg_dir), |
| 181 | reason: format!("invalid {}: {}", MANIFEST_FILE, e), |
| 182 | })?; |
| 183 | manifest.check_schema()?; |
| 184 | Ok(manifest) |
| 185 | } |
| 186 | |
| 187 | /// Reject manifests from a newer schema than this CLI understands. |
| 188 | pub fn check_schema(&self) -> AgentResult<()> { |
nothing calls this directly
no test coverage detected