docs(commands): document /usage slash command
This commit is contained in:
@@ -35,7 +35,8 @@ Directives (`/think`, `/verbose`, `/reasoning`, `/elevated`) are parsed even whe
|
|||||||
|
|
||||||
Text + native (when enabled):
|
Text + native (when enabled):
|
||||||
- `/help`
|
- `/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)
|
- `/debug show|set|unset|reset` (runtime overrides, owner-only)
|
||||||
- `/cost on|off` (toggle per-response usage line)
|
- `/cost on|off` (toggle per-response usage line)
|
||||||
- `/stop`
|
- `/stop`
|
||||||
@@ -47,7 +48,7 @@ Text + native (when enabled):
|
|||||||
- `/verbose on|off` (alias: `/v`)
|
- `/verbose on|off` (alias: `/v`)
|
||||||
- `/reasoning on|off|stream` (alias: `/reason`; `stream` = Telegram draft only)
|
- `/reasoning on|off|stream` (alias: `/reason`; `stream` = Telegram draft only)
|
||||||
- `/elevated on|off` (alias: `/elev`)
|
- `/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)
|
- `/queue <mode>` (plus options like `debounce:2s cap:25 drop:summarize`; send `/queue` to see current settings)
|
||||||
|
|
||||||
Text-only:
|
Text-only:
|
||||||
@@ -55,6 +56,7 @@ Text-only:
|
|||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
- Commands accept an optional `:` between the command and args (e.g. `/think: high`, `/send: on`, `/help:`).
|
- 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).
|
- `/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.
|
- `/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.
|
- `/verbose` is meant for debugging and extra visibility; keep it **off** in normal use.
|
||||||
|
|||||||
32
src/docs/slash-commands-doc.test.ts
Normal file
32
src/docs/slash-commands-doc.test.ts
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user