Skip to main content

Module tui

Module tui 

Source
Expand description

Interactive scaffold TUI for haz init per AUX-003..AUX-005.

Two layers live here:

  • dispatch is a pure function from a crossterm event and a TuiState to a DispatchResult. It mutates the state in-place and performs no IO; the side effects the driver needs to perform (loading children from disk, leaving the tree screen to commit) are returned as enum variants. The purity makes every key binding exhaustively unit-testable without a terminal.
  • run_interactive_scaffold is the IO-driven loop that owns the terminal: it sets up raw mode + the alternate screen, draws each frame, reads events, calls dispatch, and performs the IO actions the dispatcher requests.

The screen layout is a single navigable tree with a synthetic [ Commit selection ] button just below it; pressing Enter from any focus position commits, while arrow / space cycle state for tree rows.

Hidden-directory handling: by default the tree omits dotfile-prefixed entries (.git, .cache, …) and entries matched by the cwd’s .gitignore (and git’s global excludes). H toggles their visibility; when shown, dotfile rows render dim and gitignored rows render dim with a warning-coloured foreground so the user can still distinguish them from ordinary content. The classification is captured per-row via super::model::HiddenKind.

Structs§

TuiState
The full mutable TUI state. Held by the driver, mutated by dispatch.

Enums§

DispatchResult
What the dispatcher’s caller (the driver loop) should do next.
ScaffoldOutcome
Final outcome of the scaffold flow as far as the executor is concerned.
TuiFocus
Which on-screen element currently carries the focus highlight.

Functions§

run_interactive_scaffold
Run the full interactive scaffold flow against cwd_host.