Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/core/webview/ClineProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ export class ClineProvider implements vscode.WebviewViewProvider {
return this.clineStack.length
}

public getCurrentTaskStack(): string[] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding unit tests for the getCurrentTaskStack method to ensure it correctly reflects the current stack state, especially in cases of empty or non-empty arrays.

return this.clineStack.map((cline) => cline.taskId)
}

// remove the current task/cline instance (at the top of the stack), ao this task is finished
// and resume the previous task/cline instance (if it exists)
// this is used when a sub task is finished and the parent task needs to be resumed
Expand Down
4 changes: 4 additions & 0 deletions src/exports/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,8 @@ export class API extends EventEmitter<RooCodeEvents> implements RooCodeAPI {
public getMessages(taskId: string) {
return this.history.getMessages(taskId)
}

public getCurrentTaskStack(): string[] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests to verify that the getCurrentTaskStack() method in the API returns the expected array of task IDs.

return this.provider.getCurrentTaskStack()
}
}
6 changes: 6 additions & 0 deletions src/exports/roo-code.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ export interface RooCodeAPI extends EventEmitter<RooCodeEvents> {
* @returns An array of ClineMessage objects.
*/
getMessages(taskId: string): ClineMessage[]

/**
* Returns the current task stack.
* @returns An array of task IDs.
*/
getCurrentTaskStack(): string[]
}

export type ClineAsk =
Expand Down