On this page
App class -- TUI event loop for claudewheel.
#claudewheel.app
#claudewheel.app
TUI event loop, keyboard dispatch, and segment interaction.
#KeyContext
Ephemeral snapshot of state relevant to key dispatch decisions.
#Binding
A single keybinding entry in the registry.
#App
TUI application managing the event loop, keyboard handling, and segment interaction.
#run_tui
def run_tui(self) -> dict[str, str | None] | NoneEnter the TUI loop. Returns selections on launch, None on quit.
#_promote_ephemeral
def _promote_ephemeral(self) -> NonePromote ephemeral selections to pinned on disk before launch.
#_run_slow_discovery_thread
def _run_slow_discovery_thread(self) -> NoneBackground thread: run slow discovery and store results.
#_apply_slow_discovery
def _apply_slow_discovery(self) -> NoneMerge slow discovery results into the live segment bar.
Results for the focused segment are deferred to avoid disrupting the user's current interaction. Unfocused segments are updated immediately.
Known limitation: while results are buffered, evaluate_requires() uses the focused segment's pre-discovery options for cross-segment constraint checks. Constraint-based dimming may be briefly stale until defocus.
#_apply_pending_for_segment
def _apply_pending_for_segment(self, seg: Segment) -> NoneApply any deferred discovery results for seg and clear pending state.
#_defocus
def _defocus(self) -> NoneRun deferred-apply housekeeping on the segment about to lose focus.
#_build_context
def _build_context(self) -> KeyContextBuild an ephemeral KeyContext from current app state.
#_compute_hints
def _compute_hints(self) -> list[str]Compute visible hint labels from the binding registry for the current state.
#_handle_key
def _handle_key(self, key: str) -> str | NoneProcess a keypress via the binding registry.
#_h_theme_switch
def _h_theme_switch(self, key: str) -> str | NoneHandle Mode 2031 theme-change notification.
#_run_install_flow
def _run_install_flow(self, seg: Segment, version: str) -> NoneConfirm install via run_selection, download in cooked, show result page.
#_build_bindings
def _build_bindings(self) -> list[Binding]Build the full binding registry from handler methods.
#_h_main_search_or_quit
def _h_main_search_or_quit(self, key: str) -> str | NoneHandle printable key on searchable segment: search or quit.
#_intercept_unauth
def _intercept_unauth(self, seg: Segment) -> strPrompt auth for an unauthenticated profile before launch.
The app's terminal stays raw: the auth forms render borrowed as pages in the existing alt screen, and the subprocess steps inside the auth flow open their own cooked windows. On "authenticated", "unverified" (a token was saved without validation), and "failed" (credentials may be partially written), re-runs profile discovery and updates auth status. Returns the auth flow outcome: "authenticated", "unverified", "skip", "cancel", or "failed".
#_show_profile_inspect
def _show_profile_inspect(self, seg: Segment) -> NoneShow a fullscreen inspect page for the focused profile option.
The app's terminal stays raw: show_page renders borrowed in the existing alt screen and the main TUI repaints on return. If the profile has an auth shadow, the hint offers 'f' to fix it.
#_delete_profile_flow
def _delete_profile_flow(self, seg: Segment) -> NoneConfirm and delete the focused profile from the TUI.
Profiles holding REAL data at shared-dir names are hard-blocked with a fullscreen page pointing at the CLI escape hatch -- the TUI offers no override. Otherwise an informed two-option confirm runs (Cancel default-focused), then delete_profile_core() without any force flags; refusals surface as a flash.
#_refresh_profile_segment
def _refresh_profile_segment(self, seg: Segment) -> NoneRe-run profile discovery and update the segment's auth status.
#_launch_profile_wizard
def _launch_profile_wizard(self, seg: Segment) -> str | NoneRun the create-profile flow as one continuous alt-screen session.
The app's terminal stays raw throughout: the wizard form, the auth forms, and the creation summary page all render borrowed in the existing alt screen (subprocess steps open cooked windows inside the auth flow). The main TUI repaints on return.
#_confirm_create
def _confirm_create(self, seg: Segment) -> NoneConfirm creation of a new option.