fix(commands): Respect YOLO mode in custom slash commands (#6441)

This commit is contained in:
Abhi
2025-08-18 10:34:51 -04:00
committed by GitHub
parent 88fc6e5861
commit 065eb7897d
2 changed files with 56 additions and 5 deletions

View File

@@ -5,6 +5,7 @@
*/
import {
ApprovalMode,
checkCommandPermissions,
escapeShellArg,
getShellConfiguration,
@@ -107,7 +108,11 @@ export class ShellProcessor implements IPromptProcessor {
`${this.commandName} cannot be run. Blocked command: "${command}". Reason: ${blockReason || 'Blocked by configuration.'}`,
);
}
disallowedCommands.forEach((uc) => commandsToConfirm.add(uc));
// If not a hard denial, respect YOLO mode and auto-approve.
if (config.getApprovalMode() !== ApprovalMode.YOLO) {
disallowedCommands.forEach((uc) => commandsToConfirm.add(uc));
}
}
}