fix(discord): avoid invalid /acp native option payload

This commit is contained in:
Peter Steinberger
2026-02-26 16:48:59 +00:00
parent cd80c7e7ff
commit c5facb8477
2 changed files with 18 additions and 2 deletions

View File

@@ -320,8 +320,7 @@ function buildChatCommands(): ChatCommandDefinition[] {
args: [
{
name: "action",
description:
"spawn | cancel | steer | close | sessions | status | set-mode | set | cwd | permissions | timeout | model | reset-options | doctor | install | help",
description: "Action to run",
type: "string",
choices: [
"spawn",

View File

@@ -109,6 +109,23 @@ describe("commands registry", () => {
expect(findCommandByNativeName("tts", "discord")).toBeUndefined();
});
it("keeps discord native command specs within slash-command limits", () => {
const native = listNativeCommandSpecsForConfig(
{ commands: { native: true } },
{ provider: "discord" },
);
for (const spec of native) {
expect(spec.name).toMatch(/^[a-z0-9_-]{1,32}$/);
expect(spec.description.length).toBeGreaterThan(0);
expect(spec.description.length).toBeLessThanOrEqual(100);
for (const arg of spec.args ?? []) {
expect(arg.name).toMatch(/^[a-z0-9_-]{1,32}$/);
expect(arg.description.length).toBeGreaterThan(0);
expect(arg.description.length).toBeLessThanOrEqual(100);
}
}
});
it("keeps ACP native action choices aligned with implemented handlers", () => {
const acp = listChatCommands().find((command) => command.key === "acp");
expect(acp).toBeTruthy();