Skip to main content

systemprompt_cli/commands/core/plugins/
mod.rs

1//! `plugins` CLI command group: list, show, validate, and generate plugins.
2//!
3//! [`PluginsCommands`] enumerates the subcommands; [`execute`] dispatches each
4//! to its submodule and renders the result. Output payload types live in
5//! [`types`].
6
7pub mod types;
8
9mod generate;
10mod list;
11mod show;
12mod validate;
13
14use anyhow::{Context, Result};
15use clap::Subcommand;
16
17use crate::context::CommandContext;
18use crate::shared::render_result;
19
20#[derive(Debug, Subcommand)]
21pub enum PluginsCommands {
22    #[command(about = "List configured plugins")]
23    List(list::ListArgs),
24
25    #[command(about = "Show plugin details")]
26    Show(show::ShowArgs),
27
28    #[command(about = "Validate plugin configuration")]
29    Validate(validate::ValidateArgs),
30
31    #[command(about = "Generate Claude Code plugin output")]
32    Generate(generate::GenerateArgs),
33}
34
35pub fn execute(command: PluginsCommands, ctx: &CommandContext) -> Result<()> {
36    match command {
37        PluginsCommands::List(args) => {
38            let result = list::execute(args, &ctx.cli).context("Failed to list plugins")?;
39            render_result(&result, &ctx.cli);
40            Ok(())
41        },
42        PluginsCommands::Show(args) => {
43            let result = show::execute(&args, &ctx.cli).context("Failed to show plugin")?;
44            render_result(&result, &ctx.cli);
45            Ok(())
46        },
47        PluginsCommands::Validate(args) => {
48            let result = validate::execute(args, &ctx.cli).context("Failed to validate plugins")?;
49            render_result(&result, &ctx.cli);
50            Ok(())
51        },
52        PluginsCommands::Generate(args) => {
53            let result =
54                generate::execute(&args, &ctx.cli).context("Failed to generate plugins")?;
55            render_result(&result, &ctx.cli);
56            Ok(())
57        },
58    }
59}