use crate::cli::{err, ok};
use anyhow::Result;
use clap::Parser;

#[derive(Parser)]
pub struct Args {
    /// Skip copying the binary; only drop SKILL.md and completions.
    #[arg(long)]
    pub skill_only: bool,
}

pub fn run(_args: Args) -> Result<()> {
    let home = std::env::var("HOME").unwrap_or_else(|_| "/home/adom".to_string());
    let skill_dir = format!("{home}/.claude/skills/adom-step");
    if let Err(e) = std::fs::create_dir_all(&skill_dir) {
        err(format!("create {skill_dir}: {e}"));
        return Err(e.into());
    }

    // Bundle: SKILL.md is included via include_str! so users can paste-install.
    let skill_md = include_str!("../../SKILL.md");
    let skill_path = format!("{skill_dir}/SKILL.md");
    std::fs::write(&skill_path, skill_md)?;
    ok(format!("wrote {skill_path}"));

    Ok(())
}