workyard_application/actions/recover/
mod.rs1mod action;
3mod cli;
4mod contract;
5mod input;
6mod workspace;
7
8use crate::{contracts::Progress, presentation::cli::exit_status};
9use trine::{
10 Action, RegistrationError,
11 application::{CliBinding, Entry},
12};
13
14pub use action::recover;
15pub use contract::{RecoverOutcome, RecoveryOutcome};
16pub use input::RecoverInput;
17
18use input::RecoveryRequest;
19
20type RecoverEntry = Entry<RecoveryRequest, RecoveryOutcome, RecoveryOutcome, Progress>;
21
22pub(crate) fn build_entry() -> Result<RecoverEntry, RegistrationError> {
23 let handler = Action::new(
24 "recover",
25 "Repair workspace locations or resume an interrupted task operation",
26 action::execute,
27 )?;
28 let cli = CliBinding::new(cli::bindings());
29 let rpc = crate::presentation::structured::progress_binding();
30 let mcp = crate::presentation::mcp::progress_binding();
31
32 Entry::new(handler)
33 .cli(
34 cli,
35 |output| {
36 Ok(cli::RecoverView {
37 output,
38 started: false,
39 })
40 },
41 |result| match result {
42 Ok(RecoveryOutcome::Task(outcome)) => u8::from(
43 outcome.operation.outcome != workyard_core::OperationOutcome::Succeeded,
44 ),
45 _ => exit_status::result(result),
46 },
47 )
48 .rpc(rpc)
49 .mcp_with_input(
50 mcp,
51 "Resume creation, checkout or participant additions and renames for one named task",
52 RecoveryRequest::Participants,
53 )
54}