Skip to content

chore(session-ui): drop strip-ansi - #59011

Merged
kitlangton merged 1 commit into
devfrom
drop-strip-ansi
Oct 25, 2026
Merged

kitlangton merged 1 commit into
devfrom
drop-strip-ansi

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What it does

Drops the strip-ansi dependency from session-ui. Shell and execute tool output is now cleaned by one local regex in tools/ansi.ts.

How it works

The regex is the one strip-ansi 7.1.2 gets from ansi-regex 6.3.0, copied as is (OSC sequences ending in BEL, ESC\ or 0x9c, plus CSI and related escapes). stripAnsi is a single replace(regex, ""), the same as the package. tool-renderer.tsx imports it where it imported the package. The TUI keeps its own strip-ansi dependency.

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.ts in packages/session-ui: 5 pass (colors, cursor and erase, truecolor with :, C1 CSI, OSC with each terminator, plain text untouched, unterminated OSC, repeated calls).
  • bun typecheck in packages/session-ui: clean.
  • bun script/lint-changed.ts origin/dev: 0 problems.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kitlangton
kitlangton merged commit 54b66f9 into dev Oct 25, 2026
21 checks passed
@kitlangton
kitlangton deleted the drop-strip-ansi branch October 25, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant