Skip to main content

zenith_cli/cli/
plugin.rs

1//! Argument types for `zenith plugin` and its subcommands.
2
3use clap::{Args, Subcommand};
4
5/// Arguments for `zenith plugin`.
6#[derive(Debug, Args)]
7pub struct PluginArgs {
8    #[command(subcommand)]
9    pub command: PluginSub,
10}
11
12/// Subcommands of `zenith plugin`.
13#[derive(Debug, Subcommand)]
14pub enum PluginSub {
15    /// Install the skill for the given agents (auto-detects when none are named).
16    ///
17    /// Install the Zenith agent skill so AI coding tools know how to drive the
18    /// `zenith` CLI. Claude Code, Codex, and OpenCode receive the full folder skill (SKILL.md plus
19    /// reference packs, templates, and themes); other agents receive a single self-contained rule
20    /// file that points back at this self-documenting CLI. Writes are idempotent. With no agent flag,
21    /// the present agents are auto-detected.
22    Install(PluginInstallArgs),
23
24    /// Remove a previously installed skill for the given agents.
25    Uninstall(PluginUninstallArgs),
26
27    /// Show where the Zenith skill is installed, per agent and scope.
28    List,
29}
30
31/// Installation scope for `zenith plugin`.
32#[derive(Debug, Clone, Copy, clap::ValueEnum)]
33pub enum ScopeArg {
34    /// Install for the current user (e.g. `~/.claude/skills/…`).
35    User,
36    /// Install into the current project (e.g. `./.claude/skills/…`).
37    Project,
38}
39
40/// Per-agent selection flags, shared by install and uninstall.
41///
42/// With no flag set, the command auto-detects which agents are present. `--all`
43/// selects every supported agent.
44#[derive(Debug, Args)]
45pub struct AgentFlags {
46    /// Target Claude Code (folder skill).
47    #[arg(long)]
48    pub claude: bool,
49    /// Target Codex (folder skill).
50    #[arg(long)]
51    pub codex: bool,
52    /// Target OpenCode (folder skill).
53    #[arg(long)]
54    pub opencode: bool,
55    /// Target Cursor (project rule).
56    #[arg(long)]
57    pub cursor: bool,
58    /// Target Windsurf (project rule).
59    #[arg(long)]
60    pub windsurf: bool,
61    /// Target Aider (rule file).
62    #[arg(long)]
63    pub aider: bool,
64    /// Target Zed (rule file).
65    #[arg(long)]
66    pub zed: bool,
67    /// Target Gemini CLI (rule file).
68    #[arg(long)]
69    pub gemini: bool,
70    /// Target GitHub Copilot (rule file).
71    #[arg(long)]
72    pub copilot: bool,
73    /// Target Continue (rule file).
74    #[arg(long = "continue")]
75    pub continue_dev: bool,
76    /// Target Kiro (steering rule).
77    #[arg(long)]
78    pub kiro: bool,
79    /// Target Antigravity (rule file).
80    #[arg(long)]
81    pub antigravity: bool,
82    /// Target every supported agent.
83    #[arg(long)]
84    pub all: bool,
85}
86
87/// Arguments for `zenith plugin install`.
88#[derive(Debug, Args)]
89#[command(after_help = "EXAMPLES:\n  \
90zenith plugin install                       # auto-detect and install for the user\n  \
91zenith plugin install --claude --codex      # specific agents\n  \
92zenith plugin install --all --scope project # everything, into ./\n  \
93zenith plugin install --claude --dry-run    # preview without writing")]
94pub struct PluginInstallArgs {
95    #[command(flatten)]
96    pub agents: AgentFlags,
97
98    /// Install for the user (default) or the current project.
99    #[arg(long, value_enum, default_value_t = ScopeArg::User)]
100    pub scope: ScopeArg,
101
102    /// Overwrite existing files whose content differs.
103    #[arg(long)]
104    pub force: bool,
105
106    /// Show what would be written without touching the filesystem.
107    #[arg(long)]
108    pub dry_run: bool,
109}
110
111/// Arguments for `zenith plugin uninstall`.
112#[derive(Debug, Args)]
113pub struct PluginUninstallArgs {
114    #[command(flatten)]
115    pub agents: AgentFlags,
116
117    /// Uninstall from the user (default) or the current project.
118    #[arg(long, value_enum, default_value_t = ScopeArg::User)]
119    pub scope: ScopeArg,
120
121    /// Show what would be removed without touching the filesystem.
122    #[arg(long)]
123    pub dry_run: bool,
124}