ExAthena.Chat.Commands (ExAthena v0.12.0)

Copy Markdown View Source

Pure parser + dispatcher for slash commands in the mix athena.chat REPL.

parse/1 maps a raw input line (or :eof) to one of:

  • {:message, text} — free-form user prompt for the agent loop.
  • {:command, verb, args} — recognized slash command (:model, :mode, :tools, :clear, :help).
  • :exit — user wants to leave the session (/exit, /quit, /q, EOF).
  • :noop — input was blank.
  • {:unknown, verb} — slash-prefixed input that didn't match a known verb.

Parsing is case-insensitive on the verb and trims surrounding whitespace. Arguments after the verb are split on whitespace and preserved as strings.

Summary

Functions

One-line summary for each verb, keyed by the slash-prefixed name. Used to enrich autocomplete suggestions.

Canonical slash-prefixed verbs available for autocomplete, sorted alphabetically. The aliases (? for help, q/quit for exit, etc.) are intentionally excluded.

Types

result()

@type result() ::
  {:message, String.t()}
  | {:command, atom(), [String.t()]}
  | :exit
  | :noop
  | {:unknown, String.t()}

Functions

descriptions()

@spec descriptions() :: %{required(String.t()) => String.t()}

One-line summary for each verb, keyed by the slash-prefixed name. Used to enrich autocomplete suggestions.

help_text()

@spec help_text() :: String.t()

parse(input)

@spec parse(String.t() | :eof) :: result()

verbs()

@spec verbs() :: [String.t()]

Canonical slash-prefixed verbs available for autocomplete, sorted alphabetically. The aliases (? for help, q/quit for exit, etc.) are intentionally excluded.