Skip to content

Commit 85afd5f

Browse files
betegonclaude
andcommitted
feat(install): add --init flag to run wizard after install
Lets users install the CLI and launch the setup wizard in one command: curl -fsSL https://cli.sentry.dev/install | bash -s -- --init After the normal install completes, resolves the installed binary path and runs `sentry init </dev/tty`. The </dev/tty is needed because `curl | bash` consumes stdin 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>
1 parent 79e72c1 commit 85afd5f

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

.github/workflows/docs-preview.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request:
55
paths:
66
- 'docs/**'
7+
- 'install'
78
- '.github/workflows/docs-preview.yml'
89

910
permissions:

install

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Usage: install [options]
8383
Options:
8484
-h, --help Display this help message
8585
-v, --version <version> Install a specific version (e.g., 0.2.0) or "nightly"
86+
--init Run \`sentry init\` after installing
8687
--no-modify-path Don't modify shell config files (.zshrc, .bashrc, etc.)
8788
--no-completions Don't install shell completions
8889
@@ -92,6 +93,7 @@ Environment Variables:
9293
9394
Examples:
9495
curl -fsSL https://cli.sentry.dev/install | bash
96+
curl -fsSL https://cli.sentry.dev/install | bash -s -- --init
9597
curl -fsSL https://cli.sentry.dev/install | bash -s -- --version nightly
9698
curl -fsSL https://cli.sentry.dev/install | bash -s -- --version 0.19.0
9799
SENTRY_VERSION=nightly curl -fsSL https://cli.sentry.dev/install | bash
@@ -102,6 +104,7 @@ EOF
102104
requested_version="${SENTRY_VERSION:-}"
103105
no_modify_path=false
104106
no_completions=false
107+
run_init=false
105108
while [[ $# -gt 0 ]]; do
106109
case "$1" in
107110
-h|--help) usage; exit 0 ;;
@@ -113,6 +116,10 @@ while [[ $# -gt 0 ]]; do
113116
die "Error: --version requires a version argument" "args"
114117
fi
115118
;;
119+
--init)
120+
run_init=true
121+
shift
122+
;;
116123
--no-modify-path)
117124
no_modify_path=true
118125
shift
@@ -276,3 +283,21 @@ trap - EXIT
276283

277284
# shellcheck disable=SC2086
278285
"$tmp_binary" cli setup $setup_args
286+
287+
# Optionally launch the setup wizard after install.
288+
# Resolve the installed binary path using the same logic as the TS code:
289+
# SENTRY_INSTALL_DIR > ~/.local/bin > ~/bin > ~/.sentry/bin
290+
# </dev/tty reopens stdin from the terminal since `curl | bash` consumes it.
291+
if [[ "$run_init" == "true" ]]; then
292+
sentry_bin=""
293+
for dir in "${SENTRY_INSTALL_DIR:-}" "$HOME/.local/bin" "$HOME/bin" "$HOME/.sentry/bin"; do
294+
if [[ -x "${dir}/sentry" ]]; then
295+
sentry_bin="${dir}/sentry"
296+
break
297+
fi
298+
done
299+
if [[ -z "$sentry_bin" ]]; then
300+
die "Cannot find installed sentry binary" "init"
301+
fi
302+
"$sentry_bin" init </dev/tty
303+
fi

0 commit comments

Comments
 (0)