Repository navigation
feat(cli): Make sentry init print an agent setup guide - #1856
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
betegon
force-pushed
the
bt/init-agent-guide
branch
from
November 4, 2026 14:59
31a0301 to
23fe3dc
Compare
betegon
force-pushed
the
bt/init-agent-guide
branch
from
November 4, 2026 16:25
23fe3dc to
f33b9c9
Compare
betegon
marked this pull request as ready for review
November 4, 2026 19:29
`sentry init` no longer runs the remote Mastra setup wizard. It prints `packages/cli/init.md`, a guide a coding agent follows to add Sentry: install the CLI, log in, map the project (which apps, which SDKs each needs, whether Sentry is already there), pick a Sentry project, choose features with the user, install the SDKs from the current docs, verify with a test error, and report back. The docs site serves the same file at https://cli.sentry.dev/init.md. The wizard runner, tools, preflight, verification, Ink wizard screens, init-eval suite, WizardError, wizard prompt telemetry, SENTRY_INIT_TUI, @mastra/client-js, ink-spinner, and the provider-utils patch that only Mastra needed are removed. The org/project picker moves to src/lib/select-ui/, and the docs service keeps its host check in docs-service.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017M6odVd9nWxcAefpXRLd8M
Delete the glob engine (`scan/glob.ts`), `safe-read.ts`, and the exports nothing calls now that the wizard is gone: `looksLikePath`, `getUncommittedFiles`, `captureOAuthScopeRecoveryGate`, `parseOrgProjectFromSettingsUrl`, `FULL_BANNER_LINES`, `bannerLinesWidth`, `YES_ALIASES`, and `BUFFER_SIZE`. Helpers the wizard imported but their own module still uses are no longer exported. Comments that pointed at the wizard now describe the remaining callers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017M6odVd9nWxcAefpXRLd8M
…eanup `sentry init` failed in a directory whose `.sentryclirc` points at another Sentry host: `buildCommand` checks that URL for every command unless it sets `skipRcUrlCheck`, and `auth: false` does not skip it. `init` sends nothing to Sentry, so it now skips the check. - `init` takes no positionals and no flags of its own, only the `--json` and `--fields` every command gets. It no longer accepts the wizard's flags, and update notices are no longer suppressed for it. - Print the Markdown source to agents behind a pseudo-terminal, and add an output schema for `--json`. - Remove `MASTRA_API_URL`; `sentry docs` always calls the hosted service. - Run `sentry init` from the installers after `cli setup`, which no longer skips the login step for `SENTRY_INIT=1`. - Guide: read the docs pages as Markdown on self-hosted Sentry, the CLI picks the team, what to do when `sentry` isn't on PATH, and a `--verify` timeout doesn't mean the setup failed. - Reduce the picker to the single filterable list the org, project, and account prompts use, without the wizard's shortcut registry and frame width helpers. - Rename `EXIT.WIZARD_VERIFY` to `EXIT.VERIFY_FAILED`, and remove `deferAutoCreateOnEmptyOrg`, `buildProjectIssuesUrl`, the `zod/v3` stub's `ZodType`, and the provider-utils advisory allowance, which only the wizard needed. - Update comments, docs, and test fixtures that still described the wizard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017M6odVd9nWxcAefpXRLd8M
betegon
force-pushed
the
bt/init-agent-guide
branch
from
November 4, 2026 19:51
f33b9c9 to
ad0bf68
Compare
Conflicts: - Wizard files main changed (init/ui/ink-ui.ts, stdin-reopen.ts, tools/create-sentry-project.ts, verify-setup.ts, wizard-runner.ts and their tests) stay deleted; main's edits there were lint and error-reporting changes with nothing to carry over. - force-exit.ts stays deleted, as on main (#1960). - .oxlintrc.json: keep main's codemod ignore, drop the init-eval one. - env-registry.ts: keep main's SENTRY_GAMES_API_URL, drop SENTRY_INIT_TUI. - cli/setup.ts: keep main's SENTRY_SETUP_CODE login skip, drop the SENTRY_INIT one, and restore the getEnv import it needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017M6odVd9nWxcAefpXRLd8M
BYK
approved these changes
Nov 5, 2026
BYK
left a comment
Member
There was a problem hiding this comment.
I still think there's value in listing all available SDKs to the agent, the version we compiled from sentry release registry, ask it to pick one from there and instruct it to use sentry docs to keep going or generate a guide or something.
Member
Author
|
@BYK thanks for the review, i'm making those changes. About showing the sdks, i've had a bad experience with it in init in the past:
|
The CLI is still 0.x, so exit codes 61–63 don't need to stay reserved after the `sentry init` wizard's removal. 64 stays: `sentry local run --verify` uses it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017M6odVd9nWxcAefpXRLd8M
On cli.sentry.dev, `init.md` reads as a guide to initializing the CLI itself. The guide is about adding Sentry to a project, so the docs site now serves it at https://cli.sentry.dev/get-started-with-sentry.md. `sentry init` still prints the same file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017M6odVd9nWxcAefpXRLd8M
Member
|
@betegon I'm not suggesting that we propose an SDK, merely providing the list of all available SDKs from our registry to the agent so it can make the decision to add multiple if needed which we should also mention. |
…e init guide The guide only explained several SDKs through framework and runtime, and assumed one Sentry project. It now: - lists the other cases (frontend and backend, separately deployed services such as each Supabase Edge Function, mobile and native code), and that one SDK can also cover several parts; - leaves the choice to the setup pages the agent reads, with https://docs.sentry.io/platforms.md as the index when a search finds nothing; - adds integrations for the libraries the app uses (AI SDKs, Zod, Prisma, queues), added only when the docs say they aren't on by default; - creates one Sentry project per frontend and backend. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017M6odVd9nWxcAefpXRLd8M
This was referenced Nov 5, 2026
BYK
added a commit
that referenced
this pull request
Nov 5, 2026
This finishes the CLI 0.48.0 release. Every publish target shipped, but Craft couldn't merge the release branch back into `main` ([job log](https://github.com/getsentry/publish/actions/runs/42102069927/job/127507152523)), so the post-release bump never ran either. **Why the merge failed:** `release: 0.48.0` (283b555) changed `version: 0.48.0-dev.0` to `version: 0.48.0` in `references/init.md`. #1856 changed the `description:` line right below it on `main`. The fix in Craft is getsentry/craft#964. **This PR** 1. Merges `release/cli/0.48.0` into `main`. That brings in the 0.48.0 `CHANGELOG.md` section and the release versions. For `init.md`, it keeps the new description from `main` together with `version: 0.48.0`. I resolved the conflict with the resolver from getsentry/craft#964. 2. Bumps to the next development version the same way Craft's `postReleaseBump` does: the npm bump plus `versioning.files` from `.craft.yml`. - `packages/cli/package.json` and `packages/mcp-server/package.json` → `0.49.0-dev.0` - Skill frontmatter (`SKILL.md`, `references/*.md`) → `0.49.0-dev.0` - `.claude-plugin/plugin.json` → `0.49.0` (`stripPrerelease`) Squash merging is fine: the `cli@0.48.0` tag already points at the release commit. Once this lands, `release/cli/0.48.0` can be deleted. #skip-changelog <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:local%3Aweb%3A2b52a6f3270e30b7c2e844d3 --> -- [View Session in Sentry](https://sentry.sentry.io/explore/conversations/local%3Aweb%3A2b52a6f3270e30b7c2e844d3/?project=4510944073809921) <!-- junior-session-footer:end -->
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sentry initno longer runs the remote Mastra setup wizard. It prints aMarkdown guide (
packages/cli/init.md) that a coding agent follows to addSentry to a project, the same way Railway (
railway.com/agents.md) andVercel (
vercel.com/get-started.md) hand agents a playbook:sentry init)sentry auth loginmore than one: TanStack Start on Cloudflare needs
@sentry/cloudflareand
@sentry/tanstackstart-react), and whether Sentry is already there,in which case it upgrades or extends the setup instead
Replay, profiling, crons, User Feedback, AI agent and MCP monitoring) and
ask the user which to enable
APIs
sentry local run --verify, thensentry issue listThe rules in steps 3, 5, and 6 come from the hosted wizard's agent prompts in
getsentry/cli-init-api: deployable contexts and one SDK per runtime,evidence-only Crons/AI/MCP suggestions, features that need tracing, the DSN
placement policy, configuring only the chosen features, installing every
package the code imports, browser profiling's
Document-Policyheader, andconversation tracking for AI agent monitoring.
Agents get the Markdown source, whether they read it through a pipe or a
pseudo-terminal that
detectAgentrecognizes; a person in a terminal gets itrendered;
--jsonreturns{ guide }. Like any command without input, ittakes no positionals and no flags of its own, only
--jsonand--fields.It sends nothing to Sentry, so it needs no login and skips the
.sentryclircURL check (
skipRcUrlCheck), which otherwise rejects a directory whose.sentryclircpoints at another Sentry host. With a self-hosted Sentry, the guide tells the agent to read thedocs.sentry.io pages as Markdown, because
sentry docsneeds a sentry.iologin. The docs site serves the same file at
https://cli.sentry.dev/get-started-with-sentry.md(a symlink inapps/cli-docs/public, likeinstall), so users can also say "Fetchhttps://cli.sentry.dev/get-started-with-sentry.md and follow it" before the
CLI is installed. It isn't called
init.mdthere, which would read as aguide to initializing the CLI itself.
Removed
screens, and the
init-evalsuite (src/lib/init/,test/lib/init/,test/init-eval/)init's flags (--yes,--features,--dry-run,--team,--app,--no-tui), positionals ([target] [directory]), and their completer.Passing one now fails like it would on any other command
WizardError, wizard prompt telemetry,SENTRY_INIT_TUI,MASTRA_API_URL(
sentry docsalways calls the hosted service), and the update-noticesuppression for
init@mastra/client-jsandink-spinner, plus the@ai-sdk/provider-utils@2.2.8patch that existed only for Mastra's copy
scan/glob.ts),safe-read.ts,resolveOrCreateTeam'sdeferAutoCreateOnEmptyOrg,buildProjectIssuesUrl, and exports such aslooksLikePath,getUncommittedFiles, andcaptureOAuthScopeRecoveryGatezod/v3stub'sZodTypeexport and theGHSA-866g-f22w-33x8dependency-review allowance, which only Mastra's dependencies needed
Kept and moved
src/lib/init/ui/tosrc/lib/select-ui/and is now only what those prompts use: onefilterable, single-choice list drawn inline. The wizard's multiselect,
centered layout, details panel, paging, shortcut registry, and frame
width helpers are gone. The sidecar is still
ink-app.js, so build and packaging are unchanged. Picker tests that wentthrough the wizard
Appnow renderSelectPickerdirectly.sentry docsstill calls the same hosted service; its host check moved frominit/init-service-auth.tsintodocs-service.ts.0.x; 64 is still used by
sentry local run --verify, now namedEXIT.VERIFY_FAILED.Also
Labels in the compact picker no longer disappear when a long hint fills the
row (found while porting the tests).
check:doc-examplesnow validates everysentry …command ininit.md.init.mdis embedded by aninit-guidestep inscript/generate.ts(phase 1, skipped when
init.mdhasn't changed).The agent skill tells agents to use
sentry initwhen adding Sentry.The installers still honor
SENTRY_INIT=1: they runsentry initaftercli setup, which no longer skips its login step for it.Not in this PR
the worker still serves
sentry docs.Testing
Rebased on
mainat 9637d09:pnpm run typecheck, rootpnpm run lint, andpnpm run ci:policypassvitest run test/lib test/commands test/types test/script: 12,563 pass.The 22 failures are in permission and zstd tests (
cli fix,agent-skills,completionsinstall,db/resilient,code-scanner,upgrade,zstd-transport) that also fail onmainin this sandbox,which runs as root on Node 22
script/bundle.tsbuildsdist/ink-app.jswithmountSelectPrompt;sentry initprints the guide from the bundle, with no token and aself-hosted
.sentryclircin the directory, and rejects--yesandmy-org/xlike any command without input; the@sentry/mcp-serverbundle builds and its bundle test passes
https://claude.ai/code/session_017M6odVd9nWxcAefpXRLd8M
Generated by Claude Code