feat: support draft editing and file-sourced draft bodies - #77
Merged
Conversation
Add two draft enhancements:
1. `mail compose` can now read a draft body from a file via
`-F`/`--body-file PATH` as an alternative to the inline positional
body. Exactly one of the two must be supplied.
2. A new `PATCH /drafts/{draft_id}` endpoint lets an authenticated
user-agent update an existing draft's subject, body, reply_to, and
tags. Only supplied fields change (tags: [] clears, omitted leaves
unchanged) and updated_at is refreshed on any edit. Exposed in the
CLI as `mail draft-edit` (alias `de`).
Regenerates spec/openapi.yaml and updates the HTTP and CLI docs.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Two enhancements to message drafts in MAIL:
mail compose --body-file— the draft body can now be read from a file via-F/--body-file PATHas an alternative to the inline positional body. Exactly one of the two must be supplied.PATCH /drafts/{draft_id}— a new endpoint letting an authenticated user-agent update an existing draft'ssubject,body,reply_to, andtags. Only supplied fields change (tags: []clears, omitted leaves unchanged), andupdated_atis refreshed on any edit. Exposed in the CLI asmail draft-edit(aliasde).Changes
DraftPatchRequest(all-optional fields) +DraftPatchResponse.validate_patch_draft_requestvalidator,PATCH /drafts/{draft_id}route (mirrors thepatch_webhookprecedent), andpatch_drafton the backend base + memory impl (model_copy+updated_at, 404 on unknown/foreign draft)._body.pybody resolver; optional positional body forcompose; newdraft-editcommand.spec/openapi.yaml; updatedhttp.md,cli.md, andquickstart.md.Design notes
--body-fileis an explicit flag (not a@path/auto-detect convention), and PATCH does not guard against editing already-sent drafts (sent_atis never set under current behavior, so the guard couldn't trigger).reply_tois editable via PATCH, matchingcompose.Testing
body_filearg.443 passed, 6 xfailed(xfails are pre-existing NotImplementedError stubs).ruffclean on all touched files; OpenAPI drift test passes.🤖 Generated with Claude Code