Skip to content

Refactor CLI UI state into nested structs - #28

Merged
anasx07 merged 1 commit into
mainfrom
cool-updates
Jul 24, 2026
Merged

Refactor CLI UI state into nested structs#28
anasx07 merged 1 commit into
mainfrom
cool-updates

Conversation

@anasx07

@anasx07 anasx07 commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Restructure the CLI UI state by splitting the large App struct into focused nested state structs (ProviderState, SessionState, MenuState, ApiKeyInputState, ModelSearchState, PlanApprovalState, HookTrustState, CommandConfirmationState, UserMessageState, MouseState, RenderCache, UiSettings, UpdateState, etc.). Introduce ActiveModal to centralize modal/menu/dialog state instead of many boolean flags. Update all code paths to reference the new nested fields (e.g. history -> session.history, current_model -> provider.current_model, session_id -> session.id) and migrate modal logic to use app.active_modal and the dedicated modal states. Adjust event handling, command/provider/model selection, API key input flow, plan/hook/command confirmations, user-message modal, auto-scroll/collapse behavior, and related helpers to the new layout. Tests were updated to reflect the new state layout. This refactor improves code organization, isolates modal/dialog state, and simplifies UI state management.

Restructure the CLI UI state by splitting the large App struct into focused nested state structs (ProviderState, SessionState, MenuState, ApiKeyInputState, ModelSearchState, PlanApprovalState, HookTrustState, CommandConfirmationState, UserMessageState, MouseState, RenderCache, UiSettings, UpdateState, etc.). Introduce ActiveModal to centralize modal/menu/dialog state instead of many boolean flags. Update all code paths to reference the new nested fields (e.g. history -> session.history, current_model -> provider.current_model, session_id -> session.id) and migrate modal logic to use app.active_modal and the dedicated modal states. Adjust event handling, command/provider/model selection, API key input flow, plan/hook/command confirmations, user-message modal, auto-scroll/collapse behavior, and related helpers to the new layout. Tests were updated to reflect the new state layout. This refactor improves code organization, isolates modal/dialog state, and simplifies UI state management.
@anasx07
anasx07 merged commit d2e3edf into main Jul 24, 2026
0 of 3 checks passed
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