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`] dispatches each
4//! against the invocation's [`CommandContext`]. Output payload types live in
5//! [`types`].
6//!
7//! Copyright (c) systemprompt.io — Business Source License 1.1.
8//! See <https://systemprompt.io> for licensing details.
9
10pub mod types;
11
12mod list;
13mod show;
14
15use anyhow::{Context, Result};
16use clap::Subcommand;
17
18use crate::context::CommandContext;
19use crate::shared::render_result;
20
21#[derive(Debug, Subcommand)]
22pub enum SkillsCommands {
23    #[command(about = "List configured skills")]
24    List(list::ListArgs),
25
26    #[command(about = "Show skill details")]
27    Show(show::ShowArgs),
28}
29
30pub fn execute(command: SkillsCommands, ctx: &CommandContext) -> Result<()> {
31    match command {
32        SkillsCommands::List(args) => {
33            let result = list::execute(args, &ctx.cli).context("Failed to list skills")?;
34            render_result(&result, &ctx.cli);
35            Ok(())
36        },
37        SkillsCommands::Show(args) => {
38            let result = show::execute(&args, &ctx.cli).context("Failed to show skill")?;
39            render_result(&result, &ctx.cli);
40            Ok(())
41        },
42    }
43}