mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
refactor: consolidate prompt functionality into support-prompt module
- Move code action prompts from core/prompts to shared/support-prompt - Migrate enhance prompt functionality from modes to support-prompt - Add UI for managing code action prompts in PromptsView - Update types and interfaces for better prompt management
This commit is contained in:
@@ -12,6 +12,16 @@ export type ModeConfig = {
|
||||
groups: readonly ToolGroup[] // Now uses groups instead of tools array
|
||||
}
|
||||
|
||||
// Mode-specific prompts only
|
||||
export type PromptComponent = {
|
||||
roleDefinition?: string
|
||||
customInstructions?: string
|
||||
}
|
||||
|
||||
export type CustomPrompts = {
|
||||
[key: string]: PromptComponent | undefined | string
|
||||
}
|
||||
|
||||
// Helper to get all tools for a mode
|
||||
export function getToolsForMode(groups: readonly ToolGroup[]): string[] {
|
||||
const tools = new Set<string>()
|
||||
@@ -130,33 +140,6 @@ export function isToolAllowedForMode(
|
||||
return mode.groups.some((group) => TOOL_GROUPS[group].includes(tool as string))
|
||||
}
|
||||
|
||||
export type PromptComponent = {
|
||||
roleDefinition?: string
|
||||
customInstructions?: string
|
||||
}
|
||||
|
||||
// Mode-specific prompts only
|
||||
export type CustomPrompts = {
|
||||
[key: string]: PromptComponent | undefined
|
||||
}
|
||||
|
||||
// Separate enhance prompt type and definition
|
||||
export type EnhanceConfig = {
|
||||
prompt: string
|
||||
}
|
||||
|
||||
export const enhance: EnhanceConfig = {
|
||||
prompt: "Generate an enhanced version of this prompt (reply with only the enhanced prompt - no conversation, explanations, lead-in, bullet points, placeholders, or surrounding quotes):",
|
||||
} as const
|
||||
|
||||
// Completely separate enhance prompt handling
|
||||
export const enhancePrompt = {
|
||||
default: enhance.prompt,
|
||||
get: (customPrompts: Record<string, any> | undefined): string => {
|
||||
return customPrompts?.enhance ?? enhance.prompt
|
||||
},
|
||||
} as const
|
||||
|
||||
// Create the mode-specific default prompts
|
||||
export const defaultPrompts: Readonly<CustomPrompts> = Object.freeze(
|
||||
Object.fromEntries(modes.map((mode) => [mode.slug, { roleDefinition: mode.roleDefinition }])),
|
||||
|
||||
Reference in New Issue
Block a user