feat: phase 2 — playbooks (am history --save + am playbook, rejeu pas à pas) (closes #51)

This commit is contained in:
2026-08-18 13:30:29 -04:00
parent e82979e6a3
commit aa0d8e43eb
17 changed files with 630 additions and 16 deletions
+46
View File
@@ -293,6 +293,52 @@ pub static HELP_SPECS: &[HelpSpec] = &[
HelpExample { desc: "JSON stream for scripts.", code: "monitor --json --interval 10" },
],
},
HelpSpec {
name: "history",
category: "Commands",
usage: "history {flags} [range]",
about: "Structured history of every REPL command, with search, re-run and playbook export (issue #51).",
search_terms: &["history", "search", "rerun", "playbook", "save", "replay"],
flags: &[
HelpFlag { short: "", long: "--kind", value: "KIND", desc: "Only commands of this kind (am or shell)" },
HelpFlag { short: "", long: "--cwd", value: "DIR", desc: "Only commands run in this directory" },
HelpFlag { short: "", long: "--search", value: "TEXT", desc: "Full-text search in the command line" },
HelpFlag { short: "", long: "--failed", value: "", desc: "Only failed commands" },
HelpFlag { short: "", long: "--session", value: "ID", desc: "Only commands of this session" },
HelpFlag { short: "", long: "--limit", value: "N", desc: "Maximum entries (default 100)" },
HelpFlag { short: "", long: "--rerun", value: "N", desc: "Re-run the Nth most recent entry" },
HelpFlag { short: "", long: "--save", value: "FILE", desc: "Export the range as a playbook YAML (issue #51)" },
],
subcommands: &[],
parameters: &[
HelpParam { name: "range", typ: "from..to", desc: "1-based inclusive range, newest first (e.g. 12..25)" },
],
io: None,
examples: &[
HelpExample { desc: "List the last commands.", code: "history" },
HelpExample { desc: "Re-run the 5th most recent entry.", code: "history --rerun 5" },
HelpExample { desc: "Save entries 12..25 as a playbook.", code: "history 12..25 --save deploy.yaml" },
],
},
HelpSpec {
name: "playbook",
category: "Commands",
usage: "playbook <file> {flags}",
about: "Replay a saved playbook step by step with confirmation; stops with a non-zero exit code on failure (issue #51).",
search_terms: &["playbook", "replay", "rejouer", "steps", "automation"],
flags: &[
HelpFlag { short: "", long: "--var", value: "NAME=VALUE", desc: "Variable value, repeatable ({{name}} in the steps)" },
],
subcommands: &[],
parameters: &[
HelpParam { name: "file", typ: "path", desc: "Playbook file (bare name resolves under state_dir/playbooks/)" },
],
io: None,
examples: &[
HelpExample { desc: "Replay with confirmation for each step.", code: "playbook deploy.yaml" },
HelpExample { desc: "Replay without asking, with a variable.", code: "playbook deploy.yaml --yes --var agent=claude-code" },
],
},
HelpSpec {
name: "top",
category: "Commands",