Skip to content

Commit ada4513

Browse files
committed
add new task command
1 parent 99f64ca commit ada4513

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@
129129
"title": "Roo Code: Add To Context",
130130
"category": "Roo Code"
131131
},
132+
{
133+
"command": "roo-cline.newTask",
134+
"title": "Roo Code: New Task",
135+
"category": "Roo Code"
136+
},
132137
{
133138
"command": "roo-cline.terminalAddToContext",
134139
"title": "Roo Code: Add Terminal Content to Context",

src/activate/handleTask.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import * as vscode from "vscode"
2+
import { COMMAND_IDS } from "../core/CodeActionProvider"
3+
import { ClineProvider } from "../core/webview/ClineProvider"
4+
5+
export const handleNewTask = async (params: { prompt?: string } | null | undefined) => {
6+
let prompt = params?.prompt
7+
if (!prompt) {
8+
prompt = await vscode.window.showInputBox({
9+
prompt: "What should Roo do?",
10+
placeHolder: "Type your task here",
11+
})
12+
}
13+
if (!prompt) {
14+
await vscode.commands.executeCommand("roo-cline.SidebarProvider.focus")
15+
return
16+
}
17+
18+
await ClineProvider.handleCodeAction(COMMAND_IDS.NEW_TASK, "NEW_TASK", {
19+
userInput: prompt,
20+
})
21+
}

src/activate/registerCommands.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import delay from "delay"
44
import { ClineProvider } from "../core/webview/ClineProvider"
55

66
import { registerHumanRelayCallback, unregisterHumanRelayCallback, handleHumanRelayResponse } from "./humanRelay"
7+
import { handleNewTask } from "./handleTask"
78

89
// Store panel references in both modes
910
let sidebarPanel: vscode.WebviewView | undefined = undefined
@@ -85,6 +86,7 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
8586
"roo-cline.registerHumanRelayCallback": registerHumanRelayCallback,
8687
"roo-cline.unregisterHumanRelayCallback": unregisterHumanRelayCallback,
8788
"roo-cline.handleHumanRelayResponse": handleHumanRelayResponse,
89+
"roo-cline.newTask": handleNewTask,
8890
}
8991
}
9092

src/core/CodeActionProvider.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ export const ACTION_NAMES = {
77
FIX_LOGIC: "Roo Code: Fix Logic",
88
IMPROVE: "Roo Code: Improve Code",
99
ADD_TO_CONTEXT: "Roo Code: Add to Context",
10+
NEW_TASK: "Roo Code: New Task",
1011
} as const
1112

1213
export const COMMAND_IDS = {
1314
EXPLAIN: "roo-cline.explainCode",
1415
FIX: "roo-cline.fixCode",
1516
IMPROVE: "roo-cline.improveCode",
1617
ADD_TO_CONTEXT: "roo-cline.addToContext",
18+
NEW_TASK: "roo-cline.newTask",
1719
} as const
1820

1921
export class CodeActionProvider implements vscode.CodeActionProvider {

src/shared/support-prompt.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ Please provide:
141141
2. Explanation of each part/flag
142142
3. Expected output and behavior`,
143143
},
144+
NEW_TASK: {
145+
label: "Start New Task",
146+
description: "Start new task with user input",
147+
template: `\${userInput}`,
148+
},
144149
} as const
145150

146151
type SupportPromptType = keyof typeof supportPromptConfigs

0 commit comments

Comments
 (0)