Repository navigation
feat(cli): add Nuxt and Angular to sentry wizard - #2525
sentry-junior[bot] wants to merge 35 commits into
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
…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>
…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>
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>
- 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>
…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>
…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>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.
❌ 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>
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.
| await installPackage({ | ||
| packageName: "sentry@^4", | ||
| alreadyInstalled: hasPackageInstalled("sentry", packageDotJson), | ||
| devDependency: true, | ||
| forceInstall: options.forceInstall, | ||
| }); |
There was a problem hiding this comment.
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
configureSentryCLIinstallspackageName: "sentry@^4"(line 65).packages/cli/package.jsonis"version": "0.52.0-dev.0"; changelog latest release is0.51.0— nothing satisfies npm^4(>=4.0.0 <5.0.0).- On install failure,
installPackagelogs the error and callsabort(), so the Angular wizard exits mid sourcemap setup. angular-wizard.tscallsconfigureSentryCLI(...)on the normal path after installing@sentry/angularand editing app files.
Identified by Warden · code-review · P2C-BHA

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 wizardas thenuxtandangularintegrations, and registers both inWIZARD_RUNNERS. Their upstream tests come along.What's ported
src/nuxt/*→src/lib/wizard/nuxt/*andsrc/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.main.ts) and recast (Angular app config). Unify thesentry initandsentry wizardsetup flows #2510 removes them onceinitandwizardare unified after v4.sentry-clibinary. The wizard doesn't check for one either. The project's ownsentry:sourcemapsscript calls v4sentryfrom thesentrypackage it installs.promoCodeorcomingFrom, 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) andsetupCIdirectly.The tool moves from the legacy sentry-cli to v4:
sentrypackage (^4) instead of@sentry/cli@^2.sentry:sourcemapsnpm script issentry sourcemap inject <dir> && sentry sourcemap upload <dir>, in place ofsentry-cli sourcemaps …. It passes no org, project or URL flags.sentry sourcemap uploadreads the org and project from the project's.sentryclirc. The wizard writes them to its[defaults]section (org=,project=, plusurl=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.[auth]section of that file, as upstream did, and v4 still reads it (applySentryCliRcEnvShimmaps it toSENTRY_AUTH_TOKEN). The file stays in.gitignore.sourcemaps/ci.tslists the environment variables to set. On sentry.io that's onlySENTRY_AUTH_TOKEN, because v4 resolves the org and project from the DSN. Self-hosted CI also getsSENTRY_ORG,SENTRY_PROJECTandSENTRY_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.urlwrite depends on the CLI's same-file trust fix, which is tracked separately. Today v4 refuses a non-SaaS[defaults] urlunless the token's host or a stored login vouches for it, and an[auth] tokenfrom the same file doesn't count (assertRcUrlTrusted). Until that fix lands, self-hosted users setSENTRY_URLwherever the script runs, and the wizard tells them to.sourcemaps/ci.tsagain asks the user to runsentry:sourcemapsin CI for tools that usesentrycommands, the same as upstream'sconfigureCI. That step was dropped whenci.tswas 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 exportedgetSentryCliNpmScriptandsetSentryCliRcDefaults.sourcemaps/tools/angular.ts.angularJsonTemplateis no longer exported.sourcemaps/tools/types.ts. OnlySourceMapUploadToolConfigurationOptionsis here. The unusedSourceMapUploadToolConfigurationFunctionis 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.sentry-cli.tsandci.tstest files, and the.sentryclircfile test.Once
runSourcemapsWizardlands, Angular could call it again.Behaves differently from sentry-wizard
captureExceptionnow go throughreportCliError: the failedangular.jsonwrite and the failed Nuxt example page.angular.jsonis logged withdebug()and not captured, since it isn't a bug.options. Upstream did that only to hand the project to the source maps wizard.--organd--projecttosentry-cli. Here they come from.sentryclirclocally. In CI they come from the DSN on sentry.io and fromSENTRY_ORG/SENTRY_PROJECTon self-hosted Sentry.Not covered
srcDir: "."and no rootpages/gets the example page underapp/pages/, as upstream does. Left for a follow-up.via @BYK.
--
View Session [Sentry]