Skip to content

fix(deps): migrate to lipgloss v2 (charm.land/lipgloss/v2)#93

Merged
ryanlewis merged 2 commits into
mainfrom
lipgloss-v2
May 30, 2026
Merged

fix(deps): migrate to lipgloss v2 (charm.land/lipgloss/v2)#93
ryanlewis merged 2 commits into
mainfrom
lipgloss-v2

Conversation

@ryanlewis

Copy link
Copy Markdown
Owner

What

Migrates things-cli from lipgloss v1 → v2, replacing the unmergeable renovate PR #73.

Why #73 can't work (two independent reasons)

  1. The module was renamed. lipgloss v2's go.mod declares module charm.land/lipgloss/v2. Renovate just appended /v2 to the old github.com/charmbracelet/lipgloss path — which Go rejects outright (declared-path mismatch). The import must become charm.land/lipgloss/v2.
  2. go.sum was never populated (renovate's artifacts step failed), and renovate doesn't touch the breaking API changes.

The real change

v2 removes the global renderer: lipgloss.SetColorProfile/ColorProfile are gone and Style.Render() now always emits full-fidelity ANSI. Downsampling/stripping moved to write time via colorprofile.Writer{Forward, Profile}. So the --color mechanism moved from render-time to write-time:

  • internal/output/style.go — package colorProfile var + detectProfile()/newWriter() helpers; SetColorMode maps auto→colorprofile.Detect, always→TrueColor, never→NoTTY.
  • internal/output/output.goPrint/PrintTaskWithChecklist wrap the caller's writer with newWriter() for styled (non-JSON) paths only.
  • internal/output/style_test.go — tests assert at the writer boundary (v2 helpers always emit ANSI); hermetic TestMain no-color baseline; new auto/non-TTY coverage.
  • go.mod/go.sumcharm.land/lipgloss/v2 v2.0.3; colorprofile promoted to direct; github.com/muesli/termenv dropped entirely.

Behavior parity (verified end-to-end on the real binary)

--color piped (non-TTY)
auto strips ANSI (exactly like v1)
always forces color even when piped
never fully plain

Verification

  • go build ./... ✅ · go vet ./... ✅ · golangci-lint run ./... clean ✅
  • go test -race ./...240 pass ✅ · go mod tidy no-op ✅ · go mod verify
  • Two rounds of adversarial multi-agent review (migration lenses + 9-angle /code-review); no correctness bugs in the migration. Fixes applied: hardened the new auto test against TTY_FORCE, strengthened the always test to assert color (not just decoration), de-duplicated the profile-detection expression.

Notes

ryanlewis added 2 commits May 30, 2026 13:29
Lipgloss v2 renamed its module to charm.land/lipgloss/v2 and removed the
global renderer: Style.Render() now always emits full ANSI, and color
downsampling/stripping happens at write time via colorprofile.Writer.

- Rework --color so SetColorMode sets a package colorProfile
  (auto -> colorprofile.Detect, always -> TrueColor, never -> NoTTY); Print and
  PrintTaskWithChecklist wrap the caller writer with colorprofile.Writer for
  styled (non-JSON) output. Behavior is preserved: auto strips when piped,
  always forces color, never is fully plain.
- Drop github.com/muesli/termenv; promote github.com/charmbracelet/colorprofile
  to a direct dependency.
- Rearchitect the output tests around the write-time model (helpers now always
  emit ANSI); add a hermetic TestMain no-color baseline and coverage for the
  auto/non-TTY path.

Supersedes #73, which could not work: renovate appended /v2 to the old
github.com path (which no longer matches the module's declared path) and its
go.sum artifact step failed.
Follow-ups from review triage:
- Add a cmd/things TestMain pinning SetColorMode("never") so its styled-output
  tests can't become TTY-dependent (they drive Print without going through main).
- Lock in that untrusted task content (Notes) has literal ANSI stripped under
  --color=never, the safer v2 write-time behavior.
- Assert color survives always-mode on the PrintTaskWithChecklist (detail) path.
@ryanlewis ryanlewis merged commit e8983a0 into main May 30, 2026
1 check passed
@ryanlewis ryanlewis deleted the lipgloss-v2 branch May 30, 2026 13:36
ryanlewis added a commit that referenced this pull request May 30, 2026
Release notes header for **v0.4.0**, required at the tagged commit by
`.goreleaser.yaml` (`readFile ".github/releases/<tag>.md"`). Merge this,
then the `v0.4.0` tag gets cut.

- Headlines bash/zsh/fish **shell completions** (#94, #95).
- Notes the lipgloss v2 migration (#93) and routine dep updates.
- Folds in the skill-doc changes (#89).

Also removes the orphaned `v0.3.2.md`: v0.3.2 was never tagged and its
only change (#89) is now covered here, so we go straight from v0.3.1 →
v0.4.0.
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.

1 participant