mod help;
use crate::judge::nearest;
pub(in crate::cli) use help::{USAGE, verb_help};
pub(in crate::cli) const VERBS: &[&str] =
&["check", "explain", "sets", "fix", "stats", "init", "guard"];
pub(in crate::cli) const POINTER: &str =
"run 'ctrm --help' for the verbs and flags";
#[must_use]
pub(in crate::cli) fn unknown_verb(word: &str) -> String {
let hint = nearest(word, VERBS.iter().copied())
.map(|verb| format!(" (did you mean '{verb}'?)"))
.unwrap_or_default();
format!("unknown verb '{word}'{hint}\n{POINTER}")
}
#[must_use]
pub(in crate::cli) fn missing_verb() -> String {
format!("no verb given\n{POINTER}")
}
pub(in crate::cli) const GUARD: &str = "ctrm guard -- agent hook adapter
reads one hook payload (JSON) on stdin and writes the hook decision on
stdout; the rules come from the dotfiles at the payload's cwd. Takes no
flags: any other word is ignored, so a hook line can never exit 2.
exit codes: 0 decided (the decision is in the JSON), 1 the adapter
failed; never 2, which a harness reads as \"block\"
example: ctrm guard < payload.json (as a PreToolUse/PostToolUse hook)";