Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@
"title": "Roo Code: Add To Context",
"category": "Roo Code"
},
{
"command": "roo-cline.newTask",
"title": "Roo Code: New Task",
"category": "Roo Code"
},
{
"command": "roo-cline.terminalAddToContext",
"title": "Roo Code: Add Terminal Content to Context",
Expand Down
21 changes: 21 additions & 0 deletions src/activate/handleTask.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as vscode from "vscode"
import { COMMAND_IDS } from "../core/CodeActionProvider"
import { ClineProvider } from "../core/webview/ClineProvider"

export const handleNewTask = async (params: { prompt?: string } | null | undefined) => {
let prompt = params?.prompt
if (!prompt) {
prompt = await vscode.window.showInputBox({
prompt: "What should Roo do?",
placeHolder: "Type your task here",
})
}
if (!prompt) {
await vscode.commands.executeCommand("roo-cline.SidebarProvider.focus")
return
}

await ClineProvider.handleCodeAction(COMMAND_IDS.NEW_TASK, "NEW_TASK", {
userInput: prompt,
})
}
2 changes: 2 additions & 0 deletions src/activate/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import delay from "delay"
import { ClineProvider } from "../core/webview/ClineProvider"

import { registerHumanRelayCallback, unregisterHumanRelayCallback, handleHumanRelayResponse } from "./humanRelay"
import { handleNewTask } from "./handleTask"

// Store panel references in both modes
let sidebarPanel: vscode.WebviewView | undefined = undefined
Expand Down Expand Up @@ -85,6 +86,7 @@ const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOpt
"roo-cline.registerHumanRelayCallback": registerHumanRelayCallback,
"roo-cline.unregisterHumanRelayCallback": unregisterHumanRelayCallback,
"roo-cline.handleHumanRelayResponse": handleHumanRelayResponse,
"roo-cline.newTask": handleNewTask,
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/core/CodeActionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ export const ACTION_NAMES = {
FIX_LOGIC: "Roo Code: Fix Logic",
IMPROVE: "Roo Code: Improve Code",
ADD_TO_CONTEXT: "Roo Code: Add to Context",
NEW_TASK: "Roo Code: New Task",
} as const

export const COMMAND_IDS = {
EXPLAIN: "roo-cline.explainCode",
FIX: "roo-cline.fixCode",
IMPROVE: "roo-cline.improveCode",
ADD_TO_CONTEXT: "roo-cline.addToContext",
NEW_TASK: "roo-cline.newTask",
} as const

export class CodeActionProvider implements vscode.CodeActionProvider {
Expand Down
5 changes: 5 additions & 0 deletions src/shared/support-prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ Please provide:
2. Explanation of each part/flag
3. Expected output and behavior`,
},
NEW_TASK: {
label: "Start New Task",
description: "Start new task with user input",
template: `\${userInput}`,
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it need to be added here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just thinking that this adds another tab at the bottom of the prompts view right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my scenario, other plugins will send tasks to Roo, and I hope Roo can define its own prompt words when receiving instructions from other plugins.

In addition, because this pr also supports users to create tasks directly through the command palette, this option can also be used for users to define their own "quick start" prompt words.

Copy link
Collaborator

@cte cte Mar 18, 2025

Choose a reason for hiding this comment

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

Does this work for the problem you're trying to solve?
https://github.com/RooVetGit/Roo-Code/blob/878b3820d2f41809f6063c5c54597d6bf0d3c591/src/exports/roo-code.d.ts#L24-L31

This should allow other extensions to interface with Roo Code. Or is it more convenient to use an action?

Copy link
Contributor Author

@qdaxb qdaxb Mar 18, 2025

Choose a reason for hiding this comment

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

API can meet the needs, but I think command is more convenience. it can be called from the command palette, shortcut keys, other plugins or the command line

} as const

type SupportPromptType = keyof typeof supportPromptConfigs
Expand Down
Loading