Skip to content

chore(deps): upgrade OpenTUI to 0.4.2#513

Open
benvinegar wants to merge 2 commits into
mainfrom
pr-501
Open

chore(deps): upgrade OpenTUI to 0.4.2#513
benvinegar wants to merge 2 commits into
mainfrom
pr-501

Conversation

@benvinegar

Copy link
Copy Markdown
Member

Summary

  • Upgrade @opentui/core and @opentui/react to 0.4.2
  • Update renderer startup config to use screenMode: "alternate-screen"
  • Allow test color capture assertions to handle both normalized and byte-scale RGBA values

Validation

  • bun run typecheck
  • bun test ./src ./packages ./scripts ./test/cli ./test/session
  • bun run test:integration
  • bun run test:tty-smoke
  • bun run lint

This PR description was generated by Pi using OpenAI GPT-5

dependabot Bot and others added 2 commits July 3, 2026 17:29
Bumps the github-actions group with 3 updates: [actions/checkout](https://github.com/actions/checkout), [taiki-e/install-action](https://github.com/taiki-e/install-action) and [suzuki-shunsuke/pinact-action](https://github.com/suzuki-shunsuke/pinact-action).


Updates `actions/checkout` from 6.0.2 to 7.0.0
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@de0fac2...9c091bb)

Updates `taiki-e/install-action` from 2.79.2 to 2.82.0
- [Release notes](https://github.com/taiki-e/install-action/releases)
- [Changelog](https://github.com/taiki-e/install-action/blob/main/CHANGELOG.md)
- [Commits](taiki-e/install-action@213ccc1...b8cecb8)

Updates `suzuki-shunsuke/pinact-action` from 2.0.0 to 3.0.0
- [Release notes](https://github.com/suzuki-shunsuke/pinact-action/releases)
- [Commits](suzuki-shunsuke/pinact-action@cf51507...896d595)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: taiki-e/install-action
  dependency-version: 2.82.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: suzuki-shunsuke/pinact-action
  dependency-version: 3.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​opentui/​core@​0.1.89 ⏵ 0.4.298 +1410092 +198100
Updated@​opentui/​react@​0.1.89 ⏵ 0.4.298 +1100100 +198100

View full report

@greptile-apps

greptile-apps Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR upgrades @opentui/core and @opentui/react from 0.1.89 to 0.4.2, switches the renderer to screenMode: "alternate-screen", and updates test color helpers to handle the new byte-scale (0-255) RGBA format alongside the old normalized (0-1) format. GitHub Actions action versions are also bumped across all workflows.

  • src/main.tsx: adds screenMode: "alternate-screen" to createCliRenderer, enabling proper alternate-screen buffer management so the primary terminal is cleanly restored on exit.
  • test/helpers/test-color-helpers.ts: introduces dual-format RGBA-to-hex conversion using a value > 1 threshold to distinguish byte-scale from normalized values, accommodating the changed output format of OpenTUI 0.4.2.
  • bun.lock / package.json: dependency tree is significantly slimmed down — heavy optional packages (jimp, three, planck, bun-webgpu, rapier2d) that were transitive deps of the old OpenTUI are no longer present.

Confidence Score: 4/5

Safe to merge — the runtime change is a single config addition and the dependency upgrade sheds many heavy transitive packages with no breaking surface in the application code.

The only substantive concern is the value > 1 heuristic in the test color helper, which will produce an incorrect hex string for any theme color whose channel byte value is exactly 1. This is a very unlikely scenario for UI palette colors, but it's a latent correctness issue in the test infrastructure that could silently pass wrong assertions if such a color ever appears.

test/helpers/test-color-helpers.ts — the byte/normalized threshold logic warrants a second look.

Important Files Changed

Filename Overview
src/main.tsx Adds screenMode: "alternate-screen" to createCliRenderer config, enabling the terminal alternate screen buffer for cleaner exit behavior.
test/helpers/test-color-helpers.ts New helper added to normalize both byte-scale (0-255) and normalized (0-1) RGBA values to hex; the value > 1 heuristic has a theoretical edge case for byte value 1.
package.json Updates @opentui/core and @opentui/react devDependencies and peerDependencies from ^0.1.89 to ^0.4.2.
bun.lock Lockfile updated: removes many heavy optional deps (jimp, three.js, planck, bun-webgpu, rapier2d) that were indirect deps of the old OpenTUI, and upgrades react-reconciler to 0.33.0.
.github/workflows/ci.yml Bumps pinned actions/checkout commit SHA from v6.0.2 to v7.0.0 and taiki-e/install-action from v2.79.2 to v2.82.0 across all jobs.
.github/workflows/pinact.yml Bumps suzuki-shunsuke/pinact-action from v2.0.0 to v3.0.0 alongside the checkout action update.
.changeset/fast-opentui-pandas.md New patch changeset entry documenting the OpenTUI 0.4.2 upgrade.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["capturedTestColorToHex(color)"] --> B{"buffer exists?"}
    B -- No --> C["return null"]
    B -- Yes --> D["componentToHex(value)"]
    D --> E{"value > 1?"}
    E -- Yes\nbyte-scale --> F["use value as-is"]
    E -- No\nnormalized --> G["value × 255"]
    F --> H["clamp to 0–255, round"]
    G --> H
    H --> I["toString(16).padStart(2)"]
    I --> J["return #rrggbb string"]

    subgraph "src/main.tsx – renderer startup"
        K["createCliRenderer()"] --> L["screenMode: alternate-screen"]
        L --> M["Uses terminal alternate buffer"]
        M --> N["Primary screen restored on exit"]
    end
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A["capturedTestColorToHex(color)"] --> B{"buffer exists?"}
    B -- No --> C["return null"]
    B -- Yes --> D["componentToHex(value)"]
    D --> E{"value > 1?"}
    E -- Yes\nbyte-scale --> F["use value as-is"]
    E -- No\nnormalized --> G["value × 255"]
    F --> H["clamp to 0–255, round"]
    G --> H
    H --> I["toString(16).padStart(2)"]
    I --> J["return #rrggbb string"]

    subgraph "src/main.tsx – renderer startup"
        K["createCliRenderer()"] --> L["screenMode: alternate-screen"]
        L --> M["Uses terminal alternate buffer"]
        M --> N["Primary screen restored on exit"]
    end
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
test/helpers/test-color-helpers.ts:8-11
The `value > 1` threshold misclassifies a byte-scale channel value of exactly `1` as normalized, scaling it to `255` instead of keeping it as `1`. Any theme color with a channel component of `0x01` (e.g. `#010000`) would produce a wrong hex string. A threshold of `> 1.0` (or equivalently checking `Number.isInteger`) is more robust — since OpenTUI now returns integer byte values, checking for an integer cleanly disambiguates the two formats.

```suggestion
  const componentToHex = (value: number) =>
    Math.max(0, Math.min(255, Math.round(Number.isInteger(value) ? value : value * 255)))
      .toString(16)
      .padStart(2, "0");
```

Reviews (1): Last reviewed commit: "chore(deps): upgrade opentui to 0.4.2" | Re-trigger Greptile

Comment on lines 8 to 11
const componentToHex = (value: number) =>
Math.max(0, Math.min(255, Math.round(value * 255)))
Math.max(0, Math.min(255, Math.round(value > 1 ? value : value * 255)))
.toString(16)
.padStart(2, "0");

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.

P2 The value > 1 threshold misclassifies a byte-scale channel value of exactly 1 as normalized, scaling it to 255 instead of keeping it as 1. Any theme color with a channel component of 0x01 (e.g. #010000) would produce a wrong hex string. A threshold of > 1.0 (or equivalently checking Number.isInteger) is more robust — since OpenTUI now returns integer byte values, checking for an integer cleanly disambiguates the two formats.

Suggested change
const componentToHex = (value: number) =>
Math.max(0, Math.min(255, Math.round(value * 255)))
Math.max(0, Math.min(255, Math.round(value > 1 ? value : value * 255)))
.toString(16)
.padStart(2, "0");
const componentToHex = (value: number) =>
Math.max(0, Math.min(255, Math.round(Number.isInteger(value) ? value : value * 255)))
.toString(16)
.padStart(2, "0");
Prompt To Fix With AI
This is a comment left during a code review.
Path: test/helpers/test-color-helpers.ts
Line: 8-11

Comment:
The `value > 1` threshold misclassifies a byte-scale channel value of exactly `1` as normalized, scaling it to `255` instead of keeping it as `1`. Any theme color with a channel component of `0x01` (e.g. `#010000`) would produce a wrong hex string. A threshold of `> 1.0` (or equivalently checking `Number.isInteger`) is more robust — since OpenTUI now returns integer byte values, checking for an integer cleanly disambiguates the two formats.

```suggestion
  const componentToHex = (value: number) =>
    Math.max(0, Math.min(255, Math.round(Number.isInteger(value) ? value : value * 255)))
      .toString(16)
      .padStart(2, "0");
```

How can I resolve this? If you propose a fix, please make it concise.

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