feat(cli): ship the agent skill inside the binary

A `cargo install` leaves a binary and nothing else, so there is no file on
disk for a coding agent to read. `skills install` writes an embedded SKILL.md
into every agent found on the machine — Claude Code and opencode today, any
other via --dir — and installing over an older copy is what updating means.

The skill carries what --help cannot: the JSON keys of every record, what each
exit code means, and the rule that an agent always passes --json. A unit test
walks the clap command tree and holds SKILL.md to a documented entry for every
command, so a new subcommand fails the build until it is written up.
This commit is contained in:
Michel de Graaf
2026-07-25 02:17:11 +02:00
parent 03e8924a6b
commit 95bc18672d
7 changed files with 543 additions and 3 deletions
+22
View File
@@ -423,6 +423,28 @@ impl Record for ConfigRecord {
}
}
/// What happened to one agent's copy of the skill.
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
pub struct SkillRecord {
/// The agent the directory belongs to, or `custom` for a `--dir`.
pub agent: String,
pub path: String,
/// `installed` (written), `unchanged` (already identical), `outdated`
/// (present but different, reported by `list`), `removed`, or `absent`.
pub action: String,
}
impl Record for SkillRecord {
fn text(&self) -> String {
format!(
"{}\t{}\t{}",
sanitize(&self.action),
sanitize(&self.agent),
sanitize(&self.path)
)
}
}
/// The result of probing automatic port mapping.
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
pub struct PortmapRecord {