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

@ -1681,6 +1681,35 @@ export type ReplyChunk =
| { kind: "final"; content: string }
| { kind: "error"; message: string };
export type SlashCommandAvailability =
| { status: "available" }
| { status: "unavailable"; reason: string };
export type SlashCommandSource =
| "native"
| { plugin: { pluginId: string } };
export type NativeSlashCommand = "help" | "clean" | "profile";
export interface SlashCommand {
name: string;
shortDescription: string;
requiresConfirmation: boolean;
availability: SlashCommandAvailability;
source: SlashCommandSource;
native?: NativeSlashCommand;
}
export type SlashCommandEffect =
| { kind: "help"; commands: SlashCommand[] }
| { kind: "cleanConversation"; sessionId: string; clearedChunks: number }
| { kind: "profileSwitch"; sessionId: string };
export interface ExecuteSlashCommandResult {
command: SlashCommand;
effect: SlashCommandEffect;
}
// ---------------------------------------------------------------------------
// Paired devices + pairing code (ticket #77)
// ---------------------------------------------------------------------------