summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/slashCommandProcessor.ts
diff options
context:
space:
mode:
authorLouis Jimenez <[email protected]>2025-06-20 01:18:11 -0400
committerGitHub <[email protected]>2025-06-20 01:18:11 -0400
commitb179424161a81bb3401ac046e605cfb0403c0f0d (patch)
tree89d55f92380ff9676fe93654a0107d82a27f514a /packages/cli/src/ui/hooks/slashCommandProcessor.ts
parent6c6761862427279455256e7c99cc45a2f17583ca (diff)
Support autocompletion for checkpoints (#1253)
Diffstat (limited to 'packages/cli/src/ui/hooks/slashCommandProcessor.ts')
-rw-r--r--packages/cli/src/ui/hooks/slashCommandProcessor.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts
index 8195f005..679c294c 100644
--- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts
+++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts
@@ -810,6 +810,22 @@ Add any other context about the problem here.
name: 'restore',
description:
'restore a tool call. This will reset the conversation and file history to the state it was in when the tool call was suggested',
+ completion: async () => {
+ const checkpointDir = config?.getProjectTempDir()
+ ? path.join(config.getProjectTempDir(), 'checkpoints')
+ : undefined;
+ if (!checkpointDir) {
+ return [];
+ }
+ try {
+ const files = await fs.readdir(checkpointDir);
+ return files
+ .filter((file) => file.endsWith('.json'))
+ .map((file) => file.replace('.json', ''));
+ } catch (_err) {
+ return [];
+ }
+ },
action: async (_mainCommand, subCommand, _args) => {
const checkpointDir = config?.getProjectTempDir()
? path.join(config.getProjectTempDir(), 'checkpoints')