workyard_application/actions/create/
mod.rs1mod action;
3mod cli;
4mod contract;
5mod input;
6mod prepare;
7mod retry;
8
9use crate::{contracts::Progress, presentation::cli::exit_status};
10use trine::{
11 Action, RegistrationError,
12 application::{CliBinding, Entry},
13 cli::Alias,
14};
15
16pub use crate::contracts::RepositoryInput;
17pub use action::create;
18pub use contract::{CreateOutcome, ParticipantOutcome};
19pub use input::CreateInput;
20
21type CreateEntry = Entry<CreateInput, CreateOutcome, CreateOutcome, Progress>;
22
23pub(crate) fn build_entry() -> Result<CreateEntry, RegistrationError> {
24 let handler = Action::new(
25 "create",
26 "Create a task with a new branch in each repository",
27 action::create,
28 )?;
29
30 let checkout_shorthand = Alias::new("checkout")
31 .description("Create a task, reusing existing target branches where available")
32 .set("checkout", true);
33 let cli = CliBinding::new(cli::bindings()).alias(checkout_shorthand);
34 let rpc = crate::presentation::structured::progress_binding();
35 let mcp = crate::presentation::mcp::progress_binding();
36
37 Ok(Entry::new(handler)
38 .cli(
39 cli,
40 |output| {
41 Ok(cli::CreateView {
42 output,
43 wrote_progress: false,
44 })
45 },
46 |result| exit_status::operation(result, |outcome| &outcome.operation),
47 )
48 .rpc(rpc)
49 .mcp(mcp))
50}