fix(tui): keep memory commands out of suggestions

This commit is contained in:
Ralph Chang
2026-05-08 20:55:03 +08:00
parent 65b3b2f2c3
commit 2ff17ea1b3
2 changed files with 3 additions and 2 deletions
+3 -1
View File
@@ -7,7 +7,7 @@ import type { TuiCommand } from "@opencode-ai/plugin/tui";
// ---------------------------------------------------------------------------
type MockDialogContext = { clear: () => void; replace: (...args: unknown[]) => void; stack: unknown[] };
type RuntimeCommand = { value: string; slash?: { name: string; aliases?: string[] }; onSelect?: (dialog: MockDialogContext) => void | Promise<void> };
type RuntimeCommand = { value: string; suggested?: boolean; slash?: { name: string; aliases?: string[] }; onSelect?: (dialog: MockDialogContext) => void | Promise<void> };
interface MockPromptCall {
sessionID: string;
@@ -53,6 +53,7 @@ function makeMockTuiApi(options: {
for (const item of items) {
const runtimeItem: RuntimeCommand = {
value: item.value,
suggested: item.suggested,
slash: item.slash,
onSelect: item.onSelect
? (dialogContext: MockDialogContext = dialog) => (item.onSelect as (dialog: MockDialogContext) => void | Promise<void>)(dialogContext)
@@ -102,6 +103,7 @@ test("registers three unique hyphenated memory slash commands", async () => {
const slashNames = api.commands.map(command => command.slash?.name).filter(Boolean);
assert.deepEqual(slashNames, ["memory-status", "memory-list", "memory-help"]);
assert.deepEqual(api.commands.map(command => command.slash), [{ name: "memory-status" }, { name: "memory-list" }, { name: "memory-help" }]);
assert.deepEqual(api.commands.map(command => command.suggested), [undefined, undefined, undefined]);
assert.equal(new Set(slashNames).size, slashNames.length);
assert.deepEqual(api.commands.map(command => command.value), ["memory.status", "memory.list", "memory.help"]);
assert.equal(api.commands.some(command => command.value === "memory.activity"), false);