feat: Disable YOLO and AUTO_EDIT modes for untrusted folders (#7041)

This commit is contained in:
shrutip90
2025-08-25 17:30:04 -07:00
committed by GitHub
parent 2c6794feed
commit ae1f67df04
9 changed files with 451 additions and 55 deletions

View File

@@ -406,6 +406,14 @@ export async function loadCliConfig(
argv.yolo || false ? ApprovalMode.YOLO : ApprovalMode.DEFAULT;
}
// Force approval mode to default if the folder is not trusted.
if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
logger.warn(
`Approval mode overridden to "default" because the current folder is not trusted.`,
);
approvalMode = ApprovalMode.DEFAULT;
}
const interactive =
!!argv.promptInteractive || (process.stdin.isTTY && question.length === 0);
// In non-interactive mode, exclude tools that require a prompt.