feat(cli): menu contextuel d'autocomplétion des slash-commands dans le composer — #163 (QA verte)

À la saisie d'un « / » en début de draft (sans espace), ouverture d'un menu
contextuel listant les commandes matchant le préfixe, via le contrat unifié
listSlashCommands — aucune liste codée en dur côté UI. Rafinement incrémental
des suggestions à la frappe, navigation clavier + sélection, exécution par
executeSlashCommand.

- adapters/agent: listSlashCommands(prefix?) + executeSlashCommand (invoke Tauri).
- domain + ports: types SlashCommand / ExecuteSlashCommandResult.
- mock: données de test.
- CustomAgentChatView: détection de préfixe (/ sans espace), fetch avec séquence
  anti-retard, gestion ouverture/active index, navigation clavier, fermeture
  quand le préfixe cesse d'être éligible.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-06 15:02:40 +02:00
parent b51011d206
commit 853d8229f2
7 changed files with 467 additions and 0 deletions

View File

@ -76,6 +76,8 @@ import type {
ResolvedAgentPermissions,
ResolvedAgentSystemPermissions,
ReplyChunk,
SlashCommand,
ExecuteSlashCommandResult,
ServerExposurePreview,
ServerExposureSettings,
Skill,
@ -305,6 +307,16 @@ export interface AgentGateway {
onChunk: (chunk: ReplyChunk) => void,
options?: SendAgentChatOptions,
): Promise<void>;
/**
* Lists/filter the unified slash-command registry for the custom structured
* CLI. The backend owns command metadata and future plugin contributions.
*/
listSlashCommands?(prefix?: string): Promise<SlashCommand[]>;
/** Executes a selected slash command and returns the planned UI effect. */
executeSlashCommand?(
name: string,
options?: { sessionId?: string | null },
): Promise<ExecuteSlashCommandResult>;
/** Interrupts only the current turn of a live structured session. */
cancelAgentChat?(sessionId: string): Promise<void>;
/** Shuts a live structured session down. */