Skip to content

feat(cli): add Nuxt and Angular to sentry wizard - #2525

Open
sentry-junior[bot] wants to merge 35 commits into
mainfrom
feat/cli-wizard-nuxt-angular
Open

sentry-junior[bot] wants to merge 35 commits into
mainfrom
feat/cli-wizard-nuxt-angular

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

Part of #1965 and #2511. Stacked on #2520, which is stacked on #2519.

Ports the Nuxt and Angular wizards of sentry-wizard 9.1.0 (069923d) into sentry wizard as the nuxt and angular integrations, and registers both in WIZARD_RUNNERS. Their upstream tests come along.

What's ported

  • src/nuxt/* → src/lib/wizard/nuxt/* and src/angular/** → src/lib/wizard/angular/**, with the same mechanical port rules as the Next.js flow.
  • utils/abort-if-sportlight-not-supported.ts. Both flows stop in Spotlight mode, as they did upstream.
  • Both flows keep editing config with magicast (Nuxt config, Angular main.ts) and recast (Angular app config). Unify the sentry init and sentry wizard setup flows #2510 removes them once init and wizard are unified after v4.
  • Neither flow uses or installs a sentry-cli binary. The wizard doesn't check for one either. The project's own sentry:sourcemaps script calls v4 sentry from the sentry package it installs.
  • The sign-up and partner options are gone. Nothing reads promoCode or comingFrom, and Angular's CI step has no Vercel branch.

Source maps (Angular)

Upstream, Angular called runSourcemapsWizard(options, 'angular'). With the Angular tool preselected, that function's other steps either don't apply here or are already done: the framework-wizard redirect, the SDK version check, project selection, Prettier and the outro. So the Angular flow now calls the tool setup (configureSentryCLI) and setupCI directly.

The tool moves from the legacy sentry-cli to v4:

  • It installs the sentry package (^4) instead of @sentry/cli@^2.
  • The sentry:sourcemaps npm script is sentry sourcemap inject <dir> && sentry sourcemap upload <dir>, in place of sentry-cli sourcemaps …. It passes no org, project or URL flags.
  • Locally, sentry sourcemap upload reads the org and project from the project's .sentryclirc. The wizard writes them to its [defaults] section (org=, project=, plus url= for self-hosted Sentry), which v4 already feeds into org/project/url resolution (src/lib/sentryclirc.ts). The edit (setSentryCliRcDefaults) only sets those keys. It keeps every other key, comment and section of an existing file, and updates the keys in every [defaults] section, since the last one wins when the file is read.
  • The auth token still goes into the [auth] section of that file, as upstream did, and v4 still reads it (applySentryCliRcEnvShim maps it to SENTRY_AUTH_TOKEN). The file stays in .gitignore.
  • In CI, sourcemaps/ci.ts lists the environment variables to set. On sentry.io that's only SENTRY_AUTH_TOKEN, because v4 resolves the org and project from the DSN. Self-hosted CI also gets SENTRY_ORG, SENTRY_PROJECT and SENTRY_URL. setupCI(selectedTool, authToken, uploadTarget?) takes the org, project and self-hosted URL as an optional third argument, and Angular passes them. Without it (Next.js), the step shows only the auth token, as before.
  • The self-hosted url write depends on the CLI's same-file trust fix, which is tracked separately. Today v4 refuses a non-SaaS [defaults] url unless the token's host or a stored login vouches for it, and an [auth] token from the same file doesn't count (assertRcUrlTrusted). Until that fix lands, self-hosted users set SENTRY_URL wherever the script runs, and the wizard tells them to.

sourcemaps/ci.ts again asks the user to run sentry:sourcemaps in CI for tools that use sentry commands, the same as upstream's configureCI. That step was dropped when ci.ts was split out for Next.js.

Overlap with the source maps PR

These files have the same paths as upstream's src/sourcemaps/, so reconcile them with the parallel source maps port:

  • sourcemaps/tools/sentry-cli.ts, with the v4 changes above. It also adds the exported getSentryCliNpmScript and setSentryCliRcDefaults.
  • sourcemaps/tools/angular.ts. angularJsonTemplate is no longer exported.
  • sourcemaps/tools/types.ts. Only SourceMapUploadToolConfigurationOptions is here. The unused SourceMapUploadToolConfigurationFunction is left out.
  • sourcemaps/ci.ts, for the CI npm-script step and the optional upload target.
  • utils/abort-if-sportlight-not-supported.ts. Other flow ports probably add this file too.
  • The sentry-cli.ts and ci.ts test files, and the .sentryclirc file test.

Once runSourcemapsWizard lands, Angular could call it again.

Behaves differently from sentry-wizard

  • Errors upstream sent with a raw captureException now go through reportCliError: the failed angular.json write and the failed Nuxt example page.
  • A missing or unparsable angular.json is logged with debug() and not captured, since it isn't a bug.
  • When the Angular version can't be parsed, the wizard now exits with an error. Upstream it would have crashed.
  • The Angular flow no longer writes the project back into options. Upstream did that only to hand the project to the source maps wizard.
  • Upstream's generated script passed --org and --project to sentry-cli. Here they come from .sentryclirc locally. In CI they come from the DSN on sentry.io and from SENTRY_ORG / SENTRY_PROJECT on self-hosted Sentry.

Not covered

  • A Nuxt 4 project with srcDir: "." and no root pages/ gets the example page under app/pages/, as upstream does. Left for a follow-up.

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 Nuxt and Angular flows of sentry-wizard 9.1.0 into
`sentry wizard -i nuxt` and `sentry wizard -i angular`, with their tests.

Angular uploads source maps with `sentry` commands. sentry-wizard ran its
source maps wizard here with the Angular tool preselected; the flow now
calls that tool's setup (`sourcemaps/tools/sentry-cli.ts`) and the CI step
directly, since the other source maps steps are already done by then. The
tool installs `sentry@^4` instead of `@sentry/cli@^2` and its
`sentry:sourcemaps` script runs `sentry sourcemap inject` and
`sentry sourcemap upload --org … --project …` instead of `sentry-cli
sourcemaps …`. v4 has no `--url`, so self-hosted users are told to set
`SENTRY_URL`. The CI step asks to run that script in CI again, as it did
upstream.

Errors that sentry-wizard sent with a raw `captureException` go through
`reportCliError`; a missing or unparsable `angular.json` is logged with
`debug()` instead, since it is not a bug.

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 12:15
@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

…nuxt-angular

Picks up the removal of the sign-up and partner flags. The Nuxt and Angular
flows no longer pass `promoCode` to `printWelcome()`, and Angular calls
`setupCI(selectedTool, authToken)` without `comingFrom`. The wizard docs
fragment keeps both the removed-flags note and the source maps note.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
The `sentry:sourcemaps` script that the Angular flow adds no longer passes
the hidden `--org`/`--project` compat flags. It is now
`sentry sourcemap inject <dir> && sentry sourcemap upload <dir>`.

The wizard writes the org and project to the `[defaults]` section of the
project's `.sentryclirc`, which v4 already reads for org/project
resolution. The edit keeps every other key, comment and section,
including the `[auth]` token that the wizard still writes next to it, as
sentry-wizard did. The file stays in `.gitignore`.

For CI, `setupCI` takes an optional upload target. Angular passes it, so
the CI step lists `SENTRY_ORG`, `SENTRY_PROJECT` and, for self-hosted
Sentry, `SENTRY_URL` next to `SENTRY_AUTH_TOKEN`.

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

v4 refuses a non-SaaS `[defaults] url` from `.sentryclirc` unless the
token's host or a stored login vouches for it, and the `[auth] token` in the
same file doesn't count. Writing the URL there would make the generated
`sentry:sourcemaps` script fail on self-hosted Sentry, so the wizard tells
users to set `SENTRY_URL` instead.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@vercel
vercel Bot temporarily deployed to Preview – sentry-local November 26, 2026 13:19 Inactive
sentry-junior Bot added a commit that referenced this pull request Nov 26, 2026
…sourcemaps-cloudflare

Picks up the removed sign-up and partner flags. The source maps and
Cloudflare wizards no longer pass `promoCode` to `printWelcome`, and
`setupCI` loses the `comingFrom` argument. The `sourcemaps/ci.ts`
conflict is resolved to the shared version from
#2525.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
sentry-junior Bot added a commit that referenced this pull request Nov 26, 2026
Generated `sentry` commands no longer pass the hidden `--org` and
`--project` compat flags. The generic and Wrangler source maps flows
merge `org` and `project` into the project's `.sentryclirc` `[defaults]`,
next to the existing `[auth] token` and any other keys, and v4 reads them
from there. Wrangler's `sentry:sourcemaps` script drops the `SENTRY_URL=`
prefix and the flags from `sentry release create` and
`sentry sourcemap upload`.

The self-hosted URL is not written to the file. v4 only trusts a non-SaaS
`[defaults] url` when the token's host or a stored login vouches for it,
and a token from the same file does not, so the upload would be refused.
Self-hosted users are told to set `SENTRY_URL` instead.

`setupCI` gets the upload target, so the CI step lists `SENTRY_AUTH_TOKEN`,
`SENTRY_ORG`, `SENTRY_PROJECT` and, for self-hosted, `SENTRY_URL`. Wrangler
counts as a `sentry`-command tool there (its token lives in `.sentryclirc`),
but skips the "run the script in CI" prompt, since its `post<deploy>`
script already runs it.

`sentry@^4` is installed as a devDependency. `sourcemaps/ci.ts`,
`sourcemaps/tools/sentry-cli.ts`, `angular.ts`, `types.ts` and
`abort-if-sportlight-not-supported.ts` now match #2525,
apart from exporting `addOrgAndProjectToSentryCliRc` for Wrangler, the
devDependency install, and the Wrangler CI case.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
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>
- Angular: pass --force-install through to installPackage, like the
  Next.js and Nuxt flows.
- Nuxt: name the generated SentryErrorButton component in the closing
  message.
- Nuxt: still create the example API route when the example page already
  exists, and keep an existing API route.
- Nuxt: drop ignoreResponseError from the example page so the expected
  500 from the API route shows the success message.

Adds regression tests for each.

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

On sentry.io, v4 `sentry sourcemap upload` resolves the org and project
from the DSN, so the CI step now lists only SENTRY_AUTH_TOKEN. Self-hosted
CI still needs SENTRY_ORG, SENTRY_PROJECT and SENTRY_URL.

For self-hosted Sentry the wizard also writes `url` to the `.sentryclirc`
[defaults] section, next to org/project and the [auth] token. v4 reads it
once the CLI trusts an [auth] token from the same file for that URL; until
that same-file trust fix lands, users set SENTRY_URL.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 27, 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.

Stale Bugbot comment from a previous run.

…angular

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

# Conflicts:
#	apps/cli-docs/src/fragments/commands/wizard.md
#	packages/cli/src/lib/wizard/run.ts
#	packages/cli/src/lib/wizard/sourcemaps/ci.ts
…ngular and Nuxt wizards

- Angular: a src/app/app.config.ts that does not parse shows the manual
  setup steps instead of crashing the wizard, like src/main.ts.
- Add safeMinVersion next to getMajorVersion, which returns undefined
  instead of throwing on specifiers such as `latest` or `workspace:*`, and
  use it for the Nuxt and Angular version checks so they keep their
  existing unsupported/unparseable handling.

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

@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.

Stale Bugbot comment from a previous run.

sentry-junior Bot and others added 2 commits November 27, 2026 14:52
…o providers array

addProviders now reports whether it found `export const appConfig = {
providers: [...] }`. When it didn't, updateAppConfigMod throws before
anything is written, so updateAppConfig shows the manual setup steps
instead of logging success with no Sentry providers registered.

Its visitor's early exits now return false, as recast requires, so a
second named export in the file no longer crashes the codemod.

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

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

@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 da1234c. Configure here.

- Nuxt: createExampleComponent reports a write failure and exits the
  wizard cleanly, like createExamplePage.
- Nuxt: supportsExamplePage also accepts the kebab-case <nuxt-page> tag.
- configureSentryCLI forwards forceInstall to the `sentry` CLI install,
  and the Angular wizard passes it through.
- Angular: the generated example component no longer logs the
  connectivity result to the browser console.
- Angular: the manual source map snippet sets sourceMap under
  configurations.production, matching the automatic angular.json edit.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@vercel
vercel Bot temporarily deployed to Preview – sentry-local November 27, 2026 16:49 Inactive
sentry-junior Bot added a commit that referenced this pull request Nov 27, 2026
Takes `sourcemaps/tools/sentry-cli.ts`, `sourcemaps/tools/angular.ts` and
their tests from #2525 (370f74d) unchanged, so both PRs
carry the same copies. This brings in the Angular snippet that sets
`sourceMap` in the production configuration and the `forceInstall` option
for the `sentry` install.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Nuxt 4 defaults the src directory to app/, so the wizard wrote the
example page and component there whenever there was no root pages/
directory. A project with a root app.vue and no app/ directory keeps
a root srcDir, so app/pages/ would be unreachable and its root app.vue
wasn't checked for <NuxtPage>. Use the root in that case. Nuxt 3 and
Nuxt 4 projects with an app/ directory are unchanged.
…angular

# Conflicts:
#	packages/cli/src/lib/wizard/run.ts
#	packages/cli/src/lib/wizard/utils/abort-if-sportlight-not-supported.ts
…cript

`sentry sourcemap upload` already injects missing debug IDs into the
files on disk before it uploads them, the same way `sentry sourcemap
inject` does, so the script ran injection twice. Run only the upload.
Comment on lines +64 to +69
await installPackage({
packageName: "sentry@^4",
alreadyInstalled: hasPackageInstalled("sentry", packageDotJson),
devDependency: true,
forceInstall: options.forceInstall,
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

configureSentryCLI installs sentry@^4 but the package is still 0.x

Angular (and other) sourcemap setup runs installPackage({ packageName: "sentry@^4" }), but this package is versioned 0.x (e.g. 0.51.0 / 0.52.0-dev.0), so the install fails and installPackage aborts the wizard after SDK/config changes.

Evidence
  • configureSentryCLI installs packageName: "sentry@^4" (line 65).
  • packages/cli/package.json is "version": "0.52.0-dev.0"; changelog latest release is 0.51.0 — nothing satisfies npm ^4 (>=4.0.0 <5.0.0).
  • On install failure, installPackage logs the error and calls abort(), so the Angular wizard exits mid sourcemap setup.
  • angular-wizard.ts calls configureSentryCLI(...) on the normal path after installing @sentry/angular and editing app files.

Identified by Warden · code-review · P2C-BHA

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – cli — 3d5522dd Deployed Nov 27, 2026 by vercel[bot]
Preview – sentry-local — 3d5522dd 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