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

Method install_integration

atomic-cli/src/commands/agent/enable.rs:557–628  ·  view source on GitHub ↗

Install an externally-packaged integration for an agent. The package directory comes from `--from` (a local checkout) or from syncing the registry's Atomic storage project into the CLI-managed cache. Installation itself is done by the integrations engine per the package's atomic-integration.toml. When the manifest declares `[skills-source]`, the shared atomic-skills cache is synced (or reused) a

(
        &self,
        agent_name: &str,
        spec: &atomic_agent::integrations::IntegrationSpec,
    )

Source from the content-addressed store, hash-verified

555 /// `--agents-md` or the prompt, the repo root is passed so
556 /// `[[repo-file]]` entries land in the repo.
557 fn install_integration(
558 &self,
559 agent_name: &str,
560 spec: &atomic_agent::integrations::IntegrationSpec,
561 ) -> CliResult<atomic_agent::integrations::InstallOutcome> {
562 let source;
563 let pkg_dir = if let Some(ref from) = self.from {
564 source = from.display().to_string();
565 from.clone()
566 } else {
567 source = spec.url.clone();
568 sync_integration_package(agent_name, spec, self.force)?
569 };
570
571 // Peek at the manifest to see if we need the skills cache.
572 let manifest = atomic_agent::integrations::IntegrationManifest::load(&pkg_dir)
573 .map_err(|e| crate::error::CliError::Internal(anyhow::anyhow!(e.to_string())))?;
574
575 let skills_cache_dir = if manifest.skills_source.is_some()
576 || manifest.skills_config.is_some()
577 || manifest.agent_definition.is_some()
578 || !manifest.skills.is_empty()
579 {
580 if let Some(ref from_skills) = self.from_skills {
581 if !std::fs::exists(from_skills).unwrap_or(false) {
582 return Err(crate::error::CliError::InvalidArgument {
583 message: format!(
584 "--from-skills: no checkout at {}; point it at a local \
585 atomic-skills checkout (or omit it to sync from storage)",
586 from_skills.display()
587 ),
588 });
589 }
590 Some(from_skills.clone())
591 } else {
592 Some(sync_skills_cache(self.force)?)
593 }
594 } else {
595 None
596 };
597
598 // Determine repo_root from the --agents-md / --no-agents-md flags
599 // or the interactive prompt. Only relevant when the manifest has
600 // [[repo-file]] entries. Outside a repository the entries are
601 // skipped with a warning rather than failing the whole install —
602 // `enable` does not require a repository.
603 let repo_root = if !manifest.repo_files.is_empty() && self.agents_md {
604 match find_repository_root() {
605 Ok(root) => Some(root),
606 Err(_) => {
607 print_warning(
608 "--agents-md requires an Atomic repository — skipping [[repo-file]] entries.",
609 );
610 None
611 }
612 }
613 } else {
614 None

Callers 1

runMethod · 0.45

Calls 8

sync_integration_packageFunction · 0.85
sync_skills_cacheFunction · 0.85
find_repository_rootFunction · 0.85
print_warningFunction · 0.85
install_from_dirFunction · 0.85
displayMethod · 0.80
cloneMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected