From b67806ae9a99e5a3c449c60457933b47d14ba66c Mon Sep 17 00:00:00 2001 From: Billy Biggs Date: Sun, 15 Jun 2025 11:40:39 -0700 Subject: Support completion of checkpoint names in /resume (#1063) --- packages/cli/src/ui/hooks/slashCommandProcessor.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (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 a4b13d0a..dfefc562 100644 --- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts @@ -44,6 +44,7 @@ export interface SlashCommand { name: string; altName?: string; description?: string; + completion?: () => Promise; action: ( mainCommand: string, subCommand?: string, @@ -643,6 +644,25 @@ Add any other context about the problem here. name: 'resume', description: 'resume from conversation checkpoint. Usage: /resume [tag]', + completion: async () => { + const geminiDir = config?.getGeminiDir(); + if (!geminiDir) { + return []; + } + try { + const files = await fs.readdir(geminiDir); + return files + .filter( + (file) => + file.startsWith('checkpoint-') && file.endsWith('.json'), + ) + .map((file) => + file.replace('checkpoint-', '').replace('.json', ''), + ); + } catch (_err) { + return []; + } + }, action: async (_mainCommand, subCommand, _args) => { const tag = (subCommand || '').trim(); const logger = new Logger(config?.getSessionId() || ''); -- cgit v1.2.3