Skip to content

Commit d1e555d

Browse files
betegonclaude
andauthored
feat(install): add SENTRY_INIT env var to run wizard after install (#685)
## Summary Lets users install the CLI and launch the setup wizard in one command: ```bash curl -fsSL https://cli.sentry.dev/install | SENTRY_INIT=1 bash ``` After the normal install completes, resolves the installed binary by checking the same candidate directories as the TS code (`SENTRY_INSTALL_DIR` > `~/.local/bin` > `~/bin` > `~/.sentry/bin`), then runs `sentry init </dev/tty`. The `</dev/tty` reopens stdin from the terminal since `curl | bash` consumes it for the pipe. Also adds `install` to the docs-preview workflow path filter — changes to the install script weren't triggering preview builds because the symlink in `docs/public/` doesn't match the `docs/**` glob. ## Test plan - [ ] `curl -fsSL .../install | SENTRY_INIT=1 bash` — installs CLI, then launches wizard with working interactive prompts - [ ] `curl -fsSL .../install | bash` (without env var) — normal install, no wizard - [ ] Verify binary is found even when installed to `~/.sentry/bin` (fallback path) Closes #682 Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7e6689a commit d1e555d

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

.github/workflows/docs-preview.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- 'src/**'
88
- 'script/generate-command-docs.ts'
99
- 'script/generate-skill.ts'
10+
- 'install'
1011
- '.github/workflows/docs-preview.yml'
1112

1213
permissions:

install

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@ Options:
8989
Environment Variables:
9090
SENTRY_INSTALL_DIR Override the installation directory
9191
SENTRY_VERSION Install a specific version (e.g., 0.19.0, nightly)
92+
SENTRY_INIT Set to 1 to run \`sentry init\` after installing
9293
9394
Examples:
9495
curl -fsSL https://cli.sentry.dev/install | bash
96+
curl -fsSL https://cli.sentry.dev/install | SENTRY_INIT=1 bash
9597
curl -fsSL https://cli.sentry.dev/install | bash -s -- --version nightly
9698
curl -fsSL https://cli.sentry.dev/install | bash -s -- --version 0.19.0
9799
SENTRY_VERSION=nightly curl -fsSL https://cli.sentry.dev/install | bash
@@ -276,3 +278,24 @@ trap - EXIT
276278

277279
# shellcheck disable=SC2086
278280
"$tmp_binary" cli setup $setup_args
281+
282+
# Optionally launch the setup wizard after install.
283+
# Reconnect stdin to the real terminal so the wizard can prompt
284+
# interactively — when piped (curl | bash), stdin is the pipe.
285+
if [[ "${SENTRY_INIT:-}" == "1" ]]; then
286+
sentry_bin=""
287+
for dir in "${SENTRY_INSTALL_DIR:-}" "$HOME/.local/bin" "$HOME/bin" "$HOME/.sentry/bin"; do
288+
[[ -z "$dir" ]] && continue
289+
if [[ -x "${dir}/sentry" ]]; then
290+
sentry_bin="${dir}/sentry"
291+
break
292+
fi
293+
done
294+
if [[ -z "$sentry_bin" ]]; then
295+
die "Cannot find installed sentry binary" "init"
296+
fi
297+
if [[ ! -e /dev/tty ]]; then
298+
die "SENTRY_INIT=1 requires an interactive terminal (/dev/tty not available)" "init"
299+
fi
300+
exec "$sentry_bin" init </dev/tty
301+
fi

0 commit comments

Comments
 (0)