agent_first_mail/cli/cases.rs
1use clap::{Args, Subcommand};
2
3#[derive(Subcommand, Debug)]
4pub enum CaseCommand {
5 /// Create a new case and return its stable UID/ref.
6 Create(CaseCreateArgs),
7 /// List compact active case locators.
8 List,
9 /// Show the active case's case.md without changing workspace state.
10 Show {
11 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
12 case_ref: String,
13 },
14 /// Add a message to this existing case.
15 Add {
16 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
17 case_ref: String,
18 /// Message id to add.
19 message_id: String,
20 /// Why this message belongs in this case; required by default.
21 #[arg(long)]
22 reason: Option<String>,
23 },
24 /// Move this case to another group.
25 Move {
26 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
27 case_ref: String,
28 /// Destination group.
29 group: String,
30 },
31 /// Rename this active case's human-readable name without changing its UID.
32 Rename {
33 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
34 case_ref: String,
35 /// New human-readable case name.
36 #[arg(long)]
37 name: String,
38 /// Why this name better represents the case; required by default.
39 #[arg(long)]
40 reason: Option<String>,
41 },
42 /// Show or edit active case notes.
43 Notes {
44 #[command(subcommand)]
45 action: CaseNotesAction,
46 },
47 /// Archive this active case.
48 Archive {
49 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
50 case_ref: String,
51 /// Why this case is ready to archive; required by default.
52 #[arg(long)]
53 reason: Option<String>,
54 },
55 /// Reopen this case as active work without changing its tags.
56 Reopen {
57 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
58 case_ref: String,
59 /// Why this case should be reopened; required by default.
60 #[arg(long)]
61 reason: Option<String>,
62 },
63 /// Add a case organization tag.
64 Tag {
65 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
66 case_ref: String,
67 /// Case organization tag.
68 tag: String,
69 /// Why this tag is useful; required by default.
70 #[arg(long)]
71 reason: Option<String>,
72 },
73 /// Remove a case organization tag.
74 Untag {
75 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
76 case_ref: String,
77 /// Case organization tag.
78 tag: String,
79 /// Why this tag should be removed; required by default.
80 #[arg(long)]
81 reason: Option<String>,
82 },
83 /// Create, validate, attach to, or remove local case drafts.
84 Draft {
85 #[command(subcommand)]
86 action: CaseDraftAction,
87 },
88 /// Compose an existing case draft into the local push queue.
89 Compose {
90 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
91 case_ref: String,
92 /// Draft markdown file under the case drafts directory.
93 draft_name: String,
94 },
95 /// Scaffold a reply draft to a message, prefilled and quoting the original.
96 Reply {
97 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
98 case_ref: String,
99 /// Message id in this case to reply to.
100 message_id: String,
101 /// Reply to all original recipients (To and Cc), not just the sender.
102 #[arg(long)]
103 all: bool,
104 },
105 /// Merge another case into this case.
106 Merge {
107 /// Primary case ref.
108 case_ref: String,
109 /// Case ref to merge into the primary case.
110 other_case_ref: String,
111 /// Why these cases should be merged; required by default.
112 #[arg(long)]
113 reason: Option<String>,
114 },
115}
116
117#[derive(Args, Debug, Clone)]
118pub struct CaseCreateArgs {
119 /// Human-readable case name used in case.md and the directory suffix.
120 #[arg(long)]
121 pub name: String,
122 /// Destination group. Defaults to the configured default group.
123 #[arg(long)]
124 pub group: Option<String>,
125 /// Optional first message to add to the case.
126 #[arg(long)]
127 pub message: Option<String>,
128 /// Why this case is being created.
129 #[arg(long)]
130 pub reason: Option<String>,
131}
132
133#[derive(Subcommand, Debug)]
134pub enum CaseNotesAction {
135 /// Show notes markdown.
136 Show {
137 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
138 case_ref: String,
139 },
140 /// Append text to notes markdown.
141 Append {
142 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
143 case_ref: String,
144 /// Markdown text to append.
145 #[arg(long)]
146 text: String,
147 },
148 /// Replace notes markdown with text.
149 Replace {
150 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
151 case_ref: String,
152 /// Markdown text to write.
153 #[arg(long)]
154 text: String,
155 },
156}
157
158#[derive(Subcommand, Debug)]
159pub enum CaseDraftAction {
160 /// Scaffold a new outbound draft (not a reply) in this case.
161 New {
162 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
163 case_ref: String,
164 /// Recipient address. Repeatable.
165 #[arg(long = "to")]
166 to: Vec<String>,
167 /// Cc address. Repeatable.
168 #[arg(long = "cc")]
169 cc: Vec<String>,
170 /// Draft subject.
171 #[arg(long)]
172 subject: Option<String>,
173 },
174 /// Validate a draft under the case drafts directory.
175 Validate {
176 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
177 case_ref: String,
178 /// Draft markdown file under the case drafts directory.
179 draft_name: String,
180 },
181 /// Copy or reference a file and add it to a draft's attachments.
182 Attach {
183 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
184 case_ref: String,
185 /// Draft markdown file under the case drafts directory.
186 draft_name: String,
187 /// Local file path to attach.
188 path: String,
189 },
190 /// Remove a local draft and any queued outbound item for it.
191 Remove {
192 /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
193 case_ref: String,
194 /// Draft markdown file under the case drafts directory.
195 draft_name: String,
196 /// Why this draft should be removed; required by default.
197 #[arg(long)]
198 reason: Option<String>,
199 },
200}