Skip to main content

spec_driven_docs/cli/
skill.rs

1//! `skill` subcommand: parse-shape.
2//!
3//! Holds the clap derive structs only. No I/O, no business logic.
4
5use clap::{Subcommand, ValueEnum};
6
7/// Read the embedded skills, or install and remove them for coding agents.
8#[derive(Debug, clap::Args)]
9pub struct SkillArgs {
10    /// The verb to run.
11    #[command(subcommand)]
12    pub command: SkillCommand,
13}
14
15/// Every verb `sdd skill` offers.
16#[derive(Debug, Subcommand)]
17pub enum SkillCommand {
18    /// List every embedded skill.
19    List,
20    /// Print one skill's `SKILL.md`.
21    Show(ShowArgs),
22    /// Install the skills into the agent skill directories.
23    Install(InstallArgs),
24    /// Remove the installed skills from the agent skill directories.
25    Uninstall(UninstallArgs),
26}
27
28/// Print one skill's `SKILL.md`.
29#[derive(Debug, clap::Args)]
30pub struct ShowArgs {
31    /// The skill's name.
32    pub name: String,
33}
34
35/// Install the skills into the agent skill directories.
36#[derive(Debug, clap::Args)]
37pub struct InstallArgs {
38    /// Which agent's skill directory to install into.
39    #[arg(long, value_enum, default_value_t = Agent::All)]
40    pub agent: Agent,
41
42    /// Where the skills land; `user` is the home-directory scope.
43    #[arg(long, value_enum, default_value_t = Scope::User)]
44    pub scope: Scope,
45
46    /// Write the files; without it the install previews.
47    #[arg(long)]
48    pub apply: bool,
49
50    /// Overwrite a destination whose bytes differ from the payload.
51    #[arg(long, requires = "apply")]
52    pub force: bool,
53}
54
55/// Remove the installed skills from the agent skill directories.
56#[derive(Debug, clap::Args)]
57pub struct UninstallArgs {
58    /// Which agent's skill directory to remove from.
59    #[arg(long, value_enum, default_value_t = Agent::All)]
60    pub agent: Agent,
61
62    /// Where the skills live; `user` is the home-directory scope.
63    #[arg(long, value_enum, default_value_t = Scope::User)]
64    pub scope: Scope,
65
66    /// Remove the files; without it the uninstall previews.
67    #[arg(long)]
68    pub apply: bool,
69}
70
71/// Which skill directory family to install into.
72///
73/// The values name the root rather than one host that reads it. `sdd status
74/// --json` reports where each one resolves, including the variable that
75/// moved it, so no help text here has to spell a path.
76#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
77#[value(rename_all = "kebab-case")]
78pub enum Agent {
79    /// The root Claude Code reads.
80    Claude,
81    /// The shared root every other agent reads. `codex` is its old name.
82    #[value(alias = "codex")]
83    Agents,
84    /// Both roots.
85    All,
86}
87
88/// Where an install lands.
89#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
90#[value(rename_all = "kebab-case")]
91pub enum Scope {
92    /// The home-directory skill roots, shared across projects.
93    User,
94}