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