use clap::{ArgGroup, Args, Parser, Subcommand};
#[derive(Debug, Parser)]
#[command(
name = "agents-skills",
about = "A minimal skill installer and manager for AI agents",
long_about = None,
disable_version_flag = true
)]
pub struct Cli {
#[arg(short = 'v', long = "version")]
pub version: bool,
#[command(subcommand)]
pub command: Option<Command>,
}
#[derive(Debug, Subcommand)]
pub enum Command {
#[command(alias = "a", alias = "i", alias = "install")]
Add(AddArgs),
#[command(alias = "rm", alias = "r")]
Remove(RemoveArgs),
#[command(alias = "ls")]
List(ListArgs),
#[command(alias = "upgrade", alias = "check")]
Update(UpdateArgs),
#[command(alias = "d")]
Disable(DisableArgs),
#[command(alias = "e")]
Enable(EnableArgs),
Agent(AgentArgs),
}
#[derive(Debug, Args)]
pub struct AddArgs {
#[arg(required = true)]
pub source: Vec<String>,
#[arg(short = 'g', long = "global")]
pub global: bool,
#[arg(short = 's', long = "skill", num_args = 1..)]
pub skill: Vec<String>,
#[arg(short = 'l', long = "list")]
pub list: bool,
#[arg(short = 'y', long = "yes")]
pub yes: bool,
#[arg(long = "full-depth")]
pub full_depth: bool,
}
#[derive(Debug, Args)]
pub struct RemoveArgs {
pub skills: Vec<String>,
#[arg(short = 'g', long = "global")]
pub global: bool,
#[arg(short = 's', long = "skill", num_args = 1..)]
pub skill: Vec<String>,
#[arg(short = 'y', long = "yes")]
pub yes: bool,
#[arg(long = "all")]
pub all: bool,
}
#[derive(Debug, Args)]
pub struct ListArgs {
#[arg(short = 'g', long = "global")]
pub global: bool,
#[arg(short = 'a', long = "agent", num_args = 1..)]
pub agent: Vec<String>,
#[arg(long = "json")]
pub json: bool,
}
#[derive(Debug, Args)]
pub struct UpdateArgs {
pub skills: Vec<String>,
#[arg(short = 'g', long = "global")]
pub global: bool,
#[arg(short = 'p', long = "project")]
pub project: bool,
#[arg(short = 'y', long = "yes")]
pub yes: bool,
}
#[derive(Debug, Args)]
pub struct DisableArgs {
pub skills: Vec<String>,
#[arg(short = 'g', long = "global")]
pub global: bool,
#[arg(short = 's', long = "skill", num_args = 1..)]
pub skill: Vec<String>,
#[arg(long = "all")]
pub all: bool,
}
#[derive(Debug, Args)]
pub struct EnableArgs {
pub skills: Vec<String>,
#[arg(short = 'g', long = "global")]
pub global: bool,
#[arg(short = 's', long = "skill", num_args = 1..)]
pub skill: Vec<String>,
#[arg(long = "all")]
pub all: bool,
}
#[derive(Debug, Args)]
#[command(group(
ArgGroup::new("mode")
.required(true)
.args(["link", "unlink", "status"])
))]
pub struct AgentArgs {
pub agents: Vec<String>,
#[arg(short = 'g', long = "global")]
pub global: bool,
#[arg(long = "link")]
pub link: bool,
#[arg(long = "unlink")]
pub unlink: bool,
#[arg(long = "status")]
pub status: bool,
#[arg(long = "migrate", conflicts_with_all = ["status", "unlink"])]
pub migrate: bool,
}
pub const RESET: &str = "\x1b[0m";
pub const DIM: &str = "\x1b[38;5;102m";
pub const TEXT: &str = "\x1b[38;5;145m";
pub const BOLD: &str = "\x1b[1m";
pub const CYAN: &str = "\x1b[36m";
pub const GREEN: &str = "\x1b[32m";
pub const YELLOW: &str = "\x1b[33m";
pub const RED: &str = "\x1b[31m";
pub fn show_banner() {
println!();
println!("{DIM}Agents skills installer and manager{RESET}");
println!();
println!(
" {DIM}${RESET} {TEXT}agents-skills add {DIM}<package>{RESET} {DIM}Add a new skill{RESET}"
);
println!(
" {DIM}${RESET} {TEXT}agents-skills remove{RESET} {DIM}Remove installed skills{RESET}"
);
println!(
" {DIM}${RESET} {TEXT}agents-skills list{RESET} {DIM}List installed skills{RESET}"
);
println!();
println!(
" {DIM}${RESET} {TEXT}agents-skills update{RESET} {DIM}Update installed skills{RESET}"
);
println!();
println!(
" {DIM}${RESET} {TEXT}agents-skills agent --link{RESET} {DIM}Link agents to the skills dir{RESET}"
);
println!(
" {DIM}${RESET} {TEXT}agents-skills agent --status{RESET} {DIM}Show agent link status{RESET}"
);
println!(
" {DIM}${RESET} {TEXT}agents-skills agent --unlink{RESET} {DIM}Unlink agents{RESET}"
);
println!();
println!(
" {DIM}${RESET} {TEXT}agents-skills disable{RESET} {DIM}Disable installed skills{RESET}"
);
println!(
" {DIM}${RESET} {TEXT}agents-skills enable{RESET} {DIM}Re-enable disabled skills{RESET}"
);
println!();
println!("{DIM}try:{RESET} agents-skills add anthropics/skills");
println!();
}