Single reference for maintainers: architecture touchpoints, content rules, security/privacy framing, testing expectations, and CI gates. Product docs and tutorials remain in the Documentation Hub.
- State: Redux Toolkit feature slices + listener middleware for side effects; transient UI in Zustand (
app/transientUiStore.ts). v1.6 addsplotBoard(viewport/draw UI only β localStorage, NOT undo-able; connections/subplots/tension moved toprojectSlicefor undo support),progressTracker(session/streak/goals), andsceneComments(IDB-persisted via listenerMiddleware). - Persistence:
storageServiceβStorageBackend(IndexedDBweb / filesystem Tauri). No second ad-hoc storage for secrets. v1.6 addsscene-revisionsIDB store (services/sceneRevisionService.ts). - AI:
services/ai/index.ts(Vercel AI SDK layer, canonical entry).geminiService/aiProviderServiceβ legacy path. Multi-provider routing: Gemini, OpenAI, OpenRouter (Cloud 5, circuit breaker, free-tier:freemodels), Claude, Grok, Ollama, WebLLM, ONNX, Transformers.js. AI Execution Modes (aiModeService.ts):hybrid | cloud | local | ecoβ routing strategy persisted tosettings.aiMode. 4-layer local inference stack: WebLLM (WebGPU) β ONNX (WASM) β Transformers.js β heuristic fallback. - Copilot:
services/copilot/βheuristicEngine.ts(8 manuscript analysis rules),insightGenerator.ts,copilotContextService.ts,actionApplier.ts(apply-to-chapter, offset-safe). Flag:enableGlobalCopilot. Docs:docs/COPILOT.md,docs/HEURISTIC-RULES.md. - Commands:
services/commands/registry; execution viaCommandExecutorProvider/runCommandById. - i18n: Source modules under
locales/<lang>/*.json; runtime bundlespublic/locales/<lang>/bundle.jsonrebuilt bypnpm run i18n:bundle/i18n:check. 2 594 keys Γ 11 locales (de/en/es/fr/it core + ar/he RTL Beta + el/ja/pt/zh Beta).
- Tone: Supportive, precise; AI as co-pilot, not ghostwriter. Match formality to each locale (de/fr/es/it/en).
- Glossary (UI): Use consistently across Settings, Help, and Command Palette:
- Manuscript β main text / chapter view
- Outline β plot structure / plot skeleton (not mixed with βtemplate structureβ in user-facing text without context)
- Template β predefined narrative structure
- Codex / Story Bible β project-internal reference (as named in the app)
- Snapshot β zeitpunktbezogene Sicherung des Projekts (project-level; distinct from Scene Revision which is per-scene)
- Scene Revision β per-scene snapshot (IDB, max 50 per scene, auto-saved on content change)
- Writing Session β timed session tracked in Progress Tracker (start/stop via Ctrl+Shift+S)
- Subplot β named story thread with color and scene assignments (Plot Board feature)
- Connection β SVG directional link between scenes on the Plot Board canvas
- Errors: Pattern: what happened β what to do next β optional command/deep link; technical IDs only in
logger. - Help articles: Prefer
tryActionIdmapping to anav-*command so βTry it nowβ jumps to the right view. - Community templates: Canonical English JSON in
community-templates/index.jsonand mirrored copy underpublic/community-templates/; validated bypnpm run content:guardand Zod infetchCommunityTemplates.
- Never log API keys or decrypted payloads.
- Marketing accuracy: Offline-first means project storage is local; cloud AI is optional and user-triggered. Align README/Help FAQ with this split.
- Web vs Tauri: CSP and hardening differ by host; follow
src-tauriconfiguration for desktop builds.
- Add keys to all of
de,en,fr,es,it, thenpnpm run i18n:check. - Key parity is enforced in CI; meaning review for FR/ES/IT is manual/editorial.
- Maintainer reference:
docs/ACCESSIBILITY.md(live regions, focus traps, Lighthouse / axe / Storybook addon-a11y). - Product UX copy for accessibility belongs in locale modules like any other UI string.
- Unit/integration: Vitest; global coverage thresholds in
vitest.config.tsare a regression floor. Current (v1.22.0): lines β₯ 74 / branches β₯ 60 / functions β₯ 67 / statements β₯ 72 (CI-measured). 5 475+ tests / 449 files. Target for v2.0: lines 85 / branches 75 / functions 80 (C-7). - Risk-hotspots (aim for focused tests when touching):
dbService,dbMigration,aiProviderService,sceneRevisionService,plotBoardService,deepLinkService, project import/export,storageService/storageBackend. - IDB test isolation:
sceneRevisionServiceand similar IDB tests require@vitest-environment node+ per-testIDBFactory+_resetDbForTest(). SeeCLAUDE.md Β§ IDB unit tests. - Custom Select testing: Components using
SelectorLanguageSelectorshould mock them as native<select>elements in tests for compatibility with testing-library queries. Seedocs/UI-MODERNIZATION.mdTesting section for the mock pattern. - E2E: Playwright (CI-only
CI=true); a11y smoke with axe (seetests/e2e/a11y.spec.ts). Plot-board E2E:tests/e2e/plot-board.spec.ts. - Mutation: Stryker job (
mutation.yml) is informational untilbreakthreshold is raised. Current targets: 9 service files instryker.conf.json.
Local (fast, low-RAM):
pnpm run lint && pnpm run i18n:check && pnpm run typecheck
# Optional: single test file during development
pnpm exec vitest run tests/unit/myFile.test.tsCI (authoritative): Every push triggers security β quality β build β e2e β lighthouse β deploy. Metrics (coverage %, test count) come from CI artifacts; update README.md badges and AUDIT.md quality-gate lines from CI output after each release.
After CI goes green:
- Read coverage % from the
qualityjob logs or Codecov badge. - Update
README.mdTests-NNN_%2F_NNN_filesandCoverage-XX.XX%25badges. - Update
AUDIT.mdquality-gate line for the new version. - Commit:
chore(docs): update metrics from CI vX.Y.Z.
- No RTL locale shipped yet. When adding one: set
diron the document root from language metadata, mirror spacing in new CSS using logical properties where possible, and audit modals/scroll locks.
- Prefer stable seams over a full plugin runtime:
featureFlags, commands registry,storageService, and documented JSON contracts (settings exchange, project export).