Skip to content

[EXPERIMENTAL][ENHANCEMENT] Evaluate and prototype OpenTUI as alternative CLI renderer #11705

@mojomast

Description

@mojomast

OpenTUI Migration - Single Enhancement Issue

Use this issue body when creating the enhancement request on RooCodeInc/Roo-Code.


Issue Body

Title: [EXPERIMENTAL][ENHANCEMENT] Evaluate and prototype OpenTUI as alternative CLI renderer

Labels: Enhancement, experimental, frontend, UI/UX


Problem (one or two sentences)

The Roo CLI currently uses Ink for terminal UI rendering, which limits performance and flexibility compared to newer native terminal rendering libraries like OpenTUI. We need to evaluate whether migrating to OpenTUI can improve rendering performance, reduce bundle size, and provide better cross-platform terminal compatibility while maintaining feature parity.

Context (who is affected and when)

  • Who: CLI users and contributors working on the apps/cli package
  • When: This is an experimental evaluation/prototype phase to assess feasibility before any production migration
  • Impact: No immediate user impact; this is a research spike with a detailed implementation plan (migration.md) for future reference
  • Location: Changes would be isolated to apps/cli/src/ui/ and related command paths, with --ui flag support to maintain backward compatibility

Desired behavior (conceptual, not technical)

Create a working prototype that demonstrates OpenTUI can render the core Roo CLI interface (message streaming, input, approvals) with equivalent or better performance than the current Ink implementation. The prototype should validate that OpenTUI's runtime requirements (Bun vs Node) are compatible with the existing architecture and that a migration path exists without breaking existing non-TUI modes (--print, --output-format stream-json).

Constraints / preferences (optional)

  • Experimental only: This issue covers evaluation and prototype, not production migration
  • Backward compatibility: Existing Ink UI and non-TUI modes must remain fully functional
  • Zero breaking changes: The prototype should be behind a feature flag (--ui opentui) that is opt-in only
  • Documentation: All findings must be documented in an ADR (Architecture Decision Record)
  • Performance baseline: Must instrument and document current Ink performance metrics before comparison
  • Cross-platform: Must validate on iTerm2, Terminal.app, GNOME Terminal, Windows Terminal, and tmux

Acceptance criteria (optional)

Wave 0 - Discovery (MUST HAVE for this issue):

  • Baseline current Ink UI capabilities inventory from apps/cli/src/ui
  • Build feature parity matrix: Ink vs OpenTUI primitives/components
  • Validate OpenTUI runtime constraints (Bun-only path vs Node fallback feasibility)
  • Write ADR documenting runtime strategy decision at docs/adr/cli-opentui-runtime.md
  • Define MVP scope and non-goals (what features can be deferred)
  • Instrument current CLI UX timings (input latency, render cadence, startup) for benchmark
  • Define compatibility terminal matrix for validation

Wave 1 - Foundation (NICE TO HAVE prototype):

  • Add OpenTUI dependencies and scaffolding (behind feature flag)
  • Create new UI root apps/cli/src/opentui/App.tsx with renderer bootstrap
  • Implement view-model contracts and adapter layer
  • Add dual-UI flag (--ui ink|opentui) to command path
  • Wire lifecycle hooks and error boundaries with fallback to plain output

Success Criteria:

  • Prototype runs without crashes in experimental mode
  • Performance metrics collected and documented vs baseline
  • ADR published with go/no-go recommendation for full migration
  • All work documented in linked PR referencing this issue

Proposed approach (optional)

This is a phased experimental evaluation:

  1. Phase 0 - Research: Inventory current capabilities, validate OpenTUI compatibility, write ADR
  2. Phase 1 - Prototype: Build minimal working OpenTUI shell behind feature flag
  3. Phase 2 - Evaluation: Performance testing, cross-platform validation, document findings
  4. Phase 3 - Decision: Based on findings, either:
    • Abandon OpenTUI migration (document learnings)
    • Proceed with full migration (create follow-up epic)
    • Defer decision (leave prototype for future evaluation)

A detailed 60-task implementation backlog exists in migration.md for reference if the decision is to proceed, covering Waves 0-4 with estimates of ~7-14 weeks for full parity.

Trade-offs / risks (optional)

Risk Impact Mitigation
OpenTUI requires Bun runtime HIGH Validate Node.js compatibility or assess Bun adoption feasibility in ADR
Ink-specific UI code is deeply coupled (~69 files, ~10.8k LOC) HIGH Prototype only MVP features; full migration is separate effort if approved
Cross-terminal rendering differences MEDIUM Test on defined terminal matrix; document incompatibilities
Test migration complexity MEDIUM Prototype phase focuses on feasibility, not test parity
Contributor disruption LOW Changes isolated to experimental branch; main branch unchanged

Key Unknowns:

  • Will OpenTUI's native Zig core work with existing Node.js extension host architecture?
  • Can we achieve acceptable performance without full test suite migration?
  • What is the Bun runtime adoption barrier for the project?

Related Files

  • Implementation backlog: migration.md (60 detailed tasks with dependencies)
  • Issue importer script: scripts/import-migration-issues.js (for future use if proceeding)

Next Steps After This Issue

  1. Comment "Claiming" on this issue
  2. DM Hannes Rudolph (hrudolph) on Discord for assignment confirmation
  3. Create Draft PR for Wave 0 work
  4. After ADR approval, either:
    • Close this issue (decision: don't migrate)
    • Create follow-up epic for full migration using detailed backlog

How to Create This Issue

# Create the single enhancement issue
gh issue create \
  --repo RooCodeInc/Roo-Code \
  --title "[EXPERIMENTAL][ENHANCEMENT] Evaluate and prototype OpenTUI as alternative CLI renderer" \
  --label "Enhancement" \
  --label "experimental" \
  --label "frontend" \
  --label "UI/UX" \
  --body-file /path/to/this/issue-body.md

Or manually copy the body above into the "Enhancement Request" template on GitHub.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions