Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
949060d
feat(cli): add sentry wizard with Next.js
sentry-junior[bot] Nov 26, 2026
76e162b
feat(cli): add the wizard's shared AST and URL helpers
sentry-junior[bot] Nov 26, 2026
0113841
feat(cli): reject the wizard's removed sign-up flags
sentry-junior[bot] Nov 26, 2026
7e5f894
Merge branch 'feat/cli-wizard-scaffold' into feat/cli-wizard-shared-a…
sentry-junior[bot] Nov 26, 2026
16e6189
feat(cli): add Nuxt and Angular to sentry wizard
sentry-junior[bot] Nov 26, 2026
e7dd1c0
Merge origin/feat/cli-wizard-shared-ast-helpers into feat/cli-wizard-…
sentry-junior[bot] Nov 26, 2026
59a1bd9
feat(cli): read wizard source map upload target from .sentryclirc
sentry-junior[bot] Nov 26, 2026
58d673b
docs(cli): say why the wizard keeps the self-hosted URL out of .sentr…
sentry-junior[bot] Nov 26, 2026
39e20d5
fix(cli): address review findings in sentry wizard
sentry-junior[bot] Nov 26, 2026
c4786b3
Merge branch 'feat/cli-wizard-scaffold' into feat/cli-wizard-shared-a…
sentry-junior[bot] Nov 26, 2026
09983d3
fix(cli): address Warden findings in the Nuxt and Angular wizards
sentry-junior[bot] Nov 26, 2026
e03e53f
feat(cli): list only the auth token for sentry.io CI, write self-host…
sentry-junior[bot] Nov 26, 2026
2c98751
refactor(cli): reuse existing CLI helpers in the wizard AST utils
sentry-junior[bot] Nov 26, 2026
f9c9aa3
fix(cli): address second round of Warden findings in Nuxt and Angular…
sentry-junior[bot] Nov 26, 2026
ac6b75d
feat(cli): use positionals and existing CLI flags in sentry wizard
sentry-junior[bot] Nov 26, 2026
75cda0c
Merge remote-tracking branch 'origin/feat/cli-wizard-shared-ast-helpe…
sentry-junior[bot] Nov 26, 2026
4c93aa8
fix(cli): use the credential host for the project issues URL
sentry-junior[bot] Nov 26, 2026
d6a1c81
Merge remote-tracking branch 'origin/feat/cli-wizard-shared-ast-helpe…
sentry-junior[bot] Nov 26, 2026
bee2d24
fix(cli): build on the new wizard base: use buildProjectIssuesUrl and…
sentry-junior[bot] Nov 26, 2026
2f2f91a
fix(mcp): regenerate the chart app after the for…of conversion
sentry-junior[bot] Nov 26, 2026
f0a48de
Merge remote-tracking branch 'origin/feat/cli-wizard-scaffold' into f…
sentry-junior[bot] Nov 26, 2026
22c2b66
Merge commit 'f0a48dee68470690517ba652f224f6f6f8587528' into feat/cli…
sentry-junior[bot] Nov 26, 2026
2e2f2ec
fix(cli): update the Nuxt and Angular wizards for the new wizard base
sentry-junior[bot] Nov 26, 2026
1605587
docs(cli): correct the CI env vars for the Angular wizard
sentry-junior[bot] Nov 26, 2026
bb4886f
fix(cli): address third round of Warden findings in Nuxt and Angular …
sentry-junior[bot] Nov 27, 2026
f5ca46e
fix(cli): reconcile sentry-cli.ts and quote source map paths
sentry-junior[bot] Nov 27, 2026
f018d0a
Merge remote-tracking branch 'origin/main' into feat/cli-wizard-nuxt-…
sentry-junior[bot] Nov 27, 2026
7399ac7
fix(cli): catch unparseable app.config.ts and version specifiers in A…
sentry-junior[bot] Nov 27, 2026
d1093f3
fix(cli): fall back to manual setup when the Angular app config has n…
sentry-junior[bot] Nov 27, 2026
da1234c
Merge remote-tracking branch 'origin/main' into feat/cli-wizard-nuxt-…
sentry-junior[bot] Nov 27, 2026
370f74d
fix(cli): harden the Nuxt and Angular wizards from review findings
sentry-junior[bot] Nov 27, 2026
8a72642
fix(cli): use the root srcDir for Nuxt 4 projects with a root app.vue
sentry-junior[bot] Nov 27, 2026
7020018
Merge remote-tracking branch 'origin/main' into feat/cli-wizard-nuxt-…
sentry-junior[bot] Nov 27, 2026
b60da74
fix(cli): drop the redundant inject step from the sentry:sourcemaps s…
sentry-junior[bot] Nov 27, 2026
3d5522d
docs(cli): say the wizard's source map script only runs the upload
sentry-junior[bot] Nov 27, 2026
8416233
fix(cli): install the sentry CLI major the wizard runs on
sentry-junior[bot] Nov 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apps/cli-docs/src/fragments/commands/wizard.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,12 @@ but not its flags or `SENTRY_WIZARD_*` environment variables:

The Cordova and Electron wizards were retired. Follow their setup guides in
the Sentry docs instead.

Flows that uploaded source maps with `@sentry/cli`, such as Angular, now
install the `sentry` package instead. The `sentry:sourcemaps` script they add
to `package.json` runs `sentry sourcemap upload` on your build output, which
injects debug IDs before it uploads. The wizard writes your org, project and,
on self-hosted Sentry, URL to the `[defaults]` section of the project's
`.sentryclirc`, next to the auth token, and adds the file to `.gitignore`. In
CI, set `SENTRY_AUTH_TOKEN`. On self-hosted Sentry, also set `SENTRY_ORG`,
`SENTRY_PROJECT` and `SENTRY_URL`.
311 changes: 311 additions & 0 deletions packages/cli/src/lib/wizard/angular/angular-wizard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,311 @@
/**
* The Angular setup wizard: installs `@sentry/angular`, initializes it in
* `src/main.ts`, adds the Sentry providers to the app config, turns on
* source maps in `angular.json`, sets up their upload with `sentry
* sourcemap` commands, and optionally creates an example component.
*/

import path from "node:path";
import chalk from "chalk";
import { gte } from "semver";
import { setupCI } from "../sourcemaps/ci.js";
import { configureAngularSourcemapGenerationFlow } from "../sourcemaps/tools/angular.js";
import { configureSentryCLI } from "../sourcemaps/tools/sentry-cli.js";
import { Sentry, traceStep, withTelemetry } from "../telemetry.js";
Comment thread
sentry-junior[bot] marked this conversation as resolved.
Resolved
import { abortIfSpotlightNotSupported } from "../utils/abort-if-sportlight-not-supported.js";
import {
abort,
abortIfCancelled,
askShouldCreateExampleComponent,
confirmContinueIfNoOrDirtyGitRepo,
ensurePackageIsInstalled,
featureSelectionPrompt,
getOrAskForProjectData,
getPackageDotJson,
installPackage,
printSdkV11MigrationGuideIfOutdated,
printWelcome,
runPrettierIfInstalled,
} from "../utils/clack/index.js";
import { offerProjectScopedMcpConfig } from "../utils/clack/mcp-config.js";
import { clack } from "../utils/clack/prompts.js";
import {
askShouldReduceDataCollection,
Comment thread
sentry-junior[bot] marked this conversation as resolved.
Resolved
sdkSupportsDataCollection,
} from "../utils/data-collection.js";
import { warnIfNodeVersionUnsupportedBySdkV11 } from "../utils/node-version.js";
import {
getPackageVersion,
hasPackageInstalled,
} from "../utils/package-json.js";
import { safeMinVersion } from "../utils/semver.js";
import type { WizardOptions } from "../utils/types.js";
import { addSourcemapEntryToAngularJSON } from "./codemods/sourcemaps.js";
import { createExampleComponent } from "./example-component.js";
import {
initializeSentryOnApplicationEntry,
updateAppConfig,
} from "./sdk-setup.js";

const MIN_SUPPORTED_ANGULAR_VERSION = "14.0.0";
const MIN_SUPPORTED_WIZARD_ANGULAR_VERSION = "17.0.0";

/** Run the Angular wizard (`sentry wizard angular`). */
export async function runAngularWizard(options: WizardOptions): Promise<void> {
return await withTelemetry(
{
enabled: options.telemetryEnabled,
integration: "angular",
wizardOptions: options,
},
() => runAngularWizardWithTelemetry(options),
);
}

async function runAngularWizardWithTelemetry(
options: WizardOptions,
): Promise<void> {
printWelcome({
wizardName: "Sentry Angular Wizard",
telemetryEnabled: options.telemetryEnabled,
});

warnIfNodeVersionUnsupportedBySdkV11();

await confirmContinueIfNoOrDirtyGitRepo({
ignoreGitChanges: options.ignoreGitChanges,
cwd: undefined,
});

const packageJson = await getPackageDotJson();

await ensurePackageIsInstalled(packageJson, "@angular/core", "Angular");

let installedAngularVersion = getPackageVersion("@angular/core", packageJson);

if (!installedAngularVersion) {
clack.log.warn("Could not determine installed Angular version.");

installedAngularVersion = await abortIfCancelled(
clack.text({
message: `Please enter your installed Angular major version (e.g. ${chalk.cyan(
"18",
)} for Angular 18)`,
validate(value) {
if (!value) {
return "Angular version is required";
}

Comment thread
sentry-junior[bot] marked this conversation as resolved.
Resolved
if (!safeMinVersion(value)) {
return `Invalid Angular version provided: ${value}`;
}
return undefined;
},
}),
);
}

Sentry.setTag("angular-version", installedAngularVersion);

const installedMinVersion = safeMinVersion(installedAngularVersion);
if (!installedMinVersion) {
clack.log.warn(
`Could not parse the Angular version ${chalk.cyan(installedAngularVersion)}.`,
);
return await abort("Exiting the wizard.");
}
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved

const sdkSupportsAngularVersion = gte(
installedMinVersion,
MIN_SUPPORTED_ANGULAR_VERSION,
);

const wizardSupportsAngularVersion = gte(
installedMinVersion,
MIN_SUPPORTED_WIZARD_ANGULAR_VERSION,
);
Comment thread
sentry-junior[bot] marked this conversation as resolved.
Resolved

if (!sdkSupportsAngularVersion) {
Sentry.setTag("angular-version-compatible", false);

clack.log.warn(
`Angular version ${chalk.cyan(
MIN_SUPPORTED_ANGULAR_VERSION,
)} or higher is required for the Sentry SDK.`,
);
clack.log.warn(
`Please refer to Sentry's version compatibility table for more information:

${chalk.underline(
"https://docs.sentry.io/platforms/javascript/guides/angular/#angular-version-compatibility",
)}
`,
);

return await abort("Exiting the wizard.", 0);
}

if (!wizardSupportsAngularVersion) {
Sentry.setTag("angular-wizard-version-compatible", false);

clack.log.warn(
`The Sentry Angular Wizard requires Angular version ${chalk.cyan(
MIN_SUPPORTED_WIZARD_ANGULAR_VERSION,
)} or higher.`,
);
clack.log.warn(
`Your Angular version (${installedAngularVersion}) is compatible with the Sentry SDK but you need to set it up manually by following our documentation:

${chalk.underline("https://docs.sentry.io/platforms/javascript/guides/angular")}

Apologies for the inconvenience!`,
);

return await abort("Exiting the wizard.", 0);
}

const projectData = await getOrAskForProjectData(
options,
"javascript-angular",
);

if (projectData.spotlight) {
return await abortIfSpotlightNotSupported("Angular");
}

const { selectedProject, authToken, sentryUrl, selfHosted } = projectData;

const dsn = selectedProject.keys[0].dsn.public;

const sdkAlreadyInstalled = hasPackageInstalled(
"@sentry/angular",
packageJson,
);

Sentry.setTag("sdk-already-installed", sdkAlreadyInstalled);

printSdkV11MigrationGuideIfOutdated("@sentry/angular", packageJson);

await installPackage({
packageName: "@sentry/angular@^11",
packageNameDisplayLabel: "@sentry/angular",
alreadyInstalled: sdkAlreadyInstalled,
forceInstall: options.forceInstall,
});
Comment thread
sentry-junior[bot] marked this conversation as resolved.
Resolved

// The install may have been skipped (user declined the update prompt), so
// re-read package.json to learn which SDK major is actually installed.
const installedSdkVersion = getPackageVersion(
"@sentry/angular",
await getPackageDotJson(),
);

// From v11 on, the SDK collects rich context by default, so offer to
// reduce collection of data that can identify users.
const reduceDataCollection =
sdkSupportsDataCollection(installedSdkVersion, "^11") &&
(await askShouldReduceDataCollection());
Comment thread
sentry-junior[bot] marked this conversation as resolved.
Resolved

const selectedFeatures = await featureSelectionPrompt([
{
id: "performance",
prompt: `Do you want to enable ${chalk.bold(
"Tracing",
)} to track the performance of your application?`,
enabledHint: "recommended",
},
{
id: "replay",
prompt: `Do you want to enable ${chalk.bold(
"Session Replay",
)} to get a video-like reproduction of errors during a user session?`,
enabledHint: "recommended, but increases bundle size",
},
] as const);

await traceStep(
"Initialize Sentry on Angular application entry point",
async () => {
await initializeSentryOnApplicationEntry(
dsn,
selectedFeatures,
reduceDataCollection,
);
},
);

await traceStep("Update Angular project configuration", async () => {
await updateAppConfig(installedMinVersion, selectedFeatures.performance);
});

await traceStep("Setup for sourcemap uploads", async () => {
await addSourcemapEntryToAngularJSON();

// sentry-wizard ran its source maps wizard with the Angular tool
// preselected here. Its other steps (redirect to a framework wizard, SDK
// version check, project selection) are already done by this point, so
// run the Angular tool setup and the CI step directly.
await configureSentryCLI(
{
orgSlug: selectedProject.organization.slug,
projectSlug: selectedProject.slug,
selfHosted,
url: sentryUrl,
authToken,
defaultArtifactPath: `.${path.sep}dist`,
forceInstall: options.forceInstall,
},
configureAngularSourcemapGenerationFlow,
true,
);

await setupCI("angular", authToken, {
org: selectedProject.organization.slug,
project: selectedProject.slug,
url: selfHosted ? sentryUrl : undefined,
});
});

const shouldCreateExampleComponent = await askShouldCreateExampleComponent();

Sentry.setTag("create-example-component", shouldCreateExampleComponent);

if (shouldCreateExampleComponent) {
await traceStep(
"create-example-component",
async () =>
await createExampleComponent({
orgSlug: selectedProject.organization.slug,
projectId: selectedProject.id,
}),
);
}

await traceStep("Run Prettier", async () => {
await runPrettierIfInstalled({ cwd: undefined });
});

// Offer optional project-scoped MCP config for Sentry with org and project scope
await offerProjectScopedMcpConfig(
selectedProject.organization.slug,
selectedProject.slug,
);

clack.outro(buildOutroMessage(shouldCreateExampleComponent));
}

/** The closing message, with how to test the example component if one was created. */
export function buildOutroMessage(createdExampleComponent: boolean): string {
let msg = chalk.green("Successfully installed the Sentry Angular SDK!");

if (createdExampleComponent) {
msg += `\n\nYou can validate your setup by starting your dev environment (${chalk.cyan(
"ng serve",
)}) and throwing an error in the example component.`;
}

msg += `\n\nCheck out the SDK documentation for further configuration:
https://docs.sentry.io/platforms/javascript/guides/angular/`;

return msg;
}
Loading
Loading