Skip to main content

systemprompt_cli/commands/core/plugins/
mod.rs

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