docs(commands): document /usage slash command

This commit is contained in:
Peter Steinberger
2026-01-09 17:14:35 +01:00
parent 1838582546
commit c82ebd3ef3
2 changed files with 36 additions and 2 deletions

View File

@@ -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 <name>` (or `/<alias>` from `agents.defaults.models.*.alias`)
- `/model <name>` (alias: `/models`; or `/<alias>` from `agents.defaults.models.*.alias`)
- `/queue <mode>` (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.

View File

@@ -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<string> {
const documented = new Set<string>();
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);
}
}
});
});