Skip to main content

render_skill_files

Function render_skill_files 

Source
pub fn render_skill_files(registry: &Registry) -> String
Expand description

Render skill files for every command in a registry.

Calls render_skill_file on every command in depth-first order via crate::query::Registry::iter_all_recursive and concatenates the results separated by ---\n\n.

§Arguments

  • registry — The registry whose commands should be documented as skill files.

§Examples

let registry = Registry::new(vec![
    Command::builder("deploy")
        .summary("Deploy the application")
        .best_practice("always dry-run first")
        .build()
        .unwrap(),
    Command::builder("status")
        .summary("Show status")
        .build()
        .unwrap(),
]);

let skills = render_skill_files(&registry);
assert!(skills.contains("# Skill: deploy"));
assert!(skills.contains("# Skill: status"));
assert!(skills.contains("---"));