Skip to content

feat(cli): add the wizard's shared AST and URL helpers - #2520

Merged
BYK merged 7 commits into
feat/cli-wizard-scaffoldfrom
feat/cli-wizard-shared-ast-helpers
Nov 27, 2026
Merged

BYK merged 7 commits into
feat/cli-wizard-scaffoldfrom
feat/cli-wizard-shared-ast-helpers

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

Stacked on #2519. Tracking issue: #2511.

Nine of the remaining sentry-wizard flows (SvelteKit, Remix, React Router, Angular, Nuxt, source maps, Cloudflare, React Native, Android) use the same two helpers. Landing them here, once, lets those platform PRs stack on this one in parallel without each one re-adding the same files.

  • src/lib/wizard/utils/ast-utils.ts: finds and edits nodes in recast ASTs and reads and writes JSON-C. It's ported from sentry-wizard with strict types (unknown in place of any), and invalid JSON-C now goes to the wizard's debug log instead of being dropped.
  • src/lib/wizard/utils/url.ts: builds the issue stream URL the wizards print once setup finishes.
  • Its tests are ported to test/lib/wizard/utils/ast-utils.test.ts.

recast and ast-types become direct dev dependencies. Both already came in through magicast, so nothing new is bundled. They stay until the wizard's config edits move to the shared init/wizard flow in #2510.

via @BYK.

--

View Session [Sentry]

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-junior
sentry-junior Bot added this pull request to stack #2521 November 26, 2026 11:52
@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 26, 2026 10:42pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 26, 2026 10:42pm UTC

Request Review

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

📊 MCP Server Token Cost Report

Summary

  • Total Tokens: 67760 tokens
  • Tool Count: 76 tools
  • Average: 892 tokens/tool

Per-Tool Breakdown

Tool Tokens % of Total
get_issue_details 3967 5.9%
get_alert_rule 2245 3.3%
find_releases 1805 2.7%
get_issue_activity 1759 2.6%
update_alert_rule 1653 2.4%
get_replay_details 1602 2.4%
create_alert_rule 1506 2.2%
get_monitor_details 1501 2.2%
update_metric_monitor 1479 2.2%
create_metric_monitor 1458 2.2%
get_event_stacktrace 1381 2%
update_issue 1380 2%
render_sentry_chart 1362 2%
get_snapshot 1308 1.9%
get_profile 1291 1.9%
get_agent_conversation_details 1278 1.9%
find_monitors 1261 1.9%
search_logs 1248 1.8%
search_traces 1246 1.8%
get_alert_options 1236 1.8%
search_profiles 1228 1.8%
search_metrics 1216 1.8%
search_errors 1214 1.8%
get_profile_details 1200 1.8%
find_related_issues 1171 1.7%
get_uptime_monitor_details 1163 1.7%
create_monitor 1135 1.7%
onboarding_status_update 1109 1.6%
search_issue_events 1103 1.6%
search_replays 1095 1.6%
render_issue_chart 1061 1.6%
get_release_details 1056 1.6%
get_dashboard_details 1052 1.6%
search_issues 977 1.4%
search_docs 973 1.4%
find_alert_rules 908 1.3%
update_uptime_monitor 873 1.3%
create_uptime_monitor 871 1.3%
search_agent_conversations 830 1.2%
find_dropped_events 819 1.2%
get_metric_monitor_details 797 1.2%
create_project 793 1.2%
update_dsn 765 1.1%
get_issue_user_reports 630 0.9%
get_latest_base_snapshot 623 0.9%
find_dashboards 553 0.8%
link_issue 545 0.8%
find_uptime_monitors 537 0.8%
get_issue_breadcrumbs 492 0.7%
unlink_issue 476 0.7%
find_metric_monitors 471 0.7%
get_issue_tag_values 469 0.7%
update_project 441 0.7%
get_sentry_resource 429 0.6%
submit_feedback_to_sentry_team 426 0.6%
add_issue_note 404 0.6%
delete_monitor_environment 363 0.5%
find_teams 351 0.5%
find_projects 346 0.5%
delete_alert_rule 345 0.5%
delete_uptime_monitor 333 0.5%
delete_metric_monitor 331 0.5%
create_dsn 326 0.5%
add_team_to_project 324 0.5%
remove_team_from_project 320 0.5%
find_dsns 319 0.5%
find_organizations 311 0.5%
get_snapshot_image 302 0.4%
analyze_issue_with_seer 300 0.4%
get_event_attachment 299 0.4%
get_trace_details 282 0.4%
create_team 266 0.4%
get_span_details 263 0.4%
whoami 261 0.4%
get_sentry_mcp_info 142 0.2%
get_doc 102 0.2%

Note: This measures the static overhead of tool definitions sent to LLM clients with every request. Lower is better.

MCP Apps views

Each ui:// view as a host receives it from resources/read.

View MIME type Raw Gzip Brotli Budget % of budget
ui://sentry/chart/v6.html text/html;profile=mcp-app 19,249 B 7,913 B 7,014 B 24,576 B 78.3%

The budget applies to raw bytes, and the view's generator fails over it.

…st-helpers

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

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
*/
export function getLastRequireIndex(program: t.Program): number {
let lastRequireIdex = -1;
program.body.forEach((s, i) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be using for .. of, isn't this enforced by a lint rule already?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No lint rule was enforcing it. 2c987511 enables unicorn/no-array-for-each repo-wide in .oxlintrc.json and converts all 34 .forEach sites to for…of, getLastRequireIndex included. The other 33 are in cli, mcp-core, mcp-cloudflare, apps/local and apps/games-api. A return inside a callback became continue.

* Checks if a file where we don't know its concrete file type yet exists
* and returns the full path to the file with the correct file type.
*/
export function findFile(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have this functionality already in the CLI under DSN discovery code or something like that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DSN code has no extension-probing helper, but lib/dsn/fs-utils.ts has isRegularFile. 2c987511 moves findFile there and builds it on isRegularFile, so a directory or FIFO with a matching name is skipped. It's async now, and it has tests. The platform PRs will update their call sites when they next pick up this base.

*
* Example: https://org-slug.sentry.io/issues/?project=1234567
*/
export function getIssueStreamUrl({

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should already have a URL builder somewhere in the codebase?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was one. 2c987511 adds buildProjectIssuesUrl(orgSlug, projectId) to lib/sentry-urls.ts, built on getOrgBaseUrl like buildEventSearchUrl, with SaaS and self-hosted tests. It also deletes wizard/utils/url.ts.

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>
@BYK
BYK marked this pull request as ready for review November 26, 2026 19:07
@BYK
BYK requested a review from a team as a code owner November 26, 2026 19:07
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 26, 2026

@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 1 potential issue.

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 2c98751. Configure here.

Comment thread packages/cli/src/lib/sentry-urls.ts Resolved
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>
sentry-junior Bot and others added 2 commits November 26, 2026 22:40
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>
@vercel
vercel Bot temporarily deployed to Preview – sentry-local November 26, 2026 22:42 Inactive
sentry-junior Bot added a commit that referenced this pull request Nov 27, 2026
…izard base

Merges origin/feat/cli-wizard-shared-ast-helpers at f0a48de (#2520, the
chart-app fix and #2519's positional rework) and fixes what it breaks:

- `runWizard` no longer takes `debug`, so the redirect to another wizard
  drops it.
- `wizard/utils/url.ts` is gone. The source maps outro links to the
  project's issues with `buildProjectIssuesUrl` from `lib/sentry-web-urls`.
- `findFile` now comes from `lib/dsn/fs-utils` and is async, so the tsc,
  Vite and webpack tools await it.
- The new `no-array-for-each` lint rule: two `forEach` loops become
  `for...of`.
- The wizard docs fragment keeps the base's flag table and the source maps
  paragraph from this branch.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@BYK
BYK merged commit 504d4f9 into main Nov 27, 2026
48 checks passed
@BYK
BYK deleted the feat/cli-wizard-shared-ast-helpers branch November 27, 2026 14:04
BYK added a commit that referenced this pull request Nov 27, 2026
Before v4.0.0, the setup wizards of getsentry/sentry-wizard move into
the CLI as `sentry wizard`, so there is one tool, one login and one
telemetry client, and the wizards call v4 `sentry` commands instead of
sentry-cli v2. Tracking issue: #2511 (part of
#1965). This is the first PR in that stack: the
command, its login, and the Next.js flow.

## Changes

- **`sentry wizard [<org>/<project>] [<integration>]`**: the target
comes first, like other commands, and both are optional. The integration
takes the `@sentry/wizard -i` ids, one at a time; without it the picker
runs. The target uses the CLI's org/project syntax and resolves after
login like other commands' targets; without it the org and project
pickers run, with no detection. A bare integration id is never read as a
target and a single bare word is always read as an integration, so a
project spelled like one is written `my-org/nextjs`. `-f/--force` is the
only flag: it changes a project with uncommitted changes without asking
and force-installs the SDK. Everything else comes from the CLI: the
instance from `SENTRY_URL` or the stored login, Spotlight mode from
`SENTRY_SPOTLIGHT`, telemetry from the CLI's settings, and debug output
from `--verbose`/`--log-level`. No other `@sentry/wizard` flag or
`SENTRY_WIZARD_*` variable is accepted, hidden or not; a test pins the
flags and `ci:policy` rejects `SENTRY_WIZARD_` under `packages/cli/src`.
- **Sign-up flags are removed.** `-s/--signup`, `--promo-code` and
`--coming-from` fail as unknown flags, because the CLI's login has no
sign-up or partner step. `promoCode`/`comingFrom` are gone from the
wizard options, the welcome banner and the CI step.
- **The Next.js flow** is ported as-is in `src/lib/wizard/nextjs/`, with
its tests. Each flow loads lazily. The picker lists only ported flows,
and naming an unported integration says it isn't available in this
version yet. Cordova and Electron are dropped along with sentry-wizard's
`lib/`.
- **Shared helpers** are in `src/lib/wizard/utils/`. A small pnpm
catalog reader replaces js-yaml.
- **Login uses the CLI's own login** instead of the
`account/settings/wizard/<hash>` browser flow: the stored `sentry auth
login` session, an agent handoff from `SENTRY_HANDOFF`, or the device
flow with `org:ci` and `org:tokens`. The wizard then picks the org,
picks or creates the project for the flow's platform, reads its DSN, and
creates an org auth token for source map uploads. If it can't create a
token, for example when there's no TTY to add scopes, it writes the
placeholder token and says so.
- **No `sentry-cli` binary needed.** The wizard runs inside the CLI, so
it never installs or checks for `sentry-cli`; the old `get-cli` +
`sentry-cli --version` check isn't ported.
- **Telemetry** goes through the CLI's Sentry client and follows the
CLI's telemetry settings (`SENTRY_CLI_NO_TELEMETRY`, `DO_NOT_TRACK`,
`sentry cli defaults`).
- `sentry init` still prints the agent setup guide. Its help points to
`sentry wizard`, and the wizard's help points back to `init`. Merging
the two is #2510, after v4.

This adds one dependency: `magicast@0.2.11`, which brings recast. They
stay until the config edits move to the shared flow in
#2510.

**Breaking for `@sentry/wizard` users:** the command line changes to
`sentry wizard [<org>/<project>] [<integration>]` with only
`-f/--force`. Every other `@sentry/wizard` flag, including `--signup`,
`--promo-code` and `--coming-from`, now fails as an unknown flag,
`SENTRY_WIZARD_*` variables are ignored, and the Cordova and Electron
wizards are gone.

## Rest of the stack

1. This PR: scaffold, auth, Next.js
2. #2520: shared AST and URL helpers
3. JS frameworks: SvelteKit, Remix, React Router, Nuxt, Angular
4. Source maps and Cloudflare, with sentry-cli v2 calls moved to v4
`sentry` commands
5. Mobile: iOS and Apple Snapshots, React Native, Android, Flutter
6. Wizard e2e tests in toolkit CI

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

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

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A23ba814e02fcece5f64e00f096d03341)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A23ba814e02fcece5f64e00f096d03341/?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>
sentry-junior Bot added a commit that referenced this pull request Nov 27, 2026
#2519 and #2520 were squash-merged into main, so this
branch's base is now main. The add/add conflicts came from the squashed
wizard files. main's copies of run.ts and test/commands/wizard.test.ts
equal f0a48de, which this branch already merged, so this branch's
Android and Flutter additions are kept. project-data.ts and its test take
main's copy, which has the #2559 fix for the origin trust check.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
sentry-junior Bot added a commit that referenced this pull request Nov 27, 2026
#2519 and #2520 were squash-merged, so this PR's base
is now main. Resolved the add/add conflicts: run.ts keeps this branch's
runner registrations (main's copy equals the old base), and
project-data.ts and its test take main's copy, with the #2559
context-scoped origin trust fix (this branch didn't change them).

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>
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
Ports sentry-wizard's end-to-end suite for help output and Next.js to
`sentry wizard`, because `sentry wizard` replaces `@sentry/wizard`. Part
of getsentry#2511.

Stacked on getsentry#2520.

The upstream fixture apps are vendored. A local mock API replaces
Sentry, so no secrets are needed. The new `wizard-e2e.yml` workflow is
path-filtered and not required. A macOS job is tracked in
getsentry#2572.

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

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

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A05d7a193f6451d0411e3c81d6130a725)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A05d7a193f6451d0411e3c81d6130a725/?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
…tsentry#2526)

Part of getsentry#2511 (under getsentry#1965). Stacked
on getsentry#2520 (shared AST helpers), which sits on
getsentry#2519 (`sentry wizard` scaffold and Next.js). magicast
and recast stay until getsentry#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.

<!-- 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

2 active and 1 inactive deployments
Preview – cli — f0a48dee Deployed Nov 26, 2026 by vercel[bot]
Actions — f0a48dee Deployed Nov 26, 2026 by sentry-junior[bot] via eval #2089
Preview – sentry-local — f0a48dee Deployed Nov 26, 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