Repository navigation
perf(cli): Bundle only Zod's English locale - #1763
Merged
Merged
Conversation
Zod 4's core, classic, and mini entry points re-export locales/index.js, which pulls every locale into the bundle. Nothing we bundle switches the locale, so a shared esbuild plugin now resolves that index to an en-only module. Error messages are unchanged and z.locales.en still works. The npm bundle and the standalone binary use the plugin. It lives in script/lib so the @sentry/mcp-server bundle can reuse it. Part of #1761 Co-Authored-By: BYK <burak.kaya@sentry.io>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
sentry-junior Bot
added a commit
that referenced
this pull request
Oct 31, 2026
`@sentry/mcp-server` no longer has its own entry logic. `mcp-server.ts` runs `cli.ts`'s runner with `mcp-server-app.ts`, a route map of the CLI's real `mcp` (the default command), `auth`, and `help`. So `sentry-mcp auth status|list|switch|logout` work, and flags and help for `sentry mcp` and `sentry-mcp` come from one Stricli definition. - The runner takes a `CliEntry` that loads the application, and starts `mcp` without the CLI's telemetry, recovery middleware, and update check. The command resolves when the client closes stdin, and only then does the runner release the network. - `lib/app-identity.ts` replaces `login-command.ts`: hints and help examples name `sentry-mcp`, or `npx -y @sentry/mcp-server` under npx. - `--flag=` and values with line breaks still parse, as they did with the old parser (`splitInlineFlagValues`). - A bare `--version` answers before the application loads (86 MB, 140 ms). The server stack loads only when `mcp` serves. - The bundle adds #1763's Zod English-locale plugin, compiles out syntax highlighting and the Ink picker, and stubs MCP SDK v1's `McpServer` and `zod/v3`. It is 3,689,911 bytes; the budget is 3.75 MiB. Co-Authored-By: BYK <burak.kaya@sentry.io>
BYK
approved these changes
Oct 31, 2026
sentry-junior Bot
added a commit
that referenced
this pull request
Oct 31, 2026
Brings in the squash-merged #1763 (Zod English locale), #1764 (lazy server stack) and #1765 (lazy syntax highlighting), which this branch had merged from their PR branches. Conflicts: - packages/mcp-server/src/index.ts: kept deleted. #1764's lazy loading is already applied to the unified entry (commands/mcp.ts -> lib/mcp.ts -> lib/mcp/server.ts). - script/bundle.ts, script/build.ts: kept the zod/v3 stub plugin. bundle.ts keeps the shared script/lib/require-alias-plugin.ts (the @sentry/mcp-server bundle uses it too) instead of main's inline copy. main's filter also lists list-command.ts, but on this branch that file no longer uses _require (the route registry replaced it), so it stays out. - formatters/highlight.ts, syntax-highlight-bundle.test.ts: identical to main apart from comments that point at the shared require-alias plugin.
sentry-junior Bot
added a commit
that referenced
this pull request
Oct 31, 2026
Brings in the #1766 squash (route registry). This branch already merged #1766's branch, and its final head only added main's #1763-#1765, which are here too, so every conflict (`app.ts`, `lib/help.ts`, `script/bundle.ts`) resolves to this branch's version: the application setup and `setRoutes()` live in `lib/application.ts`, help names come from `lib/app-identity.ts`, and the require-alias filter is the shared `script/lib/require-alias-plugin.ts`. The tree is unchanged.
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.
Part of #1761.
Zod 4's
core,classic, andminientry points all re-exportlocales/index.js, which statically imports every locale. Nothing we bundle callsz.config(z.locales.xx()); Zod sets its English default by importinglocales/en.jsdirectly. A new esbuild plugin,script/lib/zod-locales-plugin.ts, resolves Zod's locales index to a module that exports onlyen. Error messages stay the same, andz.locales.enstill works.The npm bundle (
script/bundle.ts) and the standalone binary (script/build.ts) now use the plugin. Both inline@sentry/mcp-coreforsentry mcp. The plugin lives inscript/lib/so the@sentry/mcp-serverbundle from #1731 can import it next torequire-alias-plugin.ts.dist/index.cjssentry --versionmax RSSsentry mcp --versionmax RSSsentry mcpidle max RSS (initialize + tools/list)@sentry/mcp-serverbundle (#1731 branch, plugin applied locally)sentry-mcp --version/ idle max RSS (#1731)Byte counts come from the esbuild metafile. RSS is
process.resourceUsage().maxRSSfrom a-rpreload, on Node 22, 3 runs each.The new test bundles real Zod, ESM and CJS, with and without the plugin. It checks that the messages match and that
z.localeshas onlyen.This touches
script/bundle.tsin two lines, an import and one entry at the top of thepluginsarray. #1762 adds code just below that array, so the two may need a trivial rebase.via BYK.
--
View Session in Sentry