From 38445f63f00c42a9abf42b3e436d47eb39a01745 Mon Sep 17 00:00:00 2001 From: Seth Troisi Date: Tue, 1 Jul 2025 17:17:08 -0700 Subject: make tag required for /chat (#2904) --- packages/cli/src/ui/hooks/slashCommandProcessor.ts | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'packages/cli/src/ui/hooks/slashCommandProcessor.ts') diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts index ffc3d7d1..01378d89 100644 --- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts @@ -699,7 +699,7 @@ export const useSlashCommandProcessor = ( { name: 'chat', description: - 'Manage conversation history. Usage: /chat [tag]', + 'Manage conversation history. Usage: /chat ', action: async (_mainCommand, subCommand, args) => { const tag = (args || '').trim(); const logger = new Logger(config?.getSessionId() || ''); @@ -716,19 +716,27 @@ export const useSlashCommandProcessor = ( if (!subCommand) { addMessage({ type: MessageType.ERROR, - content: 'Missing command\nUsage: /chat [tag]', + content: 'Missing command\nUsage: /chat ', timestamp: new Date(), }); return; } switch (subCommand) { case 'save': { + if (!tag) { + addMessage({ + type: MessageType.ERROR, + content: 'Missing tag. Usage: /chat save ', + timestamp: new Date(), + }); + return; + } const history = chat.getHistory(); if (history.length > 0) { await logger.saveCheckpoint(chat?.getHistory() || [], tag); addMessage({ type: MessageType.INFO, - content: `Conversation checkpoint saved${tag ? ' with tag: ' + tag : ''}.`, + content: `Conversation checkpoint saved with tag: ${tag}.`, timestamp: new Date(), }); } else { @@ -743,11 +751,19 @@ export const useSlashCommandProcessor = ( case 'resume': case 'restore': case 'load': { + if (!tag) { + addMessage({ + type: MessageType.ERROR, + content: 'Missing tag. Usage: /chat resume ', + timestamp: new Date(), + }); + return; + } const conversation = await logger.loadCheckpoint(tag); if (conversation.length === 0) { addMessage({ type: MessageType.INFO, - content: `No saved checkpoint found${tag ? ' with tag: ' + tag : ''}.`, + content: `No saved checkpoint found with tag: ${tag}.`, timestamp: new Date(), }); return; -- cgit v1.2.3