dev_prune/commands/
skill.rs1use anyhow::Result;
6use std::fs;
7
8use crate::config::Registry;
9use crate::output;
10
11pub const EMBEDDED_SKILL_MD: &str = include_str!("../../.agents/skills/dev-prune/SKILL.md");
12
13pub fn run() -> Result<()> {
15 output::print_header("dev-prune AI Agent Skill Integration");
16
17 let skill_path = if let Ok(config_dir) = Registry::config_dir() {
18 if !config_dir.exists() {
19 let _ = fs::create_dir_all(&config_dir);
20 }
21 let target = config_dir.join("SKILL.md");
22 let _ = fs::write(&target, EMBEDDED_SKILL_MD);
23 output::clean_path(&target)
24 } else {
25 "~/.config/dev-prune/SKILL.md".to_string()
26 };
27
28 output::print_success(&format!("Bundled SKILL.md exported to `{skill_path}`"));
29
30 let agent_roots = crate::setup::agent_skill_roots();
33 match crate::setup::ensure_agent_skills() {
34 crate::setup::Outcome::Installed | crate::setup::Outcome::AlreadyPresent => {
35 for root in &agent_roots {
36 output::print_success(&format!(
37 "Skill installed for your AI agent at `{}`",
38 output::clean_path(root.join("SKILL.md"))
39 ));
40 }
41 }
42 crate::setup::Outcome::Skipped(_) => {
43 output::print_info(
44 "No AI agent skills directory was found — use the prompts below instead.",
45 );
46 }
47 crate::setup::Outcome::Failed(why) => {
48 output::print_warning(&format!(
49 "Could not install into the agent skills directory: {why}"
50 ));
51 }
52 }
53 println!();
54 output::print_header("🤖 AI Agent Onboarding Prompts (Copy & Paste to your AI Assistant)");
55 println!();
56 output::print_info("Prompt 1: Initial Workspace Discovery & Onboarding");
57 println!("```markdown");
58 println!(
59 "Read the dev-prune AI skill at file://{skill_path} and run `devp init` to scan, register, and onboard all Git repositories in my workspace."
60 );
61 println!("```");
62 println!();
63 output::print_info(
64 "Prompt 2: Universal Skill Import (Antigravity, Claude Code, Cursor, Windsurf, Copilot, OpenClaw)",
65 );
66 println!("```markdown");
67 println!(
68 "I have installed `dev-prune` on my machine. Read the skill at file://{skill_path} and import it into your agent skills folder so you can autonomously maintain lockfiles and prune bloat directories."
69 );
70 println!("```");
71
72 Ok(())
73}