Conversation
Implements three feature requests for automated/headless email workflows. #8 - Bridge password from environment: - GetPassword() checks PM_CLI_BRIDGE_PASSWORD before the system keyring, enabling headless/CI use where no secret service is available. Interactive use is unchanged (env var only consulted when set and non-empty). #9 - mail list enhancements: - --unread/--flagged now use server-side IMAP SEARCH, so results honor --limit instead of being thinned by client-side filtering. - Adds from_address, to, message_id, and in_reply_to to list/search output (all already in the ENVELOPE, no extra fetch). - Adds --fields (project onto named JSON fields) and --compact (bare array). - ListMessages now takes a ListOptions struct; all callers updated. #10 - mail batch: - New 'mail batch' subcommand executes a JSON array of operations (label, unlabel, archive, move, flag, delete) over a single IMAP session. - Operations are fully validated before connecting; mailbox/label names with IMAP special characters (including the source mailbox) are rejected; input is capped at 10MB; errors are sanitized for terminal output. - --stop-on-error halts after the first failure; per-op results reported. Docs (commands.md, batch-format.md) and JSON help schema updated; version bumped to 0.3.0. Note: batch's per-op success reporting depends on issue #11 (silent no-op detection in STORE/COPY) for full accuracy.
Report-level credit to @Juan-de-Costa-Rica for the detailed issue reports. Implementation written fresh against the issues.
No v0.3.0 release/tag exists yet; latest published release is v0.2.5.
These changes ship in the 0.2.6 line, not a 0.3.0 minor release.
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements three feature requests (#8, #9, #10) for automated/headless email workflows. Reimplemented from scratch (issue branches used only as reference); builds clean,
go vetclean, all tests pass.#8 — Bridge password from env var
GetPassword()checksPM_CLI_BRIDGE_PASSWORDbefore the system keyring → enables headless/CI use with no secret service.#9 —
mail listenhancements--unreadundercount:--unread/--flaggednow use server-side IMAPSEARCH, so results honor--limitinstead of being thinned by client-side filtering. The two can be combined.from_address,to,message_id,in_reply_toto list/search JSON (all already in the ENVELOPE — zero extra fetch). Previouslyfromdropped the address whenever a display name was present.--fields(project onto named JSON fields) and--compact(bare array). JSON-only; text output unchanged.ListMessagesnow takes aListOptionsstruct; all callers updated.#10 —
mail batchmail batchsubcommand runs a JSON array of ops (label,unlabel,archive,move,flag,delete) over a single IMAP session.mailbox(closed a gap vs. the original proposal); 10MB input cap; errors sanitized viasafetext.--stop-on-errorhalts after first failure; per-op results + totals reported.Tests & docs
docs/commands.md, newdocs/batch-format.md, and the--help-jsonschema updated. Version bumped to 0.2.6.mail batchroutes throughCopyMessages/DeleteMessages/MoveMessages. Its per-op success reporting is only fully accurate once #11 (silent no-op detection in STORE/COPY) lands — and #11's COPY check still needs theUIDPLUS/COPYUIDverification flagged in that review. Recommend landing #11 before relying on batch'slabel/unlabelresults.Supersedes #12 (closed automatically when its branch was renamed to
v0.2.6).