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::cli_settings::get_global_config;
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) -> Result<()> {
36    let config = get_global_config();
37
38    match command {
39        PluginsCommands::List(args) => {
40            let result = list::execute(args, &config).context("Failed to list plugins")?;
41            render_result(&result);
42            Ok(())
43        },
44        PluginsCommands::Show(args) => {
45            let result = show::execute(&args, &config).context("Failed to show plugin")?;
46            render_result(&result);
47            Ok(())
48        },
49        PluginsCommands::Validate(args) => {
50            let result = validate::execute(args, &config).context("Failed to validate plugins")?;
51            render_result(&result);
52            Ok(())
53        },
54        PluginsCommands::Generate(args) => {
55            let result = generate::execute(&args, &config).context("Failed to generate plugins")?;
56            render_result(&result);
57            Ok(())
58        },
59    }
60}