From 82b85ceb795e4b77c00d269acb87800d3735d881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Beteg=C3=B3n?= Date: Wed, 8 Apr 2026 21:01:38 +0200 Subject: [PATCH] feat(install): add SENTRY_INIT env var to run wizard after install 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) --- .github/workflows/docs-preview.yml | 1 + install | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 0d8836263..6cab1ce42 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -7,6 +7,7 @@ on: - 'src/**' - 'script/generate-command-docs.ts' - 'script/generate-skill.ts' + - 'install' - '.github/workflows/docs-preview.yml' permissions: diff --git a/install b/install index 3b5b00868..110f33c89 100755 --- a/install +++ b/install @@ -89,9 +89,11 @@ Options: Environment Variables: SENTRY_INSTALL_DIR Override the installation directory SENTRY_VERSION Install a specific version (e.g., 0.19.0, nightly) + SENTRY_INIT Set to 1 to run \`sentry init\` after installing Examples: curl -fsSL https://cli.sentry.dev/install | bash + curl -fsSL https://cli.sentry.dev/install | SENTRY_INIT=1 bash curl -fsSL https://cli.sentry.dev/install | bash -s -- --version nightly curl -fsSL https://cli.sentry.dev/install | bash -s -- --version 0.19.0 SENTRY_VERSION=nightly curl -fsSL https://cli.sentry.dev/install | bash @@ -276,3 +278,24 @@ trap - EXIT # shellcheck disable=SC2086 "$tmp_binary" cli setup $setup_args + +# Optionally launch the setup wizard after install. +# Reconnect stdin to the real terminal so the wizard can prompt +# interactively — when piped (curl | bash), stdin is the pipe. +if [[ "${SENTRY_INIT:-}" == "1" ]]; then + sentry_bin="" + for dir in "${SENTRY_INSTALL_DIR:-}" "$HOME/.local/bin" "$HOME/bin" "$HOME/.sentry/bin"; do + [[ -z "$dir" ]] && continue + if [[ -x "${dir}/sentry" ]]; then + sentry_bin="${dir}/sentry" + break + fi + done + if [[ -z "$sentry_bin" ]]; then + die "Cannot find installed sentry binary" "init" + fi + if [[ ! -e /dev/tty ]]; then + die "SENTRY_INIT=1 requires an interactive terminal (/dev/tty not available)" "init" + fi + exec "$sentry_bin" init