resend-cli 1.0.3 → 1.2.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.
Files changed (365) hide show
  1. package/.claude/settings.local.json +5 -0
  2. package/.claude/worktrees/emails-list/.claude/settings.local.json +5 -0
  3. package/.claude/worktrees/emails-list/.github/scripts/pr-title-check.js +34 -0
  4. package/.claude/worktrees/emails-list/.github/workflows/ci.yml +32 -0
  5. package/.claude/worktrees/emails-list/.github/workflows/pr-title-check.yml +13 -0
  6. package/.claude/worktrees/emails-list/.github/workflows/release.yml +93 -0
  7. package/.claude/worktrees/emails-list/CHANGELOG.md +31 -0
  8. package/.claude/worktrees/emails-list/LICENSE +21 -0
  9. package/.claude/worktrees/emails-list/README.md +424 -0
  10. package/.claude/worktrees/emails-list/biome.json +36 -0
  11. package/.claude/worktrees/emails-list/bun.lock +76 -0
  12. package/.claude/worktrees/emails-list/bunfig.toml +2 -0
  13. package/.claude/worktrees/emails-list/install.ps1 +140 -0
  14. package/.claude/worktrees/emails-list/install.sh +301 -0
  15. package/.claude/worktrees/emails-list/package.json +43 -0
  16. package/.claude/worktrees/emails-list/renovate.json +6 -0
  17. package/.claude/worktrees/emails-list/src/cli.ts +74 -0
  18. package/.claude/worktrees/emails-list/src/commands/api-keys/create.ts +114 -0
  19. package/.claude/worktrees/emails-list/src/commands/api-keys/delete.ts +47 -0
  20. package/.claude/worktrees/emails-list/src/commands/api-keys/index.ts +26 -0
  21. package/.claude/worktrees/emails-list/src/commands/api-keys/list.ts +35 -0
  22. package/.claude/worktrees/emails-list/src/commands/api-keys/utils.ts +8 -0
  23. package/.claude/worktrees/emails-list/src/commands/auth/index.ts +20 -0
  24. package/.claude/worktrees/emails-list/src/commands/auth/login.ts +207 -0
  25. package/.claude/worktrees/emails-list/src/commands/auth/logout.ts +105 -0
  26. package/.claude/worktrees/emails-list/src/commands/broadcasts/create.ts +196 -0
  27. package/.claude/worktrees/emails-list/src/commands/broadcasts/delete.ts +46 -0
  28. package/.claude/worktrees/emails-list/src/commands/broadcasts/get.ts +59 -0
  29. package/.claude/worktrees/emails-list/src/commands/broadcasts/index.ts +43 -0
  30. package/.claude/worktrees/emails-list/src/commands/broadcasts/list.ts +60 -0
  31. package/.claude/worktrees/emails-list/src/commands/broadcasts/send.ts +56 -0
  32. package/.claude/worktrees/emails-list/src/commands/broadcasts/update.ts +95 -0
  33. package/.claude/worktrees/emails-list/src/commands/broadcasts/utils.ts +35 -0
  34. package/.claude/worktrees/emails-list/src/commands/contact-properties/create.ts +118 -0
  35. package/.claude/worktrees/emails-list/src/commands/contact-properties/delete.ts +48 -0
  36. package/.claude/worktrees/emails-list/src/commands/contact-properties/get.ts +46 -0
  37. package/.claude/worktrees/emails-list/src/commands/contact-properties/index.ts +48 -0
  38. package/.claude/worktrees/emails-list/src/commands/contact-properties/list.ts +68 -0
  39. package/.claude/worktrees/emails-list/src/commands/contact-properties/update.ts +88 -0
  40. package/.claude/worktrees/emails-list/src/commands/contact-properties/utils.ts +17 -0
  41. package/.claude/worktrees/emails-list/src/commands/contacts/add-segment.ts +78 -0
  42. package/.claude/worktrees/emails-list/src/commands/contacts/create.ts +122 -0
  43. package/.claude/worktrees/emails-list/src/commands/contacts/delete.ts +49 -0
  44. package/.claude/worktrees/emails-list/src/commands/contacts/get.ts +53 -0
  45. package/.claude/worktrees/emails-list/src/commands/contacts/index.ts +58 -0
  46. package/.claude/worktrees/emails-list/src/commands/contacts/list.ts +57 -0
  47. package/.claude/worktrees/emails-list/src/commands/contacts/remove-segment.ts +48 -0
  48. package/.claude/worktrees/emails-list/src/commands/contacts/segments.ts +39 -0
  49. package/.claude/worktrees/emails-list/src/commands/contacts/topics.ts +45 -0
  50. package/.claude/worktrees/emails-list/src/commands/contacts/update-topics.ts +90 -0
  51. package/.claude/worktrees/emails-list/src/commands/contacts/update.ts +77 -0
  52. package/.claude/worktrees/emails-list/src/commands/contacts/utils.ts +119 -0
  53. package/.claude/worktrees/emails-list/src/commands/doctor.ts +298 -0
  54. package/.claude/worktrees/emails-list/src/commands/domains/create.ts +83 -0
  55. package/.claude/worktrees/emails-list/src/commands/domains/delete.ts +42 -0
  56. package/.claude/worktrees/emails-list/src/commands/domains/get.ts +47 -0
  57. package/.claude/worktrees/emails-list/src/commands/domains/index.ts +35 -0
  58. package/.claude/worktrees/emails-list/src/commands/domains/list.ts +53 -0
  59. package/.claude/worktrees/emails-list/src/commands/domains/update.ts +75 -0
  60. package/.claude/worktrees/emails-list/src/commands/domains/utils.ts +44 -0
  61. package/.claude/worktrees/emails-list/src/commands/domains/verify.ts +38 -0
  62. package/.claude/worktrees/emails-list/src/commands/emails/batch.ts +140 -0
  63. package/.claude/worktrees/emails-list/src/commands/emails/index.ts +28 -0
  64. package/.claude/worktrees/emails-list/src/commands/emails/list.ts +73 -0
  65. package/.claude/worktrees/emails-list/src/commands/emails/receiving/attachment.ts +55 -0
  66. package/.claude/worktrees/emails-list/src/commands/emails/receiving/attachments.ts +68 -0
  67. package/.claude/worktrees/emails-list/src/commands/emails/receiving/get.ts +58 -0
  68. package/.claude/worktrees/emails-list/src/commands/emails/receiving/index.ts +28 -0
  69. package/.claude/worktrees/emails-list/src/commands/emails/receiving/list.ts +59 -0
  70. package/.claude/worktrees/emails-list/src/commands/emails/receiving/utils.ts +38 -0
  71. package/.claude/worktrees/emails-list/src/commands/emails/send.ts +189 -0
  72. package/.claude/worktrees/emails-list/src/commands/open.ts +24 -0
  73. package/.claude/worktrees/emails-list/src/commands/segments/create.ts +50 -0
  74. package/.claude/worktrees/emails-list/src/commands/segments/delete.ts +47 -0
  75. package/.claude/worktrees/emails-list/src/commands/segments/get.ts +38 -0
  76. package/.claude/worktrees/emails-list/src/commands/segments/index.ts +36 -0
  77. package/.claude/worktrees/emails-list/src/commands/segments/list.ts +58 -0
  78. package/.claude/worktrees/emails-list/src/commands/segments/utils.ts +7 -0
  79. package/.claude/worktrees/emails-list/src/commands/teams/index.ts +10 -0
  80. package/.claude/worktrees/emails-list/src/commands/teams/list.ts +35 -0
  81. package/.claude/worktrees/emails-list/src/commands/teams/remove.ts +83 -0
  82. package/.claude/worktrees/emails-list/src/commands/teams/switch.ts +73 -0
  83. package/.claude/worktrees/emails-list/src/commands/topics/create.ts +73 -0
  84. package/.claude/worktrees/emails-list/src/commands/topics/delete.ts +47 -0
  85. package/.claude/worktrees/emails-list/src/commands/topics/get.ts +42 -0
  86. package/.claude/worktrees/emails-list/src/commands/topics/index.ts +42 -0
  87. package/.claude/worktrees/emails-list/src/commands/topics/list.ts +34 -0
  88. package/.claude/worktrees/emails-list/src/commands/topics/update.ts +59 -0
  89. package/.claude/worktrees/emails-list/src/commands/topics/utils.ts +16 -0
  90. package/.claude/worktrees/emails-list/src/commands/webhooks/create.ts +128 -0
  91. package/.claude/worktrees/emails-list/src/commands/webhooks/delete.ts +49 -0
  92. package/.claude/worktrees/emails-list/src/commands/webhooks/get.ts +42 -0
  93. package/.claude/worktrees/emails-list/src/commands/webhooks/index.ts +44 -0
  94. package/.claude/worktrees/emails-list/src/commands/webhooks/list.ts +55 -0
  95. package/.claude/worktrees/emails-list/src/commands/webhooks/update.ts +83 -0
  96. package/.claude/worktrees/emails-list/src/commands/webhooks/utils.ts +36 -0
  97. package/.claude/worktrees/emails-list/src/commands/whoami.ts +71 -0
  98. package/.claude/worktrees/emails-list/src/lib/actions.ts +157 -0
  99. package/.claude/worktrees/emails-list/src/lib/client.ts +34 -0
  100. package/.claude/worktrees/emails-list/src/lib/config.ts +211 -0
  101. package/.claude/worktrees/emails-list/src/lib/files.ts +15 -0
  102. package/.claude/worktrees/emails-list/src/lib/help-text.ts +38 -0
  103. package/.claude/worktrees/emails-list/src/lib/output.ts +54 -0
  104. package/.claude/worktrees/emails-list/src/lib/pagination.ts +36 -0
  105. package/.claude/worktrees/emails-list/src/lib/prompts.ts +149 -0
  106. package/.claude/worktrees/emails-list/src/lib/spinner.ts +93 -0
  107. package/.claude/worktrees/emails-list/src/lib/table.ts +57 -0
  108. package/.claude/worktrees/emails-list/src/lib/tty.ts +28 -0
  109. package/.claude/worktrees/emails-list/src/lib/version.ts +4 -0
  110. package/.claude/worktrees/emails-list/tests/commands/api-keys/create.test.ts +195 -0
  111. package/.claude/worktrees/emails-list/tests/commands/api-keys/delete.test.ts +156 -0
  112. package/.claude/worktrees/emails-list/tests/commands/api-keys/list.test.ts +133 -0
  113. package/.claude/worktrees/emails-list/tests/commands/auth/login.test.ts +119 -0
  114. package/.claude/worktrees/emails-list/tests/commands/auth/logout.test.ts +146 -0
  115. package/.claude/worktrees/emails-list/tests/commands/broadcasts/create.test.ts +447 -0
  116. package/.claude/worktrees/emails-list/tests/commands/broadcasts/delete.test.ts +182 -0
  117. package/.claude/worktrees/emails-list/tests/commands/broadcasts/get.test.ts +146 -0
  118. package/.claude/worktrees/emails-list/tests/commands/broadcasts/list.test.ts +196 -0
  119. package/.claude/worktrees/emails-list/tests/commands/broadcasts/send.test.ts +161 -0
  120. package/.claude/worktrees/emails-list/tests/commands/broadcasts/update.test.ts +283 -0
  121. package/.claude/worktrees/emails-list/tests/commands/contact-properties/create.test.ts +250 -0
  122. package/.claude/worktrees/emails-list/tests/commands/contact-properties/delete.test.ts +183 -0
  123. package/.claude/worktrees/emails-list/tests/commands/contact-properties/get.test.ts +144 -0
  124. package/.claude/worktrees/emails-list/tests/commands/contact-properties/list.test.ts +180 -0
  125. package/.claude/worktrees/emails-list/tests/commands/contact-properties/update.test.ts +216 -0
  126. package/.claude/worktrees/emails-list/tests/commands/contacts/add-segment.test.ts +188 -0
  127. package/.claude/worktrees/emails-list/tests/commands/contacts/create.test.ts +270 -0
  128. package/.claude/worktrees/emails-list/tests/commands/contacts/delete.test.ts +192 -0
  129. package/.claude/worktrees/emails-list/tests/commands/contacts/get.test.ts +148 -0
  130. package/.claude/worktrees/emails-list/tests/commands/contacts/list.test.ts +175 -0
  131. package/.claude/worktrees/emails-list/tests/commands/contacts/remove-segment.test.ts +166 -0
  132. package/.claude/worktrees/emails-list/tests/commands/contacts/segments.test.ts +167 -0
  133. package/.claude/worktrees/emails-list/tests/commands/contacts/topics.test.ts +163 -0
  134. package/.claude/worktrees/emails-list/tests/commands/contacts/update-topics.test.ts +247 -0
  135. package/.claude/worktrees/emails-list/tests/commands/contacts/update.test.ts +205 -0
  136. package/.claude/worktrees/emails-list/tests/commands/doctor.test.ts +165 -0
  137. package/.claude/worktrees/emails-list/tests/commands/domains/create.test.ts +192 -0
  138. package/.claude/worktrees/emails-list/tests/commands/domains/delete.test.ts +156 -0
  139. package/.claude/worktrees/emails-list/tests/commands/domains/get.test.ts +137 -0
  140. package/.claude/worktrees/emails-list/tests/commands/domains/list.test.ts +164 -0
  141. package/.claude/worktrees/emails-list/tests/commands/domains/update.test.ts +223 -0
  142. package/.claude/worktrees/emails-list/tests/commands/domains/verify.test.ts +117 -0
  143. package/.claude/worktrees/emails-list/tests/commands/emails/batch.test.ts +313 -0
  144. package/.claude/worktrees/emails-list/tests/commands/emails/list.test.ts +196 -0
  145. package/.claude/worktrees/emails-list/tests/commands/emails/receiving/attachment.test.ts +140 -0
  146. package/.claude/worktrees/emails-list/tests/commands/emails/receiving/attachments.test.ts +168 -0
  147. package/.claude/worktrees/emails-list/tests/commands/emails/receiving/get.test.ts +140 -0
  148. package/.claude/worktrees/emails-list/tests/commands/emails/receiving/list.test.ts +181 -0
  149. package/.claude/worktrees/emails-list/tests/commands/emails/send.test.ts +309 -0
  150. package/.claude/worktrees/emails-list/tests/commands/segments/create.test.ts +163 -0
  151. package/.claude/worktrees/emails-list/tests/commands/segments/delete.test.ts +182 -0
  152. package/.claude/worktrees/emails-list/tests/commands/segments/get.test.ts +137 -0
  153. package/.claude/worktrees/emails-list/tests/commands/segments/list.test.ts +173 -0
  154. package/.claude/worktrees/emails-list/tests/commands/teams/list.test.ts +63 -0
  155. package/.claude/worktrees/emails-list/tests/commands/teams/remove.test.ts +103 -0
  156. package/.claude/worktrees/emails-list/tests/commands/teams/switch.test.ts +96 -0
  157. package/.claude/worktrees/emails-list/tests/commands/topics/create.test.ts +191 -0
  158. package/.claude/worktrees/emails-list/tests/commands/topics/delete.test.ts +156 -0
  159. package/.claude/worktrees/emails-list/tests/commands/topics/get.test.ts +125 -0
  160. package/.claude/worktrees/emails-list/tests/commands/topics/list.test.ts +124 -0
  161. package/.claude/worktrees/emails-list/tests/commands/topics/update.test.ts +177 -0
  162. package/.claude/worktrees/emails-list/tests/commands/webhooks/create.test.ts +224 -0
  163. package/.claude/worktrees/emails-list/tests/commands/webhooks/delete.test.ts +156 -0
  164. package/.claude/worktrees/emails-list/tests/commands/webhooks/get.test.ts +125 -0
  165. package/.claude/worktrees/emails-list/tests/commands/webhooks/list.test.ts +177 -0
  166. package/.claude/worktrees/emails-list/tests/commands/webhooks/update.test.ts +206 -0
  167. package/.claude/worktrees/emails-list/tests/commands/whoami.test.ts +99 -0
  168. package/.claude/worktrees/emails-list/tests/helpers.ts +93 -0
  169. package/.claude/worktrees/emails-list/tests/lib/client.test.ts +71 -0
  170. package/.claude/worktrees/emails-list/tests/lib/config.test.ts +414 -0
  171. package/.claude/worktrees/emails-list/tests/lib/files.test.ts +65 -0
  172. package/.claude/worktrees/emails-list/tests/lib/help-text.test.ts +97 -0
  173. package/.claude/worktrees/emails-list/tests/lib/output.test.ts +127 -0
  174. package/.claude/worktrees/emails-list/tests/lib/prompts.test.ts +178 -0
  175. package/.claude/worktrees/emails-list/tests/lib/spinner.test.ts +146 -0
  176. package/.claude/worktrees/emails-list/tests/lib/table.test.ts +63 -0
  177. package/.claude/worktrees/emails-list/tests/lib/tty.test.ts +85 -0
  178. package/.claude/worktrees/emails-list/tsconfig.json +14 -0
  179. package/.github/scripts/pr-title-check.js +34 -0
  180. package/.github/workflows/ci.yml +32 -0
  181. package/.github/workflows/pr-title-check.yml +13 -0
  182. package/.github/workflows/release.yml +93 -0
  183. package/.github/workflows/test-build-windows.yml +44 -0
  184. package/.github/workflows/test-install-windows.yml +48 -0
  185. package/CHANGELOG.md +31 -0
  186. package/LICENSE +21 -21
  187. package/README.md +424 -19
  188. package/biome.json +36 -0
  189. package/bun.lock +76 -0
  190. package/bunfig.toml +2 -0
  191. package/docs/agent-dx-gaps.md +167 -0
  192. package/docs/missing-commands.md +58 -0
  193. package/docs/production-readiness.md +99 -0
  194. package/docs/secure-key-storage.md +174 -0
  195. package/install.ps1 +141 -0
  196. package/install.sh +301 -0
  197. package/package.json +43 -22
  198. package/renovate.json +4 -0
  199. package/src/cli.ts +74 -0
  200. package/src/commands/api-keys/create.ts +114 -0
  201. package/src/commands/api-keys/delete.ts +47 -0
  202. package/src/commands/api-keys/index.ts +26 -0
  203. package/src/commands/api-keys/list.ts +35 -0
  204. package/src/commands/api-keys/utils.ts +8 -0
  205. package/src/commands/auth/index.ts +20 -0
  206. package/src/commands/auth/login.ts +232 -0
  207. package/src/commands/auth/logout.ts +105 -0
  208. package/src/commands/broadcasts/create.ts +196 -0
  209. package/src/commands/broadcasts/delete.ts +46 -0
  210. package/src/commands/broadcasts/get.ts +59 -0
  211. package/src/commands/broadcasts/index.ts +43 -0
  212. package/src/commands/broadcasts/list.ts +60 -0
  213. package/src/commands/broadcasts/send.ts +56 -0
  214. package/src/commands/broadcasts/update.ts +95 -0
  215. package/src/commands/broadcasts/utils.ts +35 -0
  216. package/src/commands/contact-properties/create.ts +118 -0
  217. package/src/commands/contact-properties/delete.ts +48 -0
  218. package/src/commands/contact-properties/get.ts +46 -0
  219. package/src/commands/contact-properties/index.ts +48 -0
  220. package/src/commands/contact-properties/list.ts +68 -0
  221. package/src/commands/contact-properties/update.ts +88 -0
  222. package/src/commands/contact-properties/utils.ts +17 -0
  223. package/src/commands/contacts/add-segment.ts +78 -0
  224. package/src/commands/contacts/create.ts +122 -0
  225. package/src/commands/contacts/delete.ts +49 -0
  226. package/src/commands/contacts/get.ts +53 -0
  227. package/src/commands/contacts/index.ts +58 -0
  228. package/src/commands/contacts/list.ts +57 -0
  229. package/src/commands/contacts/remove-segment.ts +48 -0
  230. package/src/commands/contacts/segments.ts +39 -0
  231. package/src/commands/contacts/topics.ts +45 -0
  232. package/src/commands/contacts/update-topics.ts +90 -0
  233. package/src/commands/contacts/update.ts +77 -0
  234. package/src/commands/contacts/utils.ts +119 -0
  235. package/src/commands/doctor.ts +298 -0
  236. package/src/commands/domains/create.ts +83 -0
  237. package/src/commands/domains/delete.ts +42 -0
  238. package/src/commands/domains/get.ts +47 -0
  239. package/src/commands/domains/index.ts +35 -0
  240. package/src/commands/domains/list.ts +53 -0
  241. package/src/commands/domains/update.ts +75 -0
  242. package/src/commands/domains/utils.ts +44 -0
  243. package/src/commands/domains/verify.ts +38 -0
  244. package/src/commands/emails/batch.ts +140 -0
  245. package/src/commands/emails/index.ts +24 -0
  246. package/src/commands/emails/receiving/attachment.ts +55 -0
  247. package/src/commands/emails/receiving/attachments.ts +68 -0
  248. package/src/commands/emails/receiving/get.ts +58 -0
  249. package/src/commands/emails/receiving/index.ts +28 -0
  250. package/src/commands/emails/receiving/list.ts +59 -0
  251. package/src/commands/emails/receiving/utils.ts +38 -0
  252. package/src/commands/emails/send.ts +189 -0
  253. package/src/commands/open.ts +24 -0
  254. package/src/commands/segments/create.ts +50 -0
  255. package/src/commands/segments/delete.ts +47 -0
  256. package/src/commands/segments/get.ts +38 -0
  257. package/src/commands/segments/index.ts +36 -0
  258. package/src/commands/segments/list.ts +58 -0
  259. package/src/commands/segments/utils.ts +7 -0
  260. package/src/commands/teams/index.ts +10 -0
  261. package/src/commands/teams/list.ts +35 -0
  262. package/src/commands/teams/remove.ts +86 -0
  263. package/src/commands/teams/switch.ts +76 -0
  264. package/src/commands/topics/create.ts +73 -0
  265. package/src/commands/topics/delete.ts +47 -0
  266. package/src/commands/topics/get.ts +42 -0
  267. package/src/commands/topics/index.ts +42 -0
  268. package/src/commands/topics/list.ts +34 -0
  269. package/src/commands/topics/update.ts +59 -0
  270. package/src/commands/topics/utils.ts +16 -0
  271. package/src/commands/webhooks/create.ts +128 -0
  272. package/src/commands/webhooks/delete.ts +49 -0
  273. package/src/commands/webhooks/get.ts +42 -0
  274. package/src/commands/webhooks/index.ts +44 -0
  275. package/src/commands/webhooks/list.ts +55 -0
  276. package/src/commands/webhooks/update.ts +83 -0
  277. package/src/commands/webhooks/utils.ts +36 -0
  278. package/src/commands/whoami.ts +71 -0
  279. package/src/lib/actions.ts +157 -0
  280. package/src/lib/client.ts +34 -0
  281. package/src/lib/config.ts +218 -0
  282. package/src/lib/files.ts +15 -0
  283. package/src/lib/help-text.ts +38 -0
  284. package/src/lib/output.ts +54 -0
  285. package/src/lib/pagination.ts +36 -0
  286. package/src/lib/prompts.ts +149 -0
  287. package/src/lib/spinner.ts +93 -0
  288. package/src/lib/table.ts +57 -0
  289. package/src/lib/tty.ts +28 -0
  290. package/src/lib/version.ts +4 -0
  291. package/tests/commands/api-keys/create.test.ts +195 -0
  292. package/tests/commands/api-keys/delete.test.ts +156 -0
  293. package/tests/commands/api-keys/list.test.ts +133 -0
  294. package/tests/commands/auth/login.test.ts +154 -0
  295. package/tests/commands/auth/logout.test.ts +146 -0
  296. package/tests/commands/broadcasts/create.test.ts +447 -0
  297. package/tests/commands/broadcasts/delete.test.ts +182 -0
  298. package/tests/commands/broadcasts/get.test.ts +146 -0
  299. package/tests/commands/broadcasts/list.test.ts +196 -0
  300. package/tests/commands/broadcasts/send.test.ts +161 -0
  301. package/tests/commands/broadcasts/update.test.ts +283 -0
  302. package/tests/commands/contact-properties/create.test.ts +250 -0
  303. package/tests/commands/contact-properties/delete.test.ts +183 -0
  304. package/tests/commands/contact-properties/get.test.ts +144 -0
  305. package/tests/commands/contact-properties/list.test.ts +180 -0
  306. package/tests/commands/contact-properties/update.test.ts +216 -0
  307. package/tests/commands/contacts/add-segment.test.ts +188 -0
  308. package/tests/commands/contacts/create.test.ts +270 -0
  309. package/tests/commands/contacts/delete.test.ts +192 -0
  310. package/tests/commands/contacts/get.test.ts +148 -0
  311. package/tests/commands/contacts/list.test.ts +175 -0
  312. package/tests/commands/contacts/remove-segment.test.ts +166 -0
  313. package/tests/commands/contacts/segments.test.ts +167 -0
  314. package/tests/commands/contacts/topics.test.ts +163 -0
  315. package/tests/commands/contacts/update-topics.test.ts +247 -0
  316. package/tests/commands/contacts/update.test.ts +205 -0
  317. package/tests/commands/doctor.test.ts +165 -0
  318. package/tests/commands/domains/create.test.ts +192 -0
  319. package/tests/commands/domains/delete.test.ts +156 -0
  320. package/tests/commands/domains/get.test.ts +137 -0
  321. package/tests/commands/domains/list.test.ts +164 -0
  322. package/tests/commands/domains/update.test.ts +223 -0
  323. package/tests/commands/domains/verify.test.ts +117 -0
  324. package/tests/commands/emails/batch.test.ts +313 -0
  325. package/tests/commands/emails/receiving/attachment.test.ts +140 -0
  326. package/tests/commands/emails/receiving/attachments.test.ts +168 -0
  327. package/tests/commands/emails/receiving/get.test.ts +140 -0
  328. package/tests/commands/emails/receiving/list.test.ts +181 -0
  329. package/tests/commands/emails/send.test.ts +309 -0
  330. package/tests/commands/segments/create.test.ts +163 -0
  331. package/tests/commands/segments/delete.test.ts +182 -0
  332. package/tests/commands/segments/get.test.ts +137 -0
  333. package/tests/commands/segments/list.test.ts +173 -0
  334. package/tests/commands/teams/list.test.ts +63 -0
  335. package/tests/commands/teams/remove.test.ts +103 -0
  336. package/tests/commands/teams/switch.test.ts +96 -0
  337. package/tests/commands/topics/create.test.ts +191 -0
  338. package/tests/commands/topics/delete.test.ts +156 -0
  339. package/tests/commands/topics/get.test.ts +125 -0
  340. package/tests/commands/topics/list.test.ts +124 -0
  341. package/tests/commands/topics/update.test.ts +177 -0
  342. package/tests/commands/webhooks/create.test.ts +224 -0
  343. package/tests/commands/webhooks/delete.test.ts +156 -0
  344. package/tests/commands/webhooks/get.test.ts +125 -0
  345. package/tests/commands/webhooks/list.test.ts +177 -0
  346. package/tests/commands/webhooks/update.test.ts +206 -0
  347. package/tests/commands/whoami.test.ts +99 -0
  348. package/tests/helpers.ts +93 -0
  349. package/tests/lib/client.test.ts +71 -0
  350. package/tests/lib/config.test.ts +447 -0
  351. package/tests/lib/files.test.ts +65 -0
  352. package/tests/lib/help-text.test.ts +97 -0
  353. package/tests/lib/output.test.ts +127 -0
  354. package/tests/lib/prompts.test.ts +178 -0
  355. package/tests/lib/spinner.test.ts +146 -0
  356. package/tests/lib/table.test.ts +63 -0
  357. package/tests/lib/tty.test.ts +85 -0
  358. package/tsconfig.json +14 -0
  359. package/src/index.js +0 -72
  360. package/src/routes.js +0 -37
  361. package/src/sections/apikeys.js +0 -99
  362. package/src/sections/audiences.js +0 -84
  363. package/src/sections/contacts.js +0 -177
  364. package/src/sections/domain.js +0 -195
  365. package/src/sections/email.js +0 -132
@@ -0,0 +1,76 @@
1
+ {
2
+ "lockfileVersion": 1,
3
+ "configVersion": 0,
4
+ "workspaces": {
5
+ "": {
6
+ "name": "resend-cli",
7
+ "dependencies": {
8
+ "@clack/prompts": "1.1.0",
9
+ "@commander-js/extra-typings": "14.0.0",
10
+ "commander": "14.0.3",
11
+ "resend": "6.9.3",
12
+ "unicode-animations": "1.0.3",
13
+ },
14
+ "devDependencies": {
15
+ "@biomejs/biome": "2.4.6",
16
+ "@types/bun": "1.3.10",
17
+ "typescript": "5.9.3",
18
+ },
19
+ },
20
+ },
21
+ "packages": {
22
+ "@biomejs/biome": ["@biomejs/biome@2.4.6", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.4.6", "@biomejs/cli-darwin-x64": "2.4.6", "@biomejs/cli-linux-arm64": "2.4.6", "@biomejs/cli-linux-arm64-musl": "2.4.6", "@biomejs/cli-linux-x64": "2.4.6", "@biomejs/cli-linux-x64-musl": "2.4.6", "@biomejs/cli-win32-arm64": "2.4.6", "@biomejs/cli-win32-x64": "2.4.6" }, "bin": { "biome": "bin/biome" } }, "sha512-QnHe81PMslpy3mnpL8DnO2M4S4ZnYPkjlGCLWBZT/3R9M6b5daArWMMtEfP52/n174RKnwRIf3oT8+wc9ihSfQ=="],
23
+
24
+ "@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.4.6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-NW18GSyxr+8sJIqgoGwVp5Zqm4SALH4b4gftIA0n62PTuBs6G2tHlwNAOj0Vq0KKSs7Sf88VjjmHh0O36EnzrQ=="],
25
+
26
+ "@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.4.6", "", { "os": "darwin", "cpu": "x64" }, "sha512-4uiE/9tuI7cnjtY9b07RgS7gGyYOAfIAGeVJWEfeCnAarOAS7qVmuRyX6d7JTKw28/mt+rUzMasYeZ+0R/U1Mw=="],
27
+
28
+ "@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.4.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-kMLaI7OF5GN1Q8Doymjro1P8rVEoy7BKQALNz6fiR8IC1WKduoNyteBtJlHT7ASIL0Cx2jR6VUOBIbcB1B8pew=="],
29
+
30
+ "@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.4.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-F/JdB7eN22txiTqHM5KhIVt0jVkzZwVYrdTR1O3Y4auBOQcXxHK4dxULf4z43QyZI5tsnQJrRBHZy7wwtL+B3A=="],
31
+
32
+ "@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.4.6", "", { "os": "linux", "cpu": "x64" }, "sha512-oHXmUFEoH8Lql1xfc3QkFLiC1hGR7qedv5eKNlC185or+o4/4HiaU7vYODAH3peRCfsuLr1g6v2fK9dFFOYdyw=="],
33
+
34
+ "@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.4.6", "", { "os": "linux", "cpu": "x64" }, "sha512-C9s98IPDu7DYarjlZNuzJKTjVHN03RUnmHV5htvqsx6vEUXCDSJ59DNwjKVD5XYoSS4N+BYhq3RTBAL8X6svEg=="],
35
+
36
+ "@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.4.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-xzThn87Pf3YrOGTEODFGONmqXpTwUNxovQb72iaUOdcw8sBSY3+3WD8Hm9IhMYLnPi0n32s3L3NWU6+eSjfqFg=="],
37
+
38
+ "@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.4.6", "", { "os": "win32", "cpu": "x64" }, "sha512-7++XhnsPlr1HDbor5amovPjOH6vsrFOCdp93iKXhFn6bcMUI6soodj3WWKfgEO6JosKU1W5n3uky3WW9RlRjTg=="],
39
+
40
+ "@clack/core": ["@clack/core@1.1.0", "", { "dependencies": { "sisteransi": "^1.0.5" } }, "sha512-SVcm4Dqm2ukn64/8Gub2wnlA5nS2iWJyCkdNHcvNHPIeBTGojpdJ+9cZKwLfmqy7irD4N5qLteSilJlE0WLAtA=="],
41
+
42
+ "@clack/prompts": ["@clack/prompts@1.1.0", "", { "dependencies": { "@clack/core": "1.1.0", "sisteransi": "^1.0.5" } }, "sha512-pkqbPGtohJAvm4Dphs2M8xE29ggupihHdy1x84HNojZuMtFsHiUlRvqD24tM2+XmI+61LlfNceM3Wr7U5QES5g=="],
43
+
44
+ "@commander-js/extra-typings": ["@commander-js/extra-typings@14.0.0", "", { "peerDependencies": { "commander": "~14.0.0" } }, "sha512-hIn0ncNaJRLkZrxBIp5AsW/eXEHNKYQBh0aPdoUqNgD+Io3NIykQqpKFyKcuasZhicGaEZJX/JBSIkZ4e5x8Dg=="],
45
+
46
+ "@stablelib/base64": ["@stablelib/base64@1.0.1", "", {}, "sha512-1bnPQqSxSuc3Ii6MhBysoWCg58j97aUjuCSZrGSmDxNqtytIi0k8utUenAwTZN4V5mXXYGsVUI9zeBqy+jBOSQ=="],
47
+
48
+ "@types/bun": ["@types/bun@1.3.10", "", { "dependencies": { "bun-types": "1.3.10" } }, "sha512-0+rlrUrOrTSskibryHbvQkDOWRJwJZqZlxrUs1u4oOoTln8+WIXBPmAuCF35SWB2z4Zl3E84Nl/D0P7803nigQ=="],
49
+
50
+ "@types/node": ["@types/node@25.2.3", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-m0jEgYlYz+mDJZ2+F4v8D1AyQb+QzsNqRuI7xg1VQX/KlKS0qT9r1Mo16yo5F/MtifXFgaofIFsdFMox2SxIbQ=="],
51
+
52
+ "bun-types": ["bun-types@1.3.10", "", { "dependencies": { "@types/node": "*" } }, "sha512-tcpfCCl6XWo6nCVnpcVrxQ+9AYN1iqMIzgrSKYMB/fjLtV2eyAVEg7AxQJuCq/26R6HpKWykQXuSOq/21RYcbg=="],
53
+
54
+ "commander": ["commander@14.0.3", "", {}, "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw=="],
55
+
56
+ "fast-sha256": ["fast-sha256@1.3.0", "", {}, "sha512-n11RGP/lrWEFI/bWdygLxhI+pVeo1ZYIVwvvPkW7azl/rOy+F3HYRZ2K5zeE9mmkhQppyv9sQFx0JM9UabnpPQ=="],
57
+
58
+ "postal-mime": ["postal-mime@2.7.3", "", {}, "sha512-MjhXadAJaWgYzevi46+3kLak8y6gbg0ku14O1gO/LNOuay8dO+1PtcSGvAdgDR0DoIsSaiIA8y/Ddw6MnrO0Tw=="],
59
+
60
+ "resend": ["resend@6.9.3", "", { "dependencies": { "postal-mime": "2.7.3", "svix": "1.84.1" }, "peerDependencies": { "@react-email/render": "*" }, "optionalPeers": ["@react-email/render"] }, "sha512-GRXjH9XZBJA+daH7bBVDuTShr22iWCxXA8P7t495G4dM/RC+d+3gHBK/6bz9K6Vpcq11zRQKmD+B+jECwQlyGQ=="],
61
+
62
+ "sisteransi": ["sisteransi@1.0.5", "", {}, "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="],
63
+
64
+ "standardwebhooks": ["standardwebhooks@1.0.0", "", { "dependencies": { "@stablelib/base64": "^1.0.0", "fast-sha256": "^1.3.0" } }, "sha512-BbHGOQK9olHPMvQNHWul6MYlrRTAOKn03rOe4A8O3CLWhNf4YHBqq2HJKKC+sfqpxiBY52pNeesD6jIiLDz8jg=="],
65
+
66
+ "svix": ["svix@1.84.1", "", { "dependencies": { "standardwebhooks": "1.0.0", "uuid": "^10.0.0" } }, "sha512-K8DPPSZaW/XqXiz1kEyzSHYgmGLnhB43nQCMeKjWGCUpLIpAMMM8kx3rVVOSm6Bo6EHyK1RQLPT4R06skM/MlQ=="],
67
+
68
+ "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
69
+
70
+ "undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
71
+
72
+ "unicode-animations": ["unicode-animations@1.0.3", "", { "dependencies": { "unicode-animations": "^1.0.1" }, "bin": { "unicode-animations": "scripts/demo.cjs" } }, "sha512-+klB2oWwcYZjYWhwP4Pr8UZffWDFVx6jKeIahE6z0QYyM2dwDeDPyn5nevCYbyotxvtT9lh21cVURO1RX0+YMg=="],
73
+
74
+ "uuid": ["uuid@10.0.0", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ=="],
75
+ }
76
+ }
@@ -0,0 +1,2 @@
1
+ [install]
2
+ peer = false
@@ -0,0 +1,140 @@
1
+ #!/usr/bin/env pwsh
2
+ # Resend CLI installer for Windows
3
+ #
4
+ # Usage (PowerShell):
5
+ # irm https://resend.com/install.ps1 | iex
6
+ #
7
+ # Pin a version:
8
+ # $env:RESEND_VERSION = 'v0.1.0'; irm https://resend.com/install.ps1 | iex
9
+ #
10
+ # Environment variables:
11
+ # RESEND_INSTALL - Custom install directory (default: $HOME\.resend)
12
+ # RESEND_VERSION - Version to install (default: latest)
13
+
14
+ param(
15
+ [string]$Version = $env:RESEND_VERSION
16
+ )
17
+
18
+ Set-StrictMode -Version Latest
19
+ $ErrorActionPreference = 'Stop'
20
+
21
+ # ─── Helpers ─────────────────────────────────────────────────────────────────
22
+
23
+ function Write-Info { param($msg) Write-Host " $msg" -ForegroundColor DarkGray }
24
+ function Write-Ok { param($msg) Write-Host " $msg" -ForegroundColor Green }
25
+
26
+ function Write-Fail {
27
+ param($msg)
28
+ Write-Host " error: $msg" -ForegroundColor Red
29
+ exit 1
30
+ }
31
+
32
+ # ─── Architecture detection ───────────────────────────────────────────────────
33
+
34
+ if ($env:PROCESSOR_ARCHITECTURE -notin @('AMD64', 'EM64T')) {
35
+ Write-Fail "Unsupported architecture: $env:PROCESSOR_ARCHITECTURE`n`n Resend CLI currently supports Windows x64 only."
36
+ }
37
+
38
+ # ─── Version + Download URL ───────────────────────────────────────────────────
39
+
40
+ $repo = 'https://github.com/resend/resend-cli'
41
+ $target = 'windows-x64'
42
+
43
+ if ($Version) {
44
+ $Version = $Version.TrimStart('v')
45
+ if ($Version -notmatch '^\d+\.\d+\.\d+(-[a-zA-Z0-9.]+)?$') {
46
+ Write-Fail "Invalid version format: $Version`n`n Expected: semantic version like 0.1.0 or 1.2.3-beta.1`n Usage: `$env:RESEND_VERSION = 'v0.1.0'; irm https://resend.com/install.ps1 | iex"
47
+ }
48
+ $url = "$repo/releases/download/v$Version/resend-$target.zip"
49
+ } else {
50
+ $url = "$repo/releases/latest/download/resend-$target.zip"
51
+ }
52
+
53
+ # ─── Install directory ────────────────────────────────────────────────────────
54
+
55
+ $installDir = if ($env:RESEND_INSTALL) { $env:RESEND_INSTALL } else { Join-Path $HOME '.resend' }
56
+ $binDir = Join-Path $installDir 'bin'
57
+ $exe = Join-Path $binDir 'resend.exe'
58
+
59
+ if (-not (Test-Path $binDir)) {
60
+ New-Item -ItemType Directory -Path $binDir -Force | Out-Null
61
+ }
62
+
63
+ # ─── Download + Extract ───────────────────────────────────────────────────────
64
+
65
+ Write-Host ""
66
+ Write-Host " Installing Resend CLI..." -ForegroundColor White
67
+ Write-Host ""
68
+ Write-Info "Downloading from $url"
69
+ Write-Host ""
70
+
71
+ $tmpDir = Join-Path ([System.IO.Path]::GetTempPath()) "resend-$([System.Guid]::NewGuid())"
72
+ New-Item -ItemType Directory -Path $tmpDir -Force | Out-Null
73
+ $tmpZip = Join-Path $tmpDir 'resend.zip'
74
+
75
+ try {
76
+ try {
77
+ # Force TLS 1.2 for Windows PowerShell 5.1 (no-op on PowerShell 7+ where it is the default)
78
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
79
+ $ProgressPreference = 'SilentlyContinue' # Invoke-WebRequest is ~10x faster without progress bar
80
+ Invoke-WebRequest -Uri $url -OutFile $tmpZip -UseBasicParsing
81
+ } catch {
82
+ Write-Fail "Download failed.`n`n Possible causes:`n - No internet connection`n - The version does not exist: $(if ($Version) { $Version } else { 'latest' })`n - GitHub is unreachable`n`n URL: $url"
83
+ }
84
+
85
+ try {
86
+ Expand-Archive -Path $tmpZip -DestinationPath $binDir -Force
87
+ } catch {
88
+ Write-Fail "Failed to extract archive: $_"
89
+ }
90
+ }
91
+ finally {
92
+ Remove-Item -Recurse -Force $tmpDir -ErrorAction SilentlyContinue
93
+ }
94
+
95
+ if (-not (Test-Path $exe)) {
96
+ Write-Fail "Binary not found after extraction. The download may be corrupted — try again."
97
+ }
98
+
99
+ # ─── Verify installation ──────────────────────────────────────────────────────
100
+
101
+ try {
102
+ $installedVersion = (& $exe --version 2>$null).Trim()
103
+ } catch {
104
+ $installedVersion = 'unknown'
105
+ }
106
+
107
+ Write-Host ""
108
+ Write-Ok "Resend CLI $installedVersion installed successfully!"
109
+ Write-Host ""
110
+ Write-Info "Binary: $exe"
111
+
112
+ # ─── PATH setup ───────────────────────────────────────────────────────────────
113
+
114
+ $userPath = [Environment]::GetEnvironmentVariable('PATH', 'User') ?? ''
115
+ $pathEntries = $userPath -split ';' | Where-Object { $_ -ne '' }
116
+
117
+ if ($pathEntries -contains $binDir) {
118
+ # Already on PATH — just print the getting-started line
119
+ Write-Host ""
120
+ Write-Host " Run " -NoNewline
121
+ Write-Host "resend --help" -ForegroundColor Cyan -NoNewline
122
+ Write-Host " to get started"
123
+ Write-Host ""
124
+ exit 0
125
+ }
126
+
127
+ # Add to user PATH (persists across sessions — no admin rights needed)
128
+ $newPath = ($pathEntries + $binDir) -join ';'
129
+ [Environment]::SetEnvironmentVariable('PATH', $newPath, 'User')
130
+ $env:PATH = "$env:PATH;$binDir" # Also update the current session
131
+
132
+ Write-Info "Added $binDir to PATH (User scope)"
133
+ Write-Host ""
134
+ Write-Info "Restart your terminal, then:"
135
+ Write-Host ""
136
+ Write-Info "Next steps:"
137
+ Write-Host ""
138
+ Write-Host " `$env:RESEND_API_KEY = 're_...'" -ForegroundColor Cyan
139
+ Write-Host " resend --help" -ForegroundColor Cyan
140
+ Write-Host ""
@@ -0,0 +1,301 @@
1
+ #!/usr/bin/env bash
2
+ # Resend CLI installer
3
+ #
4
+ # Usage:
5
+ # curl -fsSL https://resend.com/install.sh | bash
6
+ # curl -fsSL https://resend.com/install.sh | bash -s v0.1.0
7
+ #
8
+ # Environment variables:
9
+ # RESEND_INSTALL - Custom install directory (default: ~/.resend)
10
+ # GITHUB_BASE - Custom GitHub base URL (default: https://github.com)
11
+
12
+ # Wrap everything in a function to protect against partial download.
13
+ # If the connection drops mid-transfer, bash won't execute a truncated script.
14
+ main() {
15
+
16
+ set -euo pipefail
17
+
18
+ # ─── Colors (only when outputting to a terminal) ─────────────────────────────
19
+
20
+ Color_Off='' Red='' Green='' Dim='' Bold='' Blue='' Yellow=''
21
+
22
+ if [[ -t 1 ]]; then
23
+ Color_Off='\033[0m'
24
+ Red='\033[0;31m'
25
+ Green='\033[0;32m'
26
+ Yellow='\033[0;33m'
27
+ Dim='\033[0;2m'
28
+ Bold='\033[1m'
29
+ Blue='\033[0;34m'
30
+ fi
31
+
32
+ # ─── Helpers ─────────────────────────────────────────────────────────────────
33
+
34
+ error() {
35
+ printf "%b\n" "${Red}error${Color_Off}: $*" >&2
36
+ exit 1
37
+ }
38
+
39
+ warn() {
40
+ printf "%b\n" "${Yellow}warn${Color_Off}: $*" >&2
41
+ }
42
+
43
+ info() {
44
+ printf "%b\n" "${Dim}$*${Color_Off}"
45
+ }
46
+
47
+ success() {
48
+ printf "%b\n" "${Green}$*${Color_Off}"
49
+ }
50
+
51
+ bold() {
52
+ printf "%b\n" "${Bold}$*${Color_Off}"
53
+ }
54
+
55
+ tildify() {
56
+ if [[ $1 == "$HOME"/* ]]; then
57
+ echo "~${1#"$HOME"}"
58
+ else
59
+ echo "$1"
60
+ fi
61
+ }
62
+
63
+ # ─── Dependency checks ──────────────────────────────────────────────────────
64
+
65
+ command -v curl >/dev/null 2>&1 || error "curl is required but not found. Install it and try again."
66
+ command -v tar >/dev/null 2>&1 || error "tar is required but not found. Install it and try again."
67
+
68
+ # ─── OS / Architecture detection ────────────────────────────────────────────
69
+
70
+ platform=$(uname -ms)
71
+
72
+ case $platform in
73
+ 'Darwin x86_64') target=darwin-x64 ;;
74
+ 'Darwin arm64') target=darwin-arm64 ;;
75
+ 'Linux aarch64') target=linux-arm64 ;;
76
+ 'Linux arm64') target=linux-arm64 ;;
77
+ 'Linux x86_64') target=linux-x64 ;;
78
+ *)
79
+ error "Unsupported platform: ${platform}.
80
+
81
+ Resend CLI supports:
82
+ - macOS (Apple Silicon / Intel)
83
+ - Linux (x64 / arm64)
84
+
85
+ For Windows, run this in PowerShell:
86
+ irm https://resend.com/install.ps1 | iex"
87
+ ;;
88
+ esac
89
+
90
+ # Detect Rosetta 2 on macOS — prefer native arm64 binary
91
+ if [[ $target == "darwin-x64" ]]; then
92
+ if [[ $(sysctl -n sysctl.proc_translated 2>/dev/null || echo 0) == "1" ]]; then
93
+ target=darwin-arm64
94
+ info " Rosetta 2 detected — installing native arm64 binary"
95
+ fi
96
+ fi
97
+
98
+ # Detect musl (Alpine Linux) — glibc binaries won't work
99
+ if [[ $target == linux-* ]]; then
100
+ if ldd --version 2>&1 | grep -qi musl 2>/dev/null; then
101
+ error "Alpine Linux (musl) is not currently supported.
102
+
103
+ The compiled binary requires glibc. Use one of these alternatives:
104
+ - npm install -g resend-cli
105
+ - Run in a glibc-based container (e.g., ubuntu, debian)"
106
+ fi
107
+ fi
108
+
109
+ # ─── Version + Download URL ─────────────────────────────────────────────────
110
+
111
+ GITHUB_BASE=${GITHUB_BASE:-"https://github.com"}
112
+
113
+ # Validate GITHUB_BASE is HTTPS to prevent download from arbitrary sources
114
+ case "$GITHUB_BASE" in
115
+ https://*) ;;
116
+ *) error "GITHUB_BASE must start with https:// (got: ${GITHUB_BASE})" ;;
117
+ esac
118
+
119
+ REPO="${GITHUB_BASE}/resend/resend-cli"
120
+
121
+ VERSION=${1:-}
122
+
123
+ # Validate version format if provided
124
+ if [[ -n $VERSION ]]; then
125
+ # Strip leading 'v' if present, then re-add for the tag
126
+ VERSION="${VERSION#v}"
127
+ if ! [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
128
+ error "Invalid version format: ${VERSION}
129
+
130
+ Expected: semantic version like 0.1.0 or 1.2.3-beta.1
131
+ Usage: curl -fsSL https://resend.com/install.sh | bash -s v0.1.0"
132
+ fi
133
+ url="${REPO}/releases/download/v${VERSION}/resend-${target}.tar.gz"
134
+ else
135
+ url="${REPO}/releases/latest/download/resend-${target}.tar.gz"
136
+ fi
137
+
138
+ # ─── Install directory ──────────────────────────────────────────────────────
139
+
140
+ install_dir="${RESEND_INSTALL:-$HOME/.resend}"
141
+ bin_dir="${install_dir}/bin"
142
+ exe="${bin_dir}/resend"
143
+
144
+ mkdir -p "$bin_dir" || error "Failed to create install directory: ${bin_dir}"
145
+
146
+ # ─── Download + Extract ─────────────────────────────────────────────────────
147
+
148
+ echo ""
149
+ bold " Installing Resend CLI..."
150
+ echo ""
151
+
152
+ tmpdir=$(mktemp -d) || error "Failed to create temporary directory"
153
+ trap 'rm -rf "$tmpdir"' EXIT INT TERM
154
+
155
+ tmpfile="${tmpdir}/resend.tar.gz"
156
+
157
+ info " Downloading from ${url}"
158
+ echo ""
159
+
160
+ curl --fail --location --progress-bar --output "$tmpfile" "$url" ||
161
+ error "Download failed.
162
+
163
+ Possible causes:
164
+ - No internet connection
165
+ - The version does not exist: ${VERSION:-latest}
166
+ - GitHub is unreachable
167
+
168
+ URL: ${url}"
169
+
170
+ tar -xzf "$tmpfile" -C "$bin_dir" ||
171
+ error "Failed to extract archive. The download may be corrupted — try again."
172
+
173
+ chmod +x "$exe" || error "Failed to make binary executable"
174
+
175
+ # Strip macOS Gatekeeper quarantine flag (set automatically on curl downloads)
176
+ # Without this, macOS will block the binary: "cannot be opened because Apple
177
+ # cannot check it for malicious software"
178
+ if [[ $(uname -s) == "Darwin" ]]; then
179
+ xattr -d com.apple.quarantine "$exe" 2>/dev/null || true
180
+ fi
181
+
182
+ # ─── Verify installation ────────────────────────────────────────────────────
183
+
184
+ installed_version=$("$exe" --version 2>/dev/null || echo "unknown")
185
+
186
+ echo ""
187
+ success " Resend CLI ${installed_version} installed successfully!"
188
+ echo ""
189
+ info " Binary: $(tildify "$exe")"
190
+
191
+ # ─── PATH setup ─────────────────────────────────────────────────────────────
192
+
193
+ # Check if already on PATH
194
+ if command -v resend >/dev/null 2>&1; then
195
+ existing=$(command -v resend)
196
+ if [[ "$existing" == "$exe" ]]; then
197
+ echo ""
198
+ bold " Run ${Blue}resend --help${Color_Off}${Bold} to get started${Color_Off}"
199
+ echo ""
200
+ exit 0
201
+ else
202
+ warn "another 'resend' was found at ${existing}"
203
+ info " The new installation at $(tildify "$exe") may be shadowed."
204
+ fi
205
+ fi
206
+
207
+ # Check if bin_dir is already in PATH
208
+ if echo "$PATH" | tr ':' '\n' | grep -qxF "${bin_dir}" 2>/dev/null; then
209
+ echo ""
210
+ bold " Run ${Blue}resend --help${Color_Off}${Bold} to get started${Color_Off}"
211
+ echo ""
212
+ exit 0
213
+ fi
214
+
215
+ # Determine shell config file
216
+ shell_name=$(basename "${SHELL:-}")
217
+ config=""
218
+ shell_line=""
219
+
220
+ # Build a $HOME-relative path for shell config (~ doesn't expand inside quotes)
221
+ if [[ $bin_dir == "$HOME"/* ]]; then
222
+ shell_bin_dir="\$HOME${bin_dir#"$HOME"}"
223
+ else
224
+ shell_bin_dir="$bin_dir"
225
+ fi
226
+
227
+ case $shell_name in
228
+ zsh)
229
+ config="${ZDOTDIR:-$HOME}/.zshrc"
230
+ shell_line="export PATH=\"${shell_bin_dir}:\$PATH\""
231
+ ;;
232
+ bash)
233
+ # macOS bash opens login shells — .bash_profile is loaded, not .bashrc.
234
+ # Linux bash opens non-login interactive shells — .bashrc is preferred.
235
+ if [[ $(uname -s) == "Darwin" ]]; then
236
+ if [[ -f "$HOME/.bash_profile" ]]; then
237
+ config="$HOME/.bash_profile"
238
+ elif [[ -f "$HOME/.bashrc" ]]; then
239
+ config="$HOME/.bashrc"
240
+ else
241
+ config="$HOME/.bash_profile"
242
+ fi
243
+ else
244
+ if [[ -f "$HOME/.bashrc" ]]; then
245
+ config="$HOME/.bashrc"
246
+ elif [[ -f "$HOME/.bash_profile" ]]; then
247
+ config="$HOME/.bash_profile"
248
+ else
249
+ config="$HOME/.bashrc"
250
+ fi
251
+ fi
252
+ shell_line="export PATH=\"${shell_bin_dir}:\$PATH\""
253
+ ;;
254
+ fish)
255
+ config="${XDG_CONFIG_HOME:-$HOME/.config}/fish/conf.d/resend.fish"
256
+ mkdir -p "$(dirname "$config")"
257
+ shell_line="fish_add_path ${shell_bin_dir}"
258
+ ;;
259
+ esac
260
+
261
+ if [[ -n $config ]]; then
262
+ # Check if PATH entry already exists (check both tildified and absolute)
263
+ if [[ -f "$config" ]] && (grep -qF "$(tildify "$bin_dir")" "$config" 2>/dev/null || grep -qF "$bin_dir" "$config" 2>/dev/null); then
264
+ info " PATH already configured in $(tildify "$config")"
265
+ elif [[ -w "${config%/*}" ]] || [[ -w "$config" ]]; then
266
+ {
267
+ echo ""
268
+ echo "# Resend CLI"
269
+ echo "$shell_line"
270
+ } >> "$config"
271
+ info " Added $(tildify "$bin_dir") to \$PATH in $(tildify "$config")"
272
+ echo ""
273
+ info " To start using Resend CLI, run:"
274
+ echo ""
275
+ bold " source $(tildify "$config")"
276
+ bold " resend --help"
277
+ else
278
+ echo ""
279
+ info " Manually add to your shell config:"
280
+ echo ""
281
+ bold " ${shell_line}"
282
+ fi
283
+ else
284
+ echo ""
285
+ info " Add to your shell config:"
286
+ echo ""
287
+ bold " export PATH=\"${shell_bin_dir}:\$PATH\""
288
+ fi
289
+
290
+ echo ""
291
+ info " Next steps:"
292
+ echo ""
293
+ bold " export RESEND_API_KEY=re_..."
294
+ bold " resend --help"
295
+ echo ""
296
+
297
+ }
298
+
299
+ # Run the installer — this line MUST be the last line in the file.
300
+ # If the download is interrupted, bash will not execute an incomplete function.
301
+ main "$@"
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "resend-cli",
3
+ "version": "1.1.0",
4
+ "description": "Resend CLI — email for developers",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/resend/resend-cli"
9
+ },
10
+ "homepage": "https://github.com/resend/resend-cli#readme",
11
+ "keywords": [
12
+ "cli",
13
+ "resend",
14
+ "email",
15
+ "api"
16
+ ],
17
+ "packageManager": "bun@1.3.10",
18
+ "type": "module",
19
+ "bin": {
20
+ "resend": "./src/cli.ts"
21
+ },
22
+ "scripts": {
23
+ "dev": "bun run src/cli.ts",
24
+ "dev:watch": "bun --watch src/cli.ts",
25
+ "build": "bun build --compile --minify --sourcemap --bytecode src/cli.ts --outfile dist/resend",
26
+ "lint": "biome check",
27
+ "format": "biome format --write",
28
+ "typecheck": "tsc --noEmit",
29
+ "test": "bun test tests/commands tests/lib"
30
+ },
31
+ "dependencies": {
32
+ "commander": "14.0.3",
33
+ "@commander-js/extra-typings": "14.0.0",
34
+ "resend": "6.9.3",
35
+ "@clack/prompts": "1.1.0",
36
+ "unicode-animations": "1.0.3"
37
+ },
38
+ "devDependencies": {
39
+ "@biomejs/biome": "2.4.6",
40
+ "@types/bun": "1.3.10",
41
+ "typescript": "5.9.3"
42
+ }
43
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ "config:recommended"
5
+ ]
6
+ }
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env bun
2
+ import { Command } from '@commander-js/extra-typings';
3
+ import { apiKeysCommand } from './commands/api-keys/index';
4
+ import { loginCommand } from './commands/auth/login';
5
+ import { logoutCommand } from './commands/auth/logout';
6
+ import { broadcastsCommand } from './commands/broadcasts/index';
7
+ import { contactPropertiesCommand } from './commands/contact-properties/index';
8
+ import { contactsCommand } from './commands/contacts/index';
9
+ import { doctorCommand } from './commands/doctor';
10
+ import { domainsCommand } from './commands/domains/index';
11
+ import { emailsCommand } from './commands/emails/index';
12
+ import { openCommand } from './commands/open';
13
+ import { segmentsCommand } from './commands/segments/index';
14
+ import { teamsCommand } from './commands/teams/index';
15
+ import { topicsCommand } from './commands/topics/index';
16
+ import { webhooksCommand } from './commands/webhooks/index';
17
+ import { whoamiCommand } from './commands/whoami';
18
+ import { PACKAGE_NAME, VERSION } from './lib/version';
19
+
20
+ const program = new Command()
21
+ .name('resend')
22
+ .description('Resend CLI — email for developers')
23
+ .version(
24
+ `${PACKAGE_NAME} v${VERSION}`,
25
+ '-v, --version',
26
+ 'Output the current version',
27
+ )
28
+ .option('--api-key <key>', 'Resend API key (overrides env/config)')
29
+ .option('--team <name>', 'Team profile to use (overrides RESEND_TEAM)')
30
+ .option('--json', 'Force JSON output')
31
+ .option('-q, --quiet', 'Suppress spinners and status output (implies --json)')
32
+ .configureHelp({ showGlobalOptions: true })
33
+ .hook('preAction', (thisCommand, actionCommand) => {
34
+ if (actionCommand.optsWithGlobals().quiet) {
35
+ thisCommand.setOptionValue('json', true);
36
+ }
37
+ })
38
+ .addHelpText(
39
+ 'after',
40
+ `
41
+ Environment:
42
+ RESEND_API_KEY API key — checked after --api-key, before stored credentials
43
+ Priority: --api-key flag > RESEND_API_KEY > ~/.config/resend/credentials.json
44
+ RESEND_TEAM Team profile — checked after --team flag, before active_team in config
45
+ Priority: --team flag > RESEND_TEAM > active_team in config > "default"
46
+
47
+ Output:
48
+ Human-readable by default. Pass --json or pipe stdout for machine-readable JSON.
49
+ Use --quiet (-q) in CI to suppress spinners and status messages (implies --json).
50
+ Errors always exit with code 1: {"error":{"message":"...","code":"..."}}
51
+
52
+ Examples:
53
+ $ resend login --key re_123456789
54
+ $ resend emails send --from you@domain.com --to user@example.com --subject "Hi" --text "Hello"
55
+ $ resend emails batch --file ./emails.json --json
56
+ $ resend doctor --json`,
57
+ )
58
+ .addCommand(loginCommand)
59
+ .addCommand(logoutCommand)
60
+ .addCommand(emailsCommand)
61
+ .addCommand(domainsCommand)
62
+ .addCommand(apiKeysCommand)
63
+ .addCommand(broadcastsCommand)
64
+ .addCommand(contactsCommand)
65
+ .addCommand(contactPropertiesCommand)
66
+ .addCommand(segmentsCommand)
67
+ .addCommand(topicsCommand)
68
+ .addCommand(webhooksCommand)
69
+ .addCommand(doctorCommand)
70
+ .addCommand(teamsCommand)
71
+ .addCommand(openCommand)
72
+ .addCommand(whoamiCommand);
73
+
74
+ program.parse();