mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-28 06:22:45 -08:00
2.2 KiB
2.2 KiB
Architecture
SubMiner is migrating from a single, monolithic src/main.ts runtime toward a composable architecture with clear extension points.
Current Structure
src/main.ts: bootstrap/composition root plus remaining legacy orchestration.src/core/: shared runtime primitives:app-orchestrator.ts: lifecycle wiring for ready/activate/quit hooks.action-bus.ts: typed action dispatch path.actions.ts: canonical app action types.module.ts/module-registry.ts: module lifecycle contract.services/: extracted runtime services (IPC, shortcuts, subtitle, overlay, MPV command routing).
src/ipc/: shared IPC contract + wrappers used by main, preload, and renderer.src/subtitle/: staged subtitle pipeline (normalize->tokenize->merge).src/modules/: feature modules:runtime-optionsjimakusubsyncankitexthooker
- provider registries:
src/window-trackers/index.tssrc/tokenizers/index.tssrc/token-mergers/index.tssrc/translators/index.tssrc/subsync/engines.ts
Migration Status
- Completed:
- Action bus wired for CLI, shortcuts, and IPC-triggered commands.
- Command/action mapping covered by focused core tests.
- Shared IPC channel contract adopted across main/preload/renderer.
- Runtime options extracted into module lifecycle.
- Provider registries replace hardcoded backend selection.
- Subtitle tokenization/merge/enrich flow moved to staged pipeline.
- Stage-level subtitle pipeline tests added for deterministic behavior.
- Jimaku, Subsync, Anki, and texthooker/websocket flows moduleized.
- In progress:
- Further shrink
src/main.tsby moving orchestration into dedicated services/orchestrator files. - Continue moduleizing remaining integrations with complex lifecycle coupling.
- Further shrink
Design Rules
- New feature behavior should be added as:
- a module (
src/modules/*) and/or - a provider registration (
src/*/index.tsregistries), instead of editing unrelated branches insrc/main.ts.
- a module (
- New command triggers should dispatch
AppActionand reuse existing action handlers. - New IPC channels should be added only via
src/ipc/contract.ts.