mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-22 13:21:07 -05:00
Only allow usage of diff tool if enabled in settings
This commit is contained in:
@@ -108,6 +108,7 @@ export interface ExtensionState {
|
||||
experimentalDiffStrategy?: boolean
|
||||
autoApprovalEnabled?: boolean
|
||||
customModes: ModeConfig[]
|
||||
toolRequirements?: Record<string, boolean> // Map of tool names to their requirements (e.g. {"apply_diff": true} if diffEnabled)
|
||||
}
|
||||
|
||||
export interface ClineMessage {
|
||||
|
||||
@@ -103,12 +103,24 @@ export function isCustomMode(slug: string, customModes?: ModeConfig[]): boolean
|
||||
return !!customModes?.some((mode) => mode.slug === slug)
|
||||
}
|
||||
|
||||
export function isToolAllowedForMode(tool: string, modeSlug: string, customModes: ModeConfig[]): boolean {
|
||||
export function isToolAllowedForMode(
|
||||
tool: string,
|
||||
modeSlug: string,
|
||||
customModes: ModeConfig[],
|
||||
toolRequirements?: Record<string, boolean>,
|
||||
): boolean {
|
||||
// Always allow these tools
|
||||
if (ALWAYS_AVAILABLE_TOOLS.includes(tool as any)) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Check tool requirements if any exist
|
||||
if (toolRequirements && tool in toolRequirements) {
|
||||
if (!toolRequirements[tool]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
const mode = getModeBySlug(modeSlug, customModes)
|
||||
if (!mode) {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user