Skip to content

feat(cli): add --cc and --bcc to e2a send and e2a reply - #924

Merged
jiashuoz merged 1 commit into
tokencanopy:mainfrom
AmirF194:fix/816-cli-cc-bcc-flags
Aug 21, 2026
Merged

feat(cli): add --cc and --bcc to e2a send and e2a reply#924
jiashuoz merged 1 commit into
tokencanopy:mainfrom
AmirF194:fix/816-cli-cc-bcc-flags

Conversation

@AmirF194

Copy link
Copy Markdown
Contributor

Summary

e2a send/e2a reply had no --cc/--bcc, even though the REST API, both
SDKs, and the MCP send_message tool already carry cc/bcc on send. Adds
the flags to both commands, wired straight onto the existing request fields.

Client surface checklist

  • OpenAPI spec + generated types refreshed (make generate is clean): not touched, cc/bcc were already on SendEmailRequest/ReplyRequest
  • TypeScript SDK: not touched, for the same reason
  • Python SDK: not touched, for the same reason
  • CLI command or flag in cli/src/commands/ + wired into cli/src/bin/e2a.ts
  • MCP tool: not touched, send_message/reply_message in mcp/src/tools/legacy.ts already accept cc/bcc
  • Tests at each surface above (positive + at least one negative-path / regression case)

Skipped 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 new
    cases fail on unmodified main (tsc rejects cc/bcc as unknown SendOptions/
    ReplyOptions properties) and pass on this branch.
  • npm run build --workspace @e2a/cli: clean.
  • Manual: built CLI, ran e2a send with 51 combined --to/--cc/--bcc recipients,
    confirmed it exits 2 (usage) before any request is sent, per the issue's ask.
  • Not checked: a live end-to-end send through a running server (this environment
    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 come
from the thread being replied to, so the CLI cannot compute the true combined
total the way it can for send.

e2a forward does not exist as a CLI command, so the issue's suggestion to
check it there does not apply.

Fixes #816

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
@AmirF194
AmirF194 requested a review from jiashuoz as a code owner August 21, 2026 12:28

@jiashuoz jiashuoz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — approving.

Verified against the code before approving:

  • Generated SendEmailRequest/ReplyRequest already carry optional cc/bcc, and SendEmailInput/ReplyInput inherit them via Omit, 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 reply is 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:

  1. Help-text placement (cli/src/bin/e2a.ts): the cap note is a continuation line under --json, so it reads as part of the --json description. Consider attaching it to the --bcc line or making it a standalone note under the send block.

  2. Duplicated constant: MAX_COMBINED_RECIPIENTS = 50 mirrors the server's maxRecipients. If the server value ever changes, the CLI message drifts (harmlessly — the server error carries max_recipients in details). A one-line comment pointing at the server source would help future maintainers.

@jiashuoz
jiashuoz merged commit e929121 into tokencanopy:main Aug 21, 2026
24 checks passed
@AmirF194

Copy link
Copy Markdown
Contributor Author

Thanks for the quick review and merge. Glad the SendEmailInput/ReplyInput types lined up cleanly with the CLI wiring.

@AmirF194
AmirF194 deleted the fix/816-cli-cc-bcc-flags branch August 21, 2026 22:04
jiashuoz added a commit that referenced this pull request Aug 23, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cli): e2a send has no --cc or --bcc flag

2 participants