Skip to content

fix(cli): Create .gitignore for the wizard's auth token file - #2796

Merged
BYK merged 1 commit into
mainfrom
ms/wizard-create-gitignore
Dec 4, 2026
Merged

BYK merged 1 commit into
mainfrom
ms/wizard-create-gitignore

Conversation

@msonnb

@msonnb msonnb commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

The JS wizards (Next.js, SvelteKit, Nuxt, React Router, and the source maps wizard) write the org auth token to .env.sentry-build-plugin. Then they add that file to .gitignore. If the project had no .gitignore, the wizard logged "Please add it manually!" and carried on, so the token file could be committed.

addCliConfigFileToGitIgnore now creates .gitignore with the entry when the file does not exist. It writes with the wx flag, so it never overwrites a .gitignore that appears in the meantime. An existing .gitignore is handled as before.

The new test runs addDotEnvSentryBuildPluginFile in a real temp directory with no .gitignore, with one that lacks the entry, and with one that already has it. The no-file case fails without the fix.

When a project had no .gitignore, the wizard logged "Please add it
manually!" and continued, so .env.sentry-build-plugin with the auth
token could be committed. Create .gitignore with the entry instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

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

Request Review

@vercel
vercel Bot temporarily deployed to Preview – sentry-local December 2, 2026 13:55 Inactive
@msonnb
msonnb marked this pull request as ready for review December 2, 2026 13:57
@github-actions github-actions Bot added the risk: low PR risk score: low label Dec 2, 2026
github-actions Bot pushed a commit to Fields-Education/sentry-mcp that referenced this pull request Dec 4, 2026
…entry#2839)

From the mobile re-test (getsentry/sentry-react-native#7172). Even with
every feature flag (`--tracing --profiling --logs --replay --feedback
--no-mcp < /dev/null`), `sentry wizard reactNative` exited 1 at a
prompt: bare React Native at "Do you want to run `pod install` now?",
Expo at "Have you successfully sent a test event?". This lets the React
Native and Expo wizards finish without a terminal, which the wizard e2e
tests in getsentry#2572 need.

**`pod install`**: new `--pod-install`/`--no-pod-install` flag in
`WIZARD_ANSWER_FLAGS` (reactNative only). `confirmPodInstall` asks
through `askFlagQuestion` and keeps Yes as the default.

**Closing question**: it only confirms a setup that is already done, so
it is skipped when stdin is not a TTY (`isatty(0)`, as
`guardNonInteractive` and auto-login check). Piped stdin that is still
open counts as no terminal too. The run then ends with an outro that
says Sentry is set up, tells the user to send a test event and check it
in Sentry, and links the project's issues page and the
sentry-react-native GitHub issues. `user-confirmed-first-error` is
`"skipped"`. With a terminal, it is asked as before.

**Expo second run**: a `metro.config.js` that already has Sentry is its
own `"already-configured"` outcome of `patchMetroInMemory`. It is logged
once, with no "Could not patch" error and no copy-paste instructions.
Those instructions also asked "Did you apply the snippet above?", which
would have stopped a run without a terminal too. Parse and write
failures still show them, as getsentry#2786 does for `app.json`.

**`.gitignore` duplicates**: Expo's `.env.local` (`addToGitignore`) and
Flutter's `sentry.properties` (`addProperties`) are appended only when
no line already is the entry, ignoring surrounding whitespace. The check
is `gitignoreHasEntry` in `utils/git.ts`. `addCliConfigFileToGitIgnore`
now uses it as well, so whitespace around the entry counts there too.
getsentry#2796 also changes `addCliConfigFileToGitIgnore`, but
in other lines.

<!-- junior-request-attribution:start -->
via **Antonis Lilis**.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AD0CAPGCFLSC%3A1796305761.291369 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AD0CAPGCFLSC%3A1796305761.291369)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0CAPGCFLSC%3A1796305761.291369/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Antonis Lilis <antonis.lilis@sentry.io>
@BYK
BYK added this pull request to the merge queue Dec 4, 2026
Merged via the queue into main with commit 93d73f3 Dec 4, 2026
33 checks passed
@BYK
BYK deleted the ms/wizard-create-gitignore branch December 4, 2026 06:25

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – cli — ab1bed13 Deployed Dec 2, 2026 by vercel[bot]
Preview – sentry-local — ab1bed13 Deployed Dec 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants