Skip to content

fix(cli): hand update completion directly to the TUI - #36455

Merged
kitlangton merged 3 commits into
v2from
preflight-end-state
Jul 11, 2026
Merged

kitlangton merged 3 commits into
v2from
preflight-end-state

Conversation

@kitlangton

@kitlangton kitlangton commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

What

The update preflight now completes inside its live footer instead of writing a receipt into terminal scrollback.

On success, the status line uses the same left-to-right dissolve as update stages, while the longer header dims out, swaps at its dark midpoint, and brightens into the shorter completion phrase:

OpenCode is updating from 0.0.1-old to 0.0.2-new
⠙ Connecting to OpenCode
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3/3

becomes:

OpenCode updated to 0.0.2-new
✓ Ready
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3/3

The monogram brightens to the OpenCode accent, the rail settles to a static full-accent state, the result holds briefly, and then the real TUI takes over. No completion line remains in scrollback.

How

  • Replaces the open-ended text spring with deterministic 420ms effects: a directional styled-cell dissolve for status changes and a two-phase luminance dissolve for the unequal-length completion header. Both finish predictably before the 480ms stage floor; only spatial rail progress uses a critically damped spring.
  • Runs both completion rows on one coordinated transition contract and waits for actual animation completion before the 650ms settled hold.
  • Preserves per-character color and bold styling through the wipe, including the muted/bold OpenCode wordmark, accent version, green check, and white Ready state.
  • Uses the canonical compact mark from @opencode-ai/tui/logo instead of copying glyph data.
  • Uses OpenTUI's explicit live contract at 60fps, then stops liveness during the settled hold. Each animated line is one Yoga <text> renderable with styled spans rather than one layout renderable per character.
  • Follows OpenTUI v0.4.3 teardown semantics: pause, await true renderer idle, then destroy. OpenTUI owns split-footer/output restoration before the TUI renderer starts.
  • Makes terminal settlement first-wins and idempotent, so success and failure cannot race two independent teardown paths.

Scope

This changes only the fresh-launch version-mismatch preflight introduced in #36448. Existing TUIs reconnecting to a replaced service remain separate work under #36285.

Testing

  • bun typecheck in packages/cli
  • bun run test in packages/cli (24 pass)
  • Push hook: full workspace typecheck (31 packages)
  • Real PTY end-to-end with isolated XDG state:
    • started a registered service as 0.0.1-old
    • launched a client as 0.0.2-new
    • verified real service replacement and the coordinated completion animation
    • verified OpenCode attaches at 0.0.2-new
    • verified no success receipt remains in scrollback
  • Reviewed lifecycle and animation behavior against local OpenTUI upstream/main / v0.4.3 source and tests

Demo

Real end-to-end service replacement and TUI handoff, captured at 60fps:

final3.mp4

Flow

sequenceDiagram
    participant CLI as New OpenCode CLI
    participant Footer as Update preflight
    participant Service as Background service
    participant TUI as OpenCode TUI

    CLI->>Footer: begin(old version → new version)
    CLI->>Service: replace mismatched service
    Footer->>Footer: stage wipes + spring progress
    Service-->>CLI: healthy new endpoint
    CLI->>Footer: finish()
    Footer->>Footer: dissolve header + ✓ Ready
    Footer->>Footer: brighten monogram + settle full rail
    Footer->>Footer: pause → idle → destroy
    CLI->>TUI: attach to new service
Loading

@kitlangton
kitlangton merged commit 56a7c06 into v2 Jul 11, 2026
10 checks passed
@kitlangton
kitlangton deleted the preflight-end-state branch July 11, 2026 19:42
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
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