superacli 1.1.5 → 1.1.6
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/__tests__/resend-plugin.test.js +22 -1
- package/package.json +1 -1
- package/plugins/plugins.json +2 -2
- package/plugins/resend/plugin.json +279 -2
- package/plugins/resend/skills/quickstart/SKILL.md +32 -13
- package/temp_resend_cli/repo/.github/scripts/pr-title-check.js +34 -0
- package/temp_resend_cli/repo/.github/workflows/ci.yml +67 -0
- package/temp_resend_cli/repo/.github/workflows/post-release.yml +51 -0
- package/temp_resend_cli/repo/.github/workflows/pr-title-check.yml +13 -0
- package/temp_resend_cli/repo/.github/workflows/release.yml +175 -0
- package/temp_resend_cli/repo/.github/workflows/test-install-unix.yml +34 -0
- package/temp_resend_cli/repo/.github/workflows/test-install-windows.yml +48 -0
- package/temp_resend_cli/repo/CHANGELOG.md +31 -0
- package/temp_resend_cli/repo/LICENSE +21 -0
- package/temp_resend_cli/repo/README.md +450 -0
- package/temp_resend_cli/repo/biome.json +36 -0
- package/temp_resend_cli/repo/install.ps1 +141 -0
- package/temp_resend_cli/repo/install.sh +301 -0
- package/temp_resend_cli/repo/package.json +61 -0
- package/temp_resend_cli/repo/pnpm-lock.yaml +2439 -0
- package/temp_resend_cli/repo/renovate.json +4 -0
- package/temp_resend_cli/repo/src/cli.ts +98 -0
- package/temp_resend_cli/repo/src/commands/api-keys/create.ts +114 -0
- package/temp_resend_cli/repo/src/commands/api-keys/delete.ts +47 -0
- package/temp_resend_cli/repo/src/commands/api-keys/index.ts +26 -0
- package/temp_resend_cli/repo/src/commands/api-keys/list.ts +35 -0
- package/temp_resend_cli/repo/src/commands/api-keys/utils.ts +8 -0
- package/temp_resend_cli/repo/src/commands/auth/index.ts +20 -0
- package/temp_resend_cli/repo/src/commands/auth/login.ts +234 -0
- package/temp_resend_cli/repo/src/commands/auth/logout.ts +105 -0
- package/temp_resend_cli/repo/src/commands/broadcasts/create.ts +196 -0
- package/temp_resend_cli/repo/src/commands/broadcasts/delete.ts +46 -0
- package/temp_resend_cli/repo/src/commands/broadcasts/get.ts +59 -0
- package/temp_resend_cli/repo/src/commands/broadcasts/index.ts +43 -0
- package/temp_resend_cli/repo/src/commands/broadcasts/list.ts +60 -0
- package/temp_resend_cli/repo/src/commands/broadcasts/send.ts +56 -0
- package/temp_resend_cli/repo/src/commands/broadcasts/update.ts +95 -0
- package/temp_resend_cli/repo/src/commands/broadcasts/utils.ts +35 -0
- package/temp_resend_cli/repo/src/commands/contact-properties/create.ts +118 -0
- package/temp_resend_cli/repo/src/commands/contact-properties/delete.ts +48 -0
- package/temp_resend_cli/repo/src/commands/contact-properties/get.ts +46 -0
- package/temp_resend_cli/repo/src/commands/contact-properties/index.ts +48 -0
- package/temp_resend_cli/repo/src/commands/contact-properties/list.ts +68 -0
- package/temp_resend_cli/repo/src/commands/contact-properties/update.ts +88 -0
- package/temp_resend_cli/repo/src/commands/contact-properties/utils.ts +17 -0
- package/temp_resend_cli/repo/src/commands/contacts/add-segment.ts +78 -0
- package/temp_resend_cli/repo/src/commands/contacts/create.ts +122 -0
- package/temp_resend_cli/repo/src/commands/contacts/delete.ts +49 -0
- package/temp_resend_cli/repo/src/commands/contacts/get.ts +53 -0
- package/temp_resend_cli/repo/src/commands/contacts/index.ts +58 -0
- package/temp_resend_cli/repo/src/commands/contacts/list.ts +57 -0
- package/temp_resend_cli/repo/src/commands/contacts/remove-segment.ts +48 -0
- package/temp_resend_cli/repo/src/commands/contacts/segments.ts +39 -0
- package/temp_resend_cli/repo/src/commands/contacts/topics.ts +45 -0
- package/temp_resend_cli/repo/src/commands/contacts/update-topics.ts +90 -0
- package/temp_resend_cli/repo/src/commands/contacts/update.ts +77 -0
- package/temp_resend_cli/repo/src/commands/contacts/utils.ts +119 -0
- package/temp_resend_cli/repo/src/commands/doctor.ts +216 -0
- package/temp_resend_cli/repo/src/commands/domains/create.ts +83 -0
- package/temp_resend_cli/repo/src/commands/domains/delete.ts +42 -0
- package/temp_resend_cli/repo/src/commands/domains/get.ts +47 -0
- package/temp_resend_cli/repo/src/commands/domains/index.ts +35 -0
- package/temp_resend_cli/repo/src/commands/domains/list.ts +53 -0
- package/temp_resend_cli/repo/src/commands/domains/update.ts +75 -0
- package/temp_resend_cli/repo/src/commands/domains/utils.ts +44 -0
- package/temp_resend_cli/repo/src/commands/domains/verify.ts +38 -0
- package/temp_resend_cli/repo/src/commands/emails/batch.ts +140 -0
- package/temp_resend_cli/repo/src/commands/emails/get.ts +44 -0
- package/temp_resend_cli/repo/src/commands/emails/index.ts +30 -0
- package/temp_resend_cli/repo/src/commands/emails/list.ts +84 -0
- package/temp_resend_cli/repo/src/commands/emails/receiving/attachment.ts +55 -0
- package/temp_resend_cli/repo/src/commands/emails/receiving/attachments.ts +68 -0
- package/temp_resend_cli/repo/src/commands/emails/receiving/get.ts +58 -0
- package/temp_resend_cli/repo/src/commands/emails/receiving/index.ts +28 -0
- package/temp_resend_cli/repo/src/commands/emails/receiving/list.ts +59 -0
- package/temp_resend_cli/repo/src/commands/emails/receiving/utils.ts +38 -0
- package/temp_resend_cli/repo/src/commands/emails/send.ts +189 -0
- package/temp_resend_cli/repo/src/commands/open.ts +27 -0
- package/temp_resend_cli/repo/src/commands/segments/create.ts +50 -0
- package/temp_resend_cli/repo/src/commands/segments/delete.ts +47 -0
- package/temp_resend_cli/repo/src/commands/segments/get.ts +38 -0
- package/temp_resend_cli/repo/src/commands/segments/index.ts +36 -0
- package/temp_resend_cli/repo/src/commands/segments/list.ts +58 -0
- package/temp_resend_cli/repo/src/commands/segments/utils.ts +7 -0
- package/temp_resend_cli/repo/src/commands/teams/index.ts +10 -0
- package/temp_resend_cli/repo/src/commands/teams/list.ts +35 -0
- package/temp_resend_cli/repo/src/commands/teams/remove.ts +86 -0
- package/temp_resend_cli/repo/src/commands/teams/switch.ts +76 -0
- package/temp_resend_cli/repo/src/commands/topics/create.ts +73 -0
- package/temp_resend_cli/repo/src/commands/topics/delete.ts +47 -0
- package/temp_resend_cli/repo/src/commands/topics/get.ts +42 -0
- package/temp_resend_cli/repo/src/commands/topics/index.ts +42 -0
- package/temp_resend_cli/repo/src/commands/topics/list.ts +34 -0
- package/temp_resend_cli/repo/src/commands/topics/update.ts +59 -0
- package/temp_resend_cli/repo/src/commands/topics/utils.ts +16 -0
- package/temp_resend_cli/repo/src/commands/webhooks/create.ts +128 -0
- package/temp_resend_cli/repo/src/commands/webhooks/delete.ts +49 -0
- package/temp_resend_cli/repo/src/commands/webhooks/get.ts +42 -0
- package/temp_resend_cli/repo/src/commands/webhooks/index.ts +42 -0
- package/temp_resend_cli/repo/src/commands/webhooks/list.ts +55 -0
- package/temp_resend_cli/repo/src/commands/webhooks/listen.ts +379 -0
- package/temp_resend_cli/repo/src/commands/webhooks/update.ts +83 -0
- package/temp_resend_cli/repo/src/commands/webhooks/utils.ts +36 -0
- package/temp_resend_cli/repo/src/commands/whoami.ts +71 -0
- package/temp_resend_cli/repo/src/lib/actions.ts +157 -0
- package/temp_resend_cli/repo/src/lib/client.ts +37 -0
- package/temp_resend_cli/repo/src/lib/config.ts +217 -0
- package/temp_resend_cli/repo/src/lib/files.ts +15 -0
- package/temp_resend_cli/repo/src/lib/help-text.ts +38 -0
- package/temp_resend_cli/repo/src/lib/output.ts +56 -0
- package/temp_resend_cli/repo/src/lib/pagination.ts +36 -0
- package/temp_resend_cli/repo/src/lib/prompts.ts +149 -0
- package/temp_resend_cli/repo/src/lib/spinner.ts +100 -0
- package/temp_resend_cli/repo/src/lib/table.ts +57 -0
- package/temp_resend_cli/repo/src/lib/tty.ts +28 -0
- package/temp_resend_cli/repo/src/lib/update-check.ts +169 -0
- package/temp_resend_cli/repo/src/lib/version.ts +4 -0
- package/temp_resend_cli/repo/tests/commands/api-keys/create.test.ts +196 -0
- package/temp_resend_cli/repo/tests/commands/api-keys/delete.test.ts +157 -0
- package/temp_resend_cli/repo/tests/commands/api-keys/list.test.ts +134 -0
- package/temp_resend_cli/repo/tests/commands/auth/login.test.ts +153 -0
- package/temp_resend_cli/repo/tests/commands/auth/logout.test.ts +153 -0
- package/temp_resend_cli/repo/tests/commands/broadcasts/create.test.ts +454 -0
- package/temp_resend_cli/repo/tests/commands/broadcasts/delete.test.ts +183 -0
- package/temp_resend_cli/repo/tests/commands/broadcasts/get.test.ts +147 -0
- package/temp_resend_cli/repo/tests/commands/broadcasts/list.test.ts +199 -0
- package/temp_resend_cli/repo/tests/commands/broadcasts/send.test.ts +162 -0
- package/temp_resend_cli/repo/tests/commands/broadcasts/update.test.ts +288 -0
- package/temp_resend_cli/repo/tests/commands/contact-properties/create.test.ts +251 -0
- package/temp_resend_cli/repo/tests/commands/contact-properties/delete.test.ts +184 -0
- package/temp_resend_cli/repo/tests/commands/contact-properties/get.test.ts +145 -0
- package/temp_resend_cli/repo/tests/commands/contact-properties/list.test.ts +181 -0
- package/temp_resend_cli/repo/tests/commands/contact-properties/update.test.ts +217 -0
- package/temp_resend_cli/repo/tests/commands/contacts/add-segment.test.ts +189 -0
- package/temp_resend_cli/repo/tests/commands/contacts/create.test.ts +271 -0
- package/temp_resend_cli/repo/tests/commands/contacts/delete.test.ts +193 -0
- package/temp_resend_cli/repo/tests/commands/contacts/get.test.ts +149 -0
- package/temp_resend_cli/repo/tests/commands/contacts/list.test.ts +176 -0
- package/temp_resend_cli/repo/tests/commands/contacts/remove-segment.test.ts +167 -0
- package/temp_resend_cli/repo/tests/commands/contacts/segments.test.ts +168 -0
- package/temp_resend_cli/repo/tests/commands/contacts/topics.test.ts +164 -0
- package/temp_resend_cli/repo/tests/commands/contacts/update-topics.test.ts +248 -0
- package/temp_resend_cli/repo/tests/commands/contacts/update.test.ts +206 -0
- package/temp_resend_cli/repo/tests/commands/doctor.test.ts +164 -0
- package/temp_resend_cli/repo/tests/commands/domains/create.test.ts +193 -0
- package/temp_resend_cli/repo/tests/commands/domains/delete.test.ts +157 -0
- package/temp_resend_cli/repo/tests/commands/domains/get.test.ts +138 -0
- package/temp_resend_cli/repo/tests/commands/domains/list.test.ts +165 -0
- package/temp_resend_cli/repo/tests/commands/domains/update.test.ts +224 -0
- package/temp_resend_cli/repo/tests/commands/domains/verify.test.ts +118 -0
- package/temp_resend_cli/repo/tests/commands/emails/batch.test.ts +324 -0
- package/temp_resend_cli/repo/tests/commands/emails/get.test.ts +132 -0
- package/temp_resend_cli/repo/tests/commands/emails/receiving/attachment.test.ts +141 -0
- package/temp_resend_cli/repo/tests/commands/emails/receiving/attachments.test.ts +169 -0
- package/temp_resend_cli/repo/tests/commands/emails/receiving/get.test.ts +141 -0
- package/temp_resend_cli/repo/tests/commands/emails/receiving/list.test.ts +182 -0
- package/temp_resend_cli/repo/tests/commands/emails/send.test.ts +312 -0
- package/temp_resend_cli/repo/tests/commands/segments/create.test.ts +164 -0
- package/temp_resend_cli/repo/tests/commands/segments/delete.test.ts +183 -0
- package/temp_resend_cli/repo/tests/commands/segments/get.test.ts +138 -0
- package/temp_resend_cli/repo/tests/commands/segments/list.test.ts +174 -0
- package/temp_resend_cli/repo/tests/commands/teams/list.test.ts +62 -0
- package/temp_resend_cli/repo/tests/commands/teams/remove.test.ts +110 -0
- package/temp_resend_cli/repo/tests/commands/teams/switch.test.ts +103 -0
- package/temp_resend_cli/repo/tests/commands/topics/create.test.ts +192 -0
- package/temp_resend_cli/repo/tests/commands/topics/delete.test.ts +157 -0
- package/temp_resend_cli/repo/tests/commands/topics/get.test.ts +126 -0
- package/temp_resend_cli/repo/tests/commands/topics/list.test.ts +125 -0
- package/temp_resend_cli/repo/tests/commands/topics/update.test.ts +178 -0
- package/temp_resend_cli/repo/tests/commands/webhooks/create.test.ts +225 -0
- package/temp_resend_cli/repo/tests/commands/webhooks/delete.test.ts +157 -0
- package/temp_resend_cli/repo/tests/commands/webhooks/get.test.ts +126 -0
- package/temp_resend_cli/repo/tests/commands/webhooks/list.test.ts +178 -0
- package/temp_resend_cli/repo/tests/commands/webhooks/update.test.ts +207 -0
- package/temp_resend_cli/repo/tests/commands/whoami.test.ts +98 -0
- package/temp_resend_cli/repo/tests/e2e/smoke.test.ts +93 -0
- package/temp_resend_cli/repo/tests/helpers.ts +86 -0
- package/temp_resend_cli/repo/tests/lib/client.test.ts +71 -0
- package/temp_resend_cli/repo/tests/lib/config.test.ts +451 -0
- package/temp_resend_cli/repo/tests/lib/files.test.ts +73 -0
- package/temp_resend_cli/repo/tests/lib/help-text.test.ts +97 -0
- package/temp_resend_cli/repo/tests/lib/output.test.ts +136 -0
- package/temp_resend_cli/repo/tests/lib/prompts.test.ts +185 -0
- package/temp_resend_cli/repo/tests/lib/spinner.test.ts +166 -0
- package/temp_resend_cli/repo/tests/lib/table.test.ts +63 -0
- package/temp_resend_cli/repo/tests/lib/tty.test.ts +89 -0
- package/temp_resend_cli/repo/tests/lib/update-check.test.ts +179 -0
- package/temp_resend_cli/repo/tsconfig.json +14 -0
- package/temp_resend_cli/repo/vitest.config.e2e.ts +8 -0
- package/temp_resend_cli/repo/vitest.config.ts +10 -0
- package/tests/test-resend-smoke.sh +7 -3
|
@@ -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
|
+
- pnpm add -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,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "resend-cli",
|
|
3
|
+
"version": "1.2.2",
|
|
4
|
+
"description": "The official CLI for Resend",
|
|
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
|
+
"engines": {
|
|
18
|
+
"node": ">=20"
|
|
19
|
+
},
|
|
20
|
+
"packageManager": "pnpm@10.11.0",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist/cli.cjs"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"bin": {
|
|
26
|
+
"resend": "./dist/cli.cjs"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"dev": "tsx src/cli.ts",
|
|
30
|
+
"dev:watch": "tsx --watch src/cli.ts",
|
|
31
|
+
"build": "esbuild src/cli.ts --bundle --platform=node --format=cjs --minify --outfile=dist/cli.cjs",
|
|
32
|
+
"build:bin": "pnpm build && pkg dist/cli.cjs --compress Brotli --target node24 --output dist/resend",
|
|
33
|
+
"lint": "biome check",
|
|
34
|
+
"format": "biome format --write",
|
|
35
|
+
"typecheck": "tsc --noEmit",
|
|
36
|
+
"test": "vitest run",
|
|
37
|
+
"test:e2e": "vitest run --config vitest.config.e2e.ts"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@clack/prompts": "1.1.0",
|
|
41
|
+
"@commander-js/extra-typings": "14.0.0",
|
|
42
|
+
"commander": "14.0.3",
|
|
43
|
+
"picocolors": "^1.1.1",
|
|
44
|
+
"resend": "6.9.3"
|
|
45
|
+
},
|
|
46
|
+
"pnpm": {
|
|
47
|
+
"onlyBuiltDependencies": [
|
|
48
|
+
"esbuild",
|
|
49
|
+
"@biomejs/biome"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@biomejs/biome": "2.4.6",
|
|
54
|
+
"@types/node": "22.19.15",
|
|
55
|
+
"esbuild": "0.27.3",
|
|
56
|
+
"tsx": "4.19.4",
|
|
57
|
+
"typescript": "5.9.3",
|
|
58
|
+
"vitest": "3.1.4",
|
|
59
|
+
"@yao-pkg/pkg": "6.14.1"
|
|
60
|
+
}
|
|
61
|
+
}
|