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

Function list_lifecycles

atomic-cli/src/commands/agent/lifecycle.rs:690–712  ·  view source on GitHub ↗
(dir: &Path)

Source from the content-addressed store, hash-verified

688}
689
690fn list_lifecycles(dir: &Path) -> Vec<ManagedLifecycle> {
691 let entries = match fs::read_dir(dir) {
692 Ok(entries) => entries,
693 Err(_) => return Vec::new(),
694 };
695
696 let mut lifecycles = Vec::new();
697 for entry in entries.flatten() {
698 let path = entry.path();
699 if path.extension().and_then(|e| e.to_str()) != Some("json") {
700 continue;
701 }
702 let Ok(data) = fs::read_to_string(&path) else {
703 continue;
704 };
705 let Ok(lifecycle) = serde_json::from_str::<ManagedLifecycle>(&data) else {
706 log::warn!("skipping unparseable lifecycle file {}", path.display());
707 continue;
708 };
709 lifecycles.push(lifecycle);
710 }
711 lifecycles
712}
713
714fn list_by_state(dir: &Path, now: i64) -> (Vec<ManagedLifecycle>, Vec<ManagedLifecycle>) {
715 list_lifecycles(dir)

Callers 2

runMethod · 0.85
list_by_stateFunction · 0.85

Calls 3

extensionMethod · 0.80
pathMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected