Skip to main content

agent_first_mail/cli/
archive.rs

1use clap::{Args, Subcommand};
2
3#[derive(Subcommand, Debug)]
4pub enum ArchiveAction {
5    /// List compact archived cases and/or direct-message archive categories.
6    List {
7        #[command(subcommand)]
8        target: Option<ArchiveListAction>,
9    },
10    /// Operate on a direct-message archive category.
11    Message {
12        #[command(subcommand)]
13        action: ArchiveMessageCommand,
14    },
15    /// Operate on an archived case.
16    Case {
17        #[command(subcommand)]
18        action: ArchiveCaseAction,
19    },
20}
21
22#[derive(Subcommand, Debug)]
23pub enum ArchiveListAction {
24    /// List compact archived cases.
25    Cases,
26    /// List compact direct-message archive categories.
27    Messages,
28}
29
30#[derive(Subcommand, Debug)]
31pub enum ArchiveMessageCommand {
32    /// Create a direct-message archive category and optionally file one message.
33    Create(ArchiveMessageCreateArgs),
34    /// File an existing message into this direct-message archive category.
35    Add {
36        /// Direct-message archive category ref: aYYYYMMDDNNN or aYYYYMMDDNNN-any-suffix.
37        archive_ref: String,
38        /// Message id to file.
39        message_id: String,
40        /// Human/agent-authored summary for this archive entry.
41        #[arg(long)]
42        summary: String,
43        /// Why this disposition is correct; required by default.
44        #[arg(long)]
45        reason: Option<String>,
46    },
47    /// Show archive category index and entries.
48    Show {
49        /// Direct-message archive category ref: aYYYYMMDDNNN or aYYYYMMDDNNN-any-suffix.
50        archive_ref: String,
51    },
52    /// Restore a direct archived message to triage.
53    Restore {
54        /// Direct-message archive category ref: aYYYYMMDDNNN or aYYYYMMDDNNN-any-suffix.
55        archive_ref: String,
56        message_id: String,
57        /// Why this message needs active triage again; required by default.
58        #[arg(long)]
59        reason: Option<String>,
60    },
61    /// Move a direct archived message to another archive category.
62    Move {
63        /// Source direct-message archive category ref.
64        archive_ref: String,
65        message_id: String,
66        /// Destination archive category ref.
67        new_archive_ref: String,
68        /// Why this category is better; required by default.
69        #[arg(long)]
70        reason: Option<String>,
71    },
72    /// Rename this archive category's human-readable name without changing its UID.
73    Rename {
74        /// Direct-message archive category ref: aYYYYMMDDNNN or aYYYYMMDDNNN-any-suffix.
75        archive_ref: String,
76        /// New human-readable archive name.
77        #[arg(long)]
78        name: String,
79        /// Why this name better represents the category; required by default.
80        #[arg(long)]
81        reason: Option<String>,
82    },
83    /// Set or replace one direct archive entry summary.
84    SetSummary {
85        /// Direct-message archive category ref: aYYYYMMDDNNN or aYYYYMMDDNNN-any-suffix.
86        archive_ref: String,
87        message_id: String,
88        #[arg(long)]
89        summary: String,
90        /// Why this summary is useful; required by default.
91        #[arg(long)]
92        reason: Option<String>,
93    },
94    /// Show or edit archive category notes.
95    Notes {
96        #[command(subcommand)]
97        action: ArchiveMessageNotesAction,
98    },
99}
100
101#[derive(Args, Debug, Clone)]
102pub struct ArchiveMessageCreateArgs {
103    /// Human-readable archive category name used in metadata and the directory suffix.
104    #[arg(long)]
105    pub name: String,
106    /// Optional message to immediately file into the new archive category.
107    #[arg(long)]
108    pub message: Option<String>,
109    /// Required when --message is supplied.
110    #[arg(long)]
111    pub summary: Option<String>,
112    /// Why this archive category is being created.
113    #[arg(long)]
114    pub reason: Option<String>,
115}
116
117#[derive(Subcommand, Debug)]
118pub enum ArchiveCaseAction {
119    /// Show the archived case.
120    Show {
121        /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
122        case_ref: String,
123    },
124    /// Restore an archived case to an active case group.
125    Restore {
126        /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
127        case_ref: String,
128        /// Active case group to restore into.
129        #[arg(long)]
130        group: String,
131        /// Why this case needs active attention again; required by default.
132        #[arg(long)]
133        reason: Option<String>,
134    },
135    /// Rename this archived case's human-readable name without changing its UID.
136    Rename {
137        /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
138        case_ref: String,
139        /// New human-readable case name.
140        #[arg(long)]
141        name: String,
142        /// Why this name better represents the case; required by default.
143        #[arg(long)]
144        reason: Option<String>,
145    },
146    /// Show or edit archived case notes.
147    Notes {
148        #[command(subcommand)]
149        action: ArchiveCaseNotesAction,
150    },
151}
152
153#[derive(Subcommand, Debug)]
154pub enum ArchiveMessageNotesAction {
155    /// Show notes markdown.
156    Show {
157        /// Direct-message archive category ref: aYYYYMMDDNNN or aYYYYMMDDNNN-any-suffix.
158        archive_ref: String,
159    },
160    /// Append text to notes markdown.
161    Append {
162        /// Direct-message archive category ref: aYYYYMMDDNNN or aYYYYMMDDNNN-any-suffix.
163        archive_ref: String,
164        /// Markdown text to append.
165        #[arg(long)]
166        text: String,
167    },
168    /// Replace notes markdown with text.
169    Replace {
170        /// Direct-message archive category ref: aYYYYMMDDNNN or aYYYYMMDDNNN-any-suffix.
171        archive_ref: String,
172        /// Markdown text to write.
173        #[arg(long)]
174        text: String,
175    },
176}
177
178#[derive(Subcommand, Debug)]
179pub enum ArchiveCaseNotesAction {
180    /// Show notes markdown.
181    Show {
182        /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
183        case_ref: String,
184    },
185    /// Append text to notes markdown.
186    Append {
187        /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
188        case_ref: String,
189        /// Markdown text to append.
190        #[arg(long)]
191        text: String,
192    },
193    /// Replace notes markdown with text.
194    Replace {
195        /// Case ref: cYYYYMMDDNNN or cYYYYMMDDNNN-any-suffix.
196        case_ref: String,
197        /// Markdown text to write.
198        #[arg(long)]
199        text: String,
200    },
201}