Skip to main content

workyard_application/actions/remove/
input.rs

1use schemars::JsonSchema;
2use serde::Deserialize;
3use trine::NativePath;
4
5/// Task to retire and consent options for unlinking its worktrees.
6#[derive(Deserialize, JsonSchema)]
7#[serde(deny_unknown_fields)]
8pub struct RemoveInput {
9	/// Task selected for this operation.
10	pub task: String,
11	/// Explicit workspace directory containing .workyard.
12	pub workspace: Option<NativePath>,
13	/// Skip removal confirmation.
14	#[serde(default)]
15	pub yes: bool,
16	/// Allow removal of dirty worktrees and skip confirmation.
17	#[serde(default)]
18	pub force: bool,
19}
20
21#[derive(Deserialize, JsonSchema)]
22#[serde(deny_unknown_fields)]
23pub(super) struct McpRemoveInput {
24	pub task: String,
25	/// Workspace directory containing .workyard. Defaults to ancestor discovery.
26	pub workspace: Option<NativePath>,
27	/// Approve only the files identified by a previously reviewed decision token.
28	pub approve_discard: Option<String>,
29}
30
31impl From<McpRemoveInput> for crate::execution::removal::RemovalRequest<RemoveInput> {
32	fn from(input: McpRemoveInput) -> Self {
33		let action = RemoveInput {
34			task: input.task,
35			workspace: input.workspace,
36			yes: false,
37			force: false,
38		};
39		Self::review_discard(action, input.approve_discard)
40	}
41}