Skip to main content

dev_prune/commands/
skill.rs

1// Copyright 2026 VKrishna04
2// SPDX-License-Identifier: Apache-2.0
3
4// Copyright 2026 VKrishna04
5//
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10//     http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18/// AI Agent Skill exporter & onboarding prompt generator.
19use anyhow::Result;
20use std::fs;
21
22use crate::config::Registry;
23use crate::output;
24
25pub const EMBEDDED_SKILL_MD: &str = include_str!("../../.agents/skills/dev-prune/SKILL.md");
26
27/// Run `devp skill` to export SKILL.md and display AI Agent onboarding prompts.
28pub fn run() -> Result<()> {
29    output::print_header("dev-prune AI Agent Skill Integration");
30
31    let skill_path = if let Ok(config_dir) = Registry::config_dir() {
32        if !config_dir.exists() {
33            let _ = fs::create_dir_all(&config_dir);
34        }
35        let target = config_dir.join("SKILL.md");
36        let _ = fs::write(&target, EMBEDDED_SKILL_MD);
37        output::clean_path(&target)
38    } else {
39        "~/.config/dev-prune/SKILL.md".to_string()
40    };
41
42    output::print_success(&format!("Bundled SKILL.md exported to `{skill_path}`"));
43    println!();
44    output::print_header("🤖 AI Agent Onboarding Prompts (Copy & Paste to your AI Assistant)");
45    println!();
46    output::print_info("Prompt 1: Initial Workspace Discovery & Onboarding");
47    println!("```markdown");
48    println!(
49        "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."
50    );
51    println!("```");
52    println!();
53    output::print_info(
54        "Prompt 2: Universal Skill Import (Antigravity, Claude Code, Cursor, Windsurf, Copilot, OpenClaw)",
55    );
56    println!("```markdown");
57    println!(
58        "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."
59    );
60    println!("```");
61
62    Ok(())
63}