From 6742a1b7f97033d1301f4159b67ef0d9587f65f2 Mon Sep 17 00:00:00 2001 From: Seth Troisi Date: Thu, 26 Jun 2025 22:01:00 -0700 Subject: [PATCH] Explicit message for missing subcommand (#2019) --- .../cli/src/ui/hooks/slashCommandProcessor.ts | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts index 82cb0237..52e8effc 100644 --- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts @@ -477,19 +477,27 @@ export const useSlashCommandProcessor = ( switch (subCommand) { case 'show': showMemoryAction(); - return; // Explicitly return void + return; case 'refresh': performMemoryRefresh(); - return; // Explicitly return void + return; case 'add': return addMemoryAction(mainCommand, subCommand, args); // Return the object + case undefined: + addMessage({ + type: MessageType.ERROR, + content: + 'Missing command\nUsage: /memory [text for add]', + timestamp: new Date(), + }); + return; default: addMessage({ type: MessageType.ERROR, content: `Unknown /memory command: ${subCommand}. Available: show, refresh, add`, timestamp: new Date(), }); - return; // Explicitly return void + return; } }, }, @@ -677,6 +685,14 @@ export const useSlashCommandProcessor = ( }); return; } + if (!subCommand) { + addMessage({ + type: MessageType.ERROR, + content: 'Missing command\nUsage: /chat [tag]', + timestamp: new Date(), + }); + return; + } switch (subCommand) { case 'save': { const history = chat.getHistory();