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

Method check_cli_version

atomic-agent/src/integrations/manifest.rs:96–116  ·  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

94
95 /// Enforce the package's `requires.atomic` gate against the running CLI.
96 pub fn check_cli_version(&self, cli_version: &str) -> AgentResult<()> {
97 let Some(req_str) = self.requires.atomic.as_deref() else {
98 return Ok(());
99 };
100 let req = semver::VersionReq::parse(req_str).map_err(|e| AgentError::Integration {
101 agent: self.agent.clone(),
102 reason: format!("invalid requires.atomic '{req_str}': {e}"),
103 })?;
104 let current = semver::Version::parse(cli_version).map_err(|e| AgentError::Integration {
105 agent: self.agent.clone(),
106 reason: format!("cannot parse CLI version '{cli_version}': {e}"),
107 })?;
108 if !req.matches(&current) {
109 return Err(AgentError::IntegrationVersionMismatch {
110 agent: self.agent.clone(),
111 requires: req_str.to_string(),
112 current: cli_version.to_string(),
113 });
114 }
115 Ok(())
116 }
117
118 /// Absolute paths of the settings manifests, resolved against the package.
119 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