1use crate::config::Config;
4use anyhow::Result;
5
6pub async fn handle_recover_approved(config: &Config, yes: bool) -> Result<()> {
7 let reviewed = crate::lifecycle_plan::review_plans(
8 config,
9 [crate::lifecycle_plan::LifecyclePlanRequest::shell_recovery()],
10 yes,
11 )
12 .await?
13 .into_iter()
14 .next()
15 .expect("one reviewed Shell recovery Plan");
16 let runtime = crate::lifecycle_plan::prepare_runtime(config, &reviewed).await?;
17 let report = runtime
18 .recover_shell_operation_approved(&reviewed.approval)
19 .await?;
20 if report.rolled_back_actions.is_empty() {
21 println!(
22 "Shell recovery complete: cleared the interrupted operation journal; no transaction-created launcher resources were removed."
23 );
24 } else {
25 println!(
26 "Shell recovery complete: rolled back {} interrupted launcher creation(s) and cleared the operation journal.",
27 report.rolled_back_actions.len()
28 );
29 }
30 Ok(())
31}