Auto-approve tool calls for automation
headless & scripting
// what it does
Non-interactive runs that edit files or run commands need pre-approval. --approval-mode auto_edit auto-accepts file edits but still gates shell commands; -y (--yolo) or --approval-mode yolo auto-approves everything. Set the default in settings.json under general.defaultApprovalMode.
// shell
$ gemini -p "fix the failing test" --approval-mode auto_edit$ gemini -p "apply the migration" --yolo// gotcha
YOLO lets the agent run arbitrary shell commands with no confirmation — never point it at untrusted input or a repo you cannot afford to have changed. Pair it with --sandbox so destructive commands are contained to a throwaway environment.