Skip to main content

workyard_application/actions/amend/
mod.rs

1//! Amend inputs, outcomes and interface assembly.
2mod action;
3mod cli;
4mod contract;
5mod input;
6mod mcp;
7mod prepare;
8
9use crate::{
10	contracts::Progress, execution::removal::RemovalRequest, presentation::cli::exit_status,
11};
12pub use action::amend;
13pub use contract::AmendOutcome;
14pub use input::AmendInput;
15use trine::{
16	Action, RegistrationError,
17	application::{CliBinding, Entry},
18};
19
20type AmendEntry = Entry<RemovalRequest<AmendInput>, AmendOutcome, AmendOutcome, Progress>;
21
22pub(crate) fn build_entry() -> Result<AmendEntry, RegistrationError> {
23	let handler = Action::new(
24		"amend",
25		"Add, rename, reconnect or remove task participants",
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::AmendView {
37					output,
38					progress_open: false,
39				})
40			},
41			|result| exit_status::operation(result, |outcome| &outcome.operation),
42		)
43		.rpc(rpc)
44		.mcp_with_input(
45			mcp,
46			"Add, rename or remove participants of one named task. Review any disclosed files before approving discard.",
47			mcp::McpAmendInput::into,
48		)
49}