Skip to content

feat(cli): Install Sentry CLI v4 from sentry.io/get-cli - #132672

Draft
sentry-junior[bot] wants to merge 4 commits into
masterfrom
byk/feat/get-cli-v4
Draft

sentry-junior[bot] wants to merge 4 commits into
masterfrom
byk/feat/get-cli-v4

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Important

Merge at the Sentry CLI v4 launch. Do not merge before. Tracker: getsentry/toolkit#1965

Sentry CLI v4 (sentry, from getsentry/toolkit) replaces getsentry/sentry-cli 3.x. This switches sentry.io/get-cli/ to v4.

get-cli/

get-cli/ still serves a script. It does not redirect to https://cli.sentry.dev/install, for two reasons:

  • People pipe it to sh. The v4 installer is bash, and dash (/bin/sh on Debian and Ubuntu) can't run it.
  • Some clients don't follow redirects. getsentry/sentry-wizard src/utils/bash.ts fetches it with https.get and runs the body with bash, so a 302 would give it an empty script. Port sentry-wizard into the CLI as sentry wizard toolkit#2511 replaces that code path.

The script is now a POSIX sh shim. It downloads the v4 installer to a temp file and runs it with bash. It maps the variables people pass today:

v3 variable v4 behavior
SENTRY_CLI_VERSION unset or latest latest v4
SENTRY_CLI_VERSION=4.x, v4.x, or nightly passed on as SENTRY_VERSION
SENTRY_CLI_VERSION below 4, such as 2.42.1, 3, or v3 installs the legacy sentry-cli binary, as before, so pinned CI installs keep working
INSTALL_DIR SENTRY_INSTALL_DIR, unless that is already set
INSTALL_PATH its directory becomes SENTRY_INSTALL_DIR. v4 always names the binary sentry.
none of the above SENTRY_INSTALL_DIR=/usr/local/bin, v3's default, when that directory is writable or the script runs as root. Otherwise the v4 installer's default applies (~/.local/bin with a shell rc update, and $GITHUB_PATH in GitHub Actions).

After a v4 install, the shim prints a line saying sentry-cli is now sentry, with a link to the migration guide. Without bash, it fails and suggests npm install -g sentry. The legacy branch is the old script, cleaned up so it passes ShellCheck. It also fixes the armv64 case, which used to match armv6* first.

get-cli/<platform>/<arch>/

  • When v4 has a build for the platform, this redirects to release-registry.../apps/sentry/latest?response=download&platform=<p>&arch=<a>&package=sentry. The v4 builds are darwin x64/arm64, linux x64/arm64, and windows x64. v3 names (Linux/x86_64, aarch64) and v4 names (linux/x64) both work.
  • Every other platform (Darwin/universal, Linux/i686, Linux/armv7, Windows/aarch64) gets sentry-cli 3.8.2, the last v3 release. It is pinned because app:sentry-cli latest is moving to v4.

Decided

  • No sentry-cli alias. The shim installs only sentry. Scripts that call sentry-cli can use the shim in the migration guide, pin SENTRY_CLI_VERSION=3.8.2, or switch to sentry.

via @BYK.

--

View Session [Sentry]

get-cli/ now serves a POSIX sh shim that runs the v4 installer from
cli.sentry.dev/install. It maps the v3 variables (SENTRY_CLI_VERSION,
INSTALL_DIR, INSTALL_PATH) to the v4 ones, and a SENTRY_CLI_VERSION below 4
still installs the legacy sentry-cli binary.

get-cli/<platform>/<arch>/ redirects to the v4 build from the release
registry (app:sentry), and to sentry-cli 3.8.2 for platforms v4 has no
build for.

Refs getsentry/toolkit#1965

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 26, 2026
@sentry-junior
sentry-junior Bot requested review from a team and BYK November 26, 2026 10:50
With no install variables set, the get-cli shim installs v4 to
/usr/local/bin, as v3's get-cli did, when that directory is writable or
the script runs as root. Otherwise the v4 installer's default applies.

Refs getsentry/toolkit#1965

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
SENTRY_CLI_VERSION=3 (or 2, v3) fell through to the v4 installer as
SENTRY_VERSION=3. Match bare majors below 4 too, so they install the
legacy sentry-cli, which the release registry resolves (apps/sentry-cli/3
is 3.8.2).

Refs getsentry/toolkit#1965

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Comment thread src/sentry/web/frontend/cli.py Resolved
The legacy get-cli path only installed Oh My Zsh completions for 2.22+
when the major was exactly 2, so pinned 3.x installs skipped them. The
completions command exists from 2.22 on, 3.x included.

Refs getsentry/toolkit#1965
BYK added a commit to getsentry/sentry-wizard that referenced this pull request Nov 27, 2026
* fix(apple): support the v4 sentry CLI in iOS and snapshots flows

When sentry.io/get-cli/ starts installing the Sentry CLI v4 (`sentry`)
instead of `sentry-cli` (getsentry/sentry#132672), the iOS and Apple
Snapshots flows break: the wizard installs the CLI but only looks for
`sentry-cli`, the Xcode build phase skips dSYM uploads, and the snapshots
preflight checks and prints `sentry-cli` commands.

Detect either CLI, preferring v4 `sentry` and falling back to
`sentry-cli`. `sentry debug-files --help` must succeed, which skips
unrelated `sentry` binaries. Detection also checks `~/.local/bin`, where
the v4 installer puts `sentry` when `/usr/local/bin` is not writable.
After the installer runs, the wizard detects the CLI again instead of
assuming success.

The generated Xcode build phase now runs `sentry debug-files upload`
when v4 is installed, falls back to `sentry-cli debug-files upload`, and
otherwise warns with the v4 install instructions. It adds `~/.local/bin`
to PATH and is POSIX sh. Re-runs still find existing phases, including
ones that only call `sentry debug-files upload`.

The snapshots preflight checks `snapshots upload --help` with the
detected CLI and prints the matching command.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>

* docs(changelog): add entry for the v4 sentry CLI support in Apple flows

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>

* fix(apple): give v4 sentry its org and project without flags

The Sentry CLI v4 takes the org and project from `.sentryclirc`
`[defaults]` or from SENTRY_ORG and SENTRY_PROJECT, so the commands the
wizard writes for v4 do not pass `--org` or `--project`.

The iOS wizard now writes `[defaults] org` and `project` to the
`.sentryclirc` it already creates, next to the auth token. Xcode runs the
build phase in the project directory, and both CLIs walk up from there to
that file. The build phase still exports SENTRY_ORG and SENTRY_PROJECT,
which CI needs because `.sentryclirc` is gitignored.

The snapshots instructions for v4 set SENTRY_ORG and SENTRY_PROJECT
instead of passing flags. The `sentry-cli` instructions are unchanged.
The CI hints now name SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT, and
SENTRY_URL for self-hosted Sentry.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>

* fix(apple): use the detected sentry path in the build phase and snapshot guidance

The wizard accepts ~/.local/bin/sentry when sentry on PATH is missing or
is an unrelated binary, but two places still ran bare `sentry`:

- The Xcode build phase only appended ~/.local/bin to PATH, so an
  unrelated `sentry` earlier on PATH still won and dSYM uploads were
  skipped. The phase now checks `sentry` and then
  `$HOME/.local/bin/sentry` with `debug-files --help`, and uploads with
  whichever passed. Existing-phase detection also matches the new
  "$SENTRY_BIN" debug-files upload line.
- The snapshots upload guidance printed `sentry snapshots upload`, which
  fails with "command not found" right after an install into
  ~/.local/bin. It now prints the detected command, shell-quoted.

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <126780+BYK@users.noreply.github.com>
github-actions Bot pushed a commit to Fields-Education/sentry-mcp that referenced this pull request Nov 28, 2026
…getsentry#2544)

Part of getsentry#2511. Stacked on getsentry#2520.

This ports the `ios`, `appleSnapshots` and `reactNative` flows of
`@sentry/wizard` 9.1.0 (`src/apple/`, `src/apple/snapshots/`,
`src/react-native/`) and their tests to `packages/cli/src/lib/wizard/`
and `packages/cli/test/lib/wizard/`. All three are registered in
`WIZARD_RUNNERS` and run as `sentry wizard [<org>/<project>]
ios|appleSnapshots|reactNative`. They add no flags. The upstream Apple
flags (`--app-target`, `--hosted-test-target`, `--non-interactive`,
`--xcode-project-dir`) are not carried over. The wizards look for the
Xcode project in the current directory and prompt for the project, app
target and hosted XCTest target. When stdin is not a terminal
(`isatty(0)`, the same check as auto-login), Apple Snapshots picks the
only target or fails with the choices instead of prompting.

**No `sentry-cli` binary.** After v4, sentry.io/get-cli installs
`sentry` (getsentry/sentry#132672), so these flows use only v4 commands:
- The Xcode build phase follows getsentry/sentry-wizard#1403:
- It exports PATH (installer and Homebrew dirs), SENTRY_ORG and
SENTRY_PROJECT.
- It checks for a v4 `sentry` with `sentry debug-files --help`, then
runs `sentry debug-files upload [--include-sources]
"$DWARF_DSYM_FOLDER_PATH"`.
- Without an installed `sentry`, it runs `npx --yes sentry debug-files
upload`. Failures show up as Xcode warnings, and it warns with the v4
install command only when neither `sentry` nor `npx` is found. There is
no `sentry-cli` fallback.
- `installSentryCLI`/`hasSentryCLI` are not ported.
`check-installed-cli.ts` only checks that `sentry` is on the PATH that
Xcode build phases see. If it isn't but `npx` is, the wizard notes that
builds will use `npx sentry`. If neither is, it prints the Homebrew,
curl (`cli.sentry.dev/install`) and npm install commands.
- `.sentryclirc` stays, because v4 reads it. It now gets `[defaults]
org/project` next to `[auth] token`. The CI hint names
SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT and SENTRY_URL.
- The Apple Snapshots preflight and hint use `sentry snapshots upload …
--app-id`. v4 has no `--org`/`--project` flags there, so the hint uses
env vars.
- Detection of existing upload scripts (Apple `xcode-manager`, React
Native `xcode.ts`) recognizes both the v2 and the v4 command forms.
- The React Native issues link uses `buildProjectIssuesUrl`, so it
points at the host you're logged in to.

**Dependencies.**
- xml-js is gone. `apple/snapshots/xml-scan.ts` is a small scanner, with
tests, for the two shapes the Snapshots flow reads: scheme `TestAction`
`BlueprintName`s and `xcschememanagement.plist` keys.
- `xcode` stays as a devDependency, with local typings in
`src/lib/wizard/xcode.d.ts`. It goes away with the post-v4
`init`/`wizard` unification (getsentry#2510).
- recast and magicast also stay.

**Overlap with sibling ports.** These shared helpers are ported at
upstream's paths, since other flows may port them too:
- `utils/files.ts` and `utils/find-files-with-extension.ts`. Upstream
has two `findFilesWithExtension`s, and both are kept as they are.
- `utils/abort-if-sportlight-not-supported.ts`.
- `utils/bash.ts`, with only `execute`, which `pod install` needs.

React Native needs nothing from `src/android/` or `src/sourcemaps/`.

**Fixtures.** The Xcode project fixtures are in
`test/fixtures/wizard/apple/`.

**Not ported, or different from sentry-wizard.**
- No CLI flags for the project dir or the targets; the wizard prompts
for them instead.
- No `sentry-cli` fallback in the build phase. getsentry#1403 keeps one.
- The fastlane `sentry_debug_files_upload` / `sentry_upload_snapshots`
actions are left as they are. They come from fastlane-plugin-sentry,
which still runs sentry-cli.
- React Native still writes `sentry.properties` and uses the SDK's
bundled `@sentry/cli` scripts for Xcode and Gradle uploads. Those
scripts belong to the SDK.
- Spotlight (`SENTRY_SPOTLIGHT`) is still not supported for iOS or React
Native, same as upstream.

**Resolved in review:** v4 already prefers a stored `sentry auth login`
over the `.sentryclirc` token; the build phase falls back to `npx
sentry`; fastlane and RN SDK v4 follow-ups get their own issues; the
fixtures stay in `test/fixtures/wizard/apple/`.

<!-- junior-request-attribution:start -->
via @BYK.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A875cd8525be461c20f1b8e42904f69e6 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A875cd8525be461c20f1b8e42904f69e6)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A875cd8525be461c20f1b8e42904f69e6/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <126780+BYK@users.noreply.github.com>

This branch has not been deployed

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

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant