Skip to content

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

Open
sentry-junior[bot] wants to merge 25 commits into
mainfrom
feat/cli-wizard-sveltekit-remix-react-router
Open

sentry-junior[bot] wants to merge 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>
…izards

- React Router config: logs and the copy-paste fallback name the config file
  the wizard actually edits (.js or .ts).
- React Router config: a method-style `buildEnd() {}` counts as an existing
  hook instead of being overwritten.
- React Router example routes: the manual fallback names routes.js and
  .jsx/.js modules in JavaScript apps.
- SvelteKit: declining tracing never turns off tracing.server that the
  config file already enables.

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

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