opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: YOLO Mode - Skip All Permission Prompts (CLI + Desktop)

Open mguttmann opened this issue 18 hours ago • 3 comments

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.

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 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

Testing

Manually tested:

  • [x] CLI --yolo flag
  • [x] CLI opencode yolo commands
  • [x] Environment variable
  • [x] Desktop UI 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 ✅

Closes #9070

mguttmann avatar Jan 17 '26 11:01 mguttmann