Skip to content

feat(cli): add SvelteKit, Remix and React Router to sentry wizard - #2526

Merged
BYK merged 25 commits into
mainfrom
feat/cli-wizard-sveltekit-remix-react-router
Nov 27, 2026
Merged

BYK merged 25 commits into
mainfrom
feat/cli-wizard-sveltekit-remix-react-router

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

Part of #2511 (under #1965). Stacked on #2520 (shared AST helpers), which sits on #2519 (sentry wizard scaffold and Next.js). magicast and recast stay until #2510 moves the config edits to a shared flow.

What

Ports the SvelteKit, Remix and React Router flows of getsentry/sentry-wizard 9.1.0 (src/sveltekit/, src/remix/, src/react-router/) into packages/cli/src/lib/wizard/, with their upstream tests in packages/cli/test/lib/wizard/. sveltekit, remix and reactRouter are registered in WIZARD_RUNNERS, calling runSvelteKitWizard, runRemixWizard and runReactRouterWizard with the same WizardOptions that upstream src/run.ts passes, so sentry wizard -i <id> and the picker now offer them.

The one shared helper these flows needed that the CLI didn't have yet, utils/abort-if-sportlight-not-supported.ts, comes over with its upstream path and signature. As upstream, all three flows stop with a notice under --spotlight.

Changes from upstream

  • Remix with a Vite config: upstream called the source maps wizard's configureVitePlugin (src/sourcemaps/tools/vite.ts), which belongs to the source maps port. For now this branch writes .env.sentry-build-plugin and prints a link to the manual Remix source map steps. When the source maps port lands, swap that call back in; it's one call in remix/remix-wizard.ts.
  • Remix without Vite: as upstream, the build script becomes remix build --sourcemap && npx @sentry/remix --upload-sourcemaps --org … --project … (shopify hydrogen build and --buildPath ./dist for Hydrogen, plus --url for self-hosted), and .sentryclirc gets the auth token. That is the Remix SDK's own upload script, which uses @sentry/cli internally, so it stays as is. Self-hosted is detected with the selfHosted flag from getOrAskForProjectData instead of comparing sentryUrl to DEFAULT_URL.
  • Types: the AST code uses ast-types namedTypes instead of @babel/types, which the CLI doesn't depend on. Where upstream called magicast's generateCode on a bare node, this branch calls recast.print, which is what generateCode runs for a node that has no $code. A few defensive checks that the stricter types make redundant were removed. The React Router handleError codemod now narrows the variable declaration properly instead of using as any. When the handleError value isn't a function with a block body, the codemod logs a debug message and skips the edit; upstream threw there.
  • Error reporting: Sentry.captureException(...) calls go through reportCliError. The SvelteKit Vite fallback snippet prints with clack.rawOutput instead of console.log.
  • Bug fix: the SvelteKit instrumentation.server fallback always named the file .ts, because (fileEnding ?? isUsingTypeScript()) is always truthy. It now uses the project's ending.
  • The upstream fixtures (.tsx files under test/lib/wizard/{remix,react-router}/**/fixtures/) are kept byte for byte, because the tests compare against their exact quoting. Oxfmt, Oxlint and the test tsconfig.json skip packages/cli/test/lib/wizard/**/fixtures/**, and scripts/tsconfig-policy.test.mjs lists them as unchecked on purpose, like the cli3to4 codemod fixtures.
  • A few functions with 6 or 7 positional parameters keep them, with a max-params disable comment, so that the upstream tests still call them unchanged.

Not ported / follow-ups

  • The Remix Vite source map setup, which waits on the source maps wizard port (see above).
  • test/commands/wizard.test.ts used remix as its example of an integration that isn't available yet. It now uses flutter, so a sibling PR that ports Flutter will need to pick another one.

via @BYK.

--

View Session [Sentry]

sentry-junior Bot and others added 5 commits November 26, 2026 11:48
Start moving getsentry/sentry-wizard into the CLI as `sentry wizard`.
This adds the command with the `@sentry/wizard` integrations and flags
(`-i`, `--url`, `--org`, `--project`, `--saas`, `--spotlight`, and the
rest), the shared wizard helpers, and the Next.js flow. The other
integrations report that they are not available in this version yet.

The wizard logs in with the CLI's own login: a stored `sentry auth
login` session, an agent handoff, or the device flow, instead of the
`account/settings/wizard/<hash>` browser flow. It then picks or creates
the project, reads its DSN, and creates an org auth token for source map
uploads. Telemetry goes through the CLI's client.

`sentry init` stays the agent setup guide; its help now points to
`sentry wizard` for the interactive setup.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Port `ast-utils` and `url` from getsentry/sentry-wizard into
`src/lib/wizard/utils/`. The SvelteKit, Remix, React Router, Angular,
Nuxt, source maps, Cloudflare, React Native and Android wizards all use
them, so they land once here and the platform PRs that follow build on
them in parallel.

`ast-utils` edits recast ASTs, so recast and ast-types become direct
dev dependencies; both already came in through magicast.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
`sentry wizard` logs in with the CLI's login, which has no sign-up or
partner step, so `--signup`, `--promo-code` and `--coming-from` no longer
do anything. Passing one now fails with a message that points to
https://sentry.io/signup/ instead of being accepted silently.

`promoCode` and `comingFrom` leave `WizardOptions`, the welcome banner and
`setupCI`, which loses its Vercel partner branch. The help text and the
docs say which `@sentry/wizard` flags were removed.

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

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Port the SvelteKit, Remix and React Router flows of getsentry/sentry-wizard
9.1.0 into `src/lib/wizard/` with their tests, and register them as the
`sveltekit`, `remix` and `reactRouter` runners of `sentry wizard`. The
flows take the same options `@sentry/wizard` passed them, and like
upstream they stop with a notice under `--spotlight`
(`utils/abort-if-sportlight-not-supported.ts` comes over for that).

Changes from upstream:
- Remix with a Vite config used the source maps wizard's Vite setup,
  which isn't in the CLI yet. It now writes `.env.sentry-build-plugin`
  and points to the manual source map steps instead.
- The AST code is typed with ast-types instead of `@babel/types`, which
  the CLI doesn't depend on; node printing that magicast's
  `generateCode` did on bare nodes goes through `recast.print`, which is
  what `generateCode` calls for them.
- Failures that went to `Sentry.captureException` go through
  `reportCliError`.
- The SvelteKit fallback for `instrumentation.server` named the file
  `.ts` even in JavaScript projects; it now uses the project's ending.

The upstream test fixtures are kept byte for byte, so formatting, lint
and type checks skip `test/lib/wizard/**/fixtures/`.

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

vercel Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Nov 27, 2026 11:25pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 27, 2026 11:25pm UTC

Request Review

…rs' into feat/cli-wizard-sveltekit-remix-react-router

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

CI failed on the SvelteKit, Remix and React Router flows:
- They still passed `promoCode` to `printWelcome()`, which the scaffold
  removed with the sign-up and partner flags.
- The sentry-wizard codemod fixtures under `test/lib/wizard/**/fixtures/`
  are excluded from the test tsconfig, so the tsconfig policy now lists
  them as unchecked on purpose, like the cli3to4 codemod fixtures.

The Remix build script used `npx @sentry/remix --upload-sourcemaps`,
which runs the legacy sentry-cli. The wizard must not depend on
sentry-cli, so the script now runs `sentry sourcemap upload` on the same
build path and URL prefix, and the wizard installs `sentry` as a dev
dependency so the script works in CI. The org, project and self-hosted
URL move from script flags into `.sentryclirc`, which v4 reads; the
wizard tells the user to set the matching env vars in CI.
sentry-junior Bot and others added 3 commits November 26, 2026 18:10
- Skip the `.sentryclirc` URL check, like `sentry init`: the wizard picks
  its instance (`--url`, `--saas` or a prompt) before it logs in.
- Use the stored login's instance for `sentryUrl` when none was chosen,
  and log in again when the stored login is for another instance.
- Link self-hosted users to `/settings/<org>/auth-tokens/`.
- Leave an unparseable MCP config alone (show the copy-paste fallback),
  and let a cancel inside the MCP setup stop the wizard.
- Resolve `catalog:` and `catalog:default` against both pnpm default
  catalog forms.
- Find an existing `SENTRY_AUTH_TOKEN` after the comment header of
  `.env.sentry-build-plugin`, so re-runs don't add a second one.
- Run Windows formatters with Node in the standalone binary, where
  `process.execPath` is `sentry`.
- Ask before updating an `@sentry/nextjs` listed in devDependencies, and
  treat an unknown SDK version as the `^11` the wizard installs.

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

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Revert the Remix build script change from 07f26e0. For Remix without
Vite the wizard again sets the build script to
`npx @sentry/remix --upload-sourcemaps --org … --project …` and writes
only the auth token to `.sentryclirc`, as sentry-wizard does. It no
longer installs `sentry` as a dev dependency or prints the CI env var
note. The promoCode removal from the welcome screen stays.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
sentry-junior Bot and others added 6 commits November 26, 2026 19:01
Address review feedback on the shared wizard helpers:

- Enable unicorn/no-array-for-each repo-wide and convert every
  .forEach call site to for...of, including getLastRequireIndex.
- Add buildProjectIssuesUrl to lib/sentry-urls.ts, built on
  getOrgBaseUrl like buildEventSearchUrl, and delete the
  wizard-specific wizard/utils/url.ts.
- Move findFile into lib/dsn/fs-utils.ts and build it on
  isRegularFile, so a directory or FIFO with a matching name is
  skipped. It is async now.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
`sentry wizard [<org>/<project>] [<integration>]` replaces the
`@sentry/wizard` flags, with the target first like other commands.

- The integration is a positional, one at a time. A bare integration id
  is never read as a target, and a single bare word is always read as an
  integration, so a project or org spelled like one is written
  `my-org/nextjs`, `nextjs/` or `/nextjs`.
- The target parses with the CLI's org/project grammar and resolves after
  login with `resolveOrgOptionalTarget`, like other commands. Without one
  the org and project pickers run, with no detection.
- `-f/--force` is the only flag. It sets both `forceInstall` and
  `ignoreGitChanges`.
- The instance comes from `SENTRY_URL` or the stored login, so the
  SaaS/self-hosted prompt, `--url`, `--saas` and `skipRcUrlCheck` go.
- Spotlight mode follows `SENTRY_SPOTLIGHT`, telemetry follows
  `isTelemetryEnabled()`, and debug output goes through the CLI logger
  (`--verbose`, `--log-level`).
- Every other `@sentry/wizard` flag and `SENTRY_WIZARD_*` variable is
  gone, hidden ones included, with `disableTelemetryForRun` and
  `rejectRemovedFlags`.

A test pins the wizard's own flags to `force`, and `check:env-coverage`
(part of `ci:policy`) fails when any file under `src/` names
`SENTRY_WIZARD_`.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Re-export buildProjectIssuesUrl from lib/sentry-web-urls.ts through
withSentryBaseUrl(getApiBaseUrl()), like the other user-facing link
builders, so self-hosted and regional logins get links on the host they
are authenticated against.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
…eat/cli-wizard-shared-ast-helpers

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
…e new wizard base

Merge feat/cli-wizard-shared-ast-helpers (f0a48de) and fix what it breaks:
- `findFile` moved from `wizard/utils/ast-utils.ts` to the async
  `lib/dsn/fs-utils.ts`; the Remix and SvelteKit flows now await it.
- `sentry wizard` takes `[<org>/<project>] [<integration>]` positionals,
  so the dispatch tests for the three flows pass them that way and check
  the `target` the flows get.
- The base enables `unicorn/no-array-for-each`, so the ported `forEach`
  loops are `for…of` loops.

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

- Pass telemetryEnabled to printWelcome so the disclosure shows, as in the other wizards.
- Match quoted "ssr" keys so an existing "ssr": false is flipped, not shadowed.
- Name the existing vite.config file in the copy-paste fallback.
…ekit-remix-react-router

# Conflicts:
#	packages/cli/src/lib/wizard/run.ts
#	packages/cli/src/lib/wizard/utils/abort-if-sportlight-not-supported.ts
#	packages/cli/test/tsconfig.json

@cursor cursor Bot left a comment

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.

Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.

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 e1fd683. Configure here.

@BYK
BYK enabled stacked auto-merge November 27, 2026 22:59
…ekit-remix-react-router

# Conflicts:
#	.oxfmtrc.json
#	.oxlintrc.json
#	packages/cli/src/lib/wizard/run.ts
#	packages/cli/test/commands/wizard.test.ts
#	packages/cli/test/tsconfig.json
@vercel
vercel Bot temporarily deployed to Preview – sentry-local November 27, 2026 23:24 Inactive
@BYK
BYK added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit 1c1c996 Nov 27, 2026
45 of 46 checks passed
@BYK
BYK deleted the feat/cli-wizard-sveltekit-remix-react-router branch November 27, 2026 23:45
github-actions Bot pushed a commit to Fields-Education/sentry-mcp that referenced this pull request Nov 28, 2026
Part of getsentry#2511. Stacked on getsentry#2520 (which
is stacked on getsentry#2519).

Ports the Android and Flutter flows of sentry-wizard 9.1.0
(`src/android/`, `src/flutter/` and their tests) to
`packages/cli/src/lib/wizard/{android,flutter}`. Both are registered in
`WIZARD_RUNNERS` through the entry points upstream `src/run.ts` called,
so `sentry wizard -i android` / `-i flutter` work and the picker lists
them.

## What changed vs. sentry-wizard

**No xml-js / js-yaml.**
- Android used xml-js only to *read* `AndroidManifest.xml`: it finds the
`MAIN` activity and the manifest `package`. That's now
`wizard/utils/xml.ts`, a small element/attribute reader.
- It skips text, comments, CDATA, processing instructions and the
doctype, and decodes character references in attribute values.
- It throws on malformed markup. `getMainActivity` then falls back to
"verify the setup by hand".
- Every write is still a string edit, as upstream did it, so the user's
formatting is kept. That covers the manifest, Gradle scripts, main
activity, `pubspec.yaml` and `main.dart`.
- Flutter never used js-yaml: `pubspec.yaml` was already patched with
string edits, and none of the helpers it imports touch YAML.

**No `sentry-cli` binary.**
- Nothing installs or checks for `sentry-cli`. `./gradlew` runs through
`utils/bash.ts`, which ports only `execute`.
- The Android Gradle Plugin and `sentry_dart_plugin` bundle their own
CLI, so they still read `sentry.properties` as upstream wrote it.
- The Flutter auth-token hints used to say "auth token for Sentry CLI"
and link the v3 `docs.sentry.io/cli/configuration` page. They now name
the Dart plugin and link its auth-token docs.

**Other port changes**
- `Sentry.captureException("…")` becomes `reportCliError(new
Error("…"))`, like `utils/clack/index.ts`.
- `promoCode` is gone from `printWelcome`.
- `abort()` throws `WizardExitError`.
- `getMainActivity` no longer crashes on a lone `<activity>` without an
`<intent-filter>`. Upstream dereferenced `undefined` there.
- The `sentry-properties-added` tag now reports the `sentry.properties`
result. Upstream reported the pubspec result.
- `release-registry.ts` uses `fetch` instead of axios.

## `sentry` commands

These flows don't generate or print any `sentry` CLI commands. The only
CLI configuration they write is what the Gradle and Dart plugins read
(`sentry.properties`, the `pubspec.yaml` `sentry:` block), and that
stays as upstream wrote it.

## Overlap with parallel ports

- `test/commands/wizard.test.ts` no longer hard-codes an integration for
the "not available in this version yet" case. It picks any id without a
runner through the new `hasWizardRunner()` in `run.ts`, which the picker
uses too. So sibling ports registering more integrations
(getsentry#2526 switched it to `flutter`) don't break it. When
that conflicts, keep this version.
- Expect small additive conflicts in `WIZARD_RUNNERS`.


These shared helpers are ported at their upstream paths because these
flows import them. Other flows may port the same files:
- `utils/release-registry.ts`
- `utils/line-endings.ts`
- `utils/abort-if-sportlight-not-supported.ts` (keeps upstream's file
name)
- `utils/bash.ts` (`execute` only; `installSentryCLI` / `hasSentryCLI`
are intentionally left out)

## Kept as upstream (possible follow-ups)

- Spotlight aborts for both flows ("only available for Next.js").
- The search for Gradle files walks the whole tree, including `build/`
and `.gradle/`.

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

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

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A86d7d76d65e73ea456f83a410d391124)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A86d7d76d65e73ea456f83a410d391124/?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>
github-actions Bot pushed a commit to Fields-Education/sentry-mcp that referenced this pull request Nov 28, 2026
…apes (getsentry#2565)

Stacked on getsentry#2526. It fixes the Warden and Bugbot
findings on that PR where the fix changes the wizard's behaviour
relative to upstream `getsentry/sentry-wizard` (v9.1.0).

## Behaviour changes vs upstream sentry-wizard

- **React Router `handleError` (function export, error-only params):**
binds `request` from the handler's parameters, adding `{ request }` when
needed. Upstream used `request` unbound, so the handler threw. (CC6-JTR)
- **React Router `handleError` (const or arrow export):**
`Sentry.captureException` now goes first in the body, as it already did
for function exports, so an early `return` no longer skips it. (6BK-CX9)
- **React Router `handleError` (named second parameter):** the guard
reads `args.request` / `context.request` from the existing parameter
instead of assuming a destructured `request`.
- **React Router `vite.config`:** `sentryReactRouter(…, <env>)` gets the
`defineConfig` callback's own parameter, with or without a default. If
there is none, or it is destructured (`({ mode })`), the wizard picks a
name nothing in the file uses yet (`config`, then `configEnv`). A
destructured parameter is destructured again in the body and keeps its
default. Upstream always passed `config`. (NTK-WRA)
- **React Router `start` script:** keeps the project's own command and
adds `NODE_ENV=production NODE_OPTIONS='--import
./instrument.server.mjs'` in front of it. Upstream replaced any start
script without `NODE_OPTIONS` with `react-router-serve
./build/server/index.js`. A default project gets the same command as
before. (55R-DRR)
- **React Router `NODE_OPTIONS` merge:** an unquoted value ends at the
first whitespace, as in a shell. The import is merged in before any
command (e.g. `pm2`), and sibling variables like `PORT=3000` stay
separate. Upstream allowlisted commands and absorbed the following
tokens. (QRC-596)
- **Remix root `export { ErrorBoundary }`:** the existing boundary is
found and instrumented. Upstream added a duplicate `ErrorBoundary`.
(X9W-F69)
- **Remix root `export const ErrorBoundary`:** arrow and
function-expression boundaries are instrumented, and an expression body
becomes a block body. Upstream left them unchanged. (SFV-22K)
- **Remix root capture:** `captureRemixErrorBoundaryError(<name>)` goes
right after the `useRouteError()` read (also `useRouteError() as Error`
or `useRouteError()!`) and uses the boundary's own binding (e.g.
`routeError`). Upstream used `error` before the last statement.
(UWP-WMX)
- **Remix root, boundary not resolvable** (e.g. `export const
ErrorBoundary = withX(…)`): the wizard warns with the line to add.
Upstream skipped it silently.
- **Remix `handleError`:** wraps the existing handler as a whole
(`Sentry.wrapHandleErrorWithSentry(<original>)`), which keeps `async`,
parameters, expression bodies and handlers built elsewhere. Upstream
copied the body into a fixed non-async arrow, or threw on expression
bodies. (7JW-LJX, 484-EKL)
- **Remix example page:** also writes
`app/routes/api.sentry-example-api.(ts|js)`, the route the page's button
fetches. Upstream never created it, so the button got a 404. (HTF-GHR)
- **Remix custom Express server:** the instrumentation import is
relative to the server file (`../instrumentation.server.mjs` from
`server/index.ts`). Upstream always used `./`. (QPF-CJ8)
- **SvelteKit Svelte 5 example page:** `isConnected` uses
`$state(true)`, so the connectivity warning and the disabled button
update. (XYK-TL6)

## Product calls

- The `start` script keeps the user's command. For a default
`react-router-serve ./build/server/index.js` project, the result matches
the [React Router manual setup
docs](https://docs.sentry.io/platforms/javascript/guides/react-router/manual-setup/).
- The Remix `handleError` output is the
`Sentry.wrapHandleErrorWithSentry(...)` form from the [Remix manual
setup
docs](https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/),
wrapped around the user's own handler.
- The Remix example API route uses the same loader shape as the React
Router wizard's route, at the path the Remix example page already
fetches.

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

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

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A41bbd99c5ac5a29973bfc446a4b17011)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A41bbd99c5ac5a29973bfc446a4b17011/?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>
github-actions Bot pushed a commit to Fields-Education/sentry-mcp that referenced this pull request Nov 28, 2026
…#2529)

Part of getsentry#1965 (tracking: getsentry#2511).
Stacked on getsentry#2520.

Ports two sentry-wizard 9.1.0 (@069923d) flows into the `sentry wizard`
picker:

- **Source maps** (`src/sourcemaps/` → `src/lib/wizard/sourcemaps/`):
every tool (webpack, Vite, Rollup, esbuild, tsc, Create React App,
Angular, Wrangler, and the generic "I use another tool" flow), plus
`utils/vendor/is-unicorn-supported.ts`, which now reads env vars through
`getEnv`.
- **Cloudflare** (`src/cloudflare/` → `src/lib/wizard/cloudflare/`).

Both are registered in `WIZARD_RUNNERS` with the upstream entry points.
The existing `sourcemaps/ci.ts` gains the upstream step that asks the
user to run the `sentry:sourcemaps` script in CI. There is no second
copy of that file.

The webpack, Vite and tsc tools and the Cloudflare config/worker edits
still use magicast/recast. getsentry#2510 removes them after v4.

### sentry-cli v2 → v4

Generated projects use the v4 `sentry` CLI from the `sentry` npm
package. They install `sentry@<major>.x` as a devDependency instead of
`@sentry/cli@^2`. The wizard itself never needs a `sentry-cli` binary:
`src/utils/bash.ts` (the `get-cli` download and `sentry-cli --version`
check) is not ported.

| sentry-cli v2 | v4 |
|---|---|
| `sentry-cli sourcemaps inject` / `upload` | `sentry sourcemap inject`
/ `upload` |
| `sentry-cli releases propose-version` / `new` | `sentry release
propose-version` / `create` |
| `--org <org> --project <project>` | `[defaults]` in `.sentryclirc`, or
`SENTRY_ORG` / `SENTRY_PROJECT` |
| `--url <url>` | `SENTRY_URL` |
| Wrangler upload with `--strip-prefix 'dist/..'` | Wrangler upload with
`--no-rewrite` |

The generated commands don't use the hidden `--org` / `--project` compat
flags:

- **Local runs**: the generic and Wrangler flows merge `org`, `project`
and, on self-hosted Sentry, `url` into the project's `.sentryclirc`
`[defaults]`, next to the gitignored `[auth] token` the wizard already
writes. Other sections, keys and comments are kept. v4 reads them from
there.
- **Self-hosted `url`**: this depends on a CLI fix that's in progress
separately. Today v4 rejects a non-SaaS `[defaults] url` that sits in
the same file as the token. The wizard also tells self-hosted users to
set `SENTRY_URL` wherever the script runs.
- **CI**: on sentry.io, the CI step lists only `SENTRY_AUTH_TOKEN`. On
self-hosted Sentry, it also lists `SENTRY_ORG`, `SENTRY_PROJECT` and
`SENTRY_URL`. Wrangler now counts as a `sentry`-command tool there,
since its token is in `.sentryclirc`, not `.env.sentry-build-plugin`. It
skips the "run the script in CI" prompt because its `post<deploy>`
script already runs the upload.

The `sentry-cli` tool id and file name stay, so telemetry tags still
line up with sentry-wizard's.

### Overlap with the other wizard PRs

File paths match upstream, so this and the parallel ports reconcile with
a merge.

- getsentry#2525 (Nuxt/Angular): `sourcemaps/ci.ts`,
`sourcemaps/tools/sentry-cli.ts`, `tools/angular.ts`, `tools/types.ts`,
`utils/abort-if-sportlight-not-supported.ts`, and the `sentry-cli`, `ci`
and `sentryclirc-file` tests match its head. This PR supersedes these
lines of it:
- `tools/sentry-cli.ts`: `addOrgAndProjectToSentryCliRc` is exported, so
Wrangler writes `[defaults]` the same way.
- `tools/sentry-cli.ts`: the `sentry@<major>.x` install passes
`devDependency: true`. It's a build-time tool.
- `ci.ts`: `"wrangler"` joins `CLI_BASED_FLOW_TOOLS`, and the npm-script
CI step is skipped for it. The reasons are in the CI bullet above.
- `tools/types.ts`: adds the `SourceMapUploadToolConfigurationFunction`
type that the bundler tools use.
- getsentry#2526 (SvelteKit/Remix/React Router) adds the same
`abort-if-sportlight-not-supported.ts`. This PR takes getsentry#2525's copy,
whose JSDoc differs from getsentry#2526's by one line.

### Other differences from upstream

- `tools/nextjs.ts` and `tools/remix.ts` are not ported. Nothing in
9.1.0 reaches them.
- The redirect to a better-suited wizard (SvelteKit, React Native) calls
the CLI's `runWizard` instead of spawning `@sentry/wizard`.
- The Wrangler deploy-script parser no longer splits on shell operators
inside quotes or `$(…)`. Without this, rerunning the wizard would split
inside the version pipe it adds.
- Wrangler's `sentry release create` no longer passes `--project`, so
the project slug stays out of `package.json`. It depends on
getsentry#2534, which makes `release create` default to the
resolved project.
- The formatter, linter and test tsconfig now skip
`packages/cli/test/lib/wizard/**/fixtures/**`, so the Cloudflare
fixtures keep their exact upstream bytes.

### Follow-ups

- **Remix + Vite** (getsentry#2526): `remix/remix-wizard.ts`
there writes `.env.sentry-build-plugin` and links to the manual steps,
because `configureVitePlugin` wasn't ported yet. Once both land, swap
that back to `configureVitePlugin` from `sourcemaps/tools/vite.ts`. Its
path and signature match upstream, so the change is one line.
- **Release version hint**: the Wrangler script keeps only the first
line of `sentry release propose-version` (`| head -n 1`), because a hint
line follows the version on stdout. Tracked in getsentry#2531.

### Open questions

1. **Wrangler prefix**: v4's `--strip-prefix` strips uploaded file
paths, not the sources inside the maps. So v2's `--strip-prefix
'dist/..'` was dropped, and the upload relies on release and URL
matching. Is that enough?
The `sentry:sourcemaps` npm script is now just `sentry sourcemap upload
<path>`, because the upload injects debug IDs itself.

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

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

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A5cf1df7c30f084bc9d1e92f69ae9f377)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A5cf1df7c30f084bc9d1e92f69ae9f377/?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 was successfully deployed

1 active and 1 inactive deployments
Preview – cli — 89d2d643 Deployed Nov 27, 2026 by vercel[bot]
Preview – sentry-local — 89d2d643 Deployed Nov 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant