- Extract remaining runtime helper clusters from main.ts into dedicated modules for readability:\n - src/main/jlpt-runtime.ts\n - src/main/media-runtime.ts\n - src/main/overlay-visibility-runtime.ts\n- Wire main.ts to use the new runtime services and remove duplicated in-file helpers.\n- Preserve existing behavior via full typecheck + test:fast verification.\n- Finalize and archive TASK-56 backlog entry; update TASK-54 with completion metadata and summary.
2.3 KiB
id, title, status, assignee, created_date, updated_date, labels, dependencies, references, priority
| id | title | status | assignee | created_date | updated_date | labels | dependencies | references | priority | |
|---|---|---|---|---|---|---|---|---|---|---|
| TASK-56 | Extract remaining main.ts runtime functions to dedicated modules | Done | 2026-02-16 04:47 | 2026-02-16 05:16 |
|
medium |
Description
main.ts is still 1481 lines after previous refactoring efforts. While significant progress has been made, there are still opportunities to extract runtime functions into dedicated modules to further reduce its size and improve maintainability.
Current opportunities:
- JLPT dictionary lookup functions (lines 470-535) - initializeJlptDictionaryLookup, ensureJlptDictionaryLookup, getJlptDictionarySearchPaths
- Media path utilities (lines 552-590) - updateCurrentMediaPath, updateCurrentMediaTitle, resolveMediaPathForJimaku
- Overlay visibility helpers (lines 1273-1360) - updateVisibleOverlayVisibility, updateInvisibleOverlayVisibility, syncInvisibleOverlayMousePassthrough
These functions are largely self-contained and could be moved to:
src/main/jlpt-runtime.tssrc/main/media-runtime.tssrc/main/overlay-visibility-runtime.ts
Goal: Reduce main.ts complexity by extracting focused runtime helpers into dedicated modules
Benefits:
- Faster navigation and comprehension of main.ts
- Easier to test extracted modules independently
- Clearer separation of concerns
Acceptance Criteria
- #1 Extract JLPT dictionary lookup functions to dedicated module
- #2 Extract media path utilities to dedicated module
- #3 Extract overlay visibility helpers to dedicated module
- #4 Update main.ts imports to use new modules
- #5 Ensure all functionality remains intact
- #6 Run full test suite
- #7 Keep extracted code organized and easier to follow
Final Summary
Refactor complete for targeted runtime extraction: JLPT lookup, media utilities, and overlay visibility helpers were moved into dedicated main-runtime modules and wired from main.ts. Existing behavior preserved and full typecheck + test suite passed.
Task intent updated to prioritize readability over strict line-count target.