From e73381aa366f1db56c6fa71ca7c038afd6f20b07 Mon Sep 17 00:00:00 2001 From: sudacode Date: Fri, 20 Feb 2026 01:39:32 -0800 Subject: [PATCH] refactor: prebuild global shortcut and mpv log handler deps --- .../codex-task85-20260219T233711Z-46hc.md | 2 ++ src/main.ts | 32 ++++++++++--------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/docs/subagents/agents/codex-task85-20260219T233711Z-46hc.md b/docs/subagents/agents/codex-task85-20260219T233711Z-46hc.md index 0f2a7a5..31b5c69 100644 --- a/docs/subagents/agents/codex-task85-20260219T233711Z-46hc.md +++ b/docs/subagents/agents/codex-task85-20260219T233711Z-46hc.md @@ -416,3 +416,5 @@ - [2026-02-20T09:35:02Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + `protocol-url-handlers*` and `secondary-sub-mode-main-deps` tests pass. - [2026-02-20T09:35:02Z] progress: prebuilt setup-window focus handlers (`maybeFocusExistingAnilistSetupWindow`, `maybeFocusExistingJellyfinSetupWindow`) and injected them into corresponding main deps builders in `main.ts`. - [2026-02-20T09:35:02Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + setup-window suites pass (`anilist-setup-window*`, `jellyfin-setup-window*`). +- [2026-02-20T09:37:12Z] progress: completed one consolidated 5-block normalization batch in `main.ts` by prebuilding finalized deps objects before handler creation for `getConfiguredShortcuts`, `registerGlobalShortcuts`, `refreshGlobalAndOverlayShortcuts`, `appendToMpvLog`, and `showMpvOsd`. +- [2026-02-20T09:37:12Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + targeted suites pass for `global-shortcuts*` and `mpv-osd-log*`. diff --git a/src/main.ts b/src/main.ts index 02f0d3f..7544bef 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2476,9 +2476,10 @@ const buildGetConfiguredShortcutsMainDepsHandler = createBuildGetConfiguredShort resolveConfiguredShortcuts, }, ); -const getConfiguredShortcutsHandler = createGetConfiguredShortcutsHandler({ - ...buildGetConfiguredShortcutsMainDepsHandler(), -}); +const getConfiguredShortcutsMainDeps = buildGetConfiguredShortcutsMainDepsHandler(); +const getConfiguredShortcutsHandler = createGetConfiguredShortcutsHandler( + getConfiguredShortcutsMainDeps, +); const buildRegisterGlobalShortcutsMainDepsHandler = createBuildRegisterGlobalShortcutsMainDepsHandler({ @@ -2490,9 +2491,10 @@ const buildRegisterGlobalShortcutsMainDepsHandler = isDev, getMainWindow: () => overlayManager.getMainWindow(), }); -const registerGlobalShortcutsHandler = createRegisterGlobalShortcutsHandler({ - ...buildRegisterGlobalShortcutsMainDepsHandler(), -}); +const registerGlobalShortcutsMainDeps = buildRegisterGlobalShortcutsMainDepsHandler(); +const registerGlobalShortcutsHandler = createRegisterGlobalShortcutsHandler( + registerGlobalShortcutsMainDeps, +); const buildRefreshGlobalAndOverlayShortcutsMainDepsHandler = createBuildRefreshGlobalAndOverlayShortcutsMainDepsHandler({ @@ -2500,9 +2502,11 @@ const buildRefreshGlobalAndOverlayShortcutsMainDepsHandler = registerGlobalShortcuts: () => registerGlobalShortcuts(), syncOverlayShortcuts: () => syncOverlayShortcuts(), }); -const refreshGlobalAndOverlayShortcutsHandler = createRefreshGlobalAndOverlayShortcutsHandler({ - ...buildRefreshGlobalAndOverlayShortcutsMainDepsHandler(), -}); +const refreshGlobalAndOverlayShortcutsMainDeps = + buildRefreshGlobalAndOverlayShortcutsMainDepsHandler(); +const refreshGlobalAndOverlayShortcutsHandler = createRefreshGlobalAndOverlayShortcutsHandler( + refreshGlobalAndOverlayShortcutsMainDeps, +); function registerGlobalShortcuts(): void { registerGlobalShortcutsHandler(); @@ -2544,9 +2548,8 @@ const buildAppendToMpvLogMainDepsHandler = createBuildAppendToMpvLogMainDepsHand appendFileSync: (targetPath, data, options) => fs.appendFileSync(targetPath, data, options), now: () => new Date(), }); -const appendToMpvLogHandler = createAppendToMpvLogHandler({ - ...buildAppendToMpvLogMainDepsHandler(), -}); +const appendToMpvLogMainDeps = buildAppendToMpvLogMainDepsHandler(); +const appendToMpvLogHandler = createAppendToMpvLogHandler(appendToMpvLogMainDeps); const buildShowMpvOsdMainDepsHandler = createBuildShowMpvOsdMainDepsHandler({ appendToMpvLog: (message) => appendToMpvLog(message), @@ -2555,9 +2558,8 @@ const buildShowMpvOsdMainDepsHandler = createBuildShowMpvOsdMainDepsHandler({ getMpvClient: () => appState.mpvClient, logInfo: (line) => logger.info(line), }); -const showMpvOsdHandler = createShowMpvOsdHandler({ - ...buildShowMpvOsdMainDepsHandler(), -}); +const showMpvOsdMainDeps = buildShowMpvOsdMainDepsHandler(); +const showMpvOsdHandler = createShowMpvOsdHandler(showMpvOsdMainDeps); function showMpvOsd(text: string): void { showMpvOsdHandler(text);