Skip to content

Terminal UI: accessible-mode parity, robustness, and visual consistency - #67

Merged
ApiliumDevTeam merged 8 commits into
devfrom
chore/tui-redesign-p0-p1
Jul 13, 2026
Merged

ApiliumDevTeam merged 8 commits into
devfrom
chore/tui-redesign-p0-p1

Conversation

@ApiliumDevTeam

Copy link
Copy Markdown
Collaborator

Summary

First pass of the terminal UI redesign (P0 + selected P1 from the audit in `docs/platforms/tui-redesign.md`). Closes the accessibility feature gap, fixes two robustness bugs, and aligns the visual identity across CLI and TUI. No changes to the rendering engine.

Accessible mode (P0)

  • Fix a temporal-dead-zone crash: the gateway disconnect handler referenced the readline interface before its declaration, so a disconnect in the startup window threw a `ReferenceError`.
  • Share slash-command handling between the graphical and accessible TUIs via a renderer-agnostic command core. The accessible mode now supports `/abort`, `/new`, `/reset`, `/compact`, `/status`, `/sessions`, `/session `, `/model`, and `/help` — closing the parity gap for every command that does not need a visual picker.

Robustness (P0)

  • Ctrl+C now aborts the active run (tri-state: abort run → clear input → exit on double press). Escape remains a secondary abort path. This unblocks users of modal editors where Escape is consumed to switch modes.

Visual consistency (P1)

  • Align the CLI palette with the TUI dark palette so `mayros` and `mayros code` share the same accent, success, warn, and error colors.
  • Render diffs with the active theme colors instead of hardcoded chalk values, so added/removed lines stay legible under light and high-contrast themes.

Terminal capability (P1)

  • Enable extended keyboard protocols (kitty keyboard or xterm modifyOtherKeys) in capable terminals so modifier combinations like Shift+Enter survive. Conservative allow-list; terminals outside the list get no upgrade. Protocol is popped on exit to restore the shell.

Hygiene

  • Remove the unused input-history store (dead code that looked like a feature).
  • Align the session-rename test with the current API (`label` field) and skip the symlink test on Windows where unprivileged symlink creation is not permitted.

Test plan

  • `pnpm tsgo` — 0 errors
  • `pnpm lint` — 0 errors, 346 warnings
  • `pnpm exec vitest run src/tui/` — 503 passed, 1 skipped (Windows symlink), 0 failed
  • New unit tests: shared-commands (10), term-capabilities (7)

The accessible TUI created its readline interface after wiring the
gateway client's disconnect handler and after client.start(). If the
client disconnected in that window, the handler referenced the readline
binding before its initialization, throwing a ReferenceError. Move the
readline creation before the disconnect wiring so the reference is
always initialized.
Ctrl+C now follows a three-state priority: abort an active run, clear
non-empty input, or exit on a second press within one second. Escape
remains a secondary abort path. This unblocks users of modal editors
(where Escape is consumed to switch modes) and aligns the interrupt
behavior with terminal conventions.
…ble modes

The accessible TUI previously supported only /quit and /exit. Introduce a
renderer-agnostic shared command core (shared-commands.ts) that calls
the gateway client directly and reports results through an injected
text sink. The accessible TUI now routes /abort, /new, /reset,
/compact, /status, /sessions, /session <key>, /model, and /help
through this core, reaching feature parity with the graphical TUI for
every command that does not require a visual picker.

The graphical TUI continues to use its full handler for overlay-based
commands. Both TUIs share logic (the gateway calls and command parsing)
without sharing presentation.
The diff renderer hardcoded chalk.green/red/cyan/white, so added and
removed lines were hard to read under light or high-contrast themes.
Thread optional DiffColors through renderDiff and formatDiffStatsLine;
when the TUI calls them it passes the active theme's success/error/
accent/dim functions, keeping diff colors consistent across every theme
preset. Callers without a theme fall back to the previous defaults.
The CLI and the terminal UI used different accent colors (orange in the
CLI, gold in the TUI), so running `mayros` then `mayros code` showed
two different identities. Derive the CLI palette tokens from the TUI dark
palette so both surfaces share accent, success, warn, and error values.
The CLI's accentBright maps to the TUI accentSoft; accentDim is a
darkened accent; info reuses accentSoft. The visual identity is now
consistent across every Mayros surface.
Add term-capabilities.ts to detect and manage extended keyboard
protocols. Capable terminals (kitty, WezTerm, ghostty get the kitty
keyboard protocol; iTerm, vscode, tmux, windows-terminal, Apple
Terminal get xterm modifyOtherKeys level 2) are upgraded at TUI startup
so modifier combinations like Shift+Enter and Ctrl+Shift survive instead
of being collapsed by plain raw-mode stdin. The protocol is popped on
exit/SIGINT/SIGTERM so the terminal is restored for the shell.

Detection is conservative: terminals outside the allow-list get no
upgrade, so escape sequences are never emitted to a terminal that cannot
parse them back.
The input-history store was never wired into the TUI main loop; it was
dead code that looked like a feature. Remove it and its test to reduce
confusion. Cross-session input history can be reintroduced as a real
feature later, but shipping a dormant implementation invites false
confidence.
…k on Windows

The session rename API field changed from displayName to label in the
0.80 surface; update the assertion to match the implementation. The
symlink-follows test requires Developer Mode or admin rights to create
a symlink on Windows (EPERM otherwise), so skip it on win32; CI on
Linux exercises it normally.
@ApiliumDevTeam
ApiliumDevTeam force-pushed the chore/tui-redesign-p0-p1 branch from 37d9d59 to 9033572 Compare July 13, 2026 17:50
@ApiliumDevTeam
ApiliumDevTeam merged commit bb5e966 into dev Jul 13, 2026
7 of 8 checks passed
@ApiliumDevTeam
ApiliumDevTeam deleted the chore/tui-redesign-p0-p1 branch July 13, 2026 17:50
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