diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index cf374e7..ac364d1 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -58,6 +58,7 @@ jobs: node desktop.test.mjs node toolbar-order.test.mjs node editor-inline.test.mjs + node ai-quick-actions.test.mjs else echo "tests/frontend/node_modules missing - installing jsdom" npm install --no-audit --no-fund --silent @@ -74,6 +75,7 @@ jobs: node desktop.test.mjs node toolbar-order.test.mjs node editor-inline.test.mjs + node ai-quick-actions.test.mjs fi # ── Tests ───────────────────────────────────────────────────────── diff --git a/CHANGELOG.md b/CHANGELOG.md index dc748ea..bda9035 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ Format basé sur [Keep a Changelog](https://keepachangelog.com/fr/1.1.0/), et [Semantic Versioning](https://semver.org/spec/v2.0.0.html). > **En cours de développement** : les changements à venir sont listés dans la section -> [Unreleased](#unreleased). La dernière version livrée est **2.13.1**. +> [Unreleased](#unreleased). La dernière version livrée est **2.14.0**. --- @@ -14,6 +14,26 @@ et [Semantic Versioning](https://semver.org/spec/v2.0.0.html). --- +## [2.14.0] — 2026-09-19 + +### Ajouté + +- **#106 - Assistant IA : actions instantanées contextuelles + catalogue de prompts** : + la zone d'accueil remplace les 3 suggestions statiques par des **actions suggérées + selon le contexte détecté** (sélection dans l'éditeur → concis/corriger/expliquer ; + fichier de code → expliquer/bugs/tests ; 2+ docs → fusionner/comparer/frictions ; + 1 doc → résumé 3 points/checklist/frontmatter ; répertoire ou général sinon), avec + badge de contexte dans l'en-tête. Un bouton **« Toutes les actions »** ouvre un + tiroir catalogue (recherche instantanée, 6 catégories, 25 actions i18n FR/EN). + Nouveau prompt **« Générer le frontmatter YAML »** au format complet du vault + (titre, auteur, dates ISO-8601, tags, aliases, booléens, NomDeVoute, Description) + et **« Mettre à jour le frontmatter »** (conserve les champs existants, actualise + `modification_date`, recalcule tags/aliases/Description, complète les manquants) — + tous deux basculent en mode agent et appliquent le résultat via la carte de + confirmation. Détail : [features/ai-quick-actions.md](./features/ai-quick-actions.md). + +--- + ## [2.13.1] — 2026-09-18 --- diff --git a/README.fr.md b/README.fr.md index ac675f5..09eb36a 100644 --- a/README.fr.md +++ b/README.fr.md @@ -4,7 +4,7 @@ **Porte d'entrée web ultra-léger pour vos vaults Obsidian** — Accédez, naviguez et recherchez dans toutes vos notes Obsidian depuis n'importe quel appareil via une interface web moderne et responsive. -[]() +[]() [](https://opensource.org/licenses/MIT) [](https://www.docker.com/) [](https://www.python.org/) @@ -927,8 +927,8 @@ Ce projet est sous licence **MIT** — voir le fichier [LICENSE](LICENSE) pour l ## 📝 Changelog -Consultez le [CHANGELOG.md](./CHANGELOG.md) pour l'historique complet de toutes les versions (v1.0.0 → v2.13.1). +Consultez le [CHANGELOG.md](./CHANGELOG.md) pour l'historique complet de toutes les versions (v1.0.0 → v2.14.0). --- -*Projet : ObsiGate | Version : 2.13.1 | Dernière mise à jour : Juin 2026* +*Projet : ObsiGate | Version : 2.14.0 | Dernière mise à jour : Juin 2026* diff --git a/README.md b/README.md index a1b1332..989dd18 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ **Ultra-light web gateway for your Obsidian vaults** — Access, browse, and search all your Obsidian notes from any device via a modern, responsive web interface. -[]() +[]() [](https://opensource.org/licenses/MIT) [](https://www.docker.com/) [](https://www.python.org/) @@ -1096,8 +1096,8 @@ This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) ## 📝 Changelog -See [CHANGELOG.md](./CHANGELOG.md) for the complete version history (v1.0.0 → v2.13.1). +See [CHANGELOG.md](./CHANGELOG.md) for the complete version history (v1.0.0 → v2.14.0). --- -*Project: ObsiGate | Version: 2.13.1 | Last updated: May 2026* +*Project: ObsiGate | Version: 2.14.0 | Last updated: May 2026* diff --git a/VERSION b/VERSION index 94f15e9..edcfe40 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.13.1 +2.14.0 diff --git a/desktop/Cargo.lock b/desktop/Cargo.lock index 7e0e951..3151b47 100644 --- a/desktop/Cargo.lock +++ b/desktop/Cargo.lock @@ -2626,7 +2626,7 @@ dependencies = [ [[package]] name = "obsigate-desktop" -version = "2.13.1" +version = "2.14.0" dependencies = [ "chrono", "env_logger", diff --git a/desktop/Cargo.toml b/desktop/Cargo.toml index 5d49c80..13e6dc6 100644 --- a/desktop/Cargo.toml +++ b/desktop/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "obsigate-desktop" -version = "2.13.1" +version = "2.14.0" description = "ObsiGate Desktop — Porte d'entrée native pour vos vaults Obsidian" authors = ["Bruno Charest"] edition = "2021" diff --git a/desktop/tauri.conf.json b/desktop/tauri.conf.json index 2cc914a..f247b71 100644 --- a/desktop/tauri.conf.json +++ b/desktop/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/nicedoc/obsigate/main/desktop/tauri.conf.schema.json", "productName": "ObsiGate", - "version": "2.13.1", + "version": "2.14.0", "identifier": "com.obsigate.desktop", "build": { "frontendDist": "../frontend", diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 1c22b49..6b66d5f 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -1,6 +1,6 @@ # ObsiGate — Roadmap -> **Version :** 2.13.1 | **Dernière mise à jour :** 2026-09-18 +> **Version :** 2.14.0 | **Dernière mise à jour :** 2026-09-19 > **Ce fichier ne contient que le travail à venir** (🔵 En cours + ⚪ Backlog) et un index compact > vers les fonctionnalités livrées. > - **Méthode de livraison à appliquer pour toute tâche : [DELIVERY_WORKFLOW.md](./DELIVERY_WORKFLOW.md)** @@ -188,6 +188,7 @@ | 103 | Configuration — clés utilisateur des sources connectées & recherche à clé (page Configurations, `data/api_keys.json`, priorité sur l'env) | 2.11.0 | [features/ai-tools-roadmap.md](./features/ai-tools-roadmap.md) | | 104 | Configuration — Redesign UI de la section « Clés API IA » : recherche fournisseurs, carte défaut 2 colonnes + badges de capacités, cartes dépliables, footer d'actions sticky | 2.12.0 | [features/ai-keys-ui.md](./features/ai-keys-ui.md) | | 105 | Guide d'utilisation — audit de couverture complet, téléchargement Markdown/PDF, guide desktop élargi, section Architecture (Mermaid) + BUG-067 | 2.13.0 | [features/guide-coverage-105.md](./features/guide-coverage-105.md) | +| 106 | Assistant IA — Actions instantanées contextuelles, catalogue « Toutes les actions » & frontmatter complet | 2.14.0 | [features/ai-quick-actions.md](./features/ai-quick-actions.md) | --- @@ -195,7 +196,7 @@ | Priorité | Items | Effort total estimé | |---|---|---| -| ✅ Complété | #1 → #59, #61–72, #74–76, #78–84, #88–93, #94–100, #102–104, #92 | ~115 jours réalisés | +| ✅ Complété | #1 → #59, #61–72, #74–76, #78–84, #88–93, #94–100, #102–106, #92 | ~115 jours réalisés | | 🔵 P2 restant | #77 Desktop : signature de code (non retenue), 6 tests E2E **manuels** ([protocole](./DESKTOP_E2E_CHECKLIST.md)) | ~0,5-1 jour | | ⚪ P4 restant | #73 Sync (6-8j) | 6-8 jours | | ⚪ P0/P1 restant | #85-87 Refonte architecturale, performance, CI/CD (BUG-035 → BUG-040 corrigés) | ~15-23 jours | diff --git a/docs/features/ai-quick-actions.md b/docs/features/ai-quick-actions.md new file mode 100644 index 0000000..e35351b --- /dev/null +++ b/docs/features/ai-quick-actions.md @@ -0,0 +1,89 @@ +# #106 — Assistant IA : actions instantanées contextuelles & catalogue de prompts + +> **Statut :** livré en 2.14.0 · **Domaine :** Assistant IA (frontend) · +> **Fichiers :** `frontend/js/ai-quick-actions.js`, `frontend/js/bookslm.js`, +> `frontend/style.css`, `frontend/locales/{fr,en}.json`, +> `tests/frontend/ai-quick-actions.test.mjs` + +## Problème + +La zone d'accueil de l'assistant affichait 3 suggestions **statiques** par mode +(résumé / thèmes / contradictions), sans lien avec ce que l'utilisateur regarde +réellement (un fichier de code ? plusieurs documents ? une sélection dans +l'éditeur ?), et sans point d'accès au reste des prompts utiles. + +## Solution + +### Catalogue (`frontend/js/ai-quick-actions.js`, module pur sans DOM) + +25 actions en 6 catégories, chacune = `{id, cat, icon (lucide), labelKey, +promptKey, agent?}` — libellés **et** prompts i18n FR/EN (clés `qa.*`) : + +| Catégorie | Actions | +|---|---| +| 📝 Synthèse & Analyse | Résumer en 3 points clés · Frictions/contradictions · Vulgariser · FAQ | +| ✅ Productivité & Structuration | Checklist d'actions · Plan d'action · Mémo exécutif · **Générer le frontmatter YAML** · **Mettre à jour le frontmatter** · Liens/backlinks · Sections hiérarchiques | +| 💻 Code & Scripts | Expliquer · Bugs & failles · Docstrings/types · Tests unitaires | +| 🔗 Cross-documents | Comparer · Fusionner en note de synthèse · Chronologie | +| ✍️ Édition & Reformulation | Concis · Corriger le style · Reformuler · Traduire · Expliquer la sélection | +| ❔ Assistant (général) | Que sais-tu faire · Rechercher efficacement · Créer une note de réunion | + +Les deux actions frontmatter sont marquées `agent: true` : un clic bascule +transparentement le panneau en **mode agent** (comme Deep Research) puis envoie +le prompt — l'assistant lit le document, propose la mutation via l'outil +`edit_file`/`append_to_file`, et la **carte de confirmation** (#79) applique le +nouveau bloc en tête du fichier. + +Le prompt « Générer le frontmatter YAML » demande le format complet du vault de +Bruno (titre, auteur, creation_date/modification_date ISO-8601 avec fuseau, +catégorie, tags en liste inline, aliases, status, publish, favoris, template, +task, archive, draft, private, NomDeVoute, Description). « Mettre à jour le +frontmatter » **conserve les champs existants** : actualise +`modification_date`, recalcule titre/tags/aliases/catégorie/NomDeVoute/Description +d'après le contenu, complète les champs manquants. + +### Sélection contextuelle (triage par défaut dans l'UI) + +`detectContext({mode, docCount, currentPath, hasSelection})` — précédence : +**sélection > code > multi-docs > doc unique > répertoire > général**. + +| Contexte | Boutons suggérés | +|---|---| +| 1 doc texte | Résumer 3 points · Checklist · Générer le frontmatter · Mettre à jour le frontmatter | +| 2+ docs | Fusionner · Comparer · Frictions/contradictions | +| Fichier de code (.py, .ts, .sh…) | Expliquer · Bugs & failles · Tests unitaires | +| Sélection dans l'éditeur | Concis · Corriger le style · Expliquer la sélection | +| Répertoire | Résumer le répertoire · Thèmes · Checklist | +| Général | Que sais-tu faire · Rechercher · Créer une note | + +### Présentation (calquée sur le POC `ai_assistant_quick_actions_poc.html`) + +- Badge de contexte dans l'en-tête (« 1 doc ouvert », « Fichier de code », + « Sélection active », « 3 docs ouverts »…). +- Ligne « Actions suggérées » + bouton **« Toutes les actions »** ouvrant un + **tiroir bottom-sheet** : recherche instantanée (insensible aux accents/casse + via `normalizeSearch`) + catalogue groupé par catégorie, Échap/backdrop + pour fermer. +- Boutons icône + libellé + flèche au survol ; clic = **envoi immédiat** du + prompt dans le composer (chemin `_sendMessage()` : skills, images et mode + agent continuent de fonctionner). +- La rangée se masque dès le premier message du fil (comportement historique) ; + le rafraîchissement du contexte à la sélection éditeur est throttled 250 ms + (`selectionchange` + `mouseup`/`keyup`, CodeMirror n'émettant pas + `selectionchange` natif). +- CSS 100 % variables de thème (`--surface`, `--accent`, `--accent-bg`…) → + conforme aux 15 thèmes ; transitions désactivées en `prefers-reduced-motion`. + +## Tests + +`tests/frontend/ai-quick-actions.test.mjs` (13 tests, câblé au job lint CI) : +précédence des contextes, presets 3-4 actions résolvables, table de conception, +agent-flag des actions frontmatter, **complétude FR+EN** de chaque clé +catalogue/badge contre les vrais JSON de locales. + +## Vérification live (obsigate-test :2020, Playwright) + +badge « 1 doc ouvert », 4 suggestions dont les 2 frontmatter, tiroir à 6 +catégories / 25 actions, recherche « frontmatter » → 2 résultats, clic → +`aria-pressed=true` sur le bouton agent + message envoyé avec le nouveau +prompt + réponse de l'assistant. diff --git a/frontend/js/ai-quick-actions.js b/frontend/js/ai-quick-actions.js new file mode 100644 index 0000000..8fb734b --- /dev/null +++ b/frontend/js/ai-quick-actions.js @@ -0,0 +1,159 @@ +// ObsiGate — #106 : Actions instantanées de l'assistant IA. +// +// Two responsibilities, deliberately framework-free and DOM-free so the +// context rules stay unit-testable (tests/frontend/ai-quick-actions.test.mjs): +// +// 1. ACTION_CATALOG — every prompt action grouped by category. Each action +// carries an id, a lucide icon name, an i18n label key and an i18n +// prompt key; both strings are resolved through t() at render time so +// the FR/EN switch is live. +// 2. detectContext / suggestionsFor — a pure function of the assistant's +// live state (mode, open documents, current file, editor selection) +// returning the context key, then the 3 top action ids for that context +// (contextual triage table, see docs/features/ai-quick-actions.md). +// +// Context precedence (first match wins): +// selection — the user has a live text selection in the open editor +// code — the focused document is a source file (.py, .js, .sh…) +// multi_doc — two or more documents are open in tabs/panes +// single_doc — exactly one text document (.md, .txt, …) is open +// directory — a vault folder was opened from the tree context menu +// general — nothing open: app-help assistant +import { t } from './i18n.js'; + +/** Categories of the action catalogue (order = drawer display order). */ +export const CATEGORIES = Object.freeze([ + { id: 'synthesis', icon: 'sparkles', labelKey: 'qa.cat_synthesis' }, + { id: 'structure', icon: 'list-checks', labelKey: 'qa.cat_structure' }, + { id: 'code', icon: 'code', labelKey: 'qa.cat_code' }, + { id: 'cross', icon: 'git-compare', labelKey: 'qa.cat_cross' }, + { id: 'edition', icon: 'pen-tool', labelKey: 'qa.cat_edition' }, + { id: 'general', icon: 'help-circle', labelKey: 'qa.cat_general' }, +]); + +/** + * The full catalogue. `labelKey` is the button text, `promptKey` the message + * actually sent to the assistant (kept richer than the label on purpose: + * labels stay scannable, prompts stay precise). + */ +export const ACTION_CATALOG = Object.freeze([ + // ── Synthèse & Analyse ────────────────────────────────────────────── + { id: 'summarize_3', cat: 'synthesis', icon: 'align-left', labelKey: 'qa.summarize_3', promptKey: 'qa.summarize_3.prompt' }, + { id: 'frictions', cat: 'synthesis', icon: 'alert-triangle', labelKey: 'qa.frictions', promptKey: 'qa.frictions.prompt' }, + { id: 'vulgarize', cat: 'synthesis', icon: 'lightbulb', labelKey: 'qa.vulgarize', promptKey: 'qa.vulgarize.prompt' }, + { id: 'faq', cat: 'synthesis', icon: 'help-circle', labelKey: 'qa.faq', promptKey: 'qa.faq.prompt' }, + // ── Productivité & Structuration ──────────────────────────────────── + { id: 'checklist', cat: 'structure', icon: 'list-checks', labelKey: 'qa.checklist', promptKey: 'qa.checklist.prompt' }, + { id: 'plan', cat: 'structure', icon: 'list-ordered', labelKey: 'qa.plan', promptKey: 'qa.plan.prompt' }, + { id: 'memo', cat: 'structure', icon: 'scroll-text', labelKey: 'qa.memo', promptKey: 'qa.memo.prompt' }, + { id: 'frontmatter', cat: 'structure', icon: 'braces', labelKey: 'qa.frontmatter', promptKey: 'qa.frontmatter.prompt', agent: true }, + { id: 'frontmatter_update', cat: 'structure', icon: 'refresh-cw', labelKey: 'qa.frontmatter_update', promptKey: 'qa.frontmatter_update.prompt', agent: true }, + { id: 'backlinks', cat: 'structure', icon: 'link-2', labelKey: 'qa.backlinks', promptKey: 'qa.backlinks.prompt' }, + { id: 'sections', cat: 'structure', icon: 'heading', labelKey: 'qa.sections', promptKey: 'qa.sections.prompt' }, + // ── Code & Scripts ─────────────────────────────────────────────────── + { id: 'explain_code', cat: 'code', icon: 'file-code', labelKey: 'qa.explain_code', promptKey: 'qa.explain_code.prompt' }, + { id: 'audit_code', cat: 'code', icon: 'bug', labelKey: 'qa.audit_code', promptKey: 'qa.audit_code.prompt' }, + { id: 'doc_code', cat: 'code', icon: 'braces', labelKey: 'qa.doc_code', promptKey: 'qa.doc_code.prompt' }, + { id: 'test_code', cat: 'code', icon: 'flask-conical', labelKey: 'qa.test_code', promptKey: 'qa.test_code.prompt' }, + // ── Cross-documents ────────────────────────────────────────────────── + { id: 'compare', cat: 'cross', icon: 'git-compare', labelKey: 'qa.compare', promptKey: 'qa.compare.prompt' }, + { id: 'merge', cat: 'cross', icon: 'layers', labelKey: 'qa.merge', promptKey: 'qa.merge.prompt' }, + { id: 'timeline', cat: 'cross', icon: 'history', labelKey: 'qa.timeline', promptKey: 'qa.timeline.prompt' }, + // ── Édition & Reformulation (sélection active) ─────────────────────── + { id: 'concise', cat: 'edition', icon: 'scissors', labelKey: 'qa.concise', promptKey: 'qa.concise.prompt' }, + { id: 'fix_style', cat: 'edition', icon: 'spell-check', labelKey: 'qa.fix_style', promptKey: 'qa.fix_style.prompt' }, + { id: 'rephrase', cat: 'edition', icon: 'pen-tool', labelKey: 'qa.rephrase', promptKey: 'qa.rephrase.prompt' }, + { id: 'translate', cat: 'edition', icon: 'languages', labelKey: 'qa.translate', promptKey: 'qa.translate.prompt' }, + // ── Général (aucun document ouvert) — reprises des anciennes suggestions + { id: 'capabilities', cat: 'general', icon: 'sparkles', labelKey: 'qa.capabilities', promptKey: 'qa.capabilities.prompt' }, + { id: 'search_help', cat: 'general', icon: 'search', labelKey: 'qa.search_help', promptKey: 'qa.search_help.prompt' }, + { id: 'create_note', cat: 'general', icon: 'notebook-pen', labelKey: 'qa.create_note', promptKey: 'qa.create_note.prompt' }, +]); + +/** id → action record, for O(1) lookup by the preset tables. */ +export const ACTIONS_BY_ID = Object.freeze( + ACTION_CATALOG.reduce((acc, a) => { acc[a.id] = a; return acc; }, {}), +); + +/** File extensions treated as source code (drive the `code` context). */ +export const CODE_EXT_RE = /\.(?:py|js|mjs|cjs|ts|tsx|jsx|vue|svelte|go|rs|java|kt|c|h|cpp|hpp|cc|cs|php|rb|swift|sh|bash|zsh|ps1|bat|sql|lua|pl|r|dart|scala)$/i; + +/** Text-ish document extensions (everything else stays "single_doc"). */ +export const TEXT_DOC_EXT_RE = /\.(?:md|markdown|mdx|txt|rst|org|adoc)$/i; + +/** + * Map a set of live facts to one context key. + * + * @param {object} facts + * @param {string} facts.mode assistant mode ('directory'|'documents'|'general') + * @param {number} facts.docCount number of open documents (tabs/panes) + * @param {string|null} facts.currentPath path of the focused document, if any + * @param {boolean} facts.hasSelection true when the open editor holds a text selection + * @param {number} [facts.fileCount] indexed files of the current directory context + * @returns {'selection'|'code'|'multi_doc'|'single_doc'|'directory'|'general'} + */ +export function detectContext(facts) { + const { mode, docCount = 0, currentPath = null, hasSelection = false } = facts || {}; + // A live editor selection is the strongest intent: act on the selection. + if (hasSelection) return 'selection'; + if (mode === 'documents' || docCount > 0) { + if (currentPath && CODE_EXT_RE.test(currentPath)) return 'code'; + if (docCount >= 2) return 'multi_doc'; + return 'single_doc'; + } + if (mode === 'directory') return 'directory'; + return 'general'; +} + +/** + * Contextual triage: the 3 top action ids per context (the "boutons 1-3" of + * the design table). Everything not shown stays reachable via the drawer. + */ +export const CONTEXT_PRESETS = Object.freeze({ + single_doc: ['summarize_3', 'checklist', 'frontmatter', 'frontmatter_update'], + multi_doc: ['merge', 'compare', 'frictions'], + code: ['explain_code', 'audit_code', 'test_code'], + selection: ['concise', 'fix_style', 'explain_selection'], + directory: ['summarize_dir', 'themes', 'checklist'], + general: ['capabilities', 'search_help', 'create_note'], +}); + +// Preset ids that are context phrasings rather than catalogue entries +// (their prompt needs the directory/list framing, so they are synthesized). +const EXTRA_ACTIONS = Object.freeze({ + explain_selection: { id: 'explain_selection', cat: 'edition', icon: 'lightbulb', labelKey: 'qa.explain_selection', promptKey: 'qa.explain_selection.prompt' }, + summarize_dir: { id: 'summarize_dir', cat: 'synthesis', icon: 'align-left', labelKey: 'bookslm.suggestion_summary', promptKey: 'bookslm.suggestion_summary' }, + themes: { id: 'themes', cat: 'synthesis', icon: 'library', labelKey: 'bookslm.suggestion_themes', promptKey: 'bookslm.suggestion_themes' }, +}); + +/** Resolve an action id (catalogue or preset extra) to its record. */ +export function getAction(id) { + return ACTIONS_BY_ID[id] || EXTRA_ACTIONS[id] || null; +} + +/** + * The ordered action records suggested for one context key. + * Unknown keys fall back to the general preset (never throws). + */ +export function suggestionsFor(contextKey) { + const ids = CONTEXT_PRESETS[contextKey] || CONTEXT_PRESETS.general; + return ids.map((id) => getAction(id)).filter(Boolean); +} + +/** Translated label + prompt for an action record (empty string when absent). */ +export function actionTexts(action) { + if (!action) return { label: '', prompt: '' }; + return { label: t(action.labelKey), prompt: t(action.promptKey) }; +} + +/** Badge text for the contextual header chip. */ +export function contextBadgeKey(contextKey, docCount) { + switch (contextKey) { + case 'selection': return 'qa.badge_selection'; + case 'code': return 'qa.badge_code'; + case 'multi_doc': return 'qa.badge_multi'; + case 'single_doc': return 'qa.badge_single'; + case 'directory': return 'qa.badge_directory'; + default: return docCount > 0 ? 'qa.badge_single' : 'qa.badge_general'; + } +} diff --git a/frontend/js/bookslm.js b/frontend/js/bookslm.js index cf55e9f..712cb1e 100644 --- a/frontend/js/bookslm.js +++ b/frontend/js/bookslm.js @@ -10,6 +10,15 @@ import { safeCreateIcons } from './utils.js'; import { api, AuthManager } from './auth.js'; import { showToast } from './ui.js'; import { state } from './state.js'; +// #106 — contextual quick actions (catalogue + triage rules live in ai-quick-actions.js). +import { + detectContext, + suggestionsFor, + actionTexts, + contextBadgeKey, + ACTION_CATALOG, + CATEGORIES, +} from './ai-quick-actions.js'; export const MODE = Object.freeze({ DIRECTORY: 'directory', @@ -920,6 +929,7 @@ class BooksLM { +