MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / check_cli_version

Method check_cli_version

atomic-agent/src/integrations/manifest.rs:202–222  ·  view source on GitHub ↗

Enforce the package's `requires.atomic` gate against the running CLI.

(&self, cli_version: &str)

Source from the content-addressed store, hash-verified

200
201 /// Enforce the package's `requires.atomic` gate against the running CLI.
202 pub fn check_cli_version(&self, cli_version: &str) -> AgentResult<()> {
203 let Some(req_str) = self.requires.atomic.as_deref() else {
204 return Ok(());
205 };
206 let req = semver::VersionReq::parse(req_str).map_err(|e| AgentError::Integration {
207 agent: self.agent.clone(),
208 reason: format!("invalid requires.atomic '{req_str}': {e}"),
209 })?;
210 let current = semver::Version::parse(cli_version).map_err(|e| AgentError::Integration {
211 agent: self.agent.clone(),
212 reason: format!("cannot parse CLI version '{cli_version}': {e}"),
213 })?;
214 if !req.matches(&current) {
215 return Err(AgentError::IntegrationVersionMismatch {
216 agent: self.agent.clone(),
217 requires: req_str.to_string(),
218 current: cli_version.to_string(),
219 });
220 }
221 Ok(())
222 }
223
224 /// Absolute paths of the settings manifests, resolved against the package.
225 pub fn settings_manifest_paths(&self, pkg_dir: &Path) -> Vec<PathBuf> {

Callers 2

install_from_dirFunction · 0.80

Calls 3

parseFunction · 0.85
cloneMethod · 0.45
matchesMethod · 0.45

Tested by 1