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

Function load_lifecycle

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

Source from the content-addressed store, hash-verified

722}
723
724fn load_lifecycle(dir: &Path, run_id: &str) -> CliResult<Option<ManagedLifecycle>> {
725 validate_run_id(run_id)?;
726 let path = lifecycle_path(dir, run_id);
727 if !path.exists() {
728 return Ok(None);
729 }
730 let data = fs::read_to_string(&path).map_err(|e| {
731 CliError::Internal(anyhow!(
732 "failed to read managed lifecycle '{}': {}",
733 path.display(),
734 e
735 ))
736 })?;
737 let lifecycle = serde_json::from_str(&data).map_err(|e| {
738 CliError::Internal(anyhow!(
739 "failed to parse managed lifecycle '{}': {}",
740 path.display(),
741 e
742 ))
743 })?;
744 Ok(Some(lifecycle))
745}
746
747fn save_lifecycle(dir: &Path, lifecycle: &ManagedLifecycle) -> CliResult<()> {
748 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