Repository navigation
refactor: Split App component into focused modules (#173) - #194
Merged
Merged
Conversation
Splits source/app.tsx (938 lines) into focused modules following the established codebase pattern. Structure: - source/app/ ├── App.tsx (main component, ~200 lines) ├── types.ts (AppProps and internal types) ├── components/ │ ├── AppContainer.tsx (layout wrapper with welcome message) │ ├── ChatInterface.tsx (main chat UI section) │ └── ModalSelectors.tsx (model/provider/theme selection modals) ├── hooks/ │ ├── useAppHandlers.tsx (handler consolidation) │ └── useNonInteractiveMode.ts (non-interactive execution logic) ├── helpers.ts (utility functions for app state) └── index.ts (re-exports App) All new modules include comprehensive test coverage: - App.spec.tsx (type safety tests) - components/AppContainer.spec.tsx (rendering + content verification) - components/ChatInterface.spec.tsx (UI state + rendering tests) - components/ModalSelectors.spec.tsx (modal rendering tests) - helpers.spec.ts (utility function tests) Test improvements: - Enhanced tests use ink-testing-library for actual component rendering - All tests verify both component structure AND rendered output - Proper cleanup with unmount() to prevent test timeouts - Fixed theme preset values (tokyo-night, dracula vs invalid monokai, default) Benefits: - Each module <500 lines with single responsibility - Improved testability and maintainability - Clear separation of concerns (UI, state, handlers) - Easier to navigate and understand Breaking changes: - Import path changed: '@/app' instead of '@/app.tsx' - Only affects source/cli.tsx Part of 5-PR refactoring series (#173) - PR #5 of 5
Avtrkrb
approved these changes
Dec 21, 2025
12 of 19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Splits
source/app.tsx(938 lines) into focused modules following the established codebase pattern. This is PR #5 of 5 in the refactoring series for issue #173.Structure
Test Coverage
All new modules include comprehensive test coverage:
App.spec.tsx- Type safety testscomponents/AppContainer.spec.tsx- Rendering + content verificationcomponents/ChatInterface.spec.tsx- UI state + rendering tests (9 tests)components/ModalSelectors.spec.tsx- Modal rendering tests (9 tests)helpers.spec.ts- Utility function testsTest Improvements
ink-testing-libraryfor actual component renderingunmount()to prevent test timeoutssource/apppassing ✅Benefits
Breaking Changes
'@/app'instead of'@/app.tsx'source/cli.tsx(already updated)Testing
pnpm run test:ava source/app # ✔ 30 tests passedCloses #173