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)])
| 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); |