agent_first_mail/cli/common.rs
1use clap::Subcommand;
2
3#[derive(Subcommand, Debug)]
4pub enum ConfigAction {
5 /// Show local .afmail/config.json.
6 Show,
7 /// Get one config key.
8 Get { key: String },
9 /// Set one config key. Multiple values become an array for array keys.
10 Set { key: String, values: Vec<String> },
11}
12
13#[derive(Subcommand, Debug)]
14pub enum RemoteAction {
15 /// Test IMAP login using local config.
16 Test,
17 /// List IMAP folders/mailboxes.
18 Folders,
19}
20
21#[derive(Subcommand, Debug)]
22pub enum TriageAction {
23 /// List compact untriaged message locators.
24 List,
25}
26
27#[derive(Subcommand, Debug)]
28pub enum PushAction {
29 /// List queued local push items.
30 List,
31 /// Push queued outbound drafts through configured draft.save actions.
32 Drafts {
33 /// Show planned push actions without IMAP/SMTP writes. This is the default.
34 #[arg(long)]
35 dry_run: bool,
36 /// Apply queued IMAP/SMTP effects.
37 #[arg(long)]
38 confirm: bool,
39 },
40 /// Push queued outbound drafts through configured draft.send actions.
41 DraftsSend {
42 /// Show planned push actions without IMAP/SMTP writes. This is the default.
43 #[arg(long)]
44 dry_run: bool,
45 /// Apply queued IMAP/SMTP effects, including sending mail.
46 #[arg(long)]
47 confirm: bool,
48 },
49 /// Push queued archive actions to their configured IMAP mailboxes.
50 Archive {
51 /// Show planned push actions without IMAP writes. This is the default.
52 #[arg(long)]
53 dry_run: bool,
54 /// Apply queued IMAP effects.
55 #[arg(long)]
56 confirm: bool,
57 },
58 /// Push queued spam actions to the configured Junk mailbox.
59 Spam {
60 /// Show planned push actions without IMAP writes. This is the default.
61 #[arg(long)]
62 dry_run: bool,
63 /// Apply queued IMAP effects.
64 #[arg(long)]
65 confirm: bool,
66 },
67 /// Push queued trash actions to the configured Trash mailbox.
68 Trash {
69 /// Show planned push actions without IMAP writes. This is the default.
70 #[arg(long)]
71 dry_run: bool,
72 /// Apply queued IMAP effects.
73 #[arg(long)]
74 confirm: bool,
75 },
76}
77
78#[derive(Subcommand, Debug)]
79pub enum DoctorAction {
80 /// Repair only unambiguous afmail-generated state.
81 Repair {
82 /// Apply repair actions. Without this flag, repair is refused.
83 #[arg(long)]
84 confirm: bool,
85 },
86}
87
88#[derive(Subcommand, Debug, Clone)]
89pub enum PurgeAction {
90 /// Permanently delete old local spam records.
91 Spam {
92 /// Only purge messages marked spam at least this many days ago. Defaults to 30.
93 #[arg(long = "older-than-days", value_name = "DAYS")]
94 older_than_days: Option<u64>,
95 },
96 /// Permanently delete old local trash records.
97 Trash {
98 /// Only purge messages marked trash at least this many days ago. Defaults to 30.
99 #[arg(long = "older-than-days", value_name = "DAYS")]
100 older_than_days: Option<u64>,
101 },
102 /// Permanently delete old local records whose remote message disappeared.
103 Deleted {
104 /// Only purge messages marked remote-deleted at least this many days ago. Defaults to 30.
105 #[arg(long = "older-than-days", value_name = "DAYS")]
106 older_than_days: Option<u64>,
107 },
108}
109
110#[derive(Subcommand, Debug)]
111pub enum RenderAction {
112 /// Rebuild generated case and direct-message archive read views.
113 Refresh,
114 /// Export built-in language templates, keeping existing files unless forced.
115 Templates {
116 /// Overwrite existing workspace templates with built-in defaults.
117 #[arg(long)]
118 force: bool,
119 },
120}
121
122#[derive(Subcommand, Debug)]
123pub enum LogAction {
124 /// List recent audit events.
125 List {
126 /// Maximum number of events to return.
127 #[arg(long, default_value_t = 50)]
128 limit: usize,
129 },
130 /// Tail recent audit events as JSON data.
131 Tail,
132 /// List events for one message id.
133 Message { message_id: String },
134 /// List events for one case id.
135 Case { case_uid: String },
136 /// List events for one archive category.
137 Archive { archive_uid: String },
138}