Files
SubMiner/docs-site/index.md
sudacode 35adf8299c Refactor startup, queries, and workflow into focused modules (#36)
* chore(backlog): add mining workflow milestone and tasks

* refactor: split character dictionary runtime modules

* refactor: split shared type entrypoints

* refactor: use bun serve for stats server

* feat: add repo-local subminer workflow plugin

* fix: add stats server node fallback

* refactor: split immersion tracker query modules

* chore: update backlog task records

* refactor: migrate shared type imports

* refactor: compose startup and setup window wiring

* Add backlog tasks and launcher time helper tests

- Track follow-up cleanup work in Backlog.md
- Replace Date.now usage with shared nowMs helper
- Add launcher args/parser and core regression tests

* test: increase launcher test timeout for CI stability

* fix: address CodeRabbit review feedback

* refactor(main): extract remaining inline runtime logic from main

* chore(backlog): update task notes and changelog fragment

* refactor: split main boot phases

* test: stabilize bun coverage reporting

* Switch plausible endpoint and harden coverage lane parsing

- update docs-site tracking to use the Plausible capture endpoint
- tighten coverage lane argument and LCOV parsing checks
- make script entrypoint use CommonJS main guard

* Restrict docs analytics and build coverage input

- limit Plausible init to docs.subminer.moe
- build Yomitan before src coverage lane

* fix(ci): normalize Windows shortcut paths for cross-platform tests

* Fix verification and immersion-tracker grouping

- isolate verifier artifacts and lease handling
- switch weekly/monthly tracker cutoffs to calendar boundaries
- tighten boot lifecycle and zip writer tests

* fix: resolve CI type failures in boot and immersion query tests

* fix: remove strict spread usage in Date mocks

* fix: use explicit super args for MockDate constructors

* Factor out mock date helper in tracker tests

- reuse a shared `withMockDate` helper for date-sensitive query tests
- make monthly rollup assertions key off `videoId` instead of row order

* fix: use variadic array type for MockDate constructor args

TS2367: fixed-length tuple made args.length === 0 unreachable.

* refactor: remove unused createMainBootRuntimes/Handlers aggregate functions

These functions were never called by production code — main.ts imports
the individual composeBoot* re-exports directly.

* refactor: remove boot re-export alias layer

main.ts now imports directly from the runtime/composers and runtime/domains
modules, eliminating the intermediate boot/ indirection.

* refactor: consolidate 3 near-identical setup window factories

Extract shared createSetupWindowHandler with a config parameter.
Public API unchanged.

* refactor: parameterize duplicated getAffected*Ids query helpers

Four structurally identical functions collapsed into two parameterized
helpers while preserving the existing public API.

* refactor: inline identity composers (stats-startup, overlay-window)

composeStatsStartupRuntime was a no-op that returned its input.
composeOverlayWindowHandlers was a 1-line delegation.
Both removed in favor of direct usage.

* chore: remove unused token/queue file path constants from main.ts

* fix: replace any types in boot services with proper signatures

* refactor: deduplicate ensureDir into shared/fs-utils

5 copies of mkdir-p-if-not-exists consolidated into one shared module
with ensureDir (directory path) and ensureDirForFile (file path) variants.

* fix: tighten type safety in boot services

- Add AppLifecycleShape and OverlayModalInputStateShape constraints
  so TAppLifecycleApp and TOverlayModalInputState generics are bounded
- Remove unsafe `as { handleModalInputStateChange? }` cast — now
  directly callable via the constraint
- Use `satisfies AppLifecycleShape` for structural validation on the
  appLifecycleApp object literal
- Document Electron App.on incompatibility with simple signatures

* refactor: inline subtitle-prefetch-runtime-composer

The composer was a pure pass-through that destructured an object and
reassembled it with the same fields. Inlined at the call site.

* chore: consolidate duplicate import paths in main.ts

* test: extract mpv composer test fixture factory to reduce duplication

* test: add behavioral assertions to composer tests

Upgrade 8 composer test files from shape-only typeof checks to behavioral
assertions that invoke returned handlers and verify injected dependencies are
actually called, following the mpv-runtime-composer pattern.

* refactor: normalize import extensions in query modules

* refactor: consolidate toDbMs into query-shared.ts

* refactor: remove Node.js fallback from stats-server, use Bun only

* Fix monthly rollup test expectations

- Preserve multi-arg Date construction in mock helper
- Align rollup assertions with the correct videoId

* fix: address PR 36 CodeRabbit follow-ups

* fix: harden coverage lane cleanup

* fix(stats): fallback to node server when Bun.serve unavailable

* fix(ci): restore coverage lane compatibility

* chore(backlog): close TASK-242

* fix: address latest CodeRabbit review round

* fix: guard disabled immersion retention windows

* fix: migrate discord rpc wrapper

* fix(ci): add changelog fragment for PR 36

* fix: stabilize macOS visible overlay toggle

* fix: pin installed mpv plugin to current binary

* fix: strip inline subtitle markup from sidebar cues

* fix(renderer): restore subtitle sidebar mpv passthrough

* feat(discord): add configurable presence style presets

Replace the hardcoded "Mining and crafting (Anki cards)" meme message
with a preset system. New `discordPresence.presenceStyle` option
supports four presets: "default" (clean bilingual), "meme" (the OG
Minecraft joke), "japanese" (fully JP), and "minimal". The default
preset shows "Sentence Mining" with 日本語学習中 as the small image
tooltip. Existing users can set presenceStyle to "meme" to keep the
old behavior.

* fix: finalize v0.10.0 release prep

* docs: add subtitle sidebar guide and release note

* chore(backlog): mark docs task done

* fix: lazily resolve youtube playback socket path

* chore(release): build v0.10.0 changelog

* Revert "chore(release): build v0.10.0 changelog"

This reverts commit 9741c0f020.
2026-03-29 16:16:29 -07:00

364 lines
9.8 KiB
Markdown

---
layout: home
title: SubMiner
titleTemplate: Immersion Mining Workflow for MPV
hero:
name: SubMiner
text: Immersion Mining for MPV
tagline: Watch media, mine vocabulary, and craft anki cards without leaving the scene.
image:
src: /assets/SubMiner.png
alt: SubMiner logo
actions:
- theme: brand
text: Install
link: /installation
- theme: alt
text: Explore workflow
link: /mining-workflow
features:
- icon:
src: /assets/mpv.svg
alt: mpv icon
title: Built for mpv
details: Tracks subtitles via mpv IPC in real time. Launch with the wrapper script or the mpv plugin — no external bridge needed.
link: /usage
linkText: How it works
- icon:
src: /assets/yomitan-icon.svg
alt: Yomitan logo
title: Bundled Yomitan
details: Ships with a built-in Yomitan instance for instant word lookups and context-aware card creation directly from subtitle text.
link: /mining-workflow
linkText: Mining workflow
- icon:
src: /assets/anki-card.svg
alt: Anki card icon
title: Anki Card Enrichment
details: Auto-fills card fields with sentence, audio clip, screenshot, and translation so you can focus on learning.
link: /anki-integration
linkText: Anki integration
- icon:
src: /assets/highlight.svg
alt: Highlight icon
title: Reading Annotations
details: N+1 targeting, character-name matching, frequency highlighting, and JLPT tagging — all layered on subtitle text in real time.
link: /subtitle-annotations
linkText: Annotation details
- icon:
src: /assets/video.svg
alt: Video playback icon
title: YouTube Playback
details: Play YouTube URLs or ytsearch targets directly — SubMiner automatically selects and loads subtitles for the video.
link: /usage#youtube-playback
linkText: YouTube playback
- icon:
src: /assets/jellyfin.svg
alt: Jellyfin icon
title: Jellyfin Integration
details: Browse your Jellyfin library, pick media interactively, and play through mpv with full subtitle and mining support.
link: /jellyfin-integration
linkText: Jellyfin setup
- icon:
src: /assets/subtitle-download.svg
alt: Subtitle download icon
title: Subtitle Download & Sync
details: Search and pull subtitles from Jimaku, then auto-sync timing with alass or ffsubsync — all from the overlay.
link: /jimaku-integration
linkText: Jimaku integration
- icon:
src: /assets/tokenization.svg
alt: Tracking chart icon
title: Stats Dashboard
details: Browse session history, streak calendars, vocabulary frequency, and per-series progress in a local dashboard — then mine cards straight from your viewing history.
link: /immersion-tracking
linkText: Dashboard & tracking
- icon:
src: /assets/cross-platform.svg
alt: Cross-platform icon
title: Cross-Platform
details: Runs on Linux (Hyprland, Sway, X11), macOS, and Windows with compositor-aware window positioning and platform-native integration.
link: /installation
linkText: Platform setup
---
<script setup>
const demoAssetVersion = '20260223-2';
</script>
<div class="landing-shell">
<section class="workflow-section">
<h2>How it fits together</h2>
<div class="workflow-steps">
<div class="workflow-step" style="animation-delay: 0ms">
<div class="step-number">01</div>
<div class="step-title">Start</div>
<div class="step-desc">Launch with the wrapper or existing mpv setup and keep subtitles in sync.</div>
</div>
<div class="workflow-connector" aria-hidden="true"></div>
<div class="workflow-step" style="animation-delay: 60ms">
<div class="step-number">02</div>
<div class="step-title">Lookup</div>
<div class="step-desc">Hover a token in the interactive overlay, then trigger Yomitan lookup to open context.</div>
</div>
<div class="workflow-connector" aria-hidden="true"></div>
<div class="workflow-step" style="animation-delay: 120ms">
<div class="step-number">03</div>
<div class="step-title">Mine</div>
<div class="step-desc">Create cards from Yomitan or mine sentence cards directly from subtitle lines.</div>
</div>
<div class="workflow-connector" aria-hidden="true"></div>
<div class="workflow-step" style="animation-delay: 180ms">
<div class="step-number">04</div>
<div class="step-title">Enrich</div>
<div class="step-desc">Automatically attach timing-accurate audio, sentence text, and visual evidence.</div>
</div>
<div class="workflow-connector" aria-hidden="true"></div>
<div class="workflow-step" style="animation-delay: 240ms">
<div class="step-number">05</div>
<div class="step-title">Track</div>
<div class="step-desc">Open the stats dashboard to review sessions, vocabulary trends, and mine cards from past viewing history.</div>
</div>
</div>
</section>
<section class="demo-section">
<h2>See it in action</h2>
<p>Subtitles, lookup flow, and card enrichment from a real playback session.</p>
<div class="demo-window">
<div class="demo-window__bar">
<span class="demo-window__dot"></span>
<span class="demo-window__dot"></span>
<span class="demo-window__dot"></span>
<span class="demo-window__title">subminer -- playback</span>
</div>
<video controls playsinline preload="metadata" :poster="`/assets/minecard-poster.jpg?v=${demoAssetVersion}`">
<source :src="`/assets/minecard.webm?v=${demoAssetVersion}`" type="video/webm" />
<source :src="`/assets/minecard.mp4?v=${demoAssetVersion}`" type="video/mp4" />
<a :href="`/assets/minecard.webm?v=${demoAssetVersion}`" target="_blank" rel="noreferrer">
<img :src="`/assets/minecard.webp?v=${demoAssetVersion}`" alt="SubMiner demo Animated fallback" style="width: 100%; height: auto;" />
</a>
</video>
</div>
</section>
</div>
<style>
.landing-shell {
max-width: 1120px;
margin: 0 auto;
padding: 0.5rem 1rem 4rem;
}
.landing-shell,
.landing-shell .step-title,
.landing-shell h1,
.landing-shell h2 {
font-family: var(--tui-font-mono);
}
.VPHome :deep(.VPFeature),
.VPHome :deep(.VPButton),
.landing-shell .workflow-step,
.landing-shell .demo-window,
.landing-shell .demo-window__bar {
border-radius: 8px;
}
.step-title,
.step-number {
font-family: var(--tui-font-mono);
letter-spacing: -0.01em;
}
/* === Workflow === */
.workflow-section {
margin: 2.4rem auto 0;
padding: 0;
}
.workflow-section h2,
.demo-section h2 {
font-size: 1.45rem;
font-weight: 600;
letter-spacing: -0.01em;
margin-bottom: 1rem;
padding-bottom: 4px;
}
.workflow-section h2::after,
.demo-section h2::after {
content: '';
display: block;
margin-top: 6px;
height: 1px;
background: repeating-linear-gradient(
to right,
var(--vp-c-divider) 0,
var(--vp-c-divider) 1ch,
transparent 1ch,
transparent 1.5ch
);
}
.workflow-steps {
display: flex;
align-items: stretch;
gap: 0;
border: 1px solid var(--vp-c-divider);
border-radius: 8px;
overflow: hidden;
}
.workflow-step {
flex: 1;
padding: 1.2rem 1.25rem;
background: var(--vp-c-bg-soft);
animation: step-enter 400ms ease-out both;
position: relative;
transition: background 180ms ease;
}
.workflow-step:hover {
background: var(--tui-step-hover-bg);
}
.workflow-step:hover .step-number {
color: var(--vp-c-brand-1);
text-shadow: 0 0 12px var(--tui-step-hover-glow);
}
.workflow-connector {
width: 1px;
background: var(--vp-c-divider);
flex-shrink: 0;
}
.workflow-step .step-number {
display: inline-block;
font-size: 0.7rem;
font-weight: 700;
letter-spacing: 0.05em;
color: var(--vp-c-text-3);
margin-bottom: 0.5rem;
font-variant-numeric: tabular-nums;
transition: color 180ms ease, text-shadow 180ms ease;
}
.workflow-step .step-number::before {
content: '$ ';
color: var(--vp-c-text-3);
}
.workflow-step .step-title {
font-weight: 600;
font-size: 1rem;
margin-bottom: 0.35rem;
}
.workflow-step .step-desc {
font-size: 0.85rem;
color: var(--vp-c-text-2);
line-height: 1.5;
}
@keyframes step-enter {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@media (max-width: 960px) {
.workflow-steps {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1px;
background: var(--vp-c-divider);
}
.workflow-step {
min-width: 0;
}
.workflow-step:last-child {
grid-column: 1 / -1;
}
.workflow-connector {
display: none;
}
}
@media (max-width: 640px) {
.workflow-steps {
grid-template-columns: 1fr;
}
.workflow-step:last-child {
grid-column: auto;
}
}
/* === Demo === */
.demo-section {
max-width: 960px;
margin: 3rem auto 0;
padding: 0;
}
.demo-section p {
color: var(--vp-c-text-2);
margin: 0 0 1.2rem;
line-height: 1.6;
}
.demo-window {
border: 1px solid var(--vp-c-divider);
border-radius: 8px;
overflow: hidden;
animation: step-enter 400ms ease-out 300ms both;
box-shadow:
0 4px 16px rgba(0, 0, 0, 0.18),
0 20px 48px rgba(0, 0, 0, 0.14);
}
.demo-window__bar {
display: flex;
align-items: center;
gap: 6px;
padding: 8px 12px;
background: var(--vp-c-bg-soft);
border-bottom: 1px solid var(--vp-c-divider);
}
.demo-window__dot {
width: 10px;
height: 10px;
border-radius: 50%;
}
.demo-window__dot:nth-child(1) { background: #ed8796; }
.demo-window__dot:nth-child(2) { background: #eed49f; }
.demo-window__dot:nth-child(3) { background: #a6da95; }
.demo-window__title {
font-family: var(--tui-font-mono);
font-size: 11px;
color: var(--vp-c-text-3);
margin-left: 6px;
}
.demo-window video {
width: 100%;
display: block;
border: none;
border-radius: 0;
box-shadow: none;
margin: 0;
}
</style>