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

Method install_integration

atomic-cli/src/commands/agent/enable.rs:491–539  ·  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

489 /// user opts in via `--agents-md` or the prompt, the repo root is passed
490 /// so `[[repo-file]]` entries land in the repo.
491 fn install_integration(
492 &self,
493 agent_name: &str,
494 spec: &atomic_agent::integrations::IntegrationSpec,
495 ) -> CliResult<atomic_agent::integrations::InstallOutcome> {
496 let source;
497 let pkg_dir = if let Some(ref from) = self.from {
498 source = from.display().to_string();
499 from.clone()
500 } else {
501 source = spec.url.clone();
502 sync_integration_package(agent_name, spec, self.force)?
503 };
504
505 // Peek at the manifest to see if we need the skills cache.
506 let manifest = atomic_agent::integrations::IntegrationManifest::load(&pkg_dir)
507 .map_err(|e| crate::error::CliError::Internal(anyhow::anyhow!(e.to_string())))?;
508
509 let skills_cache_dir = if manifest.skills_source.is_some()
510 || manifest.skills_config.is_some()
511 || manifest.agent_definition.is_some()
512 || !manifest.skills.is_empty()
513 {
514 Some(sync_skills_cache(self.force)?)
515 } else {
516 None
517 };
518
519 // Determine repo_root from the --agents-md / --no-agents-md flags
520 // or the interactive prompt. Only relevant when the manifest has
521 // [[repo-file]] entries.
522 let repo_root = if !manifest.repo_files.is_empty() && self.agents_md {
523 Some(find_repository_root()?)
524 } else {
525 None
526 };
527
528 let opts = atomic_agent::integrations::InstallOptions {
529 force: self.force,
530 cli_version: env!("CARGO_PKG_VERSION").to_string(),
531 source,
532 expect_agent: Some(agent_name.to_string()),
533 skills_cache_dir,
534 repo_root,
535 };
536
537 atomic_agent::integrations::install_from_dir(&pkg_dir, &opts)
538 .map_err(|e| crate::error::CliError::Internal(anyhow::anyhow!(e.to_string())))
539 }
540
541 /// Install hooks from an integration-supplied manifest file.
542 ///

Callers 1

runMethod · 0.80

Calls 7

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

Tested by

no test coverage detected