feat: add --yolo flag to auto-approve all permission requests#20866
feat: add --yolo flag to auto-approve all permission requests#20866alexsiri7 wants to merge 2 commits intoanomalyco:devfrom
Conversation
Adds a --yolo CLI flag and yolo config option that auto-approves all
permission requests without prompting. When enabled, the permission
service short-circuits before evaluating any rules, and the run command
auto-approves (instead of auto-rejecting) any permission requests that
reach the event loop.
Can be activated via:
- CLI flag: opencode --yolo
- Config: { "yolo": true }
- Environment variable: OPENCODE_YOLO=1
Closes anomalyco#20864
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: Found several potentially related PRs:
Recommendation: Check PRs #11833 and #12684 first as they appear to have similar or overlapping functionality. Consider whether they were closed/merged and if this PR supersedes them or addresses gaps. |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
|
The AI is broken, At somestage someone will have to merge a yolo mode |
Summary
Adds a
--yoloCLI flag andyoloconfig option that auto-approves all permission requests without prompting the user. This is useful for CI/CD pipelines, scripting, and power users who trust their agent setup.opencode --yolo run "do something"{ "yolo": true }inopencode.jsonOPENCODE_YOLO=1When enabled:
Permission.ask()before evaluating any rules, returning immediately (auto-approve)runcommand auto-approves (instead of auto-rejecting) any permission requests that reach the event loopFiles changed
packages/opencode/src/flag/flag.ts-- AddedOPENCODE_YOLOflag with dynamic getterpackages/opencode/src/index.ts-- Added--yoloCLI option and middleware to set env varpackages/opencode/src/config/config.ts-- Addedyoloboolean config option, sets env var when config is loadedpackages/opencode/src/permission/index.ts-- Short-circuit inask()when yolo mode is activepackages/opencode/src/cli/cmd/run.ts-- Auto-approve (instead of auto-reject) permission requests when yolo is setpackages/opencode/test/permission/yolo.test.ts-- 6 tests covering yolo behaviorCloses #20864
Test plan
bun test test/permission/yolo.test.ts)bun test test/permission/)bun turbo typecheck)opencode --yolo run "list files"should auto-approve all tool calls"yolo": truein config should have the same effectOPENCODE_YOLO=1 opencode run "list files"should auto-approve🤖 Generated with Claude Code