From a33d030d34e18c3c1b7f0bd8a8186eeb9462bee6 Mon Sep 17 00:00:00 2001 From: sudacode Date: Fri, 20 Feb 2026 01:45:02 -0800 Subject: [PATCH] refactor: prebuild additional main startup dependency bundles --- docs/subagents/INDEX.md | 2 +- .../codex-task85-20260219T233711Z-46hc.md | 3 +++ src/main.ts | 17 ++++++++++++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/subagents/INDEX.md b/docs/subagents/INDEX.md index 892a6f6..ba47c06 100644 --- a/docs/subagents/INDEX.md +++ b/docs/subagents/INDEX.md @@ -6,7 +6,7 @@ Read first. Keep concise. | ------------ | -------------- | ---------------------------------------------------- | --------- | ------------------------------------- | ---------------------- | | `codex-generate-minecard-image-20260220T112900Z-vsxr` | `codex-generate-minecard-image` | `Generate media fallbacks (GIF) from assets/minecard.webm and wire README/docs fallback markup` | `done` | `docs/subagents/agents/codex-generate-minecard-image-20260220T112900Z-vsxr.md` | `2026-02-20T11:35:30Z` | | `codex-main` | `planner-exec` | `Fix frequency/N+1 regression in plugin --start flow` | `in_progress` | `docs/subagents/agents/codex-main.md` | `2026-02-19T19:36:46Z` | -| `codex-task85-20260219T233711Z-46hc` | `codex-task85` | `Resume TASK-85 maintainability refactor from latest handoff point` | `in_progress` | `docs/subagents/agents/codex-task85-20260219T233711Z-46hc.md` | `2026-02-20T09:43:47Z` | +| `codex-task85-20260219T233711Z-46hc` | `codex-task85` | `Resume TASK-85 maintainability refactor from latest handoff point` | `in_progress` | `docs/subagents/agents/codex-task85-20260219T233711Z-46hc.md` | `2026-02-20T09:44:47Z` | | `codex-config-validation-20260219T172015Z-iiyf` | `codex-config-validation` | `Find root cause of config validation error for ~/.config/SubMiner/config.jsonc` | `completed` | `docs/subagents/agents/codex-config-validation-20260219T172015Z-iiyf.md` | `2026-02-19T17:26:17Z` | | `codex-task85-20260219T233711Z-46hc` | `codex-task85` | `Resume TASK-85 maintainability refactor from latest handoff point` | `in_progress` | `docs/subagents/agents/codex-task85-20260219T233711Z-46hc.md` | `2026-02-20T02:56:34Z` | | `codex-anilist-deeplink-20260219T233926Z` | `anilist-deeplink` | `Fix external subminer:// AniList callback handling from browser` | `done` | `docs/subagents/agents/codex-anilist-deeplink-20260219T233926Z.md` | `2026-02-19T23:59:21Z` | diff --git a/docs/subagents/agents/codex-task85-20260219T233711Z-46hc.md b/docs/subagents/agents/codex-task85-20260219T233711Z-46hc.md index 963bab1..4868837 100644 --- a/docs/subagents/agents/codex-task85-20260219T233711Z-46hc.md +++ b/docs/subagents/agents/codex-task85-20260219T233711Z-46hc.md @@ -9,6 +9,9 @@ ## Current Work (newest first) +- [2026-02-20T09:44:47Z] progress: added another safe 5-block normalization in `src/main.ts` for early startup/runtime wiring by prebuilding finalized deps for `applyJellyfinMpvDefaults`, `getDefaultSocketPath`, `overlayContentMeasurementStore`, `subtitleProcessingController`, and config hot-reload message handler. +- [2026-02-20T09:44:47Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + targeted suites pass for `mpv-jellyfin-defaults*`, `config-hot-reload-*`, and `subtitle-processing-controller` (18/18). +- [2026-02-20T09:44:47Z] scope: this commit batch now includes 4 refactor slices (20 normalized `main.ts` handler construction sites) + subagent bookkeeping updates. - [2026-02-20T09:43:47Z] progress: completed larger safe batch in `src/main.ts` across 3 contiguous slices (15 normalized sites) by prebuilding finalized deps objects for AniList media-state handlers, AniList post-watch/retry handlers, and protocol/lifecycle/subtitle-position handlers. - [2026-02-20T09:43:47Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + targeted suites pass for `anilist-media-state*`, `anilist-media-guess*`, `anilist-post-watch*`, `subtitle-position*`, `protocol-url-handlers*`, `app-lifecycle-main-activate*`, `startup-config*` (39/39). - [2026-02-20T09:43:47Z] scope: staging only `src/main.ts` + subagent bookkeeping files for one large checkpoint commit; excluding unrelated `vendor/texthooker-ui`, backlog task draft, and other agent files. diff --git a/src/main.ts b/src/main.ts index 5e925cb..7f2d924 100644 --- a/src/main.ts +++ b/src/main.ts @@ -628,8 +628,9 @@ const buildApplyJellyfinMpvDefaultsMainDepsHandler = sendMpvCommandRuntime: (client, command) => sendMpvCommandRuntime(client as never, command), jellyfinLangPref: JELLYFIN_LANG_PREF, }); +const applyJellyfinMpvDefaultsMainDeps = buildApplyJellyfinMpvDefaultsMainDepsHandler(); const applyJellyfinMpvDefaultsHandler = createApplyJellyfinMpvDefaultsHandler( - buildApplyJellyfinMpvDefaultsMainDepsHandler(), + applyJellyfinMpvDefaultsMainDeps, ); function applyJellyfinMpvDefaults(client: MpvIpcClient): void { @@ -701,8 +702,9 @@ const appLogger = { const buildGetDefaultSocketPathMainDepsHandler = createBuildGetDefaultSocketPathMainDepsHandler({ platform: process.platform, }); +const getDefaultSocketPathMainDeps = buildGetDefaultSocketPathMainDepsHandler(); const getDefaultSocketPathHandler = createGetDefaultSocketPathHandler( - buildGetDefaultSocketPathMainDepsHandler(), + getDefaultSocketPathMainDeps, ); function getDefaultSocketPath(): string { @@ -731,8 +733,10 @@ const buildOverlayModalRuntimeMainDepsHandler = createBuildOverlayModalRuntimeMa getMainWindow: () => overlayManager.getMainWindow(), getInvisibleWindow: () => overlayManager.getInvisibleWindow(), }); +const overlayContentMeasurementStoreMainDeps = + buildOverlayContentMeasurementStoreMainDepsHandler(); const overlayContentMeasurementStore = createOverlayContentMeasurementStore( - buildOverlayContentMeasurementStoreMainDepsHandler(), + overlayContentMeasurementStoreMainDeps, ); const overlayModalRuntime = createOverlayModalRuntimeService(buildOverlayModalRuntimeMainDepsHandler()); const appState = createAppState({ @@ -812,8 +816,10 @@ const buildSubtitleProcessingControllerMainDepsHandler = }, now: () => Date.now(), }); +const subtitleProcessingControllerMainDeps = + buildSubtitleProcessingControllerMainDepsHandler(); const subtitleProcessingController = createSubtitleProcessingController( - buildSubtitleProcessingControllerMainDepsHandler(), + subtitleProcessingControllerMainDeps, ); const overlayShortcutsRuntime = createOverlayShortcutsRuntimeService( createBuildOverlayShortcutsRuntimeMainDepsHandler({ @@ -860,8 +866,9 @@ const buildConfigHotReloadMessageMainDepsHandler = createBuildConfigHotReloadMes showMpvOsd: (message) => showMpvOsd(message), showDesktopNotification: (title, options) => showDesktopNotification(title, options), }); +const configHotReloadMessageMainDeps = buildConfigHotReloadMessageMainDepsHandler(); const notifyConfigHotReloadMessage = createConfigHotReloadMessageHandler( - buildConfigHotReloadMessageMainDepsHandler(), + configHotReloadMessageMainDeps, ); const buildWatchConfigPathMainDepsHandler = createBuildWatchConfigPathMainDepsHandler({ fileExists: (targetPath) => fs.existsSync(targetPath),