refactor: extract additional main dependency builders

This commit is contained in:
2026-02-20 01:02:40 -08:00
parent 5476d44005
commit 18648cb6fc
45 changed files with 2516 additions and 159 deletions

View File

@@ -9,6 +9,22 @@
## Current Work (newest first)
- [2026-02-20T08:34:16Z] progress: extracted field-grouping resolver deps assembly into `src/main/runtime/field-grouping-resolver-main-deps.ts` and rewired `getFieldGroupingResolver`/`setFieldGroupingResolver` handler construction in `src/main.ts`.
- [2026-02-20T08:34:16Z] progress: extracted Yomitan extension loader deps assembly into `src/main/runtime/yomitan-extension-loader-main-deps.ts` and rewired `loadYomitanExtension`/`ensureYomitanExtensionLoaded` handler construction in `src/main.ts`.
- [2026-02-20T08:34:16Z] progress: added parity tests in `src/main/runtime/field-grouping-resolver-main-deps.test.ts` and `src/main/runtime/yomitan-extension-loader-main-deps.test.ts`; `src/main.ts` now 2993 LOC.
- [2026-02-20T08:34:16Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + `node --test dist/main/runtime/yomitan-extension-loader-main-deps.test.js dist/main/runtime/yomitan-extension-loader.test.js dist/main/runtime/field-grouping-resolver-main-deps.test.js dist/main/runtime/anilist-token-refresh-main-deps.test.js` pass (7/7).
- [2026-02-20T08:31:52Z] progress: extracted AniList media-state deps assembly into `src/main/runtime/anilist-media-state-main-deps.ts` and rewired media-key/media-guess state handlers in `src/main.ts`.
- [2026-02-20T08:31:52Z] progress: extracted subtitle-position deps assembly into `src/main/runtime/subtitle-position-main-deps.ts` and rewired load/save subtitle position handlers in `src/main.ts`.
- [2026-02-20T08:31:52Z] progress: extracted AniList token-refresh deps assembly into `src/main/runtime/anilist-token-refresh-main-deps.ts` and rewired `refreshAnilistClientSecretState` handler construction in `src/main.ts`.
- [2026-02-20T08:31:52Z] progress: added parity tests in `src/main/runtime/anilist-media-state-main-deps.test.ts`, `src/main/runtime/subtitle-position-main-deps.test.ts`, and `src/main/runtime/anilist-token-refresh-main-deps.test.ts`; `src/main.ts` now 2968 LOC.
- [2026-02-20T08:31:52Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + `node --test dist/main/runtime/anilist-token-refresh-main-deps.test.js dist/main/runtime/anilist-token-refresh.test.js dist/main/runtime/anilist-media-state-main-deps.test.js dist/main/runtime/subtitle-position-main-deps.test.js dist/main/runtime/jellyfin-subtitle-preload-main-deps.test.js` pass (12/12).
- [2026-02-20T08:12:54Z] progress: extracted Jellyfin subtitle-preload deps assembly into `src/main/runtime/jellyfin-subtitle-preload-main-deps.ts` and rewired `preloadJellyfinExternalSubtitles` construction in `src/main.ts`.
- [2026-02-20T08:12:54Z] progress: added parity tests in `src/main/runtime/jellyfin-subtitle-preload-main-deps.test.ts`; `src/main.ts` now 2926 LOC.
- [2026-02-20T08:12:54Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + `node --test dist/main/runtime/jellyfin-subtitle-preload-main-deps.test.js dist/main/runtime/jellyfin-subtitle-preload.test.js dist/main/runtime/jellyfin-remote-session-main-deps.test.js` pass (6/6).
- [2026-02-20T08:11:29Z] progress: committed checkpoint `a85b6c2` (`refactor: extract additional main runtime dependency builders`) and continued with Jellyfin remote-session deps extraction.
- [2026-02-20T08:11:29Z] progress: extracted start/stop Jellyfin remote-session deps assembly into `src/main/runtime/jellyfin-remote-session-main-deps.ts` and rewired those constructor sites in `src/main.ts`.
- [2026-02-20T08:11:29Z] progress: added parity tests in `src/main/runtime/jellyfin-remote-session-main-deps.test.ts`; `src/main.ts` now 2921 LOC.
- [2026-02-20T08:11:29Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + `node --test dist/main/runtime/jellyfin-remote-session-main-deps.test.js dist/main/runtime/jellyfin-remote-session-lifecycle.test.js dist/main/runtime/jellyfin-command-dispatch-main-deps.test.js` pass (5/5).
- [2026-02-20T08:00:02Z] progress: extracted Jellyfin command-dispatch deps assembly into `src/main/runtime/jellyfin-command-dispatch-main-deps.ts` (`createBuildRunJellyfinCommandMainDepsHandler`) and rewired `runJellyfinCommand` construction in `src/main.ts`.
- [2026-02-20T08:00:02Z] progress: added parity tests in `src/main/runtime/jellyfin-command-dispatch-main-deps.test.ts`; `src/main.ts` now 2909 LOC.
- [2026-02-20T08:00:02Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + `node --test dist/main/runtime/jellyfin-command-dispatch-main-deps.test.js dist/main/runtime/jellyfin-command-dispatch.test.js dist/main/runtime/jellyfin-cli-main-deps.test.js` pass (8/8).
@@ -353,3 +369,24 @@
- [2026-02-20T07:27:15Z] progress: extracted overlay-shortcuts runtime deps assembly into `src/main/runtime/overlay-shortcuts-runtime-main-deps.ts` and rewired `createOverlayShortcutsRuntimeService` setup in `src/main.ts` through the builder.
- [2026-02-20T07:27:15Z] progress: `src/main.ts` currently 2750 LOC after this slice.
- [2026-02-20T07:27:15Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + `node --test dist/main/runtime/overlay-shortcuts-runtime-main-deps.test.js dist/main/overlay-shortcuts-runtime.test.js dist/main/runtime/overlay-shortcuts-lifecycle.test.js` pass (5/5).
- [2026-02-20T08:39:19Z] progress: extracted setup-window dependency assembly from `src/main.ts` into `src/main/runtime/anilist-setup-window-main-deps.ts` and `src/main/runtime/jellyfin-setup-window-main-deps.ts`; rewired `openAnilistSetupWindow` + `openJellyfinSetupWindow` to builder-backed handlers.
- [2026-02-20T08:39:19Z] progress: added builder mapping tests in `src/main/runtime/anilist-setup-window-main-deps.test.ts` and `src/main/runtime/jellyfin-setup-window-main-deps.test.ts`.
- [2026-02-20T08:39:19Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + `node --test dist/main/runtime/anilist-setup-window-main-deps.test.js dist/main/runtime/jellyfin-setup-window-main-deps.test.js dist/main/runtime/anilist-setup-window.test.js dist/main/runtime/jellyfin-setup-window.test.js` pass.
- [2026-02-20T08:44:42Z] progress: extracted AniList media-guess/post-watch dependency assemblies into `src/main/runtime/anilist-media-guess-main-deps.ts` + `src/main/runtime/anilist-post-watch-main-deps.ts`; rewired `main.ts` (`maybeProbeAnilistDuration`, `ensureAnilistMediaGuess`, `processNextAnilistRetryUpdate`, `maybeRunAnilistPostWatchUpdate`) to builder-backed setup.
- [2026-02-20T08:44:42Z] progress: extracted Anki/mining action dependency assemblies into `src/main/runtime/anki-actions-main-deps.ts` + `src/main/runtime/mining-actions-main-deps.ts`; rewired corresponding handler creation block in `main.ts`.
- [2026-02-20T08:44:42Z] progress: added mapping tests for all new builders (`anilist-media-guess-main-deps`, `anilist-post-watch-main-deps`, `anki-actions-main-deps`, `mining-actions-main-deps`).
- [2026-02-20T08:44:42Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + `node --test dist/main/runtime/anilist-media-guess-main-deps.test.js dist/main/runtime/anilist-post-watch-main-deps.test.js dist/main/runtime/anilist-media-guess.test.js dist/main/runtime/anilist-post-watch.test.js dist/main/runtime/anki-actions-main-deps.test.js dist/main/runtime/mining-actions-main-deps.test.js dist/main/runtime/anki-actions.test.js dist/main/runtime/mining-actions.test.js` pass.
- [2026-02-20T08:52:08Z] progress: extracted overlay visibility/main action and IPC-bridge dependency assembly from `main.ts` into new builders: `overlay-visibility-actions-main-deps.ts`, `overlay-main-actions-main-deps.ts`, `ipc-bridge-actions-main-deps.ts`.
- [2026-02-20T08:52:08Z] progress: rewired `main.ts` handler setup for `set/toggle overlay`, `appendClipboardVideoToQueue`, `handleMpvCommandFromIpc`, and `runSubsyncManualFromIpc` to builder-backed assembly.
- [2026-02-20T08:52:08Z] progress: added builder mapping tests: `overlay-visibility-actions-main-deps.test.ts`, `overlay-main-actions-main-deps.test.ts`, `ipc-bridge-actions-main-deps.test.ts`.
- [2026-02-20T08:52:08Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + `node --test dist/main/runtime/ipc-bridge-actions-main-deps.test.js dist/main/runtime/overlay-visibility-actions-main-deps.test.js dist/main/runtime/overlay-main-actions-main-deps.test.js dist/main/runtime/ipc-bridge-actions.test.js dist/main/runtime/overlay-visibility-actions.test.js dist/main/runtime/overlay-main-actions.test.js` pass.
- [2026-02-20T08:54:17Z] progress: extracted numeric shortcut and overlay-shortcuts lifecycle dependency assembly into `numeric-shortcut-session-main-deps.ts` and `overlay-shortcuts-lifecycle-main-deps.ts`; rewired corresponding `main.ts` setup blocks.
- [2026-02-20T08:54:17Z] progress: extracted overlay-window-layout dependency assembly into `overlay-window-layout-main-deps.ts`; rewired visible/invisible bounds + window level/order setup in `main.ts`.
- [2026-02-20T08:54:17Z] progress: added mapping tests for all new builders (`numeric-shortcut-session-main-deps`, `overlay-shortcuts-lifecycle-main-deps`, `overlay-window-layout-main-deps`).
- [2026-02-20T08:54:17Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + `node --test dist/main/runtime/numeric-shortcut-session-main-deps.test.js dist/main/runtime/overlay-shortcuts-lifecycle-main-deps.test.js dist/main/runtime/overlay-window-layout-main-deps.test.js dist/main/runtime/numeric-shortcut-session-handlers.test.js dist/main/runtime/overlay-shortcuts-lifecycle.test.js dist/main/runtime/overlay-window-layout.test.js` pass.
- [2026-02-20T08:55:21Z] progress: extracted startup warmup dependency assembly into `src/main/runtime/startup-warmups-main-deps.ts` (`launchBackgroundWarmupTask`, `startBackgroundWarmups`) and rewired main setup to builder-backed constants.
- [2026-02-20T08:55:21Z] progress: added `src/main/runtime/startup-warmups-main-deps.test.ts` mapping coverage.
- [2026-02-20T08:55:21Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + `node --test dist/main/runtime/startup-warmups-main-deps.test.js dist/main/runtime/startup-warmups.test.js` pass.
- [2026-02-20T08:56:46Z] progress: extracted MPV IPC command dependency assembly into `src/main/runtime/ipc-mpv-command-main-deps.ts` and rewired `main.ts` IPC bridge setup to compose through `buildMpvCommandFromIpcRuntimeMainDepsHandler`.
- [2026-02-20T08:56:46Z] progress: added `src/main/runtime/ipc-mpv-command-main-deps.test.ts` mapping coverage.
- [2026-02-20T08:56:46Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + `node --test dist/main/runtime/ipc-mpv-command-main-deps.test.js dist/main/runtime/ipc-bridge-actions-main-deps.test.js dist/main/runtime/ipc-bridge-actions.test.js` pass.