Repository navigation
TUI: deep split of tui.ts and tui-command-handlers.ts - #78
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the file-size reduction follow-up from #74. Both monolithic TUI files are split below the ~500 LOC guideline without changing any observable behavior.
tui.ts (883 → 591 LOC) — three modules extracted from
runTui():tui-status-renderer.ts(301 LOC): status/footer rendering, busy/idle timers, waiting-status animation. OwnsactivityStatus,connectionStatus,isConnected,statusTimeout— thestateobject delegates via late-bound getters/setters.tui-keybindings.ts(119 LOC): editor callbacks (onEscape,onCtrlC/D/O/L/G/P/T,onShiftTab). Mutable state accessed viaTuiStateAccess.tui-connection.ts(121 LOC): gateway client lifecycle (onEvent,onConnected,onDisconnected,onGap). Pairing/gateway-down hint flags are internal.The remaining 591 LOC is primarily the
stateobject definition (~170 LOC of getters/setters) plus essential wiring — extraer eso a una factory añade indirección sin claridad.tui-command-handlers.ts (1402 → 351 LOC) — 7 command group modules + dispatcher:
tui-cmd-session.ts: agent, session, model, new, reset, searchtui-cmd-config.ts: think, verbose, reasoning, elevated, activation, usage, contexttui-cmd-display.ts: style, theme, diff, permission, fast, toolstui-cmd-clipboard.ts: copy, exporttui-cmd-ecosystem.ts: plan, kg, trace, team, tasks, workflow, rules, mailbox, sync, mousetui-cmd-teleport.ts: teleport (export/import)tui-cmd-misc.ts: help, status, undo, abort, settings, bug, init, exit, quit, onboard, batch, vim, compact, defaulttui-cmd-types.ts: sharedCommandHandlerContext(extended with closures) +CommandGroupHandlertypeThe dispatcher iterates over the groups until one returns
true(handled). The public API (createCommandHandlers→{ handleCommand, sendMessage, ... }) is unchanged.Test plan
pnpm tsgo— 0 errorspnpm lint— 0 errors, 359 warningspnpm exec vitest run src/tui/— 512 passed, 1 skipped, 0 failedtui-command-handlers.test.tstests pass without modification (public API preserved)origin/dev(includes FTS5 session search and skill curator lifecycle #77 FTS5 search) — no conflicts,searchSessionsinterface unchanged