Repository navigation
perf(cli): Replace consola with a small in-house logger - #1771
Merged
Merged
Conversation
consola was ~75 KB of the ~320 KB `dist/complete.cjs` bundle that `sentry __complete` loads on every TAB press. The CLI used only levels, tags, the fancy stderr layout, Sentry log forwarding, and two prompt types. The new logger keeps consola's output layout and log record shape, so `Sentry.createConsolaReporter()` still forwards logs. Prompts call `@clack/prompts` directly and load only when asked, and the completion bundle drops them. Ctrl+C on a prompt now returns clack's cancel symbol, which callers already expect, instead of the initial value. Fixes #1769 Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
BYK
approved these changes
Oct 31, 2026
BYK
left a comment
Member
There was a problem hiding this comment.
Nice! File an issue to release this as a standalone package
BYK
enabled auto-merge (squash)
October 31, 2026 15:17
This was referenced Oct 31, 2026
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.
Fixes #1769.
consolawas the largest third-party package indist/complete.cjs, whichsentry __completeloads on every TAB press. The CLI used only a small part of it: levels, tags, the fancy stderr layout, Sentry log forwarding, andconfirm/textprompts. This PR replaces it with a small logger insrc/lib/logger.ts.Measured on Node 22 in a dev sandbox, so treat these as rough numbers:
dist/complete.cjsrequire("./dist/complete.cjs")(median of 30)node dist/bin.cjs __complete issue ""wall time (median of 30)dist/index.cjsAlternatives considered. No off-the-shelf logger came out lighter for what the CLI needs. Bundled and minified:
@logtape/logtape~68 KB,tslog~68 KB,pino~61 KB,signale~49 KB.loglevel(~3 KB) has no tags and no reporter hook. None of them has a Sentry integration that keeps the currentconsola.*log attributes. The new logger needs onlynode:utilandnode:path.What stays the same
WARN/ERRORbadges, right-alignedtag HH:MM:SS(still fromformatLogTime), and plain[type] [tag] messagelines in CI and tests. With colors forced in a 120-column PTY,sentry auth statuswarning output is byte-identical to the old build.{ date, args, type, level, tag }shape, soSentry.createConsolaReporter()still works and still sets theconsola.tag/consola.type/consola.levelattributes.withTagregistry thatsetLogLevelneeded is gone.Behavior changes
initialon cancel. So Ctrl+C on "Import from .sentryclirc?" or the Seer trial prompt (bothinitial: true) counted as yes. Every caller already checks=== trueortypeof === "string"and its comments expect the symbol, so cancelling now really cancels.@clack/promptsdirectly through a lazy import. It was already in the main bundle, and theSENTRY_CLI_COMPLETION_BUILDdefine drops it fromcomplete.cjs.(repeated N times)), the stack trace consola appended totracelines in the fancy layout, andbox/ready/fatal/verbose/raw. Line width is now measured withoutstring-width, so wide characters count as one column. The only visible effect is that the right-aligned tag can move by one column.via @BYK.
--
View Session in Sentry