My email triage setup applies labels, flags, and moves to 20+ messages per run. Each pm-cli call currently opens a fresh IMAP session to Proton Bridge, so a typical apply run is 5-10 separate connections with full auth round-trips. It's the dominant latency.
I'm proposing a mail batch command that reads a JSON array of operations from stdin and executes them over a single IMAP connection:
echo '[
{"op": "label", "uids": ["uid:123"], "label": "Important"},
{"op": "flag", "uids": ["uid:456"], "read": true},
{"op": "archive", "uids": ["uid:789"]}
]' | pm-cli mail batch --json
Supported ops: label, unlabel, archive, move, flag, delete. Each op is validated before execution: unknown ops, missing required fields, and IMAP special characters in names are all caught upfront. Input is capped at 10MB via io.LimitReader. Output reports per-op success/failure, with an optional --stop-on-error flag.
Branch: feat/mail-batch. Open to feedback on the JSON schema.
My email triage setup applies labels, flags, and moves to 20+ messages per run. Each pm-cli call currently opens a fresh IMAP session to Proton Bridge, so a typical apply run is 5-10 separate connections with full auth round-trips. It's the dominant latency.
I'm proposing a
mail batchcommand that reads a JSON array of operations from stdin and executes them over a single IMAP connection:Supported ops:
label,unlabel,archive,move,flag,delete. Each op is validated before execution: unknown ops, missing required fields, and IMAP special characters in names are all caught upfront. Input is capped at 10MB viaio.LimitReader. Output reports per-op success/failure, with an optional--stop-on-errorflag.Branch:
feat/mail-batch. Open to feedback on the JSON schema.