Skip to content

feat: add ratatui TUI backend with nemo-ui/nemo-tui crate split#5

Open
geoffjay wants to merge 1 commit intomainfrom
tui
Open

feat: add ratatui TUI backend with nemo-ui/nemo-tui crate split#5
geoffjay wants to merge 1 commit intomainfrom
tui

Conversation

@geoffjay
Copy link
Copy Markdown
Owner

Summary

  • Extract GPUI code into nemo-ui crate: Moves all GPUI-specific code (54 components, workspace, theme, config, runtime, window) from the nemo binary into a dedicated nemo-ui library crate with a run_gpui() entry point
  • Create nemo-tui crate with ratatui rendering: New terminal UI backend that maps XML components to ratatui widgets (stack→Layout, panel→Block, label/text→Paragraph, progress→Gauge, table→Table) with graceful degradation for unsupported types
  • Add --tui/--ui CLI flags: Mode detection with priority: CLI flag > <app default="tui"> XML config > default to GPUI

Architecture

XML config → nemo-config → nemo-layout → BuiltComponent tree
                                              |
                                  +-----------+-----------+
                                  |                       |
                             nemo-ui (GPUI)         nemo-tui (ratatui)
                                  |                       |
                               Desktop               Terminal

New crates

Crate Purpose
nemo-ui GPUI desktop rendering (extracted from nemo binary)
nemo-tui ratatui terminal rendering (new)

TUI component mapping

XML Component ratatui Widget
stack Layout (horizontal/vertical with flex constraints)
panel Block (borders + title, children inside)
label Paragraph (single line)
text Paragraph + Wrap (multi-line)
progress Gauge (value/max ratio)
table Table (column definitions + row data)

Test plan

  • All existing workspace tests pass (0 failures)
  • 12 new integration tests for TUI components using ratatui TestBackend
  • cargo run -- --app-config examples/basic/app.xml — GPUI still works
  • cargo run -- --app-config examples/tui-basic/app.xml — TUI mode via default="tui"
  • cargo run -- --app-config examples/basic/app.xml --tui — Force TUI on GPUI config

🤖 Generated with Claude Code

Separate GPUI-specific code from the nemo binary into a new nemo-ui crate
and create a nemo-tui crate with ratatui-based terminal rendering. This
allows the same XML configuration system to drive both desktop (GPUI) and
terminal (ratatui) applications.

- Extract components, workspace, theme, config, runtime into nemo-ui crate
- Create nemo-tui crate with stack, panel, label, text, progress, table components
- Add --tui/--ui CLI flags with XML <app default="tui"> fallback
- Add tui-basic example and 12 integration tests using TestBackend

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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