Repository navigation
chore(session-ui): drop strip-ansi - #59011
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Looks good. The local pattern is the same as ansi-regex 6.3.0, the version strip-ansi 7.1.2 uses in this lockfile. I checked the regex source against the installed package, then ran 200k random escape-heavy strings through both strip-ansi and the new stripAnsi with no differences. ansi.test.ts passes, and tsc -b in packages/session-ui is clean (the bun check typecheck script doesn't run with the installed Bun 1.4.2).
The public API is unchanged. This only removes an internal dependency of session-ui.
No concerns.
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.
What it does
Drops the
strip-ansidependency fromsession-ui. Shell and execute tool output is now cleaned by one local regex intools/ansi.ts.How it works
The regex is the one
strip-ansi7.1.2 gets fromansi-regex6.3.0, copied as is (OSC sequences ending in BEL,ESC\or 0x9c, plus CSI and related escapes).stripAnsiis a singlereplace(regex, ""), the same as the package.tool-renderer.tsximports it where it imported the package. The TUI keeps its ownstrip-ansidependency.Risk
Output rendering in the shell and execute tool cards. Because the pattern is identical, results should not change.
Proof
bun test src/tools/ansi.test.tsinpackages/session-ui: 5 pass (colors, cursor and erase, truecolor with:, C1 CSI, OSC with each terminator, plain text untouched, unterminated OSC, repeated calls).bun typecheckinpackages/session-ui: clean.bun script/lint-changed.ts origin/dev: 0 problems.