diff --git a/docs/tools/slash-commands.md b/docs/tools/slash-commands.md index 33e3fff6b..a69bf194d 100644 --- a/docs/tools/slash-commands.md +++ b/docs/tools/slash-commands.md @@ -35,7 +35,8 @@ Directives (`/think`, `/verbose`, `/reasoning`, `/elevated`) are parsed even whe Text + native (when enabled): - `/help` -- `/status` (alias: `/usage`) +- `/status` (show current status; includes a short usage line when available) +- `/usage` (alias: `/status`) - `/debug show|set|unset|reset` (runtime overrides, owner-only) - `/cost on|off` (toggle per-response usage line) - `/stop` @@ -47,7 +48,7 @@ Text + native (when enabled): - `/verbose on|off` (alias: `/v`) - `/reasoning on|off|stream` (alias: `/reason`; `stream` = Telegram draft only) - `/elevated on|off` (alias: `/elev`) -- `/model ` (or `/` from `agents.defaults.models.*.alias`) +- `/model ` (alias: `/models`; or `/` from `agents.defaults.models.*.alias`) - `/queue ` (plus options like `debounce:2s cap:25 drop:summarize`; send `/queue` to see current settings) Text-only: @@ -55,6 +56,7 @@ Text-only: Notes: - Commands accept an optional `:` between the command and args (e.g. `/think: high`, `/send: on`, `/help:`). +- `/status` and `/usage` show the same status output; for full provider usage breakdown, use `clawdbot status --usage`. - `/cost` appends per-response token usage; it only shows dollar cost when the model uses an API key (OAuth hides cost). - `/restart` is disabled by default; set `commands.restart: true` to enable it. - `/verbose` is meant for debugging and extra visibility; keep it **off** in normal use. diff --git a/src/docs/slash-commands-doc.test.ts b/src/docs/slash-commands-doc.test.ts new file mode 100644 index 000000000..30a7f620e --- /dev/null +++ b/src/docs/slash-commands-doc.test.ts @@ -0,0 +1,32 @@ +import fs from "node:fs/promises"; +import path from "node:path"; +import { describe, expect, it } from "vitest"; + +import { listChatCommands } from "../auto-reply/commands-registry.js"; + +function extractDocumentedSlashCommands(markdown: string): Set { + const documented = new Set(); + for (const match of markdown.matchAll(/`\/(?!<)([a-z0-9_-]+)/gi)) { + documented.add(`/${match[1]}`); + } + return documented; +} + +describe("slash commands docs", () => { + it("documents all built-in chat command aliases", async () => { + const docPath = path.join( + process.cwd(), + "docs", + "tools", + "slash-commands.md", + ); + const markdown = await fs.readFile(docPath, "utf8"); + const documented = extractDocumentedSlashCommands(markdown); + + for (const command of listChatCommands()) { + for (const alias of command.textAliases) { + expect(documented.has(alias)).toBe(true); + } + } + }); +});