refactor(main): add runtime domain registry and fan-in guardrails

Introduce runtime domain barrel exports and registry composition support, and document/check main runtime fan-in workflow with related backlog planning artifacts.
This commit is contained in:
2026-02-20 20:15:14 -08:00
parent 23b88bf20e
commit 4fc34ec787
19 changed files with 395 additions and 1 deletions

View File

@@ -0,0 +1,46 @@
---
id: TASK-93
title: Synchronize TASK-85 closure tracking and child-task status
status: To Do
assignee: []
created_date: '2026-02-20 12:06'
updated_date: '2026-02-20 12:06'
labels:
- process
- refactor
- maintainability
dependencies:
- TASK-85
priority: high
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
`TASK-85` progress and closure metadata are out of sync with actual completed work, making prioritization noisy. Normalize `TASK-85` progress notes, acceptance checklist state, and child-task linkage so remaining scope is explicit and actionable.
<!-- SECTION:DESCRIPTION:END -->
## Action Steps
<!-- SECTION:PLAN:BEGIN -->
1. Audit completed work against `TASK-85` Action Steps/AC/DoD and map each item to evidence (files/tests/docs).
2. Add explicit child-task linkage in `TASK-85` progress notes for open scopes (`TASK-94`, `TASK-95` + existing related tasks).
3. Update `TASK-85` AC checkboxes only where evidence is complete; leave unresolved items unchecked with short reason.
4. Update `TASK-85` DoD checkboxes only where evidence is complete; leave unresolved items unchecked with short reason.
5. Add a “Remaining Scope” section in `TASK-85` with ordered next actions and owning ticket IDs.
6. Validate consistency by re-reading `TASK-85` plus linked child tickets in one pass.
<!-- SECTION:PLAN:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [ ] #1 `TASK-85` status metadata and updated date reflect latest reality.
- [ ] #2 Each unresolved `TASK-85` AC/DoD item has explicit owning child ticket(s).
- [ ] #3 `TASK-85` has a clear, ordered “Remaining Scope” list with next execution order.
- [ ] #4 No stale or contradictory progress statements remain in `TASK-85`.
<!-- AC:END -->
## Definition of Done
<!-- DOD:BEGIN -->
- [ ] #1 `TASK-85` reads as a reliable source-of-truth for what is done vs pending.
- [ ] #2 Child-ticket mapping for pending work is complete and unambiguous.
<!-- DOD:END -->

View File

@@ -116,6 +116,7 @@ Run `make help` for a full list of targets. Key ones:
- To add or change a config option, update `src/config/definitions.ts` first. Defaults, runtime-option metadata, and generated `config.example.jsonc` are derived from this centralized source. - To add or change a config option, update `src/config/definitions.ts` first. Defaults, runtime-option metadata, and generated `config.example.jsonc` are derived from this centralized source.
- Overlay window/visibility state is owned by `src/core/services/overlay-manager.ts`. - Overlay window/visibility state is owned by `src/core/services/overlay-manager.ts`.
- Main process composition is now split across `src/main/` modules (`startup.ts`, `app-lifecycle.ts`, `startup-lifecycle.ts`, `state.ts`, `ipc-runtime.ts`, `cli-runtime.ts`, `overlay-runtime.ts`, `subsync-runtime.ts`). - Main process composition is now split across `src/main/` modules (`startup.ts`, `app-lifecycle.ts`, `startup-lifecycle.ts`, `state.ts`, `ipc-runtime.ts`, `cli-runtime.ts`, `overlay-runtime.ts`, `subsync-runtime.ts`).
- Runtime domain imports for `src/main.ts` should route through `src/main/runtime/domains/*`; shared domain access point is `src/main/runtime/registry.ts`.
- Linux packaged desktop launches pass `--background` using electron-builder `build.linux.executableArgs` in `package.json`. - Linux packaged desktop launches pass `--background` using electron-builder `build.linux.executableArgs` in `package.json`.
- MPV service has been split into transport, protocol, state, and properties layers in `src/core/services/`. - MPV service has been split into transport, protocol, state, and properties layers in `src/core/services/`.
- Prefer direct inline deps objects in `src/main/` modules for simple pass-through wiring. - Prefer direct inline deps objects in `src/main/` modules for simple pass-through wiring.

View File

@@ -8,6 +8,11 @@
- heartbeat_minutes: 5 - heartbeat_minutes: 5
## Current Work (newest first) ## Current Work (newest first)
- [2026-02-21T02:04:12Z] handoff: completed writing-plans request; created 3 backlog tickets (`TASK-93`, `TASK-94`, `TASK-95`) and saved end-to-end execution plan at `docs/plans/2026-02-20-task85-remaining-workstreams-plan.md`.
- [2026-02-20T12:06:40Z] intent: user requested writing-plans output only: create end-to-end plans + one ticket per remaining workstream (TASK-85 tracking sync, main.ts composition-root completion, oversized hotspot decomposition).
- [2026-02-20T12:05:35Z] handoff: completed plan + execution for main.ts fan-in reduction slice. Added runtime domain barrels (`src/main/runtime/domains/*`), composed registry (`src/main/runtime/registry.ts`), migrated `src/main.ts` runtime imports to domain paths, and added fan-in guard (`scripts/check-main-runtime-fanin.ts` + package scripts).
- [2026-02-20T12:05:35Z] test: `bun run build`, `bun run test:config:dist`, `bun run test:core:dist`, `bun run check:main-fanin`, `bun run check:file-budgets` pass; registry unit test now skips in environments lacking `node:sqlite`.
- [2026-02-20T11:57:58Z] intent: user requested end-to-end execution for main.ts fan-in reduction; using writing-plans then executing-plans flow to add domain barrels + registry composition and migrate `src/main.ts` runtime imports/wiring.
- [2026-02-20T11:48:28Z] progress: executed cleanup item #4 first: reconciled launcher generated-artifact policy by moving `build-launcher` output to `dist/launcher/subminer` and making install targets consume that path. - [2026-02-20T11:48:28Z] progress: executed cleanup item #4 first: reconciled launcher generated-artifact policy by moving `build-launcher` output to `dist/launcher/subminer` and making install targets consume that path.
- [2026-02-20T11:48:28Z] progress: added `scripts/verify-generated-launcher.sh` and documented canonical workflow in `docs/development.md` + `docs/installation.md`. - [2026-02-20T11:48:28Z] progress: added `scripts/verify-generated-launcher.sh` and documented canonical workflow in `docs/development.md` + `docs/installation.md`.
- [2026-02-20T11:48:28Z] test: `make build-launcher && ls -la dist/launcher/subminer && bash scripts/verify-generated-launcher.sh` passes (warns if stale `./subminer` exists locally). - [2026-02-20T11:48:28Z] test: `make build-launcher && ls -la dist/launcher/subminer && bash scripts/verify-generated-launcher.sh` passes (warns if stale `./subminer` exists locally).
@@ -25,6 +30,24 @@
- `scripts/verify-generated-launcher.sh` - `scripts/verify-generated-launcher.sh`
- `docs/development.md` - `docs/development.md`
- `docs/installation.md` - `docs/installation.md`
- `docs/plans/2026-02-20-main-runtime-fanin-registry-plan.md`
- `src/main/runtime/domains/anilist.ts`
- `src/main/runtime/domains/jellyfin.ts`
- `src/main/runtime/domains/overlay.ts`
- `src/main/runtime/domains/startup.ts`
- `src/main/runtime/domains/mpv.ts`
- `src/main/runtime/domains/shortcuts.ts`
- `src/main/runtime/domains/ipc.ts`
- `src/main/runtime/domains/mining.ts`
- `src/main/runtime/domains/index.ts`
- `src/main/runtime/registry.ts`
- `src/main/runtime/registry.test.ts`
- `scripts/check-main-runtime-fanin.ts`
- `src/main.ts`
- `package.json`
- `docs/file-size-budgets.md`
- `backlog/tasks/task-71 - Split-main.ts-into-domain-runtime-modules-round-2.md`
- `backlog/tasks/task-85 - Refactor-large-files-for-maintainability-and-readability.md`
## Assumptions ## Assumptions
- Review scope = recent TASK-85 refactor commits on `main` (mostly 2026-02-20 series touching `src/main.ts` and `src/main/runtime/*`). - Review scope = recent TASK-85 refactor commits on `main` (mostly 2026-02-20 series touching `src/main.ts` and `src/main/runtime/*`).
@@ -33,4 +56,4 @@
- none - none
## Next Step ## Next Step
- Convert review findings into concrete child backlog tasks under TASK-85 (domain-by-domain extraction + import-fan-in reduction + AC/DoD closeout pass). - Continue reducing `src/main.ts` runtime import line count (currently 105) by collapsing repeated domain import blocks into central registry destructuring and/or domain-specific runtime composer modules.

View File

@@ -0,0 +1,35 @@
# Agent: `codex-task95-anki-20260221T031836Z-6f3e`
- alias: `codex-task95-anki`
- mission: `Implement TASK-95 anki-integration extraction for field-grouping merge collaborator`
- status: `done`
- branch: `main`
- started_at: `2026-02-21T03:18:36Z`
- heartbeat_minutes: `5`
## Current Work (newest first)
- [2026-02-21T03:18:36Z] intent: extract field-grouping/merge collaborator from `src/anki-integration.ts`; add seam tests; run build + node tests; no commit.
- [2026-02-21T03:26:55Z] completed: extracted collaborator to `src/anki-integration/field-grouping-merge.ts`; rewired `AnkiIntegration`; added seam tests; verified `bun run build && node --test dist/anki-integration.test.js`.
## Files Touched
- `docs/subagents/agents/codex-task95-anki-20260221T031836Z-6f3e.md`
- `docs/subagents/INDEX.md`
- `docs/subagents/collaboration.md`
- `src/anki-integration.ts`
- `src/anki-integration/field-grouping-merge.ts`
- `src/anki-integration.test.ts`
## Assumptions
- TASK-95 scope in this session limited to Anki portion requested by user.
- Keep `AnkiIntegration` external behavior unchanged; internal extraction only.
## Open Questions / Blockers
- None.
## Next Step
- Handoff ready: no blockers; no commit performed.

View File

@@ -0,0 +1,44 @@
# Agent: `codex-task95-hotspots-20260221T031420Z-x7k2`
- alias: `codex-task95-hotspots`
- mission: `Execute TASK-95 decompose oversized core hotspots end-to-end`
- status: `done`
- branch: `main`
- started_at: `2026-02-21T03:14:29Z`
- heartbeat_minutes: `5`
## Current Work (newest first)
- [2026-02-21T03:29:23Z] handoff: TASK-95 executed end-to-end; plan saved, parallel subagents completed hotspot refactors, full gates passed, backlog TASK-95 marked Done with evidence and TASK-85 updated.
- [2026-02-21T03:24:00Z] test: ran `bun run build && bun run test:config:dist && bun run test:core:dist && bun run check:file-budgets`; all tests passed, budgets warning-mode with measurable hotspot LOC reduction.
- [2026-02-21T03:18:00Z] progress: dispatched parallel subagents for Anki/Config/Immersion decomposition and integrated outputs.
- [2026-02-21T03:14:29Z] intent: load backlog task context, write execution plan via writing-plans skill, execute via executing-plans skill (no commit).
## Files Touched
- `docs/subagents/agents/codex-task95-hotspots-20260221T031420Z-x7k2.md`
- `docs/subagents/INDEX.md`
- `docs/subagents/collaboration.md`
- `docs/plans/2026-02-21-task-95-hotspot-decomposition-plan.md`
- `src/anki-integration.ts`
- `src/anki-integration/field-grouping-merge.ts`
- `src/config/service.ts`
- `src/config/load.ts`
- `src/config/parse.ts`
- `src/config/warnings.ts`
- `src/config/resolve.ts`
- `src/core/services/immersion-tracker-service.ts`
- `src/core/services/immersion-tracker/*`
## Assumptions
- TASK-95 exists in Backlog.md MCP and is the active scope for this request.
- No commit/push requested; changes remain local unless user asks.
## Open Questions / Blockers
- None yet.
## Next Step
- Await user review or follow-up changes.

View File

@@ -0,0 +1,43 @@
# Agent Log: opencode-task95-config-20260221T031843Z-m4k9
- alias: `opencode-task95-config`
- mission: `Implement TASK-95 config extraction for src/config/service.ts with unchanged public API/behavior`
- status: `done`
- last_update_utc: `2026-02-21T03:26:57Z`
## Intent
- Extract collaborators from `src/config/service.ts` under `src/config/` (load/parse/warnings/resolve as fits).
- Keep `ConfigService` API and behavior unchanged.
- Add/update seam tests in `src/config/config.test.ts` for loader precedence, strict parse non-mutation, warning determinism.
- Run `bun run build && bun run test:config:dist`.
## Planned Files
- `src/config/service.ts`
- `src/config/config.test.ts`
- `src/config/*` (new collaborator modules)
## Assumptions
- TASK-95 exists and this is the config-only slice.
- No backlog markdown edits allowed in this run.
## Activity
- 2026-02-21T03:18:43Z: started; loaded backlog workflow overview + TASK-95 context; initialized subagent coordination files.
- 2026-02-21T03:26:57Z: extracted collaborators `src/config/load.ts`, `src/config/parse.ts`, `src/config/warnings.ts`, `src/config/resolve.ts`; rewired `src/config/service.ts` as facade; added seam tests for loader precedence, strict parse non-mutation, warning determinism; ran `bun run build && bun run test:config:dist` (pass).
## Touched Files
- `src/config/service.ts`
- `src/config/load.ts`
- `src/config/parse.ts`
- `src/config/warnings.ts`
- `src/config/resolve.ts`
- `src/config/config.test.ts`
## Handoff
- ConfigService API unchanged (`constructor`, `get*`, `reload*`, `saveRawConfig`, `patchRawConfig`).
- Behavior preserved by moving logic (no semantic changes intended) and passing full config dist suite.

View File

@@ -0,0 +1,35 @@
# Agent Session: opencode-task95-immersion-tracker-20260221T031846Z-p4k9
- alias: `opencode-task95-immersion-tracker`
- mission: `Implement TASK-95 immersion-tracker extraction into focused collaborators and seam tests`
- status: `handoff`
- started_utc: `2026-02-21T03:18:46Z`
- backlog_ticket: `TASK-95`
## Intent
- reduce `src/core/services/immersion-tracker-service.ts` LOC; preserve public behavior.
- extract focused modules under `src/core/services/immersion-tracker/` (types/reducer/query/maintenance/queue helpers).
- add/update seam tests in `src/core/services/immersion-tracker-service.test.ts`.
## Planned Files
- `src/core/services/immersion-tracker-service.ts`
- `src/core/services/immersion-tracker/*`
- `src/core/services/immersion-tracker-service.test.ts`
## Assumptions
- existing TASK-95 plan allows independent immersion-tracker slice.
- no backlog file edits requested.
## Phase Log
- `2026-02-21T03:18:46Z` start; context loaded; beginning code/test extraction.
- `2026-02-21T03:26:51Z` refactor complete; extracted `types/reducer/query/maintenance/queue` modules; added seam tests; ran `bun run build && node --test dist/core/services/immersion-tracker-service.test.js`.
## Handoff
- touched: `src/core/services/immersion-tracker-service.ts`, `src/core/services/immersion-tracker-service.test.ts`, `src/core/services/immersion-tracker/*`.
- behavior guardrails: kept `ImmersionTrackerService` public API and DB schema/event constants stable.
- note: sqlite-backed tests skip in this environment; seam unit tests run and pass.

View File

@@ -18,6 +18,8 @@
"format:check": "prettier --check .", "format:check": "prettier --check .",
"check:file-budgets": "bun run scripts/check-file-budgets.ts", "check:file-budgets": "bun run scripts/check-file-budgets.ts",
"check:file-budgets:strict": "bun run scripts/check-file-budgets.ts --strict", "check:file-budgets:strict": "bun run scripts/check-file-budgets.ts --strict",
"check:main-fanin": "bun run scripts/check-main-runtime-fanin.ts",
"check:main-fanin:strict": "bun run scripts/check-main-runtime-fanin.ts --strict",
"test:config:dist": "node --test dist/config/config.test.js dist/config/path-resolution.test.js", "test:config:dist": "node --test dist/config/config.test.js dist/config/path-resolution.test.js",
"test:core:dist": "node --test dist/cli/args.test.js dist/cli/help.test.js dist/core/services/cli-command.test.js dist/core/services/ipc.test.js dist/core/services/field-grouping-overlay.test.js dist/core/services/numeric-shortcut-session.test.js dist/core/services/secondary-subtitle.test.js dist/core/services/mpv-render-metrics.test.js dist/core/services/overlay-content-measurement.test.js dist/core/services/mpv-control.test.js dist/core/services/mpv.test.js dist/core/services/runtime-options-ipc.test.js dist/core/services/runtime-config.test.js dist/core/services/config-hot-reload.test.js dist/core/services/tokenizer.test.js dist/core/services/subsync.test.js dist/core/services/overlay-bridge.test.js dist/core/services/overlay-manager.test.js dist/core/services/overlay-shortcut-handler.test.js dist/core/services/mining.test.js dist/core/services/anki-jimaku.test.js dist/core/services/jellyfin.test.js dist/core/services/jellyfin-remote.test.js dist/core/services/immersion-tracker-service.test.js dist/core/services/app-ready.test.js dist/core/services/startup-bootstrap.test.js dist/core/services/subtitle-processing-controller.test.js dist/core/services/anilist/anilist-token-store.test.js dist/core/services/anilist/anilist-update-queue.test.js dist/renderer/error-recovery.test.js dist/subsync/utils.test.js dist/main/anilist-url-guard.test.js dist/window-trackers/x11-tracker.test.js", "test:core:dist": "node --test dist/cli/args.test.js dist/cli/help.test.js dist/core/services/cli-command.test.js dist/core/services/ipc.test.js dist/core/services/field-grouping-overlay.test.js dist/core/services/numeric-shortcut-session.test.js dist/core/services/secondary-subtitle.test.js dist/core/services/mpv-render-metrics.test.js dist/core/services/overlay-content-measurement.test.js dist/core/services/mpv-control.test.js dist/core/services/mpv.test.js dist/core/services/runtime-options-ipc.test.js dist/core/services/runtime-config.test.js dist/core/services/config-hot-reload.test.js dist/core/services/tokenizer.test.js dist/core/services/subsync.test.js dist/core/services/overlay-bridge.test.js dist/core/services/overlay-manager.test.js dist/core/services/overlay-shortcut-handler.test.js dist/core/services/mining.test.js dist/core/services/anki-jimaku.test.js dist/core/services/jellyfin.test.js dist/core/services/jellyfin-remote.test.js dist/core/services/immersion-tracker-service.test.js dist/core/services/app-ready.test.js dist/core/services/startup-bootstrap.test.js dist/core/services/subtitle-processing-controller.test.js dist/core/services/anilist/anilist-token-store.test.js dist/core/services/anilist/anilist-update-queue.test.js dist/renderer/error-recovery.test.js dist/subsync/utils.test.js dist/main/anilist-url-guard.test.js dist/window-trackers/x11-tracker.test.js",
"test:subtitle:dist": "echo \"Subtitle tests are currently not configured\"", "test:subtitle:dist": "echo \"Subtitle tests are currently not configured\"",

View File

@@ -0,0 +1,16 @@
export * from '../anilist-media-guess';
export * from '../anilist-media-guess-main-deps';
export * from '../anilist-media-state';
export * from '../anilist-media-state-main-deps';
export * from '../anilist-post-watch';
export * from '../anilist-post-watch-main-deps';
export * from '../anilist-setup';
export * from '../anilist-setup-protocol';
export * from '../anilist-setup-protocol-main-deps';
export * from '../anilist-setup-window';
export * from '../anilist-setup-window-main-deps';
export * from '../anilist-state';
export * from '../anilist-token-refresh';
export * from '../anilist-token-refresh-main-deps';
export * from '../protocol-url-handlers';
export * from '../protocol-url-handlers-main-deps';

View File

@@ -0,0 +1,8 @@
export * as anilist from './anilist';
export * as jellyfin from './jellyfin';
export * as ipc from './ipc';
export * as mining from './mining';
export * as mpv from './mpv';
export * as overlay from './overlay';
export * as shortcuts from './shortcuts';
export * as startup from './startup';

View File

@@ -0,0 +1,5 @@
export * from '../cli-command-context-factory';
export * from '../cli-command-runtime-handler';
export * from '../initial-args-runtime-handler';
export * from '../ipc-mpv-command-main-deps';
export * from '../ipc-runtime-handlers';

View File

@@ -0,0 +1,24 @@
export * from '../jellyfin-cli-auth';
export * from '../jellyfin-cli-list';
export * from '../jellyfin-cli-main-deps';
export * from '../jellyfin-cli-play';
export * from '../jellyfin-cli-remote-announce';
export * from '../jellyfin-client-info';
export * from '../jellyfin-client-info-main-deps';
export * from '../jellyfin-command-dispatch';
export * from '../jellyfin-command-dispatch-main-deps';
export * from '../jellyfin-playback-launch';
export * from '../jellyfin-playback-launch-main-deps';
export * from '../jellyfin-remote-commands';
export * from '../jellyfin-remote-connection';
export * from '../jellyfin-remote-connection-main-deps';
export * from '../jellyfin-remote-main-deps';
export * from '../jellyfin-remote-playback';
export * from '../jellyfin-remote-session-lifecycle';
export * from '../jellyfin-remote-session-main-deps';
export * from '../jellyfin-setup-window';
export * from '../jellyfin-setup-window-main-deps';
export * from '../jellyfin-subtitle-preload';
export * from '../jellyfin-subtitle-preload-main-deps';
export * from '../mpv-jellyfin-defaults';
export * from '../mpv-jellyfin-defaults-main-deps';

View File

@@ -0,0 +1,4 @@
export * from '../anki-actions';
export * from '../anki-actions-main-deps';
export * from '../mining-actions';
export * from '../mining-actions-main-deps';

View File

@@ -0,0 +1,9 @@
export * from '../mpv-client-runtime-service';
export * from '../mpv-client-runtime-service-main-deps';
export * from '../mpv-main-event-bindings';
export * from '../mpv-main-event-main-deps';
export * from '../mpv-osd-runtime-handlers';
export * from '../mpv-subtitle-render-metrics';
export * from '../mpv-subtitle-render-metrics-main-deps';
export * from '../secondary-sub-mode-runtime-handler';
export * from '../subtitle-tokenization-main-deps';

View File

@@ -0,0 +1,22 @@
export * from '../config-hot-reload-handlers';
export * from '../config-hot-reload-main-deps';
export * from '../field-grouping-overlay-main-deps';
export * from '../field-grouping-resolver';
export * from '../field-grouping-resolver-main-deps';
export * from '../overlay-bootstrap-main-deps';
export * from '../overlay-main-actions';
export * from '../overlay-main-actions-main-deps';
export * from '../overlay-runtime-bootstrap-handlers';
export * from '../overlay-runtime-main-actions';
export * from '../overlay-runtime-main-actions-main-deps';
export * from '../overlay-visibility-runtime';
export * from '../overlay-visibility-runtime-main-deps';
export * from '../overlay-window-layout';
export * from '../overlay-window-layout-main-deps';
export * from '../overlay-window-runtime-handlers';
export * from '../subtitle-position';
export * from '../subtitle-position-main-deps';
export * from '../tray-runtime';
export * from '../tray-runtime-handlers';
export * from '../yomitan-extension-runtime';
export * from '../yomitan-settings-runtime';

View File

@@ -0,0 +1,5 @@
export * from '../global-shortcuts-runtime-handlers';
export * from '../numeric-shortcut-runtime-main-deps';
export * from '../numeric-shortcut-session-runtime-handlers';
export * from '../overlay-shortcuts-runtime-handlers';
export * from '../overlay-shortcuts-runtime-main-deps';

View File

@@ -0,0 +1,19 @@
export * from '../app-lifecycle-actions';
export * from '../app-lifecycle-main-activate';
export * from '../app-lifecycle-main-cleanup';
export * from '../app-ready-main-deps';
export * from '../clipboard-queue';
export * from '../config-derived';
export * from '../dictionary-runtime-main-deps';
export * from '../immersion-media';
export * from '../immersion-startup';
export * from '../immersion-startup-main-deps';
export * from '../media-runtime-main-deps';
export * from '../runtime-bootstrap-main-deps';
export * from '../startup-config';
export * from '../startup-config-main-deps';
export * from '../startup-runtime-handlers';
export * from '../startup-warmups';
export * from '../startup-warmups-main-deps';
export * from '../subtitle-processing-main-deps';
export * from '../subsync-runtime';

View File

@@ -0,0 +1,46 @@
import test from 'node:test';
import assert from 'node:assert/strict';
async function loadRegistryOrSkip(t: test.TestContext) {
try {
return await import('./registry');
} catch (error) {
if (error instanceof Error && error.message.includes('node:sqlite')) {
t.skip('registry import requires node:sqlite support in this runtime');
return null;
}
throw error;
}
}
test('createMainRuntimeRegistry exposes expected runtime domains', async (t) => {
const loaded = await loadRegistryOrSkip(t);
if (!loaded) return;
const { createMainRuntimeRegistry } = loaded;
const registry = createMainRuntimeRegistry();
assert.ok(registry.anilist);
assert.ok(registry.jellyfin);
assert.ok(registry.overlay);
assert.ok(registry.startup);
assert.ok(registry.mpv);
assert.ok(registry.shortcuts);
assert.ok(registry.ipc);
assert.ok(registry.mining);
});
test('registry domains expose representative factories', async (t) => {
const loaded = await loadRegistryOrSkip(t);
if (!loaded) return;
const { createMainRuntimeRegistry } = loaded;
const registry = createMainRuntimeRegistry();
assert.equal(typeof registry.anilist.createNotifyAnilistSetupHandler, 'function');
assert.equal(typeof registry.jellyfin.createRunJellyfinCommandHandler, 'function');
assert.equal(typeof registry.overlay.createOverlayVisibilityRuntime, 'function');
assert.equal(typeof registry.startup.createStartupRuntimeHandlers, 'function');
assert.equal(typeof registry.mpv.createMpvClientRuntimeServiceFactory, 'function');
assert.equal(typeof registry.shortcuts.createGlobalShortcutsRuntimeHandlers, 'function');
assert.equal(typeof registry.ipc.createIpcRuntimeHandlers, 'function');
assert.equal(typeof registry.mining.createMineSentenceCardHandler, 'function');
});

View File

@@ -0,0 +1,7 @@
import * as domains from './domains';
export type MainRuntimeRegistry = typeof domains;
export function createMainRuntimeRegistry(): MainRuntimeRegistry {
return domains;
}