ralph/cli/queue/issue/args.rs
1//! Clap argument types for `ralph queue issue`.
2//!
3//! Responsibilities:
4//! - Define the single-task and bulk GitHub issue publish CLI surface.
5//! - Keep help text/examples colocated with the issue subcommands.
6//! - Expose stable argument types for queue CLI parsing and tests.
7//!
8//! Not handled here:
9//! - Queue loading or mutation.
10//! - GitHub API/CLI execution.
11//! - Publish workflow validation beyond clap parsing.
12//!
13//! Invariants/assumptions:
14//! - Argument defaults preserve existing CLI behavior.
15//! - Examples stay aligned with the implemented publish flows.
16//! - Parsing-only tests may construct these types directly.
17
18use clap::{Args, Subcommand};
19
20/// Top-level arguments for `ralph queue issue`.
21#[derive(Args)]
22pub struct QueueIssueArgs {
23 #[command(subcommand)]
24 pub command: QueueIssueCommand,
25}
26
27/// Issue publishing subcommands.
28#[derive(Subcommand)]
29pub enum QueueIssueCommand {
30 /// Publish (create or update) a single task as a GitHub issue.
31 Publish(QueueIssuePublishArgs),
32
33 /// Publish (create or update) many tasks as GitHub issues.
34 PublishMany(QueueIssuePublishManyArgs),
35}
36
37/// Arguments for `ralph queue issue publish`.
38#[derive(Args, Clone)]
39#[command(after_long_help = "Examples:\n\
40 # Preview rendered markdown for a task\n\
41 ralph queue issue publish RQ-0655 --dry-run\n\
42 # Create/update issue metadata and persist custom_fields\n\
43 ralph queue issue publish RQ-0655\n\
44 # Add labels/assignees\n\
45 ralph queue issue publish RQ-0655 --label bug --assignee @me\n\
46 # Target another repo\n\
47 ralph queue issue publish RQ-0655 --repo owner/repo")]
48pub struct QueueIssuePublishArgs {
49 /// Task ID to publish.
50 pub task_id: String,
51
52 /// Dry run: print rendered title/body and the action that would be executed.
53 #[arg(long)]
54 pub dry_run: bool,
55
56 /// Labels to apply (repeatable).
57 #[arg(long)]
58 pub label: Vec<String>,
59
60 /// Assignees to apply (repeatable). Supports @me for self-assignment.
61 #[arg(long)]
62 pub assignee: Vec<String>,
63
64 /// Target repository (OWNER/REPO format). Optional; uses current repo by default.
65 #[arg(long)]
66 pub repo: Option<String>,
67}
68
69/// Arguments for `ralph queue issue publish-many`.
70#[derive(Args, Clone)]
71#[command(after_long_help = "Examples:\n\
72 # Safe preview from todo backlog\n\
73 ralph queue issue publish-many --status todo --tag bug --dry-run\n\
74 # Publish selected slice with regex and labels\n\
75 ralph queue issue publish-many --status todo --tag bug --id-pattern '^RQ-08' --label triage\n\
76 # Execute publish with confirmation override\n\
77 ralph queue issue publish-many --status todo --execute --force")]
78pub struct QueueIssuePublishManyArgs {
79 /// Filter by status (repeatable). Defaults to all non-draft statuses.
80 #[arg(long)]
81 pub status: Vec<super::super::shared::StatusArg>,
82
83 /// Filter by tag (repeatable).
84 #[arg(long)]
85 pub tag: Vec<String>,
86
87 /// Filter by task ID regular expression.
88 #[arg(long)]
89 pub id_pattern: Option<String>,
90
91 /// Preview mode (default). No writes to queue or GitHub.
92 #[arg(long)]
93 pub dry_run: bool,
94
95 /// Execute publishes and persist GitHub metadata.
96 #[arg(long)]
97 pub execute: bool,
98
99 /// Labels to apply for each issue in the bulk run.
100 #[arg(long)]
101 pub label: Vec<String>,
102
103 /// Assignees to apply for each issue in the bulk run.
104 #[arg(long)]
105 pub assignee: Vec<String>,
106
107 /// Target repository (OWNER/REPO format). Optional; uses current repo by default.
108 #[arg(long)]
109 pub repo: Option<String>,
110}