( context: CommandContext, _partialArg: string, )
| 121 | } |
| 122 | |
| 123 | async function completion( |
| 124 | context: CommandContext, |
| 125 | _partialArg: string, |
| 126 | ): Promise<string[]> { |
| 127 | const { services } = context; |
| 128 | const { config } = services; |
| 129 | const checkpointDir = config?.getProjectTempDir() |
| 130 | ? path.join(config.getProjectTempDir(), 'checkpoints') |
| 131 | : undefined; |
| 132 | if (!checkpointDir) { |
| 133 | return []; |
| 134 | } |
| 135 | try { |
| 136 | const files = await fs.readdir(checkpointDir); |
| 137 | return files |
| 138 | .filter((file) => file.endsWith('.json')) |
| 139 | .map((file) => file.replace('.json', '')); |
| 140 | } catch (_err) { |
| 141 | return []; |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | export const restoreCommand = (config: Config | null): SlashCommand | null => { |
| 146 | if (!config?.getCheckpointingEnabled()) { |
nothing calls this directly
no test coverage detected