mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-27 18:22:41 -08:00
refactor(core): normalize core service naming
Standardize core service module and export names to reduce naming ambiguity and make imports predictable across runtime, tests, scripts, and docs.
This commit is contained in:
@@ -222,7 +222,7 @@ flowchart TD
|
||||
- **Better reviewability:** PRs can be scoped to one subsystem.
|
||||
- **Backward compatibility:** CLI flags and IPC channels can remain stable while internals evolve.
|
||||
- **Extracted composition root:** TASK-27 refactored `main.ts` into focused modules under `src/main/`, isolating startup, lifecycle, IPC, CLI, and domain-specific runtime wiring.
|
||||
- **Split MPV service:** TASK-27.4 separated `mpv-service.ts` into transport (`mpv-transport.ts`), protocol (`mpv-protocol.ts`), state (`mpv-state.ts`), and properties (`mpv-properties.ts`) layers for improved maintainability.
|
||||
- **Split MPV service:** TASK-27.4 separated `mpv.ts` into transport (`mpv-transport.ts`), protocol (`mpv-protocol.ts`), state (`mpv-state.ts`), and properties (`mpv-properties.ts`) layers for improved maintainability.
|
||||
|
||||
## Extension Rules
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ Run `make help` for a full list of targets. Key ones:
|
||||
## Contributor Notes
|
||||
|
||||
- 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-service.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`).
|
||||
- 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.
|
||||
|
||||
@@ -8,8 +8,8 @@ Date: 2026-02-14
|
||||
| --- | --- | --- | --- |
|
||||
| `src/main.ts` | Bootstrap / composition root / orchestration | Active | Main entrypoint owns startup, lifecycle orchestration, service construction, state mutation surfaces, and IPC bindings |
|
||||
| `src/anki-integration.ts` | Domain service orchestration / integrations | Active | 2.6k+ LOC, high cyclomatic coupling to mpv/subtitle timing and mining flows |
|
||||
| `src/core/services/mpv-service.ts` | MPV protocol + app state bridge | Active | ~780 LOC, large protocol and behavior mix, 22-entry dep interface |
|
||||
| `src/core/services/subsync-service.ts` | Subsync orchestration (ffsubsync/alass workflows) | Active | ~494 LOC, file IO + mpv command orchestration + result shaping |
|
||||
| `src/core/services/mpv.ts` | MPV protocol + app state bridge | Active | ~780 LOC, large protocol and behavior mix, 22-entry dep interface |
|
||||
| `src/core/services/subsync.ts` | Subsync orchestration (ffsubsync/alass workflows) | Active | ~494 LOC, file IO + mpv command orchestration + result shaping |
|
||||
| `src/renderer/positioning.ts` | Renderer positioning layout policy | Active (downstream of TASK-27.5) | 513 LOC, layout/rules + platform-specific behavior in one module |
|
||||
| `src/config/service.ts` | Config load/validation | Active support | ~601 LOC, central schema validation + mutation APIs |
|
||||
| `src/types.ts` | Shared contract surface | Active support | ~640 LOC, foundational type exports driving module boundaries |
|
||||
@@ -34,7 +34,7 @@ Date: 2026-02-14
|
||||
- Electron event loop (`app.whenReady`, `process` signals)
|
||||
- startup/bootstrap services, service adapters in `src/core/services`
|
||||
|
||||
### `src/core/services/mpv-service.ts` (protocol + facade)
|
||||
### `src/core/services/mpv.ts` (protocol + facade)
|
||||
|
||||
- **Core exports**: `MpvIpcClient`, `MPV_REQUEST_ID_SECONDARY_SUB_VISIBILITY`, `MpvIpcClientDeps`
|
||||
- **Primary responsibilities / API**:
|
||||
@@ -45,9 +45,9 @@ Date: 2026-02-14
|
||||
- state restoration (`restorePreviousSecondarySubVisibility`)
|
||||
- **Current caller set**:
|
||||
- `src/main.ts` (construction + lifecycle + service invocations)
|
||||
- `src/core/services/mpv-control-service.ts` (runtime control API)
|
||||
- `src/core/services/subsync-service.ts` (`requestProperty`, request ID usage)
|
||||
- tests under `src/core/services/mpv-service.test.ts`
|
||||
- `src/main/ipc-mpv-command.ts` (runtime control API)
|
||||
- `src/core/services/subsync.ts` (`requestProperty`, request ID usage)
|
||||
- tests under `src/core/services/mpv.test.ts`
|
||||
- **Observed coupling risk**:
|
||||
- `MpvIpcClientDeps` mixes protocol config with app-level side effects (subtitle broadcast, tokenizer, overlay updates, config reads)
|
||||
|
||||
@@ -61,15 +61,15 @@ Date: 2026-02-14
|
||||
- **State dependencies (constructor)**:
|
||||
- config, subtitle timing tracker, mpv client, OSD/notification callbacks
|
||||
- **Primary callers**:
|
||||
- `src/core/services/overlay-runtime-init-service.ts` (initial integration creation)
|
||||
- `src/core/services/anki-jimaku-service.ts` (enable/disable and field-grouping RPC)
|
||||
- `src/core/services/mining-service.ts` (delegates mining actions)
|
||||
- `src/core/services/overlay-runtime-init.ts` (initial integration creation)
|
||||
- `src/core/services/anki-jimaku.ts` (enable/disable and field-grouping RPC)
|
||||
- `src/core/services/mining.ts` (delegates mining actions)
|
||||
|
||||
### `src/core/services/subsync-service.ts`
|
||||
### `src/core/services/subsync.ts`
|
||||
|
||||
- **Exports**: `runSubsyncManualService`, `openSubsyncManualPickerService`, `triggerSubsyncFromConfigService`
|
||||
- **Caller set**:
|
||||
- `src/core/services/subsync-runner-service.ts` (runtime wrappers)
|
||||
- `src/core/services/subsync-runner.ts` (runtime wrappers)
|
||||
- `src/core/services/mpv-jimaku/`? (through runtime services and IPC command handlers)
|
||||
|
||||
### `src/config/service.ts`
|
||||
|
||||
Reference in New Issue
Block a user