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

Function install_decision

atomic-agent/src/integrations/install.rs:499–513  ·  view source on GitHub ↗

Decide what to do with a destination that may already exist.

(dst: &Path, previous: Option<&Receipt>, force: bool)

Source from the content-addressed store, hash-verified

497
498/// Decide what to do with a destination that may already exist.
499fn install_decision(dst: &Path, previous: Option<&Receipt>, force: bool) -> AgentResult<Decision> {
500 if !dst.exists() {
501 return Ok(Decision::Install);
502 }
503 let recorded = previous.and_then(|r| r.recorded_hash(dst));
504 match recorded {
505 // Ours and untouched since install → safe to refresh.
506 Some(hash) if hash == hash_file(dst)? => Ok(Decision::Refresh),
507 // Ours but the user changed it → hands off unless forced.
508 Some(_) if !force => Ok(Decision::Skip(SkipReason::UserModified)),
509 // Not ours → hands off unless forced.
510 None if !force => Ok(Decision::Skip(SkipReason::UserFile)),
511 _ => Ok(Decision::Refresh),
512 }
513}
514
515/// Decide what to do with a [[repo-file]] destination. Unlike [[file]] and
516/// [[skill]], a repo-file that exists but isn't ours can be *merged* — the

Callers 2

install_from_dirFunction · 0.85
copy_oneFunction · 0.85

Calls 3

hash_fileFunction · 0.85
existsMethod · 0.45
recorded_hashMethod · 0.45

Tested by

no test coverage detected