Skip to main content

ralph/cli/task/args/
edit.rs

1//! CLI arguments for task edit commands.
2//!
3//! Responsibilities:
4//! - Define Args structs for field, edit, and update commands.
5//!
6//! Not handled here:
7//! - Command execution (see edit handler).
8//!
9//! Invariants/assumptions:
10//! - All types must be Clone where needed for clap.
11
12use clap::Args;
13
14use crate::agent;
15use crate::cli::task::args::types::TaskEditFieldArg;
16
17#[derive(Args)]
18pub struct TaskFieldArgs {
19    /// Custom field key (must not contain whitespace).
20    pub key: String,
21
22    /// Custom field value.
23    pub value: String,
24
25    /// Task ID(s) to update.
26    #[arg(value_name = "TASK_ID...")]
27    pub task_ids: Vec<String>,
28
29    /// Filter tasks by tag for batch operation (alternative to explicit IDs).
30    #[arg(long, value_name = "TAG")]
31    pub tag_filter: Vec<String>,
32
33    /// Preview changes without modifying the queue.
34    #[arg(long)]
35    pub dry_run: bool,
36}
37
38#[derive(Args)]
39pub struct TaskEditArgs {
40    /// Task field to update.
41    #[arg(value_enum)]
42    pub field: TaskEditFieldArg,
43
44    /// New field value (empty string clears optional fields).
45    pub value: String,
46
47    /// Task ID(s) to update.
48    #[arg(value_name = "TASK_ID...")]
49    pub task_ids: Vec<String>,
50
51    /// Filter tasks by tag for batch operation (alternative to explicit IDs).
52    #[arg(long, value_name = "TAG")]
53    pub tag_filter: Vec<String>,
54
55    /// Preview changes without modifying the queue.
56    #[arg(long)]
57    pub dry_run: bool,
58
59    /// Disable auto-archive of terminal tasks during edit.
60    ///
61    /// By default, the edit command may auto-archive terminal tasks (Done/Rejected)
62    /// that are older than the configured `auto_archive_terminal_after_days`.
63    /// Use this flag to prevent this side effect.
64    #[arg(long)]
65    pub no_auto_archive: bool,
66}
67
68#[derive(Args)]
69pub struct TaskUpdateArgs {
70    /// Fields to update (comma-separated, default: all).
71    ///
72    /// Valid fields: scope, evidence, plan, notes, tags, depends_on
73    #[arg(long, default_value = "")]
74    pub fields: String,
75
76    /// Runner to use. CLI flag overrides config defaults (project > global > built-in).
77    #[arg(long)]
78    pub runner: Option<String>,
79
80    /// Model to use. CLI flag overrides config defaults (project > global > built-in).
81    #[arg(long)]
82    pub model: Option<String>,
83
84    /// Codex reasoning effort. CLI flag overrides config defaults (project > global > built-in).
85    /// Ignored for opencode and gemini.
86    #[arg(short = 'e', long)]
87    pub effort: Option<String>,
88
89    /// RepoPrompt mode (tools, plan, off). Alias: -rp.
90    #[arg(long = "repo-prompt", value_enum, value_name = "MODE")]
91    pub repo_prompt: Option<agent::RepoPromptMode>,
92
93    #[command(flatten)]
94    pub runner_cli: agent::RunnerCliArgs,
95
96    /// Task ID to update (omit to update all tasks).
97    #[arg(value_name = "TASK_ID")]
98    pub task_id: Option<String>,
99
100    /// Preview changes without modifying the queue.
101    ///
102    /// For task update, this shows the prompt that would be sent to the runner.
103    /// Actual changes depend on runner analysis of repository state.
104    #[arg(long)]
105    pub dry_run: bool,
106}