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

Function load_lifecycle

atomic-cli/src/commands/agent/lifecycle.rs:486–507  ·  view source on GitHub ↗
(dir: &Path, run_id: &str)

Source from the content-addressed store, hash-verified

484}
485
486fn load_lifecycle(dir: &Path, run_id: &str) -> CliResult<Option<ManagedLifecycle>> {
487 validate_run_id(run_id)?;
488 let path = lifecycle_path(dir, run_id);
489 if !path.exists() {
490 return Ok(None);
491 }
492 let data = fs::read_to_string(&path).map_err(|e| {
493 CliError::Internal(anyhow!(
494 "failed to read managed lifecycle '{}': {}",
495 path.display(),
496 e
497 ))
498 })?;
499 let lifecycle = serde_json::from_str(&data).map_err(|e| {
500 CliError::Internal(anyhow!(
501 "failed to parse managed lifecycle '{}': {}",
502 path.display(),
503 e
504 ))
505 })?;
506 Ok(Some(lifecycle))
507}
508
509fn save_lifecycle(dir: &Path, lifecycle: &ManagedLifecycle) -> CliResult<()> {
510 validate_run_id(&lifecycle.run_id)?;

Callers 1

runMethod · 0.85

Calls 3

validate_run_idFunction · 0.85
lifecycle_pathFunction · 0.85
existsMethod · 0.45

Tested by

no test coverage detected