feat(plugins): seam slash-commands contribuées par plugin via callback — #165 (QA verte)

Permet à un plugin de contribuer des commandes slash adossées à une callback,
transitant par le registry/contrat unifié (#162) :

- sdk/IdeaSDK: manifeste contributes.slashCommands (déclaratif) — pointer bumpé.
- domain: source Plugin étendue + effet PluginCallback (la commande ne
  s'exécute pas directement : elle renvoie une référence à la callback du plugin).
- application: registration des commandes plugin dans le registry + exécution
  renvoyant l'effet PluginCallback ; métadonnées UI suffisantes pour l'autocomplete.
- backend + app-tauri: DTO + commandes Tauri listant/invoquant les commandes plugin.
- frontend (contrat): types adapters/domain/ports/mock pour pluginCallback et
  l'invocation avec arguments.

L'exécution effective de la callback côté runtime UI est livrée par #166.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-06 15:46:52 +02:00
parent ff7696b724
commit fbaca9d5cc
17 changed files with 514 additions and 34 deletions

View File

@ -411,6 +411,24 @@ pub struct PluginMenuItemContribution {
pub when: Option<String>,
}
/// Slash-command contribution backed by a plugin command callback.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PluginSlashCommandContribution {
/// Slash name, including the leading `/`.
pub name: String,
/// Short autocomplete/help description.
pub short_description: String,
/// Plugin command callback id registered through the SDK command registry.
pub command: PluginCommandId,
/// Whether the host should ask for confirmation before dispatching callback.
#[serde(default)]
pub requires_confirmation: bool,
/// Optional declarative condition reserved for host-side availability.
#[serde(default)]
pub when: Option<String>,
}
/// Layout contribution.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
@ -472,6 +490,9 @@ pub struct PluginContributionSet {
/// Menu items.
#[serde(default)]
pub menu_items: Vec<PluginMenuItemContribution>,
/// Slash commands.
#[serde(default)]
pub slash_commands: Vec<PluginSlashCommandContribution>,
/// Layout contributions.
#[serde(default)]
pub layouts: Vec<PluginLayoutContribution>,