Wire generate_title_cmd into the user-visible flows. Three entry points, matching the agreed hybrid trigger (auto when conditions are met, plus on-demand for retroactive titling of old transcripts): 1. Auto on save — addToHistory in src/lib/stores/page.svelte.ts now fires `maybeAutoGenerateTitle` fire-and-forget after the SQLite write succeeds. Gate: `aiTier !== "off" && formatMode !== "Raw"`, piggybacking on the same Settings choice that drives auto-cleanup. Per the design principle "Every new setting must earn its mental real estate" (README.md:22), no new settings flag. Skipped silently when LLM isn't loaded; user retries via the per-row button. Never overwrites a title the caller already set. 2. Per-row "Title" button in HistoryPage — mirrors the existing Tag button shape exactly (Sparkles icon vs Tag icon). In-flight tracked via a `titling: Set<string>` so the same row can't fire twice; the row stays disabled with "Titling…" copy while in flight. Persists via the existing `renameHistoryEntry` (which already calls `update_transcript`) — no need to extend `saveTranscriptMeta`. 3. Bulk "Title all untitled" toolbar action — same shape as "Tag all untagged". Filters `history` to entries where `!item.title || !item.title.trim()`, iterates with progress text, surfaces a success toast at the end with the count actually written (not iterated — empty model responses count as skipped). Visible with no schema changes, no migration: transcripts.title has been nullable since v1 (migrations.rs:12-29). Verification: - `npm run check`: 0 errors, 0 warnings across 3957 files. - `cargo test --workspace --lib`: 280 passing (was 277; +3 from the sanitize_title tests landed in the kon-llm commit). Together with the prior two commits this closes the "auto-titles" plan from /home/jake/.claude/plans/delightful-meandering-moth.md. Out of scope per that plan: settings toggle, regenerate-on-edit, i18n-locale-matching titles.
22 KiB
22 KiB