resend-cli 1.5.1 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resend-cli",
3
- "version": "1.5.1",
3
+ "version": "1.7.0",
4
4
  "description": "The official CLI for Resend",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -34,18 +34,18 @@
34
34
  "resend": "6.9.4"
35
35
  },
36
36
  "devDependencies": {
37
- "@biomejs/biome": "2.4.7",
37
+ "@biomejs/biome": "2.4.8",
38
38
  "@types/node": "24.12.0",
39
39
  "esbuild": "0.27.4",
40
40
  "tsx": "4.21.0",
41
41
  "typescript": "5.9.3",
42
- "vitest": "4.1.0",
42
+ "vitest": "4.1.1",
43
43
  "@yao-pkg/pkg": "6.14.1"
44
44
  },
45
45
  "scripts": {
46
46
  "dev": "tsx src/cli.ts",
47
47
  "dev:watch": "tsx --watch src/cli.ts",
48
- "build": "esbuild src/cli.ts --bundle --platform=node --format=cjs --minify --outfile=dist/cli.cjs",
48
+ "build": "node scripts/build.mjs",
49
49
  "build:bin": "pnpm build && pkg dist/cli.cjs --compress Brotli --target node24 --output dist/resend",
50
50
  "lint": "biome check .",
51
51
  "lint:fix": "biome check --write .",
@@ -1,15 +1,16 @@
1
1
  ---
2
2
  name: resend-cli
3
3
  description: >
4
- Operate the Resend platform from the terminal — send emails, manage domains,
5
- contacts, broadcasts, templates, webhooks, and API keys via the `resend` CLI.
6
- Use when the user wants to run Resend commands in the shell, scripts, or CI/CD
7
- pipelines. Always load this skill before running `resend` commands it contains
4
+ Operate the Resend platform from the terminal — send emails (including React Email
5
+ .tsx templates via --react-email), manage domains, contacts, broadcasts, templates,
6
+ webhooks, and API keys via the `resend` CLI. Use when the user wants to run Resend
7
+ commands in the shell, scripts, or CI/CD pipelines, or send/preview React Email
8
+ templates. Always load this skill before running `resend` commands — it contains
8
9
  the non-interactive flag contract and gotchas that prevent silent failures.
9
10
  license: MIT
10
11
  metadata:
11
12
  author: resend
12
- version: "1.5.1"
13
+ version: "1.7.0"
13
14
  homepage: https://resend.com
14
15
  source: https://github.com/resend/resend-cli
15
16
  inputs:
@@ -101,6 +102,11 @@ Read the matching reference file for detailed flags and output shapes.
101
102
  resend emails send --from "you@domain.com" --to user@example.com --subject "Hello" --text "Body"
102
103
  ```
103
104
 
105
+ **Send a React Email template (.tsx):**
106
+ ```bash
107
+ resend emails send --from "you@domain.com" --to user@example.com --subject "Welcome" --react-email ./emails/welcome.tsx
108
+ ```
109
+
104
110
  **Domain setup flow:**
105
111
  ```bash
106
112
  resend domains create --name example.com --region us-east-1
@@ -6,7 +6,9 @@ Detailed flag specifications for `resend api-keys` commands.
6
6
 
7
7
  ## api-keys list
8
8
 
9
- List all API keys (IDs, names, and `created_at` only — tokens never included).
9
+ List all API keys (IDs, names, `created_at`, and `last_used_at` — tokens never included).
10
+
11
+ **Output:** `{"object":"list","data":[{"id":"...","name":"...","created_at":"...","last_used_at":"..."|null}]}`
10
12
 
11
13
  ---
12
14
 
@@ -65,3 +65,7 @@ Checks GitHub releases for newer version. Shows upgrade command.
65
65
  ## open
66
66
 
67
67
  Opens `https://resend.com/emails` in the default browser.
68
+
69
+ `broadcasts` and `templates` also have their own `open` subcommands:
70
+ - `resend broadcasts open [id]` — open a broadcast or the broadcasts list
71
+ - `resend templates open [id]` — open a template or the templates list
@@ -22,14 +22,16 @@ Detailed flag specifications for `resend broadcasts` commands.
22
22
  | `--subject <subject>` | string | Yes | Email subject |
23
23
  | `--segment-id <id>` | string | Yes | Target segment |
24
24
  | `--html <html>` | string | At least one body flag | HTML body (supports `{{{PROPERTY\|fallback}}}`) |
25
- | `--html-file <path>` | string | At least one body flag | Path to HTML file |
25
+ | `--html-file <path>` | string | At least one body flag | Path to HTML file (use `"-"` for stdin) |
26
26
  | `--text <text>` | string | At least one body flag | Plain-text body |
27
+ | `--react-email <path>` | string | At least one body flag | Path to React Email template (.tsx) — bundles and renders to HTML. Compatible with `--text` for plain-text fallback |
28
+ | `--text-file <path>` | string | At least one body flag | Path to plain-text file (use `"-"` for stdin) |
27
29
  | `--name <name>` | string | No | Internal label |
28
30
  | `--reply-to <address>` | string | No | Reply-to address |
29
31
  | `--preview-text <text>` | string | No | Preview text |
30
32
  | `--topic-id <id>` | string | No | Topic for subscription filtering |
31
33
  | `--send` | boolean | No | Send immediately (default: save as draft) |
32
- | `--scheduled-at <datetime>` | string | No | Schedule delivery (only with `--send`) |
34
+ | `--scheduled-at <datetime>` | string | No | Schedule delivery — ISO 8601 or natural language (only with `--send`) |
33
35
 
34
36
  ---
35
37
 
@@ -49,7 +51,7 @@ Send a draft broadcast.
49
51
 
50
52
  | Flag | Type | Required | Description |
51
53
  |------|------|----------|-------------|
52
- | `--scheduled-at <datetime>` | string | No | Schedule instead of immediate send |
54
+ | `--scheduled-at <datetime>` | string | No | Schedule instead of immediate send — ISO 8601 or natural language |
53
55
 
54
56
  **Note:** Dashboard-created broadcasts cannot be sent via API.
55
57
 
@@ -66,6 +68,7 @@ Send a draft broadcast.
66
68
  | `--html <html>` | string | Update HTML body |
67
69
  | `--html-file <path>` | string | Path to HTML file |
68
70
  | `--text <text>` | string | Update plain-text body |
71
+ | `--react-email <path>` | string | Path to React Email template (.tsx) — bundles and renders to HTML |
69
72
  | `--name <name>` | string | Update internal label |
70
73
 
71
74
  ---
@@ -79,3 +82,11 @@ Send a draft broadcast.
79
82
  | `--yes` | boolean | Yes (non-interactive) | Skip confirmation |
80
83
 
81
84
  **Alias:** `rm`
85
+
86
+ ---
87
+
88
+ ## broadcasts open
89
+
90
+ Open a broadcast (or the broadcasts list) in the Resend dashboard.
91
+
92
+ **Argument:** `[id]` — Broadcast ID (omit to open the list)
@@ -10,17 +10,21 @@ Send an email via the Resend API.
10
10
 
11
11
  | Flag | Type | Required | Description |
12
12
  |------|------|----------|-------------|
13
- | `--from <address>` | string | Yes | Sender address (must be on a verified domain) |
13
+ | `--from <address>` | string | Yes (unless `--template`) | Sender address (must be on a verified domain) |
14
14
  | `--to <addresses...>` | string[] | Yes | Recipient(s), space-separated |
15
- | `--subject <subject>` | string | Yes | Email subject line |
16
- | `--text <text>` | string | One of text/html/html-file | Plain-text body |
17
- | `--html <html>` | string | One of text/html/html-file | HTML body |
18
- | `--html-file <path>` | string | One of text/html/html-file | Path to HTML file |
15
+ | `--subject <subject>` | string | Yes (unless `--template`) | Email subject line |
16
+ | `--text <text>` | string | One of text/html/file/react-email/template | Plain-text body |
17
+ | `--text-file <path>` | string | One of text/html/file/react-email/template | Path to plain-text file (use `"-"` for stdin) |
18
+ | `--html <html>` | string | One of text/html/file/react-email/template | HTML body |
19
+ | `--html-file <path>` | string | One of text/html/file/react-email/template | Path to HTML file (use `"-"` for stdin) |
20
+ | `--react-email <path>` | string | One of text/html/file/react-email/template | Path to React Email template (.tsx) — bundles, renders to HTML, and sends |
21
+ | `--template <id>` | string | No | Template ID — replaces body/subject/from with template defaults |
22
+ | `--var <key=value...>` | string[] | No | Template variables as key=value pairs (e.g. `--var name=John --var count=42`) |
19
23
  | `--cc <addresses...>` | string[] | No | CC recipients |
20
24
  | `--bcc <addresses...>` | string[] | No | BCC recipients |
21
25
  | `--reply-to <address>` | string | No | Reply-to address |
22
- | `--scheduled-at <datetime>` | string | No | Schedule for later (ISO 8601) |
23
- | `--attachment <paths...>` | string[] | No | File paths to attach |
26
+ | `--scheduled-at <datetime>` | string | No | Schedule for later ISO 8601 or natural language (e.g. `"in 1 hour"`, `"tomorrow at 9am ET"`) |
27
+ | `--attachment <paths...>` | string[] | No | File paths to attach (not compatible with `--template`) |
24
28
  | `--headers <key=value...>` | string[] | No | Custom headers |
25
29
  | `--tags <name=value...>` | string[] | No | Email tags |
26
30
  | `--idempotency-key <key>` | string | No | Deduplicate request |
@@ -72,6 +76,7 @@ Send up to 100 emails in a single request.
72
76
  | Flag | Type | Required | Description |
73
77
  |------|------|----------|-------------|
74
78
  | `--file <path>` | string | Yes (non-interactive) | Path to JSON file with email array |
79
+ | `--react-email <path>` | string | No | Path to React Email template (.tsx) — rendered HTML is set on every email in the batch |
75
80
  | `--idempotency-key <key>` | string | No | Deduplicate batch |
76
81
  | `--batch-validation <mode>` | string | No | `strict` (fail all) or `permissive` (partial success) |
77
82
 
@@ -108,7 +113,7 @@ Update a scheduled email.
108
113
 
109
114
  | Flag | Type | Required | Description |
110
115
  |------|------|----------|-------------|
111
- | `--scheduled-at <datetime>` | string | Yes | New schedule (ISO 8601) |
116
+ | `--scheduled-at <datetime>` | string | Yes | New schedule ISO 8601 or natural language |
112
117
 
113
118
  **Output:** `{"object":"email","id":"..."}`
114
119
 
@@ -19,7 +19,9 @@ All errors exit with code `1` and output JSON to **stderr**:
19
19
 
20
20
  | Code | Cause | Resolution |
21
21
  |------|-------|------------|
22
- | `missing_body` | None of `--text`, `--html`, or `--html-file` provided | Provide at least one body flag |
22
+ | `missing_body` | None of `--text`, `--html`, `--html-file`, or `--react-email` provided | Provide at least one body flag |
23
+ | `react_email_build_error` | Failed to bundle a React Email `.tsx` template with esbuild | Check the template compiles; ensure `react` and `@react-email/render` (or `@react-email/components`) are installed in the project |
24
+ | `react_email_render_error` | Bundled template failed during `render()` | Check the component exports a default function and renders valid React Email markup |
23
25
  | `file_read_error` | Could not read file from `--html-file` path | Check file path exists and is readable |
24
26
  | `send_error` | Resend API rejected the send request | Check from address is on a verified domain; check recipient is valid |
25
27
 
@@ -19,10 +19,12 @@ Detailed flag specifications for `resend templates` commands.
19
19
  | Flag | Type | Required | Description |
20
20
  |------|------|----------|-------------|
21
21
  | `--name <name>` | string | Yes | Template name |
22
- | `--html <html>` | string | One of html/html-file | HTML body with `{{{VAR_NAME}}}` placeholders |
23
- | `--html-file <path>` | string | One of html/html-file | Path to HTML file |
22
+ | `--html <html>` | string | One of html/html-file/react-email | HTML body with `{{{VAR_NAME}}}` placeholders |
23
+ | `--html-file <path>` | string | One of html/html-file/react-email | Path to HTML file (use `"-"` for stdin) |
24
+ | `--react-email <path>` | string | One of html/html-file/react-email | Path to React Email template (.tsx) — bundles and renders to HTML |
24
25
  | `--subject <subject>` | string | No | Email subject |
25
26
  | `--text <text>` | string | No | Plain-text body |
27
+ | `--text-file <path>` | string | No | Path to plain-text file (use `"-"` for stdin) |
26
28
  | `--from <address>` | string | No | Sender address |
27
29
  | `--reply-to <address>` | string | No | Reply-to address |
28
30
  | `--alias <alias>` | string | No | Lookup alias |
@@ -42,7 +44,7 @@ Variable types: `string`, `number`
42
44
 
43
45
  **Argument:** `<id|alias>` — Template ID or alias
44
46
 
45
- Same optional flags as `create`. At least one required.
47
+ Same optional flags as `create` (including `--react-email`, `--text-file`, and `--html-file` with stdin support). At least one required.
46
48
 
47
49
  ---
48
50
 
@@ -65,3 +67,11 @@ Same optional flags as `create`. At least one required.
65
67
  | Flag | Type | Required | Description |
66
68
  |------|------|----------|-------------|
67
69
  | `--yes` | boolean | Yes (non-interactive) | Skip confirmation |
70
+
71
+ ---
72
+
73
+ ## templates open
74
+
75
+ Open a template (or the templates list) in the Resend dashboard.
76
+
77
+ **Argument:** `[id]` — Template ID (omit to open the list)
@@ -42,13 +42,28 @@ resend emails send \
42
42
  --cc manager@example.com \
43
43
  --reply-to support@yourdomain.com
44
44
 
45
- # Scheduled email
45
+ # React Email template (.tsx) — bundles, renders to HTML, and sends
46
+ resend emails send \
47
+ --from "you@yourdomain.com" \
48
+ --to recipient@example.com \
49
+ --subject "Welcome" \
50
+ --react-email ./emails/welcome.tsx
51
+
52
+ # React Email with plain-text fallback
53
+ resend emails send \
54
+ --from "you@yourdomain.com" \
55
+ --to recipient@example.com \
56
+ --subject "Welcome" \
57
+ --react-email ./emails/welcome.tsx \
58
+ --text "Welcome to our platform!"
59
+
60
+ # Scheduled email (ISO 8601 or natural language)
46
61
  resend emails send \
47
62
  --from "you@yourdomain.com" \
48
63
  --to recipient@example.com \
49
64
  --subject "Reminder" \
50
65
  --text "Don't forget!" \
51
- --scheduled-at "<future-ISO-8601-datetime>"
66
+ --scheduled-at "tomorrow at 9am ET"
52
67
 
53
68
  # Check status
54
69
  resend emails get <email-id>
@@ -118,6 +133,14 @@ resend broadcasts create \
118
133
  --html "<h1>Hello {{{FIRST_NAME|there}}}</h1><p>News content...</p>" \
119
134
  --send
120
135
 
136
+ # Create broadcast from a React Email template
137
+ resend broadcasts create \
138
+ --from "news@yourdomain.com" \
139
+ --subject "Monthly Update" \
140
+ --segment-id <segment-id> \
141
+ --react-email ./emails/newsletter.tsx \
142
+ --text "Plain-text fallback for email clients that don't support HTML"
143
+
121
144
  # Or create as draft first, then send later
122
145
  resend broadcasts create \
123
146
  --from "news@yourdomain.com" \
@@ -128,8 +151,8 @@ resend broadcasts create \
128
151
 
129
152
  resend broadcasts send <broadcast-id>
130
153
 
131
- # Schedule for later
132
- resend broadcasts send <broadcast-id> --scheduled-at "<future-ISO-8601-datetime>"
154
+ # Schedule for later (ISO 8601 or natural language)
155
+ resend broadcasts send <broadcast-id> --scheduled-at "in 2 hours"
133
156
  ```
134
157
 
135
158
  ---
@@ -218,11 +241,25 @@ resend templates create \
218
241
  # Publish the template
219
242
  resend templates publish welcome-email
220
243
 
244
+ # Send an email using a template
245
+ resend emails send \
246
+ --to user@example.com \
247
+ --template <template-id> \
248
+ --var NAME=Jane --var PLAN=pro
249
+
221
250
  # Duplicate for A/B testing
222
251
  resend templates duplicate welcome-email
223
252
 
224
253
  # Update the copy
225
254
  resend templates update <new-id> --name "Welcome Email v2" --subject "Hey {{{NAME}}}!"
255
+
256
+ # Create a template from a React Email component
257
+ resend templates create \
258
+ --name "Onboarding" \
259
+ --react-email ./emails/onboarding.tsx
260
+
261
+ # Update a template with a new React Email version
262
+ resend templates update <id> --react-email ./emails/onboarding-v2.tsx
226
263
  ```
227
264
 
228
265
  ---