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 ✨
Bug Fixes 🐛
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
5245bcd to
67e56c8
Compare
|
6b6df40 to
8b97caa
Compare
install
Outdated
| # 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.
8b97caa to
85afd5f
Compare
| sentry_bin="${dir}/sentry" | ||
| break | ||
| fi | ||
| done |
There was a problem hiding this comment.
Empty SENTRY_INSTALL_DIR causes check of root /sentry
Low Severity
When SENTRY_INSTALL_DIR is unset, ${SENTRY_INSTALL_DIR:-} expands to an empty string, so the first loop iteration checks -x "/sentry" (a file at the filesystem root). This is unlikely to match in practice, but it's a logic error that could theoretically resolve to the wrong binary. The empty-string directory entry needs to be skipped or filtered out.
Reviewed by Cursor Bugbot for commit 85afd5f. Configure here.
install
Outdated
| if [[ -z "$sentry_bin" ]]; then | ||
| die "Cannot find installed sentry binary" "init" | ||
| fi | ||
| "$sentry_bin" init </dev/tty |
There was a problem hiding this comment.
Bug: The script's ERR trap is not cleared before calling sentry init. A non-zero exit from the wizard, like a user cancellation, will incorrectly trigger a fatal script error.
Severity: MEDIUM
Suggested Fix
Disable the ERR trap immediately before calling the wizard with trap - ERR, and re-enable it afterward if necessary. Alternatively, wrap the command to prevent a non-zero exit code from propagating, for example: "$sentry_bin" init </dev/tty || true.
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#L302
Potential issue: The install script sets an `ERR` trap at the beginning to catch
unexpected failures. This trap is not cleared before executing `sentry init`. If the
`sentry init` command exits with a non-zero status code, which can happen if the user
cancels the wizard with Ctrl+C or if an error occurs, the script's `ERR` trap will be
triggered. This results in the script terminating and sending a misleading telemetry
event for an "Unexpected failure", rather than allowing the wizard to exit gracefully on
its own.
85afd5f to
19f5d97
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 19f5d97. Configure here.
f6b769c to
086c091
Compare
086c091 to
98608e3
Compare
curl -fsSL https://cli.sentry.dev/install | SENTRY_INIT=1 bash The binary now reopens /dev/tty itself when stdin is not a TTY, so clack prompts receive keypress events even when launched from a pipe. Falls back gracefully in CI/containers where /dev/tty is unavailable. Closes #682 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
98608e3 to
bcdb083
Compare
Codecov Results 📊✅ 134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 1476 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 95.43% 95.46% +0.03%
==========================================
Files 223 223 —
Lines 32511 32520 +9
Branches 0 0 —
==========================================
+ Hits 31027 31044 +17
- Misses 1484 1476 -8
- Partials 0 0 —Generated by Codecov Action |


Summary
Lets users install the CLI and launch the setup wizard in one command:
curl -fsSL https://cli.sentry.dev/install | SENTRY_INIT=1 bashAfter 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 runssentry 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
curl -fsSL .../install | SENTRY_INIT=1 bash— installs CLI, then launches wizard with working interactive promptscurl -fsSL .../install | bash(without env var) — normal install, no wizard~/.sentry/bin(fallback path)Closes #682