[PR #9073] feat: YOLO Mode - Skip All Permission Prompts (CLI + Desktop) #12975

Closed
opened 2026-02-16 18:17:51 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9073

State: closed
Merged: No


Summary

Comprehensive implementation of YOLO mode that allows users to skip all permission prompts. This addresses multiple community requests (#8463, #7928, #1813) with a complete solution for both CLI and Desktop.

Closes #9070

Features

CLI Support

Method Usage
Flag opencode --yolo or opencode --dangerously-skip-permissions
Environment Variable OPENCODE_YOLO=true opencode
Commands opencode yolo status / enable / disable
# Check current status
$ opencode yolo status
YOLO mode: ENABLED (saved in config)
Config: /Users/.../.config/opencode/config.json

# Enable permanently
$ opencode yolo enable
YOLO mode ENABLED - saved to config
Warning: All permission prompts will be skipped!

# Disable
$ opencode yolo disable
YOLO mode disabled - removed from config

Desktop App Support

New Settings → Danger Zone tab with:

  • This Session Only - Toggle for current session (resets on restart)
  • Always Enabled - Persists to ~/.config/opencode/config.json
  • Clear visual indicators showing active state
  • Live switching without app restart
  • Warning messaging about the risks

Config File Support

{
  "yolo": true
}

Works in both project-level opencode.json and global ~/.config/opencode/config.json.

Technical Implementation

  • Yolo Module (packages/opencode/src/yolo/index.ts): Centralized state management
  • Permission Bypass (permission/next.ts): Auto-approves in PermissionNext.ask() when YOLO enabled
  • API Endpoints: GET/POST /config/yolo for runtime control
  • Safety: Explicit deny rules are still respected even in YOLO mode

Files Changed

File Changes
packages/opencode/src/yolo/index.ts New module for YOLO state management
packages/opencode/src/cli/cmd/yolo.ts New CLI commands
packages/opencode/src/permission/next.ts Auto-approve logic
packages/opencode/src/server/routes/config.ts YOLO API endpoints
packages/opencode/src/flag/flag.ts OPENCODE_YOLO env var
packages/opencode/src/config/config.ts Config schema
packages/opencode/src/index.ts CLI flag + command registration
packages/app/src/components/dialog-settings.tsx Desktop UI (Danger Zone tab)

Testing

Manually tested:

  • CLI --yolo flag
  • CLI opencode yolo commands
  • Environment variable
  • Desktop UI YOLO toggles
  • Config persistence
  • Live toggle without restart
  • Permission prompts appear when disabled
  • Permission prompts skipped when enabled
  • Switching between session-only and permanent modes

Related Issues

This PR provides a comprehensive solution that addresses:

  • #8463: --dangerously-skip-permissions flag
  • #7928: Runtime permission toggle
  • #1813: YOLO mode / auto-accept
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9073 **State:** closed **Merged:** No --- ## Summary Comprehensive implementation of YOLO mode that allows users to skip all permission prompts. This addresses multiple community requests (#8463, #7928, #1813) with a complete solution for both CLI and Desktop. Closes #9070 ## Features ### CLI Support | Method | Usage | |--------|-------| | Flag | `opencode --yolo` or `opencode --dangerously-skip-permissions` | | Environment Variable | `OPENCODE_YOLO=true opencode` | | Commands | `opencode yolo status` / `enable` / `disable` | ```bash # Check current status $ opencode yolo status YOLO mode: ENABLED (saved in config) Config: /Users/.../.config/opencode/config.json # Enable permanently $ opencode yolo enable YOLO mode ENABLED - saved to config Warning: All permission prompts will be skipped! # Disable $ opencode yolo disable YOLO mode disabled - removed from config ``` ### Desktop App Support New **Settings → Danger Zone** tab with: - **This Session Only** - Toggle for current session (resets on restart) - **Always Enabled** - Persists to `~/.config/opencode/config.json` - Clear visual indicators showing active state - Live switching without app restart - Warning messaging about the risks ### Config File Support ```json { "yolo": true } ``` Works in both project-level `opencode.json` and global `~/.config/opencode/config.json`. ## Technical Implementation - **Yolo Module** (`packages/opencode/src/yolo/index.ts`): Centralized state management - **Permission Bypass** (`permission/next.ts`): Auto-approves in `PermissionNext.ask()` when YOLO enabled - **API Endpoints**: `GET/POST /config/yolo` for runtime control - **Safety**: Explicit `deny` rules are still respected even in YOLO mode ## Files Changed | File | Changes | |------|---------| | `packages/opencode/src/yolo/index.ts` | New module for YOLO state management | | `packages/opencode/src/cli/cmd/yolo.ts` | New CLI commands | | `packages/opencode/src/permission/next.ts` | Auto-approve logic | | `packages/opencode/src/server/routes/config.ts` | YOLO API endpoints | | `packages/opencode/src/flag/flag.ts` | OPENCODE_YOLO env var | | `packages/opencode/src/config/config.ts` | Config schema | | `packages/opencode/src/index.ts` | CLI flag + command registration | | `packages/app/src/components/dialog-settings.tsx` | Desktop UI (Danger Zone tab) | ## Testing Manually tested: - [x] CLI `--yolo` flag - [x] CLI `opencode yolo` commands - [x] Environment variable - [x] Desktop UI YOLO toggles - [x] Config persistence - [x] Live toggle without restart - [x] Permission prompts appear when disabled - [x] Permission prompts skipped when enabled - [x] Switching between session-only and permanent modes ## Related Issues This PR provides a comprehensive solution that addresses: - **#8463**: `--dangerously-skip-permissions` flag ✅ - **#7928**: Runtime permission toggle ✅ - **#1813**: YOLO mode / auto-accept ✅
yindo added the pull-request label 2026-02-16 18:17:51 -05:00
yindo closed this issue 2026-02-16 18:17:51 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12975