feat(install): add SENTRY_INIT env var to run wizard after install#685
feat(install): add SENTRY_INIT env var to run wizard after install#685
Conversation
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
5245bcd to
67e56c8
Compare
|
Lets users install the CLI and launch the setup wizard in one command:
SENTRY_INIT=1 curl -fsSL https://cli.sentry.dev/install | bash
Uses </dev/tty to reopen stdin from the terminal since curl | bash
consumes it for the pipe.
Also adds `install` to the docs-preview workflow path filter so changes
to the install script trigger a preview build.
Closes #682
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6b6df40 to
8b97caa
Compare
| # Optionally launch the setup wizard after install. | ||
| # </dev/tty reopens stdin from the terminal since `curl | bash` consumes it. | ||
| if [[ "${SENTRY_INIT:-}" == "1" ]]; then | ||
| sentry init </dev/tty |
There was a problem hiding this comment.
Bug: The install script calls sentry init before the new binary's location (~/.sentry/bin) is added to the current shell's PATH, causing a "command not found" error on some systems.
Severity: MEDIUM
Suggested Fix
Instead of relying on the PATH, call sentry init using the absolute path to the newly installed binary. The installation directory path could be stored in a variable and used to construct the full command path. Alternatively, source the modified shell configuration file before calling sentry init to update the current session's PATH.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: install#L285
Potential issue: The install script attempts to run `sentry init` immediately after
installation. The installation logic in `determineInstallDir()` prioritizes directories
already in the shell's `PATH` (e.g., `~/.local/bin`). However, on systems where these
common directories are not in the `PATH`, it falls back to installing in
`~/.sentry/bin`. While the script updates shell configuration files to add this new
directory to the `PATH`, these changes only apply to future shell sessions.
Consequently, the immediate call to `sentry init` in the current session fails with a
"command not found" error, confusing the user. This primarily affects older or minimal
Linux installations.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8b97caa. Configure here.
| # Optionally launch the setup wizard after install. | ||
| # </dev/tty reopens stdin from the terminal since `curl | bash` consumes it. | ||
| if [[ "${SENTRY_INIT:-}" == "1" ]]; then | ||
| sentry init </dev/tty |
There was a problem hiding this comment.
sentry not in PATH after fresh install
High Severity
After a fresh install, sentry init on line 285 calls sentry by bare name, but the binary may not be in the current shell's PATH. The cli setup command installs the binary (e.g., to ~/.sentry/bin) and adds the directory to shell config files, but that only takes effect in new shell sessions. The temp binary ($tmp_binary) has already been deleted by setup. This means for first-time users — the exact target audience of SENTRY_INIT — the command will fail with "command not found," and the ERR trap will fire with a confusing "Unexpected failure" message despite the install itself succeeding.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 8b97caa. Configure here.
| # Optionally launch the setup wizard after install. | ||
| # </dev/tty reopens stdin from the terminal since `curl | bash` consumes it. | ||
| if [[ "${SENTRY_INIT:-}" == "1" ]]; then | ||
| sentry init </dev/tty |
There was a problem hiding this comment.
ERR trap misreports wizard failure as install failure
Medium Severity
The ERR trap (line 75) is still active when sentry init </dev/tty runs. Since set -e is in effect, any failure of the wizard — missing TTY, user cancellation, network error — triggers die "Unexpected failure at line $LINENO", printing a scary red error and sending a false-positive telemetry event to Sentry. The install already succeeded at that point, so the optional wizard step's failure gets misreported as a catastrophic install failure.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 8b97caa. Configure here.


Summary
Lets users install the CLI and launch the setup wizard in one command:
SENTRY_INIT=1 curl -fsSL https://cli.sentry.dev/install | bashAfter the normal install completes, runs
sentry init </dev/tty. The</dev/ttyreopens stdin from the terminal sincecurl | bashconsumes it for the pipe.Also adds
installto the docs-preview workflow path filter — changes to the install script weren't triggering preview builds because the symlink indocs/public/doesn't match thedocs/**glob.Test plan
SENTRY_INIT=1 curl -fsSL .../install | bash— installs CLI, then launches wizard with working interactive promptscurl -fsSL .../install | bash(without env var) — normal install, no wizardCloses #682