From 183ec5f2d41772a36d3b3af14a1cd8afcb6d9929 Mon Sep 17 00:00:00 2001 From: "Duong M. CUONG" Date: Mon, 28 Apr 2025 19:55:28 +0900 Subject: [PATCH] feat: persist workspacePath to each task for improved task management --- src/core/Cline.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 304b86d318..4883a404ae 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -133,6 +133,7 @@ export class Cline extends EventEmitter { readonly rootTask: Cline | undefined = undefined readonly parentTask: Cline | undefined = undefined readonly taskNumber: number + readonly workspacePath: string isPaused: boolean = false pausedModeSlug: string = defaultModeSlug @@ -221,6 +222,10 @@ export class Cline extends EventEmitter { } this.taskId = historyItem ? historyItem.id : crypto.randomUUID() + // normal use-case is usually retry similar history task with new workspace + this.workspacePath = parentTask + ? parentTask.workspacePath + : getWorkspacePath(path.join(os.homedir(), "Desktop")) this.instanceId = crypto.randomUUID().slice(0, 8) this.taskNumber = -1 @@ -288,7 +293,7 @@ export class Cline extends EventEmitter { } get cwd() { - return getWorkspacePath(path.join(os.homedir(), "Desktop")) + return this.workspacePath } // Storing task to disk for history