feat: add custom return path flag and CID/URL attachment syntax#352
Merged
Conversation
- domains create: new --custom-return-path <subdomain> flag (same as domains claim create) - emails send --attachment: optional ;cid=, ;type=, ;filename= params on paths, plus https:// URLs passed as hosted attachments - emails send --attachments-file: JSON array escape hatch (file or stdin) accepting snake_case and camelCase fields - dry-run now summarizes contentId/contentType/path (content stays redacted as byteLength) - document URL attachment caveats (async fetch failure, no derived filename/type) in help text and agent skill
gabrielmfern
approved these changes
Jul 22, 2026
Contributor
There was a problem hiding this comment.
1 issue found across 9 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/commands/emails/send.ts">
<violation number="1" location="src/commands/emails/send.ts:325">
P2: Unknown suffixes following a valid suffix are accepted as part of the preceding value, so `--attachment "a.png;cid=logo;foo=bar"` does not return `invalid_attachment`. Validate parameter-like tokens in every suffix value (while preserving MIME parameters in `;type=`) before constructing metadata.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
| (value) => { | ||
| let spec: AttachmentSpec; | ||
| try { | ||
| spec = parseAttachmentSpec(value); |
Contributor
There was a problem hiding this comment.
P2: Unknown suffixes following a valid suffix are accepted as part of the preceding value, so --attachment "a.png;cid=logo;foo=bar" does not return invalid_attachment. Validate parameter-like tokens in every suffix value (while preserving MIME parameters in ;type=) before constructing metadata.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/commands/emails/send.ts, line 325:
<comment>Unknown suffixes following a valid suffix are accepted as part of the preceding value, so `--attachment "a.png;cid=logo;foo=bar"` does not return `invalid_attachment`. Validate parameter-like tokens in every suffix value (while preserving MIME parameters in `;type=`) before constructing metadata.</comment>
<file context>
@@ -295,21 +318,58 @@ export const sendCommand = new Command('send')
+ (value) => {
+ let spec: AttachmentSpec;
+ try {
+ spec = parseAttachmentSpec(value);
+ } catch (err) {
+ return outputError(
</file context>
- reject stray ;key= tokens inside cid and filename values (type stays permissive for MIME parameters) - stop silently ignoring an explicit empty --attachments-file value, including in the --template conflict check - forward explicit empty --custom-return-path to the API - mention camelCase aliases in the unsupported-field error
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
Closes two gaps where the CLI couldn't express features the SDK already supports:
domains create --custom-return-path <subdomain>— same flagdomains claim createalready has; sets the Return-Path subdomain (e.g.bounce) at creation.Inline/CID and hosted-URL attachments on
emails send—--attachmentnow accepts optional curl-style suffix params, andhttps://values are passed as hosted attachments:--attachments-file <path|->— JSON-array escape hatch (file or stdin) for scripted use or paths containing a literal;key=; accepts both snake_case and camelCase fields, mirroringemails batch --file.Design notes
;cid=/;type=/;filename=tokens, so Windows paths, plain semicolons/equals, and MIME parameters (type=text/plain;charset=utf-8) parse correctly. Unrecognized;key=errors (invalid_attachment) instead of silently mis-attaching.contentId/contentType/pathper attachment; raw content stays redacted asbyteLength.domains updateis untouched: the SDK'sUpdateDomainsOptionshas nocustomReturnPath.attachment-0/application/octet-stream).Testing
content_id: "logo"andcontent_disposition: "inline"; base64 JSON-file attachment delivered; hosted-URL attachment (sample invoice.pdf) delivered;domains create --custom-return-path bouncereturned SPF/MX records onbounce.<domain>instead of the defaultsend.(test domain deleted afterwards).Summary by cubic
Adds
--custom-return-pathtodomains createand extendsemails sendto support CID/URL attachments and a JSON attachments file. Tightens attachment parsing and improves dry-run output.New Features
domains create --custom-return-path <subdomain>sets the Return-Path subdomain (e.g.,bounce).emails send --attachmentaccepts;cid=,;type=,;filename=suffixes andhttps://URLs as hosted attachments (quote values).--attachments-file <path|->reads a JSON array of attachments; snake_case and camelCase fields are accepted.contentId,contentType,path) with content redacted asbyteLength. For URL attachments, the API fetches after send; pass;filename=and;type=, and check failures withemails get <id>.Bug Fixes
;key=params (except MIME params in;type=) withinvalid_attachment.--attachments-file, including in the--templateconflict check.--custom-return-pathto the API.Written for commit d74616f. Summary will update on new commits.