Skip to main content

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}
32
33#[derive(Subcommand, Debug)]
34pub enum DoctorAction {
35    /// Repair only unambiguous afmail-generated state.
36    Repair {
37        /// Apply repair actions. Without this flag, repair is refused.
38        #[arg(long)]
39        confirm: bool,
40    },
41}
42
43#[derive(Subcommand, Debug, Clone)]
44pub enum PurgeAction {
45    /// Permanently delete old local spam records.
46    Spam {
47        /// Only purge messages marked spam at least this many days ago. Defaults to 30.
48        #[arg(long = "older-than-days", value_name = "DAYS")]
49        older_than_days: Option<u64>,
50    },
51    /// Permanently delete old local trash records.
52    Trash {
53        /// Only purge messages marked trash at least this many days ago. Defaults to 30.
54        #[arg(long = "older-than-days", value_name = "DAYS")]
55        older_than_days: Option<u64>,
56    },
57    /// Permanently delete old local records whose remote message disappeared.
58    Deleted {
59        /// Only purge messages marked remote-deleted at least this many days ago. Defaults to 30.
60        #[arg(long = "older-than-days", value_name = "DAYS")]
61        older_than_days: Option<u64>,
62    },
63}
64
65#[derive(Subcommand, Debug)]
66pub enum RenderAction {
67    /// Rebuild generated case and direct-message archive read views.
68    Refresh,
69    /// Export built-in language templates, keeping existing files unless forced.
70    Templates {
71        /// Overwrite existing workspace templates with built-in defaults.
72        #[arg(long)]
73        force: bool,
74    },
75}
76
77#[derive(Subcommand, Debug)]
78pub enum LogAction {
79    /// List recent audit events.
80    List {
81        /// Maximum number of events to return.
82        #[arg(long, default_value_t = 50)]
83        limit: usize,
84    },
85    /// Tail recent audit events as JSON data.
86    Tail,
87    /// List events for one message id.
88    Message { message_id: String },
89    /// List events for one case id.
90    Case { case_uid: String },
91    /// List events for one archive category.
92    Archive { archive_uid: String },
93}