Skip to content

Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.

Merge PR #749

Corey Hainese54e8cedce45
diff --cc tools/clis/resend.js
index e9c6687,3c25556..c083462
--- a/tools/clis/resend.js
+++ b/tools/clis/resend.js
@@@ -60,19 -59,24 +60,36 @@@ function booleanArg(name)
throw new Error(`--${name} must be true or false (or a bare flag for true)`)
}
+function idempotencyHeaders() {
+ const key = args['idempotency-key']
+ if (key === undefined) return {}
+ if (typeof key !== 'string' || key.length < 1 || key.length > 256 || key !== key.trim() || /[\u0000-\u001f\u007f-\uffff]/.test(key)) {
+ throw new Error('--idempotency-key must be 1–256 printable ASCII characters without surrounding whitespace')
+ }
+ return { 'Idempotency-Key': key }
+}
+
+ function listQuery() {
+ const params = new URLSearchParams()
+ if (args.after !== undefined && args.before !== undefined) throw new Error('--after and --before are mutually exclusive')
+ for (const name of ['after', 'before']) {
+ if (args[name] === undefined) continue
+ if (typeof args[name] !== 'string' || !args[name].trim()) throw new Error(`--${name} requires a nonempty cursor`)
+ params.set(name, args[name])
+ }
+ if (args.limit !== undefined) {
+ if (typeof args.limit !== 'string' || !/^\d+$/.test(args.limit) || Number(args.limit) < 1 || Number(args.limit) > 100) {
+ throw new Error('--limit must be an integer from 1 to 100')
+ }
+ params.set('limit', args.limit)
+ }
+ return params.toString()
+ }
+
async function main() {
+ if (args['idempotency-key'] !== undefined && cmd !== 'send' && cmd !== 'batch') {
+ throw new Error('--idempotency-key is supported only for send and batch')
+ }
let result
switch (cmd) {
@@@ -368,8 -367,8 +380,8 @@@
result = {
error: 'Unknown command',
usage: {
- send: 'send --from <email> --to <email> --subject <subject> --html <html>',
+ send: 'send --from <email> --to <email> --subject <subject> --html <html> [--idempotency-key <stable_key>]',
- emails: 'emails [list|get|cancel] [id]',
+ emails: 'emails [list|get|cancel] [id] [--limit <1-100>] [--after <cursor> | --before <cursor>]',
domains: 'domains [list|get|create|verify|delete] [id] [--name <name>]',
'api-keys': 'api-keys [list|create|delete] [id] [--name <name>]',
audiences: 'audiences [list|get|create|delete] [id] [--name <name>]',
diff --cc tools/integrations/resend.md
index 689a032,a47219b..a5ec10c
--- a/tools/integrations/resend.md
+++ b/tools/integrations/resend.md
@@@ -211,12 -211,12 +211,22 @@@ await resend.emails.send(
- emails
- onboarding
+## Retry identity in the bundled CLI
+
+For single `send` and whole `batch` operations, pass `--idempotency-key <stable_key>` to send the `Idempotency-Key` header. Use one key per logical send and retain the same payload/key when retrying; use a new key for a different send. The CLI accepts 1–256 printable ASCII characters, forwards the caller's key, and never generates a new key or retries automatically.
+
+```bash
+node tools/clis/resend.js send --from [email protected] --to [email protected] --subject Welcome --text Hello --idempotency-key welcome/user-123 --dry-run
+```
+
+Resend retains keys for 24 hours. Reusing a key with a different payload returns a conflict; once retention expires it cannot prevent duplicates. This is a provider feature, not permanent exactly-once delivery. See [Resend idempotency keys](https://resend.com/docs/dashboard/emails/idempotency-keys). Dry runs show the key with authentication redacted; contract tests use fixtures and send no email.
++
+ ## Paging bundled CLI collections
+
+ The `emails list`, `domains list`, `broadcasts list`, `segments list`, `api-keys list` and `templates list` commands accept `--limit <1-100>` and either `--after <id>` or `--before <id>`. Inspect the provider's `has_more` and returned object IDs, then request the next page manually. The CLI preserves raw responses and does not silently aggregate or issue more calls.
+
+ ```bash
+ node tools/clis/resend.js emails list --limit 100 --after <last_email_id> --dry-run
+ ```
+
+ No flags retains provider defaults, including unpaginated legacy lists where the provider returns all items unless a limit is supplied. Supplying both directions, an empty cursor or an invalid limit fails before fetch. See [Resend pagination](https://resend.com/docs/api-reference/pagination); fixtures verify request construction without live account calls.