omk 0.5.0

A Rust runtime for Kimi CLI. Turns prompts into proof-backed engineering runs with gates, worktrees, and replay.
Documentation
/// Category used to group commands in help output.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CommandCategory {
    Help,
    Override,
    Inspection,
    GoalControl,
    Session,
    Theme,
    Quit,
}

/// Static metadata for a single slash command.
#[derive(Debug, Clone, Copy)]
pub struct CommandSpec {
    pub name: &'static str,
    pub aliases: &'static [&'static str],
    pub help: &'static str,
    pub args_help: &'static str,
    pub min_args: u8,
    pub max_args: Option<u8>,
    pub category: CommandCategory,
}

/// The canonical command registry.
pub const COMMAND_REGISTRY: &[CommandSpec] = &[
    CommandSpec {
        name: "help",
        aliases: &["?"],
        help: "shows the in-app help table",
        args_help: "",
        min_args: 0,
        max_args: Some(0),
        category: CommandCategory::Help,
    },
    CommandSpec {
        name: "quick",
        aliases: &[],
        help: "force-classify the next prompt as small",
        args_help: "<prompt>",
        min_args: 1,
        max_args: None,
        category: CommandCategory::Override,
    },
    CommandSpec {
        name: "escalate",
        aliases: &[],
        help: "force-classify as large (always preflights)",
        args_help: "<prompt>",
        min_args: 1,
        max_args: None,
        category: CommandCategory::Override,
    },
    CommandSpec {
        name: "classify",
        aliases: &[],
        help: "dry-run classification, no execution",
        args_help: "<prompt>",
        min_args: 1,
        max_args: None,
        category: CommandCategory::Inspection,
    },
    CommandSpec {
        name: "explain",
        aliases: &[],
        help: "show the latest classifier decision in full",
        args_help: "",
        min_args: 0,
        max_args: Some(0),
        category: CommandCategory::Inspection,
    },
    CommandSpec {
        name: "show",
        aliases: &[],
        help: "show plan/proof/goals",
        args_help: "<plan|proof|goals>",
        min_args: 1,
        max_args: Some(1),
        category: CommandCategory::Inspection,
    },
    CommandSpec {
        name: "goal",
        aliases: &[],
        help: "goal subcommand: show <id>",
        args_help: "show <id>",
        min_args: 2,
        max_args: Some(2),
        category: CommandCategory::GoalControl,
    },
    CommandSpec {
        name: "inject",
        aliases: &[],
        help: "inject a hint into running goal/worker",
        args_help: "<text>",
        min_args: 1,
        max_args: None,
        category: CommandCategory::GoalControl,
    },
    CommandSpec {
        name: "pause",
        aliases: &[],
        help: "pause all active workers",
        args_help: "",
        min_args: 0,
        max_args: Some(0),
        category: CommandCategory::GoalControl,
    },
    CommandSpec {
        name: "resume",
        aliases: &[],
        help: "resume after pause (no arg) or session by id",
        args_help: "[<session_id>]",
        min_args: 0,
        max_args: Some(1),
        category: CommandCategory::Session,
    },
    CommandSpec {
        name: "cancel",
        aliases: &[],
        help: "cancel active large goal",
        args_help: "",
        min_args: 0,
        max_args: Some(0),
        category: CommandCategory::GoalControl,
    },
    CommandSpec {
        name: "approve",
        aliases: &[],
        help: "accept the latest slice PR",
        args_help: "",
        min_args: 0,
        max_args: Some(0),
        category: CommandCategory::GoalControl,
    },
    CommandSpec {
        name: "reject",
        aliases: &[],
        help: "reject the latest slice PR with optional reason",
        args_help: "[<reason>]",
        min_args: 0,
        max_args: None,
        category: CommandCategory::GoalControl,
    },
    CommandSpec {
        name: "diff",
        aliases: &[],
        help: "show current uncommitted diff",
        args_help: "",
        min_args: 0,
        max_args: Some(0),
        category: CommandCategory::Inspection,
    },
    CommandSpec {
        name: "cost",
        aliases: &[],
        help: "print cost summary",
        args_help: "",
        min_args: 0,
        max_args: Some(0),
        category: CommandCategory::Inspection,
    },
    CommandSpec {
        name: "new",
        aliases: &[],
        help: "start a fresh session (current is archived)",
        args_help: "",
        min_args: 0,
        max_args: Some(0),
        category: CommandCategory::Session,
    },
    CommandSpec {
        name: "sessions",
        aliases: &[],
        help: "list recent sessions",
        args_help: "",
        min_args: 0,
        max_args: Some(0),
        category: CommandCategory::Session,
    },
    CommandSpec {
        name: "theme",
        aliases: &[],
        help: "switch theme: dark or light",
        args_help: "<dark|light>",
        min_args: 1,
        max_args: Some(1),
        category: CommandCategory::Theme,
    },
    CommandSpec {
        name: "quit",
        aliases: &["exit"],
        help: "exit the app (confirm if active goal)",
        args_help: "",
        min_args: 0,
        max_args: Some(0),
        category: CommandCategory::Quit,
    },
];

/// Look up a command spec by name or alias.
pub fn find_spec(name: &str) -> Option<&'static CommandSpec> {
    COMMAND_REGISTRY
        .iter()
        .find(|spec| spec.name == name || spec.aliases.contains(&name))
}