Skip to content

feat(cli): Answer wizard feature questions with flags - #2659

Merged
BYK merged 5 commits into
mainfrom
jr/wizard-answer-flags
Dec 1, 2026
Merged

BYK merged 5 commits into
mainfrom
jr/wizard-answer-flags

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to the review on #2652: a systematic way to answer wizard questions with guessable, deterministic flags. This PR adds the mechanism and covers the yes/no feature questions the wizards share.

sentry wizard gets --tracing, --replay, --logs, --profiling, --instrumentation-api (reactRouter), --example-page and --example-component. --<flag> answers yes and --no-<flag> answers no, in every wizard that asks the question. A flag that isn't set still asks. An answered question is logged (Session Replay: no (--no-replay)), so the run's output still shows it.

sentry wizard my-org/my-app nextjs --tracing --no-replay --no-example-page

How it stays systematic

  • One registry, WIZARD_ANSWER_FLAGS (lib/wizard/utils/answers.ts), holds each flag's label and the wording of its question. The prompt (askFlagQuestion), the flag's --help text and the log line are all built from it, so they can't diverge. The command builds its flags from the registry, so --help, the docs and the skill reference list them with no extra step.
  • askFlagQuestion(flag, hints) asks a question unless its flag answered it. sentry wizard stores the parsed flags once, before the first flow starts, so flows don't pass them along and a flow that hands over to another wizard (sourcemaps redirecting to SvelteKit or React Native) keeps them.
  • Feature.flag is required and Feature.prompt is gone, so every featureSelectionPrompt entry takes its wording from its flag. The Android and React Native Logs/Replay questions use the same shared wording, and their docs links move into hints.
  • design/sentry-cli.md gets the naming rule, plus a gap for the questions that still have no flag.
  • The @stricli/core patch fixes undoNegation for kebab-case names. It cut one character too many after no-, so a negated multi-word flag such as --no-example-page was rejected even though --help listed it.

Scope

The wizards have about 78 prompt sites. They fall into four groups:

Kind Examples Plan
Feature choices tracing, replay, logs, example page This PR
Value choices package manager, Next.js tunnel route, CI, MCP editors, PII reduction, RN feedback widget, pod install, formatters Follow-ups with the same registry, as hidden flags where --help would get noisy
Safety confirms dirty git, unsupported version, "modify anyway?" Already --force
Manual-step acks "Did you copy the snippet above?", "Did you add the code…?" (~15) No flag. Without a terminal, these should print the remaining steps and exit non-zero, tied in with sentry init

Once #2652 lands, its no-input message can name the exact flag for the unanswered question, read from the same registry.

Part of #2642.

via @BYK.

--

View Session [Sentry]

`sentry wizard` gets one flag per yes/no question the wizards share:
`--tracing`, `--replay`, `--logs`, `--profiling`, `--instrumentation-api`
and `--example`. `--<flag>` answers yes and `--no-<flag>` answers no in
every wizard that asks it; an unset flag still asks.

The flags come from one registry (`WIZARD_ANSWER_FLAGS`), and the prompt
helpers read the answers through `answerOrAsk`. `Feature.flag` is
required, so a new feature question can't be added without one.

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

vercel Bot commented Dec 1, 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 Dec 1, 2026 1:41pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Dec 1, 2026 1:41pm UTC

Request Review

@vercel
vercel Bot temporarily deployed to Preview – sentry-local December 1, 2026 13:07 Inactive
@BYK
BYK marked this pull request as ready for review December 1, 2026 13:12
@sentry-junior
sentry-junior Bot requested a review from BYK December 1, 2026 13:12
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Dec 1, 2026

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

Nice, we should also deduplicate and centralise the text for the flags and the prompts so they cannot diverge.

Regarding "flags that make --help noisy", we can make them hidden as long as adding the flag serves a purpose like completing the wizard in a non-interactive manner.

I like your printing instructions idea. I think we can then connect this and sentry init together

Comment thread packages/cli/src/lib/wizard/run.ts Resolved
`WIZARD_ANSWER_FLAGS` now holds each question's wording. The prompt
(`askFlagQuestion`), the flag's `--help` text and the log line of an
answered question are built from it, so they can't diverge. Features drop
their own `prompt`, and the Android and React Native Logs/Replay confirms
use the shared question too.

`--example` splits into `--example-page` and `--example-component`, one
flag per question.

The @stricli/core patch now fixes `undoNegation` for kebab-case names:
it sliced `no-` plus one more character, so `--no-example-page` and
`--no-instrumentation-api` were rejected although `--help` listed them.

Co-Authored-By: BYK <burak.kaya@sentry.io>
…wizard

`runWizard` replaced the stored answers on every call, so the sourcemaps
wizard's redirect to SvelteKit or React Native, which calls `runWizard`
again without answers, wiped them and asked the questions the flags had
answered. `sentry wizard` now stores the answers itself, once, before the
first flow starts.

Co-Authored-By: BYK <burak.kaya@sentry.io>
@BYK
BYK added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 0cc9075 Dec 1, 2026
51 checks passed
@BYK
BYK deleted the jr/wizard-answer-flags branch December 1, 2026 14:58

This branch was successfully deployed

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