|
@@ -25,24 +25,16 @@ export const createPrompt = (template: string, params: PromptParams): string =>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
interface SupportPromptConfig {
|
|
interface SupportPromptConfig {
|
|
|
- label: string
|
|
|
|
|
- description: string
|
|
|
|
|
template: string
|
|
template: string
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const supportPromptConfigs: Record<string, SupportPromptConfig> = {
|
|
const supportPromptConfigs: Record<string, SupportPromptConfig> = {
|
|
|
ENHANCE: {
|
|
ENHANCE: {
|
|
|
- label: "Enhance Prompt",
|
|
|
|
|
- description:
|
|
|
|
|
- "Use prompt enhancement to get tailored suggestions or improvements for your inputs. This ensures Roo understands your intent and provides the best possible responses. Available via the ✨ icon in chat.",
|
|
|
|
|
template: `Generate an enhanced version of this prompt (reply with only the enhanced prompt - no conversation, explanations, lead-in, bullet points, placeholders, or surrounding quotes):
|
|
template: `Generate an enhanced version of this prompt (reply with only the enhanced prompt - no conversation, explanations, lead-in, bullet points, placeholders, or surrounding quotes):
|
|
|
|
|
|
|
|
\${userInput}`,
|
|
\${userInput}`,
|
|
|
},
|
|
},
|
|
|
EXPLAIN: {
|
|
EXPLAIN: {
|
|
|
- label: "Explain Code",
|
|
|
|
|
- description:
|
|
|
|
|
- "Get detailed explanations of code snippets, functions, or entire files. Useful for understanding complex code or learning new patterns. Available in code actions (lightbulb icon in the editor) and the editor context menu (right-click on selected code).",
|
|
|
|
|
template: `Explain the following code from file path @/\${filePath}:
|
|
template: `Explain the following code from file path @/\${filePath}:
|
|
|
\${userInput}
|
|
\${userInput}
|
|
|
|
|
|
|
@@ -56,9 +48,6 @@ Please provide a clear and concise explanation of what this code does, including
|
|
|
3. Important patterns or techniques used`,
|
|
3. Important patterns or techniques used`,
|
|
|
},
|
|
},
|
|
|
FIX: {
|
|
FIX: {
|
|
|
- label: "Fix Issues",
|
|
|
|
|
- description:
|
|
|
|
|
- "Get help identifying and resolving bugs, errors, or code quality issues. Provides step-by-step guidance for fixing problems. Available in code actions (lightbulb icon in the editor) and the editor context menu (right-click on selected code).",
|
|
|
|
|
template: `Fix any issues in the following code from file path @/\${filePath}
|
|
template: `Fix any issues in the following code from file path @/\${filePath}
|
|
|
\${diagnosticText}
|
|
\${diagnosticText}
|
|
|
\${userInput}
|
|
\${userInput}
|
|
@@ -74,9 +63,6 @@ Please:
|
|
|
4. Explain what was fixed and why`,
|
|
4. Explain what was fixed and why`,
|
|
|
},
|
|
},
|
|
|
IMPROVE: {
|
|
IMPROVE: {
|
|
|
- label: "Improve Code",
|
|
|
|
|
- description:
|
|
|
|
|
- "Receive suggestions for code optimization, better practices, and architectural improvements while maintaining functionality. Available in code actions (lightbulb icon in the editor) and the editor context menu (right-click on selected code).",
|
|
|
|
|
template: `Improve the following code from file path @/\${filePath}:
|
|
template: `Improve the following code from file path @/\${filePath}:
|
|
|
\${userInput}
|
|
\${userInput}
|
|
|
|
|
|
|
@@ -93,18 +79,12 @@ Please suggest improvements for:
|
|
|
Provide the improved code along with explanations for each enhancement.`,
|
|
Provide the improved code along with explanations for each enhancement.`,
|
|
|
},
|
|
},
|
|
|
ADD_TO_CONTEXT: {
|
|
ADD_TO_CONTEXT: {
|
|
|
- label: "Add to Context",
|
|
|
|
|
- description:
|
|
|
|
|
- "Add context to your current task or conversation. Useful for providing additional information or clarifications. Available in code actions (lightbulb icon in the editor). and the editor context menu (right-click on selected code).",
|
|
|
|
|
template: `\${filePath}:
|
|
template: `\${filePath}:
|
|
|
\`\`\`
|
|
\`\`\`
|
|
|
\${selectedText}
|
|
\${selectedText}
|
|
|
\`\`\``,
|
|
\`\`\``,
|
|
|
},
|
|
},
|
|
|
TERMINAL_ADD_TO_CONTEXT: {
|
|
TERMINAL_ADD_TO_CONTEXT: {
|
|
|
- label: "Add Terminal Content to Context",
|
|
|
|
|
- description:
|
|
|
|
|
- "Add terminal output to your current task or conversation. Useful for providing command outputs or logs. Available in the terminal context menu (right-click on selected terminal content).",
|
|
|
|
|
template: `\${userInput}
|
|
template: `\${userInput}
|
|
|
Terminal output:
|
|
Terminal output:
|
|
|
\`\`\`
|
|
\`\`\`
|
|
@@ -112,9 +92,6 @@ Terminal output:
|
|
|
\`\`\``,
|
|
\`\`\``,
|
|
|
},
|
|
},
|
|
|
TERMINAL_FIX: {
|
|
TERMINAL_FIX: {
|
|
|
- label: "Fix Terminal Command",
|
|
|
|
|
- description:
|
|
|
|
|
- "Get help fixing terminal commands that failed or need improvement. Available in the terminal context menu (right-click on selected terminal content).",
|
|
|
|
|
template: `\${userInput}
|
|
template: `\${userInput}
|
|
|
Fix this terminal command:
|
|
Fix this terminal command:
|
|
|
\`\`\`
|
|
\`\`\`
|
|
@@ -127,9 +104,6 @@ Please:
|
|
|
3. Explain what was fixed and why`,
|
|
3. Explain what was fixed and why`,
|
|
|
},
|
|
},
|
|
|
TERMINAL_EXPLAIN: {
|
|
TERMINAL_EXPLAIN: {
|
|
|
- label: "Explain Terminal Command",
|
|
|
|
|
- description:
|
|
|
|
|
- "Get detailed explanations of terminal commands and their outputs. Available in the terminal context menu (right-click on selected terminal content).",
|
|
|
|
|
template: `\${userInput}
|
|
template: `\${userInput}
|
|
|
Explain this terminal command:
|
|
Explain this terminal command:
|
|
|
\`\`\`
|
|
\`\`\`
|
|
@@ -141,6 +115,9 @@ Please provide:
|
|
|
2. Explanation of each part/flag
|
|
2. Explanation of each part/flag
|
|
|
3. Expected output and behavior`,
|
|
3. Expected output and behavior`,
|
|
|
},
|
|
},
|
|
|
|
|
+ NEW_TASK: {
|
|
|
|
|
+ template: `\${userInput}`,
|
|
|
|
|
+ },
|
|
|
} as const
|
|
} as const
|
|
|
|
|
|
|
|
type SupportPromptType = keyof typeof supportPromptConfigs
|
|
type SupportPromptType = keyof typeof supportPromptConfigs
|
|
@@ -158,15 +135,6 @@ export const supportPrompt = {
|
|
|
|
|
|
|
|
export type { SupportPromptType }
|
|
export type { SupportPromptType }
|
|
|
|
|
|
|
|
-// Expose labels and descriptions for UI
|
|
|
|
|
-export const supportPromptLabels = Object.fromEntries(
|
|
|
|
|
- Object.entries(supportPromptConfigs).map(([key, config]) => [key, config.label]),
|
|
|
|
|
-) as Record<SupportPromptType, string>
|
|
|
|
|
-
|
|
|
|
|
-export const supportPromptDescriptions = Object.fromEntries(
|
|
|
|
|
- Object.entries(supportPromptConfigs).map(([key, config]) => [key, config.description]),
|
|
|
|
|
-) as Record<SupportPromptType, string>
|
|
|
|
|
-
|
|
|
|
|
export type CustomSupportPrompts = {
|
|
export type CustomSupportPrompts = {
|
|
|
[key: string]: string | undefined
|
|
[key: string]: string | undefined
|
|
|
}
|
|
}
|