From 48c0b80f390c59183cdb332d2c0f5eb223c3c765 Mon Sep 17 00:00:00 2001 From: murashit Date: Wed, 8 Jul 2026 10:36:53 +0900 Subject: [PATCH] Polish slash command help wording --- .../application/composer/slash-commands.ts | 14 ++-- .../slash-command-execution.test.ts | 82 +++++-------------- 2 files changed, 28 insertions(+), 68 deletions(-) diff --git a/src/features/chat/application/composer/slash-commands.ts b/src/features/chat/application/composer/slash-commands.ts index a74de841..ef9818ed 100644 --- a/src/features/chat/application/composer/slash-commands.ts +++ b/src/features/chat/application/composer/slash-commands.ts @@ -100,21 +100,21 @@ export const SLASH_COMMANDS = [ usage: "/auto-review", argsKind: "none", surface: "threadSetting", - detail: "Toggle approval auto-review.", + detail: "Toggle auto-review for subsequent turns.", }, { command: "/fast", usage: "/fast", argsKind: "none", surface: "threadSetting", - detail: "Toggle fast service tier for subsequent turns.", + detail: "Toggle fast mode for subsequent turns.", }, { command: "/plan", usage: "/plan [message]", argsKind: "optionalMessage", surface: "threadSetting", - detail: "Toggle Plan mode, optionally with a message.", + detail: "Toggle Plan mode for subsequent turns, optionally with a message.", }, { command: "/goal", @@ -149,14 +149,14 @@ export const SLASH_COMMANDS = [ usage: "/doctor", argsKind: "none", surface: "diagnostic", - detail: "Show Codex CLI and Codex App Server diagnostics.", + detail: "Show Codex CLI and Codex app-server diagnostics.", }, { command: "/tools", usage: "/tools", argsKind: "none", surface: "diagnostic", - detail: "Show Codex plugins, tool providers, and skills reported by App Server.", + detail: "Show Codex plugins, tool providers, and skills reported by Codex app-server.", }, { command: "/model", @@ -170,14 +170,14 @@ export const SLASH_COMMANDS = [ usage: "/reasoning [level|default]", argsKind: "showOrSet", surface: "threadSetting", - detail: "Show or set reasoning level for subsequent turns.", + detail: "Show or set reasoning effort for subsequent turns.", }, { command: "/help", usage: "/help", argsKind: "none", surface: "diagnostic", - detail: "Show available Codex slash commands.", + detail: "Show this command list.", }, ] as const satisfies readonly SlashCommandDefinitionShape[]; diff --git a/tests/features/chat/application/conversation/slash-command-execution.test.ts b/tests/features/chat/application/conversation/slash-command-execution.test.ts index 9bfc43fb..354c06f0 100644 --- a/tests/features/chat/application/conversation/slash-command-execution.test.ts +++ b/tests/features/chat/application/conversation/slash-command-execution.test.ts @@ -597,41 +597,17 @@ describe("slash commands", () => { }); it("groups slash command help by command surface", () => { - expect(slashCommandHelpSections()).toEqual([ - { - title: "Panel actions", - auditFacts: expect.arrayContaining([ - { key: "/clear", value: "Clear the current panel and start a fresh Codex thread." }, - { key: "/reconnect", value: "Reconnect to Codex app-server and resume the active thread." }, - { key: "/archive ", value: "Archive the selected Codex thread." }, - { key: "/rename ", value: "Rename the selected Codex thread." }, - ]), - }, - { - title: "Thread settings", - auditFacts: expect.arrayContaining([ - { key: "/plan [message]", value: "Toggle Plan mode, optionally with a message." }, - { key: "/goal", value: "Show or manage the current thread goal." }, - { key: "/goal set ", value: "Create or update the thread goal." }, - { key: "/permissions [profile|default]", value: "Show or set the permission profile for subsequent turns." }, - { key: "/model [model|default]", value: "Show or set the model for subsequent turns." }, - ]), - }, - { - title: "Diagnostics", - auditFacts: expect.arrayContaining([ - { key: "/status", value: "Show current thread, context, and usage limits." }, - { key: "/help", value: "Show available Codex slash commands." }, - ]), - }, - { - title: "Composition", - auditFacts: [ - { key: "/refer ", value: "Send a message with recent turns from another non-archived thread." }, - { key: "/clip [message]", value: "Clip a URL into a vault note and send a wikilink reference with an optional message." }, - ], - }, - ]); + const sections = slashCommandHelpSections(); + + expect(sections.map((section) => section.title)).toEqual(["Panel actions", "Thread settings", "Diagnostics", "Composition"]); + expect(slashCommandHelpKeys("Panel actions")).toEqual( + expect.arrayContaining(["/clear", "/reconnect", "/archive ", "/rename "]), + ); + expect(slashCommandHelpKeys("Thread settings")).toEqual( + expect.arrayContaining(["/plan [message]", "/goal", "/permissions [profile|default]", "/model [model|default]"]), + ); + expect(slashCommandHelpKeys("Diagnostics")).toEqual(expect.arrayContaining(["/status", "/doctor", "/tools", "/help"])); + expect(slashCommandHelpKeys("Composition")).toEqual(["/refer ", "/clip [message]"]); }); it("rejects /help arguments", async () => { @@ -744,24 +720,10 @@ describe("slash commands", () => { }); it("expands goal subcommands in help", () => { - expect(slashCommandHelpValue("/goal [set |edit|pause|resume|clear]")).toBeUndefined(); - expect(slashCommandHelpValue("/goal")).toBe("Show or manage the current thread goal."); - expect(slashCommandHelpValue("/goal set ")).toBe("Create or update the thread goal."); - expect(slashCommandHelpValue("/goal clear")).toBe("Clear the current thread goal."); - }); - - it("documents auto-review", () => { - expect(slashCommandHelpValue("/auto-review")).toBe("Toggle approval auto-review."); - }); - - it("documents rollback", () => { - expect(slashCommandHelpValue("/rollback")).toBe("Roll back the latest turn and restore its prompt."); - }); - - it("documents status and doctor as separate commands", () => { - expect(slashCommandHelpValue("/status")).toBe("Show current thread, context, and usage limits."); - expect(slashCommandHelpValue("/permissions [profile|default]")).toBe("Show or set the permission profile for subsequent turns."); - expect(slashCommandHelpValue("/doctor")).toBe("Show Codex CLI and Codex App Server diagnostics."); + expect(slashCommandHelpKeys("Thread settings")).toEqual( + expect.arrayContaining(["/goal", "/goal set ", "/goal edit", "/goal pause", "/goal resume", "/goal clear"]), + ); + expect(slashCommandHelpKeys("Thread settings")).not.toContain("/goal [set |edit|pause|resume|clear]"); }); it("rejects unsupported reasoning effort with usage", async () => { @@ -870,14 +832,12 @@ describe("slash commands", () => { expect(ctx.runtimeSettings.toggleFastMode).not.toHaveBeenCalled(); expect(ctx.addSystemMessage).toHaveBeenCalledWith("/fast does not take arguments. Usage: /fast"); }); - - it("documents Codex capabilities", () => { - expect(slashCommandHelpValue("/tools")).toBe("Show Codex plugins, tool providers, and skills reported by App Server."); - }); }); -function slashCommandHelpValue(key: string): string | undefined { - return slashCommandHelpSections() - .flatMap((section) => section.auditFacts) - .find((row) => row.key === key)?.value; +function slashCommandHelpKeys(title: string): string[] { + return ( + slashCommandHelpSections() + .find((section) => section.title === title) + ?.auditFacts.map((row) => row.key) ?? [] + ); }