From 30d630fea526818a7b569af32c175b8084e539f9 Mon Sep 17 00:00:00 2001 From: ShayBC Date: Wed, 5 Mar 2025 13:08:50 +0200 Subject: [PATCH] Resolved merge conflicts --- src/core/webview/ClineProvider.ts | 44 +++++++------------------------ 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index eed3764f6c..55633b2f80 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -2116,26 +2116,9 @@ export class ClineProvider implements vscode.WebviewViewProvider { // delete task from the task history state await this.deleteTaskFromState(id) - // Delete the task files. - const apiConversationHistoryFileExists = await fileExistsAtPath(apiConversationHistoryFilePath) - - if (apiConversationHistoryFileExists) { - await fs.unlink(apiConversationHistoryFilePath) - } - - const uiMessagesFileExists = await fileExistsAtPath(uiMessagesFilePath) - - if (uiMessagesFileExists) { - await fs.unlink(uiMessagesFilePath) - } - - const legacyMessagesFilePath = path.join(taskDirPath, "claude_messages.json") - - if (await fileExistsAtPath(legacyMessagesFilePath)) { - await fs.unlink(legacyMessagesFilePath) - } - + // check if checkpoints are enabled const { enableCheckpoints } = await this.getState() + // get the base directory of the project const baseDir = vscode.workspace.workspaceFolders?.map((folder) => folder.uri.fsPath).at(0) // Delete checkpoints branch. @@ -2150,22 +2133,15 @@ export class ClineProvider implements vscode.WebviewViewProvider { } } - // Delete checkpoints directory - const checkpointsDir = path.join(taskDirPath, "checkpoints") - - if (await fileExistsAtPath(checkpointsDir)) { - try { - await fs.rm(checkpointsDir, { recursive: true, force: true }) - console.log(`[deleteTaskWithId${id}] removed checkpoints repo`) - } catch (error) { - console.error( - `[deleteTaskWithId${id}] failed to remove checkpoints repo: ${error instanceof Error ? error.message : String(error)}`, - ) - } + // delete the entire task directory including checkpoints and all content + try { + await fs.rm(taskDirPath, { recursive: true, force: true }) + console.log(`[deleteTaskWithId${id}] removed task directory`) + } catch (error) { + console.error( + `[deleteTaskWithId${id}] failed to remove task directory: ${error instanceof Error ? error.message : String(error)}`, + ) } - - // Succeeds if the dir is empty. - await fs.rmdir(taskDirPath) } async deleteTaskFromState(id: string) {