feat(cli): add --cc and --bcc to e2a send and e2a reply - #924
Conversation
The API, both SDKs, and the MCP send_message tool already carry cc/bcc on send (SendEmailRequest, ReplyRequest both declare cc?: string[] and bcc?: string[]); only the CLI's send.ts/e2a.ts never wired the flags through. --to, --cc, and --bcc combined are capped at 50 recipients server-side; send now checks the total client-side too and fails with the usage exit code (2) instead of a request error, since send has the whole set in hand. reply has no such check: its primary recipients come from the thread being replied to, not a flag. e2a forward does not exist as a CLI command, so the issue's request to check it there does not apply. Fixes tokencanopy#816
jiashuoz
left a comment
There was a problem hiding this comment.
LGTM — approving.
Verified against the code before approving:
- Generated
SendEmailRequest/ReplyRequestalready carry optionalcc/bcc, andSendEmailInput/ReplyInputinherit them viaOmit, so the pass-through is type-valid with no SDK changes. - The server cap is 50 combined across to+cc+bcc (
internal/httpapi/outbound.go,maxRecipients = 50,too_many_recipients), so the CLI pre-check matches server semantics and fails with exit 2 before any request — exactly what #816 asked for. - Skipping the pre-check on
replyis correctly reasoned (thread recipients aren't knowable client-side; server stays the backstop). - 5 new tests cover passthrough, empty-list omission, the 50/51 boundary, and reply — good negative-path and boundary coverage.
- No CHANGELOG entry needed per-PR; entries are batched at release time per repo convention.
Two nits, non-blocking:
-
Help-text placement (
cli/src/bin/e2a.ts): the cap note is a continuation line under--json, so it reads as part of the--jsondescription. Consider attaching it to the--bccline or making it a standalone note under thesendblock. -
Duplicated constant:
MAX_COMBINED_RECIPIENTS = 50mirrors the server'smaxRecipients. If the server value ever changes, the CLI message drifts (harmlessly — the server error carriesmax_recipientsin details). A one-line comment pointing at the server source would help future maintainers.
|
Thanks for the quick review and merge. Glad the SendEmailInput/ReplyInput types lined up cleanly with the CLI wiring. |
Version bumps ahead of the v1.7.11 cut. The publish workflows read the in-repo version (npm publish from package.json, hatchling from pyproject.toml), so these have to land before the cli-v2.5.0 and python-v5.8.0 tags are pushed. CLI 2.4.0 -> 2.5.0 for the new --cc/--bcc flags on send and reply (#924). Python 5.7.0 -> 5.8.0 for the generated-layer dot-segment guard (#929). Minor rather than patch: the guard raises E2AValidationError on path parameter values that previously produced a real, misdirected request, so it is caller-visible behavior, which is how the changelog already frames it. The TypeScript SDK is deliberately not republished this round: its only change since v1.7.10 is a devDependency bump. Note that the TS half of the dot-segment fix is still outstanding (#915). Co-authored-by: Jace <jace@team.tokencanopy.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Summary
e2a send/e2a replyhad no--cc/--bcc, even though the REST API, bothSDKs, and the MCP
send_messagetool already carrycc/bccon send. Addsthe flags to both commands, wired straight onto the existing request fields.
Client surface checklist
make generateis clean): not touched,cc/bccwere already onSendEmailRequest/ReplyRequestcli/src/commands/+ wired intocli/src/bin/e2a.tssend_message/reply_messageinmcp/src/tools/legacy.tsalready acceptcc/bccSkipped rows: Go handler, migration. No server-side change, the fields already exist.
Operational risk
None. Client-only change, no new server behavior.
Test plan
npm run test:coverage --workspace @e2a/cli: 321/321 passed (5 new). The 5 newcases fail on unmodified
main(tscrejectscc/bccas unknownSendOptions/ReplyOptionsproperties) and pass on this branch.npm run build --workspace @e2a/cli: clean.e2a sendwith 51 combined--to/--cc/--bccrecipients,confirmed it exits 2 (usage) before any request is sent, per the issue's ask.
has no e2a instance to send through); the SDK call shape is covered by the unit
tests above instead.
The over-cap check only applies to
send;reply's primary recipients comefrom the thread being replied to, so the CLI cannot compute the true combined
total the way it can for
send.e2a forwarddoes not exist as a CLI command, so the issue's suggestion tocheck it there does not apply.
Fixes #816