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

Function sync_skills_cache

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

Always sync the atomic-skills cache to latest. Unlike the plugin cache (which reuses until --force), the skills cache is **always** re-cloned on every install. This ensures new skills added to atomic-skills are picked up immediately without --force. If the re-clone fails (network), the error is returned — the caller can retry or use --from-skills to source the skills package from a local checkout

(_force: bool)

Source from the content-addressed store, hash-verified

476/// re-clone fails (network), the error is returned — the caller can retry
477/// or use --from-skills to source the skills package from a local checkout.
478fn sync_skills_cache(_force: bool) -> CliResult<std::path::PathBuf> {
479 const SKILLS_AGENT: &str = "atomic-skills";
480
481 let spec = atomic_agent::integrations::resolve(SKILLS_AGENT).ok_or_else(|| {
482 crate::error::CliError::Internal(anyhow::anyhow!(
483 "atomic-skills not found in the integration registry — this is a bug"
484 ))
485 })?;
486
487 let cache = atomic_agent::integrations::cache_repo_dir(SKILLS_AGENT)
488 .map_err(|e| crate::error::CliError::Internal(anyhow::anyhow!(e.to_string())))?;
489
490 // Always delete + re-clone to get latest. The atomic-skills package is
491 // small (markdown files only), so this is fast.
492 if cache.exists() {
493 std::fs::remove_dir_all(&cache).map_err(crate::error::CliError::Io)?;
494 }
495
496 crate::commands::clone::Clone::new(spec.url.clone())
497 .with_path(cache.display().to_string())
498 .with_view(spec.view.clone())
499 .run()?;
500
501 Ok(cache)
502}
503
504/// Sync an agent's integration package into the CLI-managed cache
505/// (`~/.atomic/integrations/<agent>/repo`) using Atomic's own remote

Callers 1

install_integrationMethod · 0.85

Calls 8

cache_repo_dirFunction · 0.85
displayMethod · 0.80
resolveFunction · 0.50
existsMethod · 0.45
runMethod · 0.45
with_viewMethod · 0.45
with_pathMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected