Address review feedback:
- Simplify tsx CLI path lookup by extracting path variables and
reducing nested try-catch blocks
- Remove redundant try-catch around electronAppExists check in
production server path validation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Vite bundles all electron modules into a single main.js file,
so __dirname remains apps/ui/dist-electron regardless of source
file location. Updated path comments to clarify this behavior.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Extract the monolithic main.ts (~1000 lines) into focused modules:
- electron/constants.ts - Window sizing, port defaults, filenames
- electron/state.ts - Shared state container
- electron/utils/ - Port availability and icon utilities
- electron/security/ - API key management
- electron/windows/ - Window bounds and main window creation
- electron/server/ - Backend and static server management
- electron/ipc/ - IPC handlers with shared channel constants
Benefits:
- Improved testability with isolated modules
- Better discoverability and maintainability
- Single source of truth for IPC channels (used by both main and preload)
- Clear separation of concerns
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>