Skip to content

Commit f6b769c

Browse files
betegonclaude
andcommitted
feat(install): add --init flag / SENTRY_INIT to run wizard after install
curl -fsSL https://cli.sentry.dev/install | bash -s -- --init Closes #682 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 79e72c1 commit f6b769c

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

.github/workflows/docs-preview.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request:
55
paths:
66
- 'docs/**'
7+
- 'install'
78
- '.github/workflows/docs-preview.yml'
89

910
permissions:

install

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,18 @@ Usage: install [options]
8383
Options:
8484
-h, --help Display this help message
8585
-v, --version <version> Install a specific version (e.g., 0.2.0) or "nightly"
86+
--init Run \`sentry init\` after installing
8687
--no-modify-path Don't modify shell config files (.zshrc, .bashrc, etc.)
8788
--no-completions Don't install shell completions
8889
8990
Environment Variables:
9091
SENTRY_INSTALL_DIR Override the installation directory
9192
SENTRY_VERSION Install a specific version (e.g., 0.19.0, nightly)
93+
SENTRY_INIT Same as --init
9294
9395
Examples:
9496
curl -fsSL https://cli.sentry.dev/install | bash
97+
curl -fsSL https://cli.sentry.dev/install | bash -s -- --init
9598
curl -fsSL https://cli.sentry.dev/install | bash -s -- --version nightly
9699
curl -fsSL https://cli.sentry.dev/install | bash -s -- --version 0.19.0
97100
SENTRY_VERSION=nightly curl -fsSL https://cli.sentry.dev/install | bash
@@ -102,6 +105,7 @@ EOF
102105
requested_version="${SENTRY_VERSION:-}"
103106
no_modify_path=false
104107
no_completions=false
108+
run_init="${SENTRY_INIT:-false}"
105109
while [[ $# -gt 0 ]]; do
106110
case "$1" in
107111
-h|--help) usage; exit 0 ;;
@@ -113,6 +117,10 @@ while [[ $# -gt 0 ]]; do
113117
die "Error: --version requires a version argument" "args"
114118
fi
115119
;;
120+
--init)
121+
run_init=true
122+
shift
123+
;;
116124
--no-modify-path)
117125
no_modify_path=true
118126
shift
@@ -276,3 +284,21 @@ trap - EXIT
276284

277285
# shellcheck disable=SC2086
278286
"$tmp_binary" cli setup $setup_args
287+
288+
# Optionally launch the setup wizard after install.
289+
# Resolve the installed binary path using the same logic as the TS code:
290+
# SENTRY_INSTALL_DIR > ~/.local/bin > ~/bin > ~/.sentry/bin
291+
# </dev/tty reopens stdin from the terminal since `curl | bash` consumes it.
292+
if [[ "$run_init" == "true" || "$run_init" == "1" ]]; then
293+
sentry_bin=""
294+
for dir in "${SENTRY_INSTALL_DIR:-}" "$HOME/.local/bin" "$HOME/bin" "$HOME/.sentry/bin"; do
295+
if [[ -x "${dir}/sentry" ]]; then
296+
sentry_bin="${dir}/sentry"
297+
break
298+
fi
299+
done
300+
if [[ -z "$sentry_bin" ]]; then
301+
die "Cannot find installed sentry binary" "init"
302+
fi
303+
"$sentry_bin" init </dev/tty
304+
fi

0 commit comments

Comments
 (0)