Skip to content

feat(install): add SENTRY_INIT env var to run wizard after install#685

Open
betegon wants to merge 1 commit intomainfrom
feat/ephemeral-init-script
Open

feat(install): add SENTRY_INIT env var to run wizard after install#685
betegon wants to merge 1 commit intomainfrom
feat/ephemeral-init-script

Conversation

@betegon
Copy link
Copy Markdown
Member

@betegon betegon commented Apr 7, 2026

Summary

Lets users install the CLI and launch the setup wizard in one command:

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (install) Add SENTRY_INIT env var to run wizard after install by betegon in #685

Bug Fixes 🐛

  • (init,feedback) Default to tracing only in feature select and attach user email to feedback by MathurAditya724 in #688

Internal Changes 🔧

  • (eval) Replace OpenAI with Anthropic SDK in init-eval judge by betegon in #683
  • (init) Use markdown pipeline for spinner messages by betegon in #686
  • Regenerate skill files and command docs by github-actions[bot] in 584ec0e0

🤖 This preview updates automatically when you update the PR.

@betegon betegon changed the title feat: add ephemeral init bootstrapper script feat(install): add --init flag for ephemeral wizard runs Apr 7, 2026
@betegon betegon force-pushed the feat/ephemeral-init-script branch from 5245bcd to 67e56c8 Compare April 7, 2026 19:06
@betegon betegon marked this pull request as ready for review April 7, 2026 19:08
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/pr-preview/pr-685/

Built to branch gh-pages at 2026-04-08 19:02 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@betegon betegon force-pushed the feat/ephemeral-init-script branch from 6b6df40 to 8b97caa Compare April 7, 2026 19:53
@betegon betegon changed the title feat(install): add --init flag for ephemeral wizard runs feat(install): add SENTRY_INIT env var to run wizard after install Apr 7, 2026
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8b97caa. Configure here.

@betegon betegon force-pushed the feat/ephemeral-init-script branch from 8b97caa to 85afd5f Compare April 8, 2026 12:05
@betegon betegon changed the title feat(install): add SENTRY_INIT env var to run wizard after install feat(install): add --init flag to run wizard after install Apr 8, 2026
sentry_bin="${dir}/sentry"
break
fi
done
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@betegon betegon force-pushed the feat/ephemeral-init-script branch from 85afd5f to 19f5d97 Compare April 8, 2026 12:18
@betegon betegon changed the title feat(install): add --init flag to run wizard after install feat(install): add SENTRY_INIT env var to run wizard after install Apr 8, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ 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.

@betegon betegon force-pushed the feat/ephemeral-init-script branch 2 times, most recently from f6b769c to 086c091 Compare April 8, 2026 14:15
@betegon betegon force-pushed the feat/ephemeral-init-script branch from 086c091 to 98608e3 Compare April 8, 2026 18:39
    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>
@betegon betegon force-pushed the feat/ephemeral-init-script branch from 98608e3 to bcdb083 Compare April 8, 2026 19:01
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Codecov Results 📊

134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 1476 uncovered lines.
✅ Project coverage is 95.46%. Comparing base (base) to head (head).

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Offer sentry init as an ephemeral one-liner for users without the CLI installed

1 participant