From 416942ff2d1c60e594cbd1faf31b552d42be86ca Mon Sep 17 00:00:00 2001 From: sudacode Date: Thu, 26 Mar 2026 22:32:11 -0700 Subject: [PATCH] chore(backlog): add mining workflow milestone and tasks --- .../m-2 - mining-workflow-upgrades.md | 8 +++ ...se-remaining-oversized-runtime-surfaces.md | 55 +++++++++++++++++++ ...lay-window-composition-from-src-main.ts.md | 45 +++++++++++++++ ...eadless-command-wiring-from-src-main.ts.md | 46 ++++++++++++++++ ...-and-shrink-src-types.ts-import-surface.md | 44 +++++++++++++++ ...time-into-fetch-build-and-cache-modules.md | 45 +++++++++++++++ ...y-layer-into-focused-read-model-modules.md | 45 +++++++++++++++ ...ize-high-value-user-facing-improvements.md | 51 +++++++++++++++++ ...-foundations-and-profile-selection-flow.md | 46 ++++++++++++++++ ...ble-command-palette-for-desktop-actions.md | 46 ++++++++++++++++ ...e-Anki-template-preview-for-card-output.md | 45 +++++++++++++++ ...clipping-from-arbitrary-subtitle-ranges.md | 46 ++++++++++++++++ 12 files changed, 522 insertions(+) create mode 100644 backlog/milestones/m-2 - mining-workflow-upgrades.md create mode 100644 backlog/tasks/task-238 - Codebase-health-follow-up-decompose-remaining-oversized-runtime-surfaces.md create mode 100644 backlog/tasks/task-238.1 - Extract-main-window-and-overlay-window-composition-from-src-main.ts.md create mode 100644 backlog/tasks/task-238.2 - Extract-CLI-and-headless-command-wiring-from-src-main.ts.md create mode 100644 backlog/tasks/task-238.3 - Introduce-domain-type-entrypoints-and-shrink-src-types.ts-import-surface.md create mode 100644 backlog/tasks/task-238.4 - Decompose-character-dictionary-runtime-into-fetch-build-and-cache-modules.md create mode 100644 backlog/tasks/task-238.5 - Split-immersion-tracker-query-layer-into-focused-read-model-modules.md create mode 100644 backlog/tasks/task-239 - Mining-workflow-upgrades-prioritize-high-value-user-facing-improvements.md create mode 100644 backlog/tasks/task-239.1 - Add-profile-aware-config-foundations-and-profile-selection-flow.md create mode 100644 backlog/tasks/task-239.2 - Add-a-searchable-command-palette-for-desktop-actions.md create mode 100644 backlog/tasks/task-239.3 - Add-live-Anki-template-preview-for-card-output.md create mode 100644 backlog/tasks/task-239.4 - Add-sentence-clipping-from-arbitrary-subtitle-ranges.md diff --git a/backlog/milestones/m-2 - mining-workflow-upgrades.md b/backlog/milestones/m-2 - mining-workflow-upgrades.md new file mode 100644 index 0000000..32b1e65 --- /dev/null +++ b/backlog/milestones/m-2 - mining-workflow-upgrades.md @@ -0,0 +1,8 @@ +--- +id: m-2 +title: 'Mining Workflow Upgrades' +--- + +## Description + +Future user-facing workflow improvements that directly improve discoverability, previewability, and mining control without depending on speculative platform integrations like OCR, marketplace infrastructure, or cloud sync. diff --git a/backlog/tasks/task-238 - Codebase-health-follow-up-decompose-remaining-oversized-runtime-surfaces.md b/backlog/tasks/task-238 - Codebase-health-follow-up-decompose-remaining-oversized-runtime-surfaces.md new file mode 100644 index 0000000..79dd81d --- /dev/null +++ b/backlog/tasks/task-238 - Codebase-health-follow-up-decompose-remaining-oversized-runtime-surfaces.md @@ -0,0 +1,55 @@ +--- +id: TASK-238 +title: Codebase health follow-up: decompose remaining oversized runtime surfaces +status: To Do +assignee: [] +created_date: '2026-03-26 20:49' +labels: + - tech-debt + - maintainability + - runtime +milestone: m-0 +dependencies: [] +references: + - src/main.ts + - src/types.ts + - src/main/character-dictionary-runtime.ts + - src/core/services/immersion-tracker/query.ts + - backlog/tasks/task-87 - Codebase-health-harden-verification-and-retire-dead-architecture-identified-in-the-March-2026-review.md + - backlog/completed/task-87.4 - Runtime-composition-root-remove-dead-symbols-and-tighten-module-boundaries-in-src-main.ts.md + - backlog/completed/task-87.6 - Anki-integration-maintainability-continue-decomposing-the-oversized-orchestration-layer.md +priority: high +--- + +## Description + + +Follow up the March 2026 codebase-health work with a narrower pass over the biggest remaining production hotspots. The latest review correctly flags `src/main.ts` and `src/types.ts` as maintainability pressure, but it also misses the next real large surfaces that will keep slowing future work: `src/main/character-dictionary-runtime.ts` and `src/core/services/immersion-tracker/query.ts`. This parent task should track focused decomposition work that preserves behavior, avoids redoing already-completed dead-architecture cleanup, and keeps each slice small enough for isolated implementation. + + +## Acceptance Criteria + + +- [ ] #1 Child tasks exist for each focused cleanup slice instead of one broad “split the monoliths” effort. +- [ ] #2 The parent task records sequencing so agents do not overlap on `src/main.ts` and other shared surfaces. +- [ ] #3 The selected follow-up tasks target still-live pressure points, not already-completed work like TASK-87.4, TASK-87.5, or TASK-87.6. +- [ ] #4 Completion of the child tasks leaves runtime wiring, shared types, character-dictionary orchestration, and immersion-tracker queries materially easier to review and extend. + + +## Implementation Plan + + +Recommended sequencing: + +1. Start TASK-238.3 first. A compatibility-first type split reduces churn risk for the later runtime/query refactors. +2. Run TASK-238.4 and TASK-238.5 in parallel after TASK-238.3 if desired; they touch different domains. +3. Run TASK-238.1 after or alongside the domain refactors, but keep it focused on window/bootstrap composition only. +4. Run TASK-238.2 after TASK-238.1 because both touch `src/main.ts` and the CLI/headless flow should build on the cleaner composition root. + +Shared guardrails: + +- Do not reopen already-completed dead-module cleanup from TASK-87.5 unless new evidence appears. +- Keep `src/types.ts` migration compatibility-first; avoid a repo-wide import churn bomb. +- Prefer extracting named runtime/domain modules over moving code into new giant helper files. +- Verify each slice with the cheapest sufficient lane, then escalate when a task crosses runtime/build boundaries. + diff --git a/backlog/tasks/task-238.1 - Extract-main-window-and-overlay-window-composition-from-src-main.ts.md b/backlog/tasks/task-238.1 - Extract-main-window-and-overlay-window-composition-from-src-main.ts.md new file mode 100644 index 0000000..2a38570 --- /dev/null +++ b/backlog/tasks/task-238.1 - Extract-main-window-and-overlay-window-composition-from-src-main.ts.md @@ -0,0 +1,45 @@ +--- +id: TASK-238.1 +title: Extract main-window and overlay-window composition from src/main.ts +status: To Do +assignee: [] +created_date: '2026-03-26 20:49' +labels: + - tech-debt + - runtime + - windows + - maintainability +milestone: m-0 +dependencies: [] +references: + - src/main.ts + - src/main/runtime/composers + - src/main/runtime/overlay-runtime-bootstrap.ts + - docs/architecture/README.md +parent_task_id: TASK-238 +priority: high +--- + +## Description + + +`src/main.ts` still directly owns several `BrowserWindow` construction and window-lifecycle paths, including overlay-adjacent windows and setup flows. That keeps the composition root far larger than intended and makes window behavior hard to test in isolation. Extract the remaining window/bootstrap composition into named runtime modules so `src/main.ts` mostly wires dependencies and app lifecycle events together. + + +## Acceptance Criteria + + +- [ ] #1 At least the main overlay window path plus two other window/setup flows are extracted from direct `BrowserWindow` construction inside `src/main.ts`. +- [ ] #2 The extracted modules expose narrow factory/handler APIs that can be tested without booting the whole app. +- [ ] #3 `src/main.ts` becomes materially smaller and easier to scan, with window creation concentrated behind well-named runtime surfaces. +- [ ] #4 Relevant runtime/window tests pass, and new tests are added for any newly isolated window composition helpers. + + +## Implementation Plan + + +1. Map the remaining direct `BrowserWindow` creation sites in `src/main.ts` and group them by shared lifecycle concerns. +2. Extract coherent modules for construction, preload/path resolution, and open/focus/reuse behavior rather than moving raw option objects wholesale. +3. Update the composition root to consume the new modules and keep side effects/app state ownership explicit. +4. Verify with focused runtime/window tests plus `bun run typecheck`. + diff --git a/backlog/tasks/task-238.2 - Extract-CLI-and-headless-command-wiring-from-src-main.ts.md b/backlog/tasks/task-238.2 - Extract-CLI-and-headless-command-wiring-from-src-main.ts.md new file mode 100644 index 0000000..d536d68 --- /dev/null +++ b/backlog/tasks/task-238.2 - Extract-CLI-and-headless-command-wiring-from-src-main.ts.md @@ -0,0 +1,46 @@ +--- +id: TASK-238.2 +title: Extract CLI and headless command wiring from src/main.ts +status: To Do +assignee: [] +created_date: '2026-03-26 20:49' +labels: + - tech-debt + - cli + - runtime + - maintainability +milestone: m-0 +dependencies: + - TASK-238.1 +references: + - src/main.ts + - src/main/cli-runtime.ts + - src/cli/args.ts + - launcher +parent_task_id: TASK-238 +priority: high +--- + +## Description + + +`src/main.ts` still owns the headless-initial-command flow, argument handling, and a large amount of CLI/runtime bridging. That makes non-window startup paths difficult to reason about and keeps CLI behavior coupled to unrelated desktop boot logic. Extract the remaining CLI/headless orchestration into dedicated runtime services so the main entrypoint only decides which startup path to invoke. + + +## Acceptance Criteria + + +- [ ] #1 CLI parsing, initial-command dispatch, and headless command execution no longer live as large inline flows in `src/main.ts`. +- [ ] #2 The new modules make the desktop startup path and headless startup path visibly separate and easier to test. +- [ ] #3 Existing CLI behaviors remain unchanged, including help output and startup gating behavior. +- [ ] #4 Targeted CLI/runtime tests cover the extracted path, and `bun run typecheck` passes. + + +## Implementation Plan + + +1. Map the current `parseArgs` / `handleInitialArgs` / `runHeadlessInitialCommand` / `handleCliCommand` flow in `src/main.ts`. +2. Extract a small startup-path selector plus dedicated runtime services for headless execution and interactive startup dispatch. +3. Keep Electron app ownership in `src/main.ts`; move only CLI orchestration and context assembly. +4. Verify with CLI-focused tests plus `bun run typecheck`. + diff --git a/backlog/tasks/task-238.3 - Introduce-domain-type-entrypoints-and-shrink-src-types.ts-import-surface.md b/backlog/tasks/task-238.3 - Introduce-domain-type-entrypoints-and-shrink-src-types.ts-import-surface.md new file mode 100644 index 0000000..24d4694 --- /dev/null +++ b/backlog/tasks/task-238.3 - Introduce-domain-type-entrypoints-and-shrink-src-types.ts-import-surface.md @@ -0,0 +1,44 @@ +--- +id: TASK-238.3 +title: Introduce domain type entrypoints and shrink src/types.ts import surface +status: To Do +assignee: [] +created_date: '2026-03-26 20:49' +labels: + - tech-debt + - types + - maintainability +milestone: m-0 +dependencies: [] +references: + - src/types.ts + - src/shared/ipc/contracts.ts + - src/config/service.ts + - docs/architecture/README.md +parent_task_id: TASK-238 +priority: medium +--- + +## Description + + +`src/types.ts` has become the repo-wide dumping ground for unrelated domains. Splitting it is still worthwhile, but a big-bang move would create noisy churn across a large import graph. Introduce domain entrypoints under `src/types/` and migrate the highest-churn imports first while leaving `src/types.ts` as a compatibility barrel until the new structure is proven. + + +## Acceptance Criteria + + +- [ ] #1 Domain-focused type modules exist for the main clusters currently mixed together in `src/types.ts` (for example Anki, config/runtime, subtitle/media, and integration/runtime-option types). +- [ ] #2 `src/types.ts` becomes a thinner compatibility layer or barrel instead of the sole source of truth for every shared type. +- [ ] #3 A meaningful set of imports is migrated to the new entrypoints without breaking the maintained typecheck/test lanes. +- [ ] #4 The new structure is documented well enough that contributors can tell where new shared types should live. + + +## Implementation Plan + + +1. Inventory the main type clusters in `src/types.ts` and choose stable domain seams. +2. Create `src/types/` modules and re-export through `src/types.ts` so the migration can be incremental. +3. Migrate the highest-value import sites first, especially config/runtime and Anki-heavy surfaces. +4. Verify with `bun run typecheck` and the cheapest test lane covering touched domains. + diff --git a/backlog/tasks/task-238.4 - Decompose-character-dictionary-runtime-into-fetch-build-and-cache-modules.md b/backlog/tasks/task-238.4 - Decompose-character-dictionary-runtime-into-fetch-build-and-cache-modules.md new file mode 100644 index 0000000..69cc78e --- /dev/null +++ b/backlog/tasks/task-238.4 - Decompose-character-dictionary-runtime-into-fetch-build-and-cache-modules.md @@ -0,0 +1,45 @@ +--- +id: TASK-238.4 +title: Decompose character dictionary runtime into fetch, build, and cache modules +status: To Do +assignee: [] +created_date: '2026-03-26 20:49' +labels: + - tech-debt + - runtime + - anilist + - maintainability +milestone: m-0 +dependencies: + - TASK-238.3 +references: + - src/main/character-dictionary-runtime.ts + - src/main/runtime/character-dictionary-auto-sync.ts + - docs/architecture/README.md +parent_task_id: TASK-238 +priority: medium +--- + +## Description + + +`src/main/character-dictionary-runtime.ts` is now one of the largest live production files in the repo and combines AniList transport, name normalization, snapshot/image shaping, cache management, and zip packaging. That file will keep growing as character-dictionary features evolve. Split it into focused modules so the runtime surface becomes orchestration instead of a catch-all implementation blob. + + +## Acceptance Criteria + + +- [ ] #1 AniList fetch/parsing logic, dictionary-entry building, and snapshot/cache/zip persistence no longer live in one giant file. +- [ ] #2 The public runtime API stays behavior-compatible for current callers. +- [ ] #3 The top-level runtime/orchestration file becomes materially smaller and easier to review. +- [ ] #4 Existing character-dictionary tests still pass, and new focused tests cover the extracted modules where needed. + + +## Implementation Plan + + +1. Identify the dominant concern boundaries inside `src/main/character-dictionary-runtime.ts`. +2. Extract fetch/transform/persist modules with narrow interfaces, keeping data-shape ownership explicit. +3. Leave the exported runtime API stable for current main-process callers. +4. Verify with the maintained character-dictionary/runtime test lane plus `bun run typecheck`. + diff --git a/backlog/tasks/task-238.5 - Split-immersion-tracker-query-layer-into-focused-read-model-modules.md b/backlog/tasks/task-238.5 - Split-immersion-tracker-query-layer-into-focused-read-model-modules.md new file mode 100644 index 0000000..55f63f6 --- /dev/null +++ b/backlog/tasks/task-238.5 - Split-immersion-tracker-query-layer-into-focused-read-model-modules.md @@ -0,0 +1,45 @@ +--- +id: TASK-238.5 +title: Split immersion tracker query layer into focused read-model modules +status: To Do +assignee: [] +created_date: '2026-03-26 20:49' +labels: + - tech-debt + - stats + - database + - maintainability +milestone: m-0 +dependencies: + - TASK-238.3 +references: + - src/core/services/immersion-tracker/query.ts + - src/core/services/stats-server.ts + - src/core/services/immersion-tracker-service.ts +parent_task_id: TASK-238 +priority: medium +--- + +## Description + + +`src/core/services/immersion-tracker/query.ts` has grown into a large mixed read/write/maintenance surface that owns library queries, timeline/detail queries, cleanup helpers, and rollup rebuild hooks. That size makes stats work harder to change safely. Split the query layer into focused read-model and maintenance modules so future stats/dashboard work does not keep landing in one 2500-line file. + + +## Acceptance Criteria + + +- [ ] #1 Query responsibilities are grouped into focused modules such as library/session detail, vocabulary/kanji detail, and maintenance/cleanup helpers. +- [ ] #2 The stats server and immersion tracker service depend on stable exported query surfaces instead of one monolithic file. +- [ ] #3 The refactor preserves current SQL behavior and existing statistics outputs. +- [ ] #4 Existing stats/immersion tests still pass, with added focused coverage where extraction creates new seams. + + +## Implementation Plan + + +1. Inventory the major query clusters and choose modules that match current caller boundaries. +2. Extract without changing schema or response contracts unless a narrow cleanup is required for compile/test health. +3. Keep SQL ownership close to the domain module that consumes it; avoid a giant `queries/` dump with no structure. +4. Verify with the maintained stats/immersion test lane plus `bun run typecheck`. + diff --git a/backlog/tasks/task-239 - Mining-workflow-upgrades-prioritize-high-value-user-facing-improvements.md b/backlog/tasks/task-239 - Mining-workflow-upgrades-prioritize-high-value-user-facing-improvements.md new file mode 100644 index 0000000..6e1138d --- /dev/null +++ b/backlog/tasks/task-239 - Mining-workflow-upgrades-prioritize-high-value-user-facing-improvements.md @@ -0,0 +1,51 @@ +--- +id: TASK-239 +title: Mining workflow upgrades: prioritize high-value user-facing improvements +status: To Do +assignee: [] +created_date: '2026-03-26 20:49' +labels: + - feature + - ux + - planning +milestone: m-2 +dependencies: [] +references: + - src/main.ts + - src/renderer + - src/anki-integration.ts + - src/config/service.ts +priority: medium +--- + +## Description + + +Track the next set of high-value workflow improvements surfaced by the March 2026 review. The goal is to capture bounded, implementation-sized feature slices with clear user value and avoid prematurely committing to much larger bets like hard-sub OCR, plugin marketplace infrastructure, or cloud config sync. Focus this parent task on features that improve the core mining workflow directly: profile-aware setup, action discoverability, previewing output before mining, and selecting richer subtitle ranges. + + +## Acceptance Criteria + + +- [ ] #1 Child tasks exist for the selected near-to-medium-term workflow upgrades with explicit scope and exclusions. +- [ ] #2 The parent task records the recommended sequencing so future work starts with the best value/risk ratio. +- [ ] #3 The tracked feature set stays grounded in existing product surfaces instead of speculative external-platform integrations. + + +## Implementation Plan + + +Recommended sequencing: + +1. Start TASK-239.3 first. Template preview is the smallest high-signal UX win on a core mining path. +2. Start TASK-239.2 next. A command palette improves discoverability across existing actions without large backend upheaval. +3. Start TASK-239.4 after the preview/palette work. Sentence clipping is high-value but touches runtime, subtitle selection, and card creation flows together. +4. Keep TASK-239.1 as a foundation project and scope it narrowly to local multi-profile support. Do not expand it into cloud sync in the same slice. + +Deliberate exclusions for now: + +- hard-sub OCR +- plugin marketplace infrastructure +- cloud/device sync +- site-specific streaming source auto-detection beyond narrow discovery spikes + diff --git a/backlog/tasks/task-239.1 - Add-profile-aware-config-foundations-and-profile-selection-flow.md b/backlog/tasks/task-239.1 - Add-profile-aware-config-foundations-and-profile-selection-flow.md new file mode 100644 index 0000000..e0f8ad5 --- /dev/null +++ b/backlog/tasks/task-239.1 - Add-profile-aware-config-foundations-and-profile-selection-flow.md @@ -0,0 +1,46 @@ +--- +id: TASK-239.1 +title: Add profile-aware config foundations and profile selection flow +status: To Do +assignee: [] +created_date: '2026-03-26 20:49' +labels: + - feature + - config + - launcher + - ux +milestone: m-2 +dependencies: [] +references: + - src/config/service.ts + - src/config/load.ts + - launcher/config.ts + - src/main.ts +parent_task_id: TASK-239 +priority: high +--- + +## Description + + +Introduce the foundation for local multi-profile use so users can keep separate setups for different workflows without hand-editing or swapping config files manually. Keep the first slice intentionally narrow: named local profiles, explicit selection, separate config/data paths, and safe migration from the current single-profile setup. Do not couple this task to cloud sync or remote profile sharing. + + +## Acceptance Criteria + + +- [ ] #1 Users can create/select a named local profile and launch SubMiner against that profile explicitly. +- [ ] #2 Each profile uses separate config and data storage paths for settings and profile-scoped runtime state that should not bleed across workflows. +- [ ] #3 Existing single-profile users migrate safely to a default profile without losing settings. +- [ ] #4 The active profile is visible in the launcher/app surface where it materially affects user behavior. +- [ ] #5 Tests cover profile resolution, migration/defaulting behavior, and at least one end-to-end selection path. + + +## Implementation Plan + + +1. Design a minimal profile storage layout and resolution strategy that works for launcher and desktop runtime entrypoints. +2. Add profile selection plumbing before changing feature behavior inside individual services. +3. Migrate config/data-path resolution to be profile-aware while preserving a safe default-profile fallback. +4. Verify with config/launcher tests plus targeted runtime coverage. + diff --git a/backlog/tasks/task-239.2 - Add-a-searchable-command-palette-for-desktop-actions.md b/backlog/tasks/task-239.2 - Add-a-searchable-command-palette-for-desktop-actions.md new file mode 100644 index 0000000..b33a6f3 --- /dev/null +++ b/backlog/tasks/task-239.2 - Add-a-searchable-command-palette-for-desktop-actions.md @@ -0,0 +1,46 @@ +--- +id: TASK-239.2 +title: Add a searchable command palette for desktop actions +status: To Do +assignee: [] +created_date: '2026-03-26 20:49' +labels: + - feature + - ux + - desktop + - shortcuts +milestone: m-2 +dependencies: [] +references: + - src/renderer + - src/shared/ipc/contracts.ts + - src/main/runtime/overlay-runtime-options.ts + - src/main.ts +parent_task_id: TASK-239 +priority: medium +--- + +## Description + + +SubMiner already exposes many actions through scattered shortcuts, menus, and modal flows. Add a searchable command palette so users can discover and execute high-value desktop actions from one keyboard-first surface. Build on the existing runtime-options/modal infrastructure where practical instead of creating a completely separate interaction model. + + +## Acceptance Criteria + + +- [ ] #1 A keyboard-accessible command palette opens from the desktop app and lists supported actions with searchable labels. +- [ ] #2 Commands are backed by an explicit registry so action availability and labels are not hard-coded in one renderer component. +- [ ] #3 Users can navigate and execute commands entirely from the keyboard. +- [ ] #4 The first slice includes the highest-value existing actions rather than trying to cover every possible command on day one. +- [ ] #5 Tests cover command filtering, execution dispatch, and at least one disabled/unavailable command state. + + +## Implementation Plan + + +1. Define a small command-registry contract shared across renderer and main-process dispatch. +2. Reuse existing modal/runtime plumbing where it fits so the palette is a thin discoverability layer over current actions. +3. Ship a narrow but useful initial command set, then expand later based on usage. +4. Verify with renderer tests plus targeted IPC/runtime tests. + diff --git a/backlog/tasks/task-239.3 - Add-live-Anki-template-preview-for-card-output.md b/backlog/tasks/task-239.3 - Add-live-Anki-template-preview-for-card-output.md new file mode 100644 index 0000000..214ffb8 --- /dev/null +++ b/backlog/tasks/task-239.3 - Add-live-Anki-template-preview-for-card-output.md @@ -0,0 +1,45 @@ +--- +id: TASK-239.3 +title: Add live Anki template preview for card output +status: To Do +assignee: [] +created_date: '2026-03-26 20:49' +labels: + - feature + - anki + - ux +milestone: m-2 +dependencies: [] +references: + - src/anki-integration.ts + - src/anki-integration/card-creation.ts + - src/config/resolve/anki-connect.ts + - src/renderer +parent_task_id: TASK-239 +priority: high +--- + +## Description + + +Users currently have to infer what card output will look like from config fields and post-mine results. Add a live preview surface that shows the resolved card template output before mining so users can catch broken field mappings, missing media, or undesirable formatting earlier. + + +## Acceptance Criteria + + +- [ ] #1 Users can open a preview that renders the resolved front/back field output for the current note/card template configuration. +- [ ] #2 The preview clearly surfaces missing or unmapped fields instead of silently showing blank content. +- [ ] #3 Preview generation uses the same transformation logic as the live card-creation path so it stays trustworthy. +- [ ] #4 The first slice works with representative sample mining payloads and handles missing optional media gracefully. +- [ ] #5 Tests cover preview rendering for at least one valid and one invalid/missing-field configuration. + + +## Implementation Plan + + +1. Identify the current card-creation data path and extract any logic needed to render a preview without duplicating transformation rules. +2. Add a focused preview UI in the most relevant existing configuration/setup surface. +3. Surface validation/warning states for empty mappings, missing fields, and media-dependent outputs. +4. Verify with Anki integration tests plus renderer coverage for preview states. + diff --git a/backlog/tasks/task-239.4 - Add-sentence-clipping-from-arbitrary-subtitle-ranges.md b/backlog/tasks/task-239.4 - Add-sentence-clipping-from-arbitrary-subtitle-ranges.md new file mode 100644 index 0000000..aa86097 --- /dev/null +++ b/backlog/tasks/task-239.4 - Add-sentence-clipping-from-arbitrary-subtitle-ranges.md @@ -0,0 +1,46 @@ +--- +id: TASK-239.4 +title: Add sentence clipping from arbitrary subtitle ranges +status: To Do +assignee: [] +created_date: '2026-03-26 20:49' +labels: + - feature + - subtitle + - anki + - ux +milestone: m-2 +dependencies: [] +references: + - src/renderer/modals/subtitle-sidebar.ts + - src/main/runtime/subtitle-position.ts + - src/anki-integration/card-creation.ts + - src/main/runtime/mpv-main-event-actions.ts +parent_task_id: TASK-239 +priority: medium +--- + +## Description + + +Current mining flows are optimized around the active subtitle line. Add a sentence-clipping workflow that lets users select an arbitrary contiguous subtitle range, preview the combined text/timing, and mine from that selection. This should improve multi-line dialogue capture without forcing manual copy/paste or separate post-processing. + + +## Acceptance Criteria + + +- [ ] #1 Users can select a contiguous subtitle range from the existing subtitle UI instead of being limited to the active cue. +- [ ] #2 The workflow previews the combined text and resulting timing range before mining. +- [ ] #3 Mining from a clipped range uses the combined subtitle payload in card generation while preserving existing single-line behavior. +- [ ] #4 The feature handles overlapping/edge timing cases predictably and does not corrupt the normal active-cue flow. +- [ ] #5 Tests cover range selection, combined payload generation, and at least one card-creation path using a clipped selection. + + +## Implementation Plan + + +1. Define a selection model that fits the existing subtitle sidebar/runtime data flow. +2. Add preview + confirmation UI before routing the clipped payload into mining. +3. Keep the existing single-line path intact and treat clipping as an additive workflow. +4. Verify with subtitle-sidebar, runtime, and Anki/card-creation tests. +