ralph/cli/task/args/decompose.rs
1//! CLI arguments for `ralph task decompose`.
2//!
3//! Responsibilities:
4//! - Define clap arguments for decomposition previews and writes.
5//! - Mirror runner override flags used by other runner-backed task commands.
6//!
7//! Not handled here:
8//! - Source resolution or queue mutation.
9//! - Planner execution or prompt rendering.
10//!
11//! Invariants/assumptions:
12//! - Preview is the default mode; `--write` must be explicit for mutation.
13//! - `source` may be a task ID or freeform request text.
14
15use clap::Args;
16
17use super::types::{TaskDecomposeChildPolicyArg, TaskDecomposeFormatArg, TaskStatusArg};
18use crate::agent;
19
20#[derive(Args, Clone, Debug)]
21pub struct TaskDecomposeArgs {
22 /// Task ID or freeform request text to decompose.
23 /// If omitted, reads from stdin.
24 #[arg(value_name = "SOURCE")]
25 pub source: Vec<String>,
26
27 /// Attach a new decomposition subtree under an existing parent task.
28 #[arg(long, value_name = "TASK_ID")]
29 pub attach_to: Option<String>,
30
31 /// Maximum hierarchy depth to generate, including the root node.
32 #[arg(long, default_value_t = 3, value_parser = clap::value_parser!(u8).range(1..=10))]
33 pub max_depth: u8,
34
35 /// Maximum number of children allowed for any single node.
36 #[arg(long, default_value_t = 5, value_parser = clap::value_parser!(u8).range(1..=25))]
37 pub max_children: u8,
38
39 /// Maximum total nodes allowed in the generated tree.
40 #[arg(long, default_value_t = 50, value_parser = clap::value_parser!(u16).range(1..=200))]
41 pub max_nodes: u16,
42
43 /// Status to assign to newly created tasks.
44 #[arg(long, value_enum, default_value_t = TaskStatusArg::Draft)]
45 pub status: TaskStatusArg,
46
47 /// Child-tree handling when the effective parent already has children.
48 #[arg(long, value_enum, default_value_t = TaskDecomposeChildPolicyArg::Fail)]
49 pub child_policy: TaskDecomposeChildPolicyArg,
50
51 /// Infer sibling dependencies from the planner output.
52 #[arg(long)]
53 pub with_dependencies: bool,
54
55 /// Write the proposed decomposition into the queue.
56 #[arg(long, conflicts_with = "preview")]
57 pub write: bool,
58
59 /// Explicitly request preview mode.
60 #[arg(long, conflicts_with = "write")]
61 pub preview: bool,
62
63 /// Output format.
64 #[arg(long, value_enum, default_value_t = TaskDecomposeFormatArg::Text)]
65 pub format: TaskDecomposeFormatArg,
66
67 /// Runner to use. CLI flag overrides config defaults (project > global > built-in).
68 #[arg(long)]
69 pub runner: Option<String>,
70
71 /// Model to use. CLI flag overrides config defaults (project > global > built-in).
72 #[arg(long)]
73 pub model: Option<String>,
74
75 /// Codex reasoning effort. CLI flag overrides config defaults (project > global > built-in).
76 /// Ignored for opencode and gemini.
77 #[arg(short = 'e', long)]
78 pub effort: Option<String>,
79
80 /// RepoPrompt mode (tools, plan, off). Alias: -rp.
81 #[arg(long = "repo-prompt", value_enum, value_name = "MODE")]
82 pub repo_prompt: Option<agent::RepoPromptMode>,
83
84 #[command(flatten)]
85 pub runner_cli: agent::RunnerCliArgs,
86}