Skip to main content

dev_prune/commands/
skill.rs

1// Copyright 2026 VKrishna04
2// SPDX-License-Identifier: Apache-2.0
3
4/// AI Agent Skill exporter & onboarding prompt generator.
5use 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
13/// Run `devp skill` to export SKILL.md and display AI Agent onboarding prompts.
14pub 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    println!();
30    output::print_header("🤖 AI Agent Onboarding Prompts (Copy & Paste to your AI Assistant)");
31    println!();
32    output::print_info("Prompt 1: Initial Workspace Discovery & Onboarding");
33    println!("```markdown");
34    println!(
35        "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."
36    );
37    println!("```");
38    println!();
39    output::print_info(
40        "Prompt 2: Universal Skill Import (Antigravity, Claude Code, Cursor, Windsurf, Copilot, OpenClaw)",
41    );
42    println!("```markdown");
43    println!(
44        "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."
45    );
46    println!("```");
47
48    Ok(())
49}