Skip to content

Commit 183ec5f

Browse files
committed
feat: persist workspacePath to each task for improved task management
1 parent 7020d1d commit 183ec5f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/core/Cline.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export class Cline extends EventEmitter<ClineEvents> {
133133
readonly rootTask: Cline | undefined = undefined
134134
readonly parentTask: Cline | undefined = undefined
135135
readonly taskNumber: number
136+
readonly workspacePath: string
136137

137138
isPaused: boolean = false
138139
pausedModeSlug: string = defaultModeSlug
@@ -221,6 +222,10 @@ export class Cline extends EventEmitter<ClineEvents> {
221222
}
222223

223224
this.taskId = historyItem ? historyItem.id : crypto.randomUUID()
225+
// normal use-case is usually retry similar history task with new workspace
226+
this.workspacePath = parentTask
227+
? parentTask.workspacePath
228+
: getWorkspacePath(path.join(os.homedir(), "Desktop"))
224229
this.instanceId = crypto.randomUUID().slice(0, 8)
225230
this.taskNumber = -1
226231

@@ -288,7 +293,7 @@ export class Cline extends EventEmitter<ClineEvents> {
288293
}
289294

290295
get cwd() {
291-
return getWorkspacePath(path.join(os.homedir(), "Desktop"))
296+
return this.workspacePath
292297
}
293298

294299
// Storing task to disk for history

0 commit comments

Comments
 (0)