Skip to content

feat(cli): add sentry wizard with Next.js - #2519

Merged
BYK merged 4 commits into
mainfrom
feat/cli-wizard-scaffold
Nov 27, 2026
Merged

BYK merged 4 commits into
mainfrom
feat/cli-wizard-scaffold

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

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 Unify the sentry init and sentry wizard setup flows #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. feat(cli): add the wizard's shared AST and URL helpers #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

via @BYK.

--

View Session [Sentry]

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>
@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 7:07pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 26, 2026 7:07pm UTC

Request Review

@github-actions

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/v5.html text/html;profile=mcp-app 19,234 B 7,915 B 7,020 B 24,576 B 78.3%

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

`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>
Comment on lines +80 to +81
export const wizardCommand = buildCommand({
auth: false,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

auth: false without skipRcUrlCheck blocks spotlight and unauthenticated wizard runs

sentry wizard sets auth: false but not skipRcUrlCheck: true, so a self-hosted .sentryclirc URL with no matching credentials throws HostScopeError before the wizard (including --spotlight) can start its own URL/login flow. Add skipRcUrlCheck: true like sentry init.

Evidence
  • wizardCommand sets auth: false so Spotlight and login-less runs are allowed, and docs advertise wizard -i nextjs --spotlight.
  • buildCommand still runs assertRcUrlTrusted unless skipRcUrlCheck: true or auth: "dsn" (lib/command.ts); wizard sets neither.
  • assertRcUrlTrusted throws HostScopeError when .sentryclirc has a non-SaaS defaults.url and there is no trusted token/account for that host (lib/sentryclirc.ts).
  • The wizard is supposed to choose the instance itself via selectSentryUrl / useSentryUrl and log in later (lib/wizard/utils/project-data.ts); sentry init uses auth: false + skipRcUrlCheck: true for the same reason.

Identified by Warden · code-review · YRB-XGC

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.

Fixed in 39e20d5: sentry wizard now sets skipRcUrlCheck, like sentry init, so --spotlight and runs before login aren't blocked by a .sentryclirc URL.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fix attempt detected (commit ac6b75d)

The wizard was modified in a review-fix commit, but it still sets auth: false without skipRcUrlCheck: true, so the preflight trusted-host check can still throw HostScopeError before the wizard starts.

The original issue appears unresolved. Please review and try again.

Evaluated by Warden

Comment on lines +261 to +270
if (!underscoreErrorPageFile) {
const underscoreErrorFileName = `_error.${
typeScriptDetected ? "tsx" : "jsx"
}`;

await promises.writeFile(
path.join(process.cwd(), ...pagesLocation, underscoreErrorFileName),
getSentryDefaultUnderscoreErrorPage(),
{ encoding: "utf8", flag: "w" },
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Generated _error.tsx fails strict TypeScript checks

For TypeScript projects with noImplicitAny—including the default strict create-next-app configuration—the generated error page has untyped props and contextData callbacks, so next build fails its TypeScript check.

Evidence
  • When no pages _error file exists, nextjs-wizard.ts writes _error.tsx if typeScriptDetected is true and supplies getSentryDefaultUnderscoreErrorPage() as its contents.
  • That template declares CustomErrorComponent = (props) => and assigns getInitialProps = async (contextData) =>; neither parameter is typed or contextually typed, so noImplicitAny reports errors. The property assignment also fails type checking for the inferred function type.
  • isUsingTypeScript() detects a tsconfig.json; a normal strict Next.js project includes this generated .tsx page in its build type check, so the failure is reachable.
Also found at 1 additional location
  • packages/cli/src/lib/wizard/nextjs/templates.ts:600-619

Identified by Warden · code-review · RVU-2QF

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.

This matches upstream sentry-wizard 9.1.0 and is out of scope for this port.

Comment on lines +1248 to +1259
const apiRouteFileName = `sentry-example-api.${
typeScriptDetected ? "ts" : "js"
}`;

await promises.writeFile(
path.join(process.cwd(), ...pagesFolderLocation, "api", apiRouteFileName),
getSentryExamplePagesDirApiRoute({
isTypeScript: typeScriptDetected,
}),
{ encoding: "utf8", flag: "w" },
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pages example API handler parameters cause strict TypeScript build errors

For a TypeScript Pages Router project with noImplicitAny, the wizard generates an API handler with untyped parameters, so a normal next build fails until the generated file is fixed.

Evidence
  • isUsingTypeScript() returns true when the project has a tsconfig.json; the Pages Router flow then writes a .ts API route using this template.
  • The template adds a type only to the error constructor’s message parameter; _req and res remain unannotated and have no contextual types.
  • With noImplicitAny enabled, TypeScript reports implicit-any errors for the handler parameters, which the normal Next.js build typecheck includes.
  • The template test for isTypeScript: true explicitly expects the untyped handler declaration, so it does not catch the build failure.
Also found at 1 additional location
  • packages/cli/src/lib/wizard/nextjs/templates.ts:536-539

Identified by Warden · code-review · VVV-VEW

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.

This matches upstream sentry-wizard 9.1.0 and is out of scope for this port.

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

@BYK BYK left a comment

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.

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

What is recast and why do we need it?

Telemetry goes through the CLI's Sentry client. --disable-telemetry turns it off for the run.

Don't add any new flags etc for this. Sentry CLI already has ways to disable telemetry, we should just keep using what is existing.

sentry wizard takes the @sentry/wizard integration ids and flags: -i/--integration, -u/--url, --org, --project, --saas, --spotlight, --force-install, --ignore-git-changes, --disable-telemetry and --debug. The legacy --skip-connect, --quiet and --uninstall are accepted as hidden no-ops so old command lines still run. SENTRY_WIZARD_INTEGRATION, SENTRY_WIZARD_URL and SENTRY_WIZARD_DEBUG still work; a flag wins over its env var.

Make sure these follow the CLI conventions. It's clear for instance that --org or --project doesn't as we have the org/project notation everywhere and it is required. --spotlight is replaced by sentry local now. If this is to set the SENTRY_SPOTLIGHT env var, it still is the canonical value.

Drop any SENTRY_WIZARD_ env var support.

No idea what --url or --saas or --force-install are. We have -f/--force for everything already so use that instead of --force-install if it makes sense. Definitely don't want --debug. Skeptical about -i/--integration as I don't think it needs to be a flag if it is required? We can probably use a positional arg with comma separation? There are examples of this in the CLI codebase.

Do not add legacy flags at all, even as hidden.

Apply these decisions to the entire stack and any future related work and try to enforce them with tests, lint rules, and scripts.

@sentry-junior

sentry-junior Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

What is recast and why do we need it?

recast is a JS/TS parser and printer. When it writes a file back, it reprints only the AST nodes that changed, so the rest of the file keeps its formatting and comments. This PR doesn't import it directly. It comes in through magicast, which is built on it. The Next.js flow uses magicast (nextjs-wizard.ts, nextjs/utils.ts) to wrap the user's next.config.* export in withSentryConfig and merge options into an existing call, without reformatting their code. A string edit can't do that safely for arbitrary configs, so magicast and recast stay until those config edits move to the shared flow in #2510.

`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>
@sentry-junior

sentry-junior Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Reworked in ac6b75d4. The command line is now:

sentry wizard [<org>/<project>] [<integration>] [-f/--force]

Point by point:

  • No flags for things the CLI already has. Telemetry follows isTelemetryEnabled() (sentry cli defaults telemetry off, SENTRY_CLI_NO_TELEMETRY, DO_NOT_TRACK). --disable-telemetry and disableTelemetryForRun are gone.
  • --org/--project → <org>/<project> positional, first. It uses the shared org/project parsing (org/project, org/, /project, a bare slug, or a pasted URL) and resolves after login with resolveOrgOptionalTarget, like other commands. An explicit target skips the pickers. Without one, the org and project pickers (or project creation) run as before, with no detection.
  • --spotlight → SENTRY_SPOTLIGHT. Spotlight mode is on when SENTRY_SPOTLIGHT is truthy or a URL, and it's now listed in the env registry.
  • SENTRY_WIZARD_* dropped. SENTRY_WIZARD_INTEGRATION, SENTRY_WIZARD_URL and SENTRY_WIZARD_DEBUG aren't read anymore, and they're gone from the env registry.
  • --url, --saas, --debug dropped. The instance comes from SENTRY_URL or the stored login (getApiBaseUrl()), so the sentry.io/self-hosted prompt is gone too. So is skipRcUrlCheck: the wizard now uses the CLI's instance, so the .sentryclirc host check applies like it does for other commands. Debug output goes through the CLI logger, so --verbose/--log-level control it.
  • --force-install → -f/--force. It also covers --ignore-git-changes: one flag both force-installs the SDK and skips the uncommitted-changes prompt.
  • -i/--integration → positional. It takes exactly one integration. Each flow is its own interactive run, with its own prompts, file edits and project, so a list would mean chaining several wizards in one session with no clear way to stop between them. Without an integration, the picker runs.
  • No legacy flags, hidden or not. --skip-connect, --quiet, --uninstall, --signup, --promo-code and --coming-from are gone, along with rejectRemovedFlags. They now fail as unknown flags, like any other typo.

Target vs integration. A value with a / (or a URL) is the target. A bare value that matches an integration id is always the integration, in either position. With one argument, a bare word must be an integration, so sentry wizard my-project fails with a hint to write my-org/my-project or my-org/. With two arguments, the first is the target (a bare slug is allowed and resolves to a project first, then an org) and the second must be an integration. A project or org named like an integration is written out: my-org/nextjs, nextjs/ or /nextjs. sentry wizard nextjs remix fails with a one-at-a-time error, and more than two positionals is an error. Tests cover each case: integration only, target only, both, a bare slug, a slug that equals an integration id, an unknown integration, and too many positionals.

Enforcement.

  • A test pins the wizard's own flags to exactly force (alias f, not hidden), apart from the global flags buildCommand injects.
  • check:env-coverage, which runs in ci:policy, now fails if SENTRY_WIZARD_ appears in any file under packages/cli/src.
  • Tests cover --force setting both forceInstall and ignoreGitChanges, the SENTRY_SPOTLIGHT values, and telemetry following isTelemetryEnabled().
  • No oxlint rule. The policy check already covers every file type under src, and the flags test covers the flag surface, so a lint rule would just repeat them.

One CLI-wide thing I didn't touch: buildCommand adds the hidden global --org/--project compatibility flags to every command, which set SENTRY_ORG/SENTRY_PROJECT. The wizard doesn't read those, so on sentry wizard they do nothing.

The docs fragment and the generated skill docs describe the new syntax, with a table that maps each @sentry/wizard flag to its replacement. They no longer say npx @sentry/wizard flags are accepted.

@sentry-junior
sentry-junior Bot requested a review from BYK November 26, 2026 19:20
Comment on lines +743 to +762
clack.log.warning(
`Failed to add auth token to ${chalk.bold.cyan(
SENTRY_DOT_ENV_FILE,
)}. Uploading source maps during build will likely not work locally.`,
);
}
}
} else {
try {
await promises.writeFile(dotEnvFilePath, envVarContent, {
encoding: "utf8",
flag: "w",
});
clack.log.success(
`Created ${chalk.bold.cyan(
SENTRY_DOT_ENV_FILE,
)} with auth token for you to test source map uploading locally.`,
);
} catch {
clack.log.warning(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

clack.log.warning throws on env file write failure

clack.log.warning is not a @clack/prompts method (the API is warn); when writing .env.sentry-build-plugin fails, the catch path throws TypeError and crashes the wizard instead of showing the write-failure message.

Evidence
  • @clack/prompts is re-exported as clack.log in prompts.ts; every other call site in this module uses clack.log.warn (e.g. lines 613, 630, 660, 724).
  • The test mock in test/lib/wizard/utils/clack/index.test.ts only stubs log.warn, not log.warning, matching the real package API.
  • addDotEnvSentryBuildPluginFile is called from nextjs/nextjs-wizard.ts; its writeFile catch blocks at lines 743 and 762 call clack.log.warning(...).
  • wizard.ts rethrows any non-WizardExitError, so the TypeError aborts the run and skips addCliConfigFileToGitIgnore.
  • The same typo appears in the unused addSentryCliConfig catch at line 601.

Identified by Warden · code-review · 7JF-3P4

Comment on lines +812 to +817

const changedOrUntrackedFiles =
getUncommittedOrUntrackedFilePaths().filter(Boolean);

return changedOrUntrackedFiles.length ? changedOrUntrackedFiles : null;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

getFormatterTargetFiles feeds deleted paths to Prettier

Deleted uncommitted paths are passed to formatters, so Prettier exits non-zero and runFormatters stops early with a warning instead of formatting the remaining files.

Evidence
  • getUncommittedOrUntrackedFilePaths() pushes every porcelain path and never filters D statuses (git.ts).
  • getFormatterTargetFiles() only does .filter(Boolean), so deleted paths stay in the target list.
  • runFormatters() runs Prettier with ignoreExitCode: false, so a missing path rejects and hits the catch, skipping later Biome runs.
  • Dirty-repo continue / --ignore-git-changes makes pre-existing deletions a reachable input when the user agrees to format.

Identified by Warden · code-review · 9FN-E7A

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 left a comment

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.

sentry wizard [/] []: 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

This is using our established global target parser, right?

@BYK
BYK marked this pull request as ready for review November 27, 2026 13:06
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 27, 2026
@sentry-junior

sentry-junior Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Yes for the target itself. The wizard parses it with the shared parseOrgProjectInput (the orgProjectTarget grammar: org/project, org/, /project, Sentry URLs) and resolves it with the shared resolveOrgOptionalTarget after login. The only wizard-specific part is the small boundArguments wrapper that splits [<org>/<project>] [<integration>]: the target shares the positional list with the integration (a bare word is the integration), and it can only resolve after the wizard's login, so it can't use the orgOptionalTarget binding directly.

@BYK
BYK merged commit f40d4f6 into main Nov 27, 2026
49 checks passed
@BYK
BYK deleted the feat/cli-wizard-scaffold branch November 27, 2026 14:04
BYK added a commit that referenced this pull request Nov 27, 2026
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.

<!-- 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 was squash-merged into main, so this takes main's side
for every file the pre-squash #2519 commits added. main also turned the
standalone npm libraries into one `packages/{http,logger}` Craft workspace that
merge-jobs.yml discovers and packs. The forwarder joins it as
`packages/{http,logger,wizard}` and gets a `wizard` product in release.yml,
and merge-jobs.yml is main's, unchanged.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
BYK added a commit that referenced this pull request Nov 27, 2026
…in (#2559)

#2548 removed `isRequestOriginTrusted` while
#2519 still used it in the wizard's login check, so
`main` no longer builds.

This uses `isRequestOriginTrustedForContext` with
`getCredentialContext()`, the same check the removed helper did.
Behaviour doesn't change.

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

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

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A2b65e7fbe80bb65b0774094cf19fc343)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A2b65e7fbe80bb65b0774094cf19fc343/?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>
BYK added a commit that referenced this pull request Nov 27, 2026
Gets `main` ready for a GitHub merge queue. #2548
removed `isRequestOriginTrusted`, then #2519 merged
still importing it and broke `main`. Each PR was fine on its own; a
merge queue tests them together. Same approach as getsentry/junior#4469
and getsentry/junior#4533.

Merge queue entries skip the per-project matrix. The `quality` job
typechecks, builds, and policy-checks the whole workspace instead, which
is what two PRs can break together. The `test` aggregator already
accepts the skipped jobs.

`SENTRY_AUTH_TOKEN` stays off the `quality` job on purpose: when it's
set, `@sentry/mcp-cloudflare`'s Vite plugin creates a Sentry release.

## Follow-up (admin)

After this merges, a toolkit admin adds a `merge_queue` rule to the
repo's `Default` ruleset (id 5058262), with Junior's values: SQUASH, max
5 entries to build, 1 to 5 entries to merge, 5 minute wait, ALLGREEN
grouping, 60 minute check timeout, and `test` as the required status.

First, confirm the Craft release bot (`sentry-release-bot`) is in the
ruleset's `bypass_actors`, because it pushes merge-backs straight to
`main`. No getsentry/security-as-code change is needed.

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

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

--

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

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