Skip to content

feat: add --dry-run option for email and broadcast commands#184

Merged
felipefreitag merged 5 commits intoresend:mainfrom
Shubhdeep12:feat/dry-run-support
Apr 9, 2026
Merged

feat: add --dry-run option for email and broadcast commands#184
felipefreitag merged 5 commits intoresend:mainfrom
Shubhdeep12:feat/dry-run-support

Conversation

@Shubhdeep12
Copy link
Copy Markdown
Contributor

@Shubhdeep12 Shubhdeep12 commented Apr 8, 2026

  • To validate without API calls.
  • Currently added for emails send and broadcast create commands as they are write-heavy.

Summary by cubic

Adds a --dry-run mode to emails send and broadcasts create to validate payloads and print the exact request JSON without calling the API. Output is { "dryRun": true, "request": { ... } } and works interactively without network calls or an API key.

  • New Features
    • resend emails send --dry-run: validates and prints { "dryRun": true, "request": { ... } }; attachments summarized as filename and byteLength; respects --json; skips verified-domain lookup in interactive mode.
    • resend broadcasts create --dry-run: validates and prints the create payload (includes send/scheduledAt when set); respects --json; in interactive mode, prompts for segment/topic IDs instead of fetching lists.
    • Help text and docs updated (README.md, skills/resend-cli/SKILL.md); other write commands remain unchanged (no dry-run yet).

Written for commit 1d1f5ff. Summary will update on new commits.

@Shubhdeep12 Shubhdeep12 marked this pull request as draft April 8, 2026 16:57
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 6 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:78">
P2: Dry-run still performs API-related work before early return (requireClient and fetchVerifiedDomains), which can call the API and require credentials despite the “without calling the API” promise.</violation>
</file>

<file name="src/commands/broadcasts/create.ts">

<violation number="1" location="src/commands/broadcasts/create.ts:56">
P2: `--dry-run` is documented as making no API calls, but the command still performs API-backed lookups (domains/topic/segment pickers) before the dry-run check, so interactive dry runs can still hit the API.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread src/commands/emails/send.ts
Comment thread src/commands/broadcasts/create.ts Outdated
@Shubhdeep12 Shubhdeep12 marked this pull request as ready for review April 8, 2026 17:02
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 6 files

@felipefreitag
Copy link
Copy Markdown
Contributor

@Shubhdeep12 Thanks for adding this.
The interactive mode naturally calls the API, so it seems to me that the --dry-run flag makes sense only for non-interactive mode, what do you think?

Comment thread src/commands/broadcasts/create.ts Outdated

if (opts.dryRun) {
outputResult(
{ dry_run: true, request: createPayload },
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All other keys are in camelCase, I think this one should be too

Comment thread src/commands/emails/send.ts Outdated
if (opts.dryRun) {
outputResult(
{
dry_run: true,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All other keys are in camelCase, I think this one should be too

@Shubhdeep12
Copy link
Copy Markdown
Contributor Author

@Shubhdeep12 Thanks for adding this. The interactive mode naturally calls the API, so it seems to me that the --dry-run flag makes sense only for non-interactive mode, what do you think?

hey @felipefreitag I’d suggest keeping interactive --dry-run too, so the flag always means no calls to Resend.
we’d just skip the listing APIs and use text prompts where we’d normally fetch lists.

Copy link
Copy Markdown
Contributor

@felipefreitag felipefreitag left a comment

Choose a reason for hiding this comment

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

See discussion about interactive mode

@felipefreitag felipefreitag merged commit 1f2ec97 into resend:main Apr 9, 2026
8 checks passed
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.

2 participants