Resend CLI
$ resend 官方出品 中风险Resend CLI(resend)用于管理 Resend 域名、事务邮件、受众广播与本地 Webhook 监听(resend webhooks listen)。专为开发者和编程 Agent 设计,在非 TTY 环境或传入 --json 时会自动输出结构化 JSON。
brew install resend/cli/resend 环境诊断 resend doctor、本地 webhooks listen 调试以及 React Email .tsx 渲染发送使用 resend CLI;纯对话宿主内发信可配合 Resend MCP。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
针对非 TTY 环境自动输出结构化 JSON,并完整支持 --json 与 RESEND_API_KEY。
- Non-TTY auto-JSON behavior built specifically for agents and CI
- Dedicated
resend doctordiagnostics command
支持权限受限的 API 密钥与 [email protected] 等测试地址,但发往真实外部邮箱的邮件不可撤回。
- Resend supports sending-only vs full-access API keys
- Test sink addresses like
[email protected]prevent external spam
可通过 npm、Homebrew Tap 及 curl/PowerShell 脚本在主流系统安装。
npm install -g resend-cliandbrew install resend/cli/resend
涵盖邮件、域名、Webhook、广播与本地 webhooks listen 转发。
- Includes React Email
.tsx/.jsxrendering and local webhook forwarding
Resend 官方仓库(resend/resend-cli)以 MIT 协议积极维护。
- Official Resend GitHub organization
官方 CLI 文档清晰且专门提供了 Agent 与 CI 用法示例。
- Official docs at resend.com/docs/cli
安全边界、鉴权与放权指南
将会话密钥存储在 ~/.config/resend/,或直接读取环境变量 RESEND_API_KEY。
CLI 开源免费(MIT);Resend 提供每月 3,000 封免费额度及按量付费套餐。
# Resend CLI Agent Rules - For automated smoke tests, only send to `[email protected]` or team test addresses; NEVER email external users autonomously. - Use `RESEND_API_KEY` scoped with sending-only permissions where appropriate. - Background `resend webhooks listen` with an explicit timeout so it does not hang the session.
Agent 高频安全命令配方
只读查询(安全推荐)
resend doctor --json
检查 API 密钥有效性、本地配置与网络连通性,不发送任何邮件。
resend domains list --json
以 JSON 返回已配置的发信域名及 DNS 验证状态。
受控写入与预演
resend emails send --from [email protected] --to [email protected] --subject "Agent Smoke Test" --text "Hello" --json
仅向 Resend 官方测试接收地址 [email protected] 发送冒烟测试邮件。
核心优势
- + 非 TTY 环境下自动输出机器可读 JSON,大幅降低脚本解析成本。
- + 内置
resend webhooks listen,无需额外 ngrok 即可联调本地 Webhook。 - + 提供
resend doctor自检并支持[email protected]安全测试地址。
注意事项与踩坑点
- ! 发往真实外部邮箱的邮件无法撤回,也不支持通用
--dry-run。 - !
resend webhooks listen为常驻监听流,同步运行会导致阻塞。