Skip to main content

systemprompt_cli/commands/core/skills/
mod.rs

1//! `skills` CLI command group: list and show configured skills.
2//!
3//! [`SkillsCommands`] enumerates the subcommands; [`execute`] resolves the
4//! global config and dispatches via [`execute_with_config`]. Output payload
5//! types live in [`types`].
6
7pub mod types;
8
9mod list;
10mod show;
11
12use anyhow::{Context, Result};
13use clap::Subcommand;
14
15use crate::CliConfig;
16use crate::cli_settings::get_global_config;
17use crate::shared::render_result;
18
19#[derive(Debug, Subcommand)]
20pub enum SkillsCommands {
21    #[command(about = "List configured skills")]
22    List(list::ListArgs),
23
24    #[command(about = "Show skill details")]
25    Show(show::ShowArgs),
26}
27
28pub fn execute(command: SkillsCommands) -> Result<()> {
29    let config = get_global_config();
30    execute_with_config(command, &config)
31}
32
33pub fn execute_with_config(command: SkillsCommands, config: &CliConfig) -> Result<()> {
34    match command {
35        SkillsCommands::List(args) => {
36            let result = list::execute(args, config).context("Failed to list skills")?;
37            render_result(&result);
38            Ok(())
39        },
40        SkillsCommands::Show(args) => {
41            let result = show::execute(&args, config).context("Failed to show skill")?;
42            render_result(&result);
43            Ok(())
44        },
45    }
46}