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

Method install

atomic-cli/src/commands/diagnostics/collect.rs:1421–1446  ·  view source on GitHub ↗

Install `files` (relative to home) and write the receipt that records them as installed with the given content.

(&self, agent: &str, version: &str, files: &[(&str, &str)])

Source from the content-addressed store, hash-verified

1419 /// Install `files` (relative to home) and write the receipt that
1420 /// records them as installed with the given content.
1421 fn install(&self, agent: &str, version: &str, files: &[(&str, &str)]) -> Vec<PathBuf> {
1422 let paths: Vec<PathBuf> = files
1423 .iter()
1424 .map(|(rel, body)| {
1425 let path = self.home.path().join(rel);
1426 fs::create_dir_all(path.parent().unwrap()).unwrap();
1427 fs::write(&path, body).unwrap();
1428 path
1429 })
1430 .collect();
1431 let receipt = serde_json::json!({
1432 "schema": 1,
1433 "agent": agent,
1434 "version": version,
1435 "cli_version": "0.19.0",
1436 "installed_at": "2026-10-01T12:00:00+00:00",
1437 "source": "/home/someone/src/pkg",
1438 "files": paths.iter().zip(files).map(|(path, (_, body))| serde_json::json!({
1439 "dst": path,
1440 "blake3": blake3::hash(body.as_bytes()).to_hex().to_string(),
1441 })).collect::<Vec<_>>(),
1442 "settings": [],
1443 });
1444 self.write_receipt(agent, &receipt);
1445 paths
1446 }
1447
1448 fn write_receipt(&self, agent: &str, receipt: &serde_json::Value) {
1449 let dir = self.integrations().join(agent);

Calls 7

parentMethod · 0.80
write_receiptMethod · 0.80
writeFunction · 0.50
collectMethod · 0.45
iterMethod · 0.45
pathMethod · 0.45
unwrapMethod · 0.45