Skip to content

refactor(tui): move key routing, model choices and start-up out of run/mod.rs - #521

Merged
mrnasil merged 3 commits into
mainfrom
refactor/tui-run-keys-models-boot
Nov 28, 2026
Merged

mrnasil merged 3 commits into
mainfrom
refactor/tui-run-keys-models-boot

Conversation

@mrnasil

@mrnasil mrnasil commented Nov 28, 2026

Copy link
Copy Markdown
Member

What

Third step of splitting crates/tui/src/run/mod.rs (after #519 and #520):

  • run/keys.rs: which layer owns a key while idle and while a turn runs (13 items).
  • run/models.rs: model, provider, credential and agent choices (25 functions).
  • run/boot.rs: building the app and runtime, resuming a session, and the work deferred until after the first frame (16 functions).

run/mod.rs drops from 4448 to 2914 lines (6690 before #519). What is left is the run loop itself (about 930 lines), terminal setup and restore, and small helpers.

It is a pure move

Compared line by line against main (ignoring order): the only differences are pub(super) on each moved item, six signatures rustfmt re-wrapped because of that prefix, and the mod / use lines. No logic, event-loop or terminal code changed, so the docs/tui-term-matrix.md manual checks were not run.

The branch was started on top of #520 before it merged; the merge commit resolves run/mod.rs to this branch's version, after checking that main equals the branch's base.

Verification

  • cargo clippy -p whycodes-tui --all-targets -- -D warnings, cargo fmt --all --check, budget scripts: green.
  • cargo test -p whycodes-tui --lib run::: 374 passed, 0 failed.
  • One earlier local run of the same tests hung past 10 minutes and was killed; two reruns finished in under 50 s. The stuck test was not identified.

🤖 Generated with Claude Code

mrnasil and others added 3 commits November 28, 2026 20:28
- run/sessions.rs: opening, switching and closing live sessions and the
  dashboard rows (15 functions).
- run/turn.rs: starting a turn, applying its events and outcome, and
  cancelling it (21 functions).

run/mod.rs drops from 6259 to 4448 lines. A pure move: the only textual
changes are `pub(super)` on each function and three signatures rustfmt
re-wrapped because of it.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…n/mod.rs

- run/keys.rs: which layer owns a key while idle and while a turn runs.
- run/models.rs: model, provider, credential and agent choices.
- run/boot.rs: building the app and runtime, resuming a session, and
  the work deferred until after the first frame.

run/mod.rs drops from 4448 to 2914 lines. A pure move: the only textual
changes are `pub(super)` on each item and six signatures rustfmt
re-wrapped because of it.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…-models-boot

# Conflicts:
#	crates/tui/src/run/mod.rs
@mrnasil
mrnasil merged commit f0a4753 into main Nov 28, 2026
7 checks passed
@mrnasil
mrnasil deleted the refactor/tui-run-keys-models-boot branch November 28, 2026 18:03
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