Skip to main content

Module cli

Module cli 

Source
Expand description

Reusable helpers for skills-related CLI subcommands.

Downstream binaries (mcp-server, kglite-mcp-server, …) plug these into their own clap setup to offer skills-lint, skills-list, and skills-show without re-implementing the load / resolve / format flow. Each helper returns a string ready to print, plus an exit-code indicator where relevant.

use mcp_methods::server::cli;
match cli::skills_lint(&dir) {
    Ok(report) => println!("{report}"),
    Err(e) => { eprintln!("{e}"); std::process::exit(2); }
}

Structs§

LintReport
Result of skills_lint — a one-line report per file and a boolean indicating whether any error was found.

Functions§

skills_lint
Walk dir for *.md files, parse each as a skill, and report per-file status. Soft warnings (size 4–16 KB) annotate the line but don’t flip has_errors. Hard failures (missing frontmatter, missing required field, >16 KB) emit an ERROR line and flip has_errors so operators can wire a non-zero exit on lint failure.
skills_list
Build a registry from a manifest YAML and return a one-line-per- skill summary suitable for stdout. Output columns: name, provenance, description (truncated).
skills_new
Scaffold a starter SKILL.md at dest and return the resolved path written. Thin wrapper around write_skill_template that bubbles errors as String for symmetric handling alongside skills_list / skills_show.
skills_show
Look up a single skill by name and return its full body, prefixed with a header line showing the name and provenance. Returns Err if the skill is not present in the resolved set.