Light Dark

Functions

arg

fn (text: Str): Str

Return only the parsed command argument.

find

fn (commands: Vec, parsed: ParsedCommand): Command?

Find the first command matching parsed input, or null.

matches

fn (parsed: ParsedCommand, command: Command): Bool

True when parsed command parsed matches a command's name or aliases.

ns alias

Alias of ::ai::agent::command/

Command helpers for chat-style agents.

This module intentionally keeps command execution policy out of the primitive parser. Concrete agents decide whether a command replies inline, emits an event, calls a handler directly, or streams.

parse

fn (text: Str): ParsedCommand

Parse /command rest of text into {is-command, name, arg, raw}. The leading slash is removed, the command name is lowercased, and bot suffixes like /ask@MyBot become ask.

strip-bot-suffix

fn (token: Str): Str

usage-line

fn (command: Command): Str

Render one command as a concise help line.

Types

Command

Command type {
    name: Str,
    aliases: Vec?,
    description: Str?,
    usage: Str?,
    route: Str?,
    is-async: Bool?,
    handler: Fn?,
    meta: Map?
}

Declarative command metadata for docs, help text, and dispatch tables.

ParsedCommand

ParsedCommand type {
    is-command: Bool,
    name: Str,
    arg: Str,
    raw: Str
}

Result of parsing a slash-style command from text.