Skip to content

Migrate to Charm v2 (bubbletea, bubbles, lipgloss) - #14

Open
Gaurav-Gosain wants to merge 2 commits into
openai:mainfrom
Gaurav-Gosain:migrate-charm-v2
Open

Gaurav-Gosain wants to merge 2 commits into
openai:mainfrom
Gaurav-Gosain:migrate-charm-v2

Conversation

@Gaurav-Gosain

@Gaurav-Gosain Gaurav-Gosain commented May 9, 2026

Copy link
Copy Markdown

Summary

Bumps the TUI dependencies from the old github.com/charmbracelet/... v1 modules to the new charm.land/.../v2 modules at the latest stable versions:

  • charm.land/bubbletea/v2 v2.0.6
  • charm.land/bubbles/v2 v2.1.0
  • charm.land/lipgloss/v2 v2.0.3

github.com/charmbracelet/x/term is also bumped from 0.2.1 to 0.2.2 to line up with the indirect deps that come with charm v2.

Scope

The migration only touches the internal/jsonview package, which is the sole consumer of bubbletea/bubbles/lipgloss in this repo. The other 4 files modified are go.mod and go.sum for the dep bump, and the test file for the import path swap.

Notable v2 API changes applied

  • tea.KeyMsg renamed to tea.KeyPressMsg
  • Model.View() now returns tea.View, wrapped via tea.NewView
  • viewport.New(w, h) replaced with viewport.New(WithWidth(w), WithHeight(h))
  • Width/Height fields replaced with SetWidth/SetHeight methods on viewport and help
  • lipgloss.Color is now a function returning image/color.Color, so the arrayColor/stringColor/objectColor values move from const to var, and createTable's bgColor parameter is retyped from lipgloss.Color to color.Color

Reference for the full set of v2 breaking changes: the upgrade guides shipped with each module (UPGRADE_GUIDE_V2.md).

Test plan

  • `go build ./...` clean
  • `go vet ./...` clean
  • `go mod tidy` is idempotent
  • `go test ./internal/jsonview/...` all pass

Bumps the TUI dependencies from the old github.com/charmbracelet/...
v1 modules to the new charm.land/.../v2 modules:

  charm.land/bubbletea/v2 v2.0.6
  charm.land/bubbles/v2   v2.1.0
  charm.land/lipgloss/v2  v2.0.3

The migration touches only the jsonview package, which is the sole
consumer of bubbletea/bubbles/lipgloss. Notable v2 API changes
applied:

  - tea.KeyMsg renamed to tea.KeyPressMsg
  - Model.View() now returns tea.View, wrapped via tea.NewView
  - viewport.New(w, h) replaced with viewport.New(WithWidth, WithHeight)
  - Width/Height fields replaced with SetWidth/SetHeight methods on
    viewport and help
  - lipgloss.Color is now a function returning image/color.Color, so
    the array/string/object color values move from const to var and
    createTable's bgColor parameter is retyped accordingly

x/term is bumped 0.2.1 to 0.2.2 to align with the indirect deps
pulled in by charm v2.

go build, go vet, and the jsonview tests all pass.
@Gaurav-Gosain
Gaurav-Gosain requested a review from a team as a code owner May 9, 2026 16:10
In v1, viewport.View() rendered content even when its width was 0,
which is what the explorer's TableView relied on, since Resize never
called SetWidth on the table.

In v2, viewport.View() short-circuits to an empty string when either
dimension is 0, so rows stopped rendering after the migration. Setting
the table width to the full window width fixes the empty rows but
makes the underlying viewport pad each row to that width, which made
the selected-row highlight overflow past the surrounding rounded
border.

Size the table to the natural content width (sum of column widths plus
cell padding) so rows render and the highlight stays within the
border.
@meowgorithm

Copy link
Copy Markdown

Hello! One of the Bubble Tea/Lip Gloss authors here. Just chiming in to say that the main benefits you'll get from the upgrade here is rendering performance and correctness in terms of glyph rendering, particularly with non-latin characters such as Chinese, Japanese, Korean and so on.

@markstuart-oai

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-06T01:31:32.010918Z 296deae Manual request
🔒 Security Review Completed 2026-09-06T01:32:56.987302Z 296deae Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 296deaef33

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 296deaef33

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@saioai saioai 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.

--format pretty now writes color codes into pipes and files even with NO_COLOR=1. please preserve plain output, add a regression test, and rebase onto current main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants