feat(commands): add /commands slash list

This commit is contained in:
LK
2026-01-08 16:02:54 +01:00
parent c20a12aa7b
commit 559e175b38
7 changed files with 81 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ export type ChatCommandDefinition = {
description: string;
textAliases: string[];
acceptsArgs?: boolean;
supportsNative?: boolean;
};
export type NativeCommandSpec = {
@@ -21,6 +22,12 @@ const CHAT_COMMANDS: ChatCommandDefinition[] = [
description: "Show available commands.",
textAliases: ["/help"],
},
{
key: "commands",
nativeName: "commands",
description: "List all slash commands.",
textAliases: ["/commands"],
},
{
key: "status",
nativeName: "status",
@@ -65,6 +72,14 @@ const CHAT_COMMANDS: ChatCommandDefinition[] = [
description: "Start a new session.",
textAliases: ["/new"],
},
{
key: "compact",
nativeName: "compact",
description: "Compact the current session context.",
textAliases: ["/compact"],
acceptsArgs: true,
supportsNative: false,
},
{
key: "think",
nativeName: "think",
@@ -127,7 +142,9 @@ export function listChatCommands(): ChatCommandDefinition[] {
}
export function listNativeCommandSpecs(): NativeCommandSpec[] {
return CHAT_COMMANDS.map((command) => ({
return CHAT_COMMANDS.filter(
(command) => command.supportsNative !== false,
).map((command) => ({
name: command.nativeName,
description: command.description,
acceptsArgs: Boolean(command.acceptsArgs),