claudewheel v0.20.1 /claudewheel.app
Edit
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

python
def run_tui(self) -> dict[str, str | None] | None

Enter the TUI loop. Returns selections on launch, None on quit.

#_promote_ephemeral

python
def _promote_ephemeral(self) -> None

Promote ephemeral selections to pinned on disk before launch.

#_run_slow_discovery_thread

python
def _run_slow_discovery_thread(self) -> None

Background thread: run slow discovery and store results.

#_apply_slow_discovery

python
def _apply_slow_discovery(self) -> None

Merge 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

python
def _apply_pending_for_segment(self, seg: Segment) -> None

Apply any deferred discovery results for seg and clear pending state.

#_defocus

python
def _defocus(self) -> None

Run deferred-apply housekeeping on the segment about to lose focus.

#_build_context

python
def _build_context(self) -> KeyContext

Build an ephemeral KeyContext from current app state.

#_compute_hints

python
def _compute_hints(self) -> list[str]

Compute visible hint labels from the binding registry for the current state.

#_handle_key

python
def _handle_key(self, key: str) -> str | None

Process a keypress via the binding registry.

#_h_theme_switch

python
def _h_theme_switch(self, key: str) -> str | None

Handle Mode 2031 theme-change notification.

#_run_install_flow

python
def _run_install_flow(self, seg: Segment, version: str) -> None

Confirm install via run_selection, download in cooked, show result page.

#_build_bindings

python
def _build_bindings(self) -> list[Binding]

Build the full binding registry from handler methods.

#_h_main_search_or_quit

python
def _h_main_search_or_quit(self, key: str) -> str | None

Handle printable key on searchable segment: search or quit.

#_intercept_unauth

python
def _intercept_unauth(self, seg: Segment) -> str

Prompt 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

python
def _show_profile_inspect(self, seg: Segment) -> None

Show 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

python
def _delete_profile_flow(self, seg: Segment) -> None

Confirm 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

python
def _refresh_profile_segment(self, seg: Segment) -> None

Re-run profile discovery and update the segment's auth status.

#_launch_profile_wizard

python
def _launch_profile_wizard(self, seg: Segment) -> str | None

Run 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

python
def _confirm_create(self, seg: Segment) -> None

Confirm creation of a new option.