Skip to content

feat(permissions): YOLO mode, global-only settings, runtime /yolo with dialog gate - #405

Open
alecuba16 wants to merge 1 commit into
Kuberwastaken:mainfrom
alecuba16:pr388-yolo
Open

feat(permissions): YOLO mode, global-only settings, runtime /yolo with dialog gate#405
alecuba16 wants to merge 1 commit into
Kuberwastaken:mainfrom
alecuba16:pr388-yolo

Conversation

@alecuba16

Copy link
Copy Markdown

Second split from #388 (bang commands landed as #404). YOLO mode only, branched off main, no shared payload with the other splits.

What this adds

  • config.yolo_mode ("yoloMode" in settings.json): when true, the effective permission mode is BypassPermissions at startup.
  • /yolo [on|off] runtime toggle, gated by the existing BypassPermissionsModeDialog.

Security review points addressed

  1. Global-only merge (the blocker). Settings::merge pins yolo_mode: base.config.yolo_mode, the same pattern as skip_dangerous_mode_permission_prompt. A cloned repo shipping {"config":{"yoloMode":true}} cannot flip bypassPermissions on; a global false cannot be overridden by a project file. Covered by yolo_mode_is_global_only_in_merge plus a tempdir test (project_settings_cannot_enable_yolo_mode) that writes an isolated CLAURST_HOME global and a project settings file with yoloMode: true and asserts the merged result is off.
  2. Root/sudo guard kept. The yoloMode startup path runs the same Uid::effective().is_root() bail as --dangerously-skip-permissions. The guard is not skipped.
  3. Runtime /yolo goes through the dialog. /yolo on shows BypassPermissionsModeDialog first (yolo_pending flag distinguishes the runtime toggle from the startup gate). Accepting switches the mode; declining cancels the toggle and dismisses the dialog without exiting.
  4. /yolo off does not hard-set Default. The mode active before /yolo on is remembered and restored, so plan/acceptEdits sessions survive a YOLO round-trip.
  5. No test writes the real settings. Runtime /yolo is session-only (no save_sync in its path). The tempdir test isolates CLAURST_HOME so cargo test never touches the developer settings.json.

Tests

  • 3 core tests: global-only merge both directions, project-cannot-enable (tempdir), camelCase JSON roundtrip.
  • 5 TUI tests: accept activates, decline cancels without exit, off restores previous mode (plan round-trip), off restores Default, toggle shows dialog.

cargo check --workspace, cargo clippy --workspace --all-targets -- -D warnings, and both test suites pass. The settings_screen count test failure on main is pre-existing and unrelated.

Docs

docs/commands.md (CRLF preserved) documents /yolo; docs/configuration.md documents yolo_mode with the global-only note.

Adds persistent YOLO mode (bypass all permission prompts) plus a
runtime /yolo command, split from Kuberwastaken#388 as its own PR.

- config.yolo_mode ("yoloMode"): when true, the effective permission
  mode is BypassPermissions at startup. Same root/sudo guard as
  --dangerously-skip-permissions (the guard is kept, not skipped).
- SECURITY: yolo_mode is global-only in Settings::merge (pinned to
  base, same pattern as skip_dangerous_mode_permission_prompt). A
  project .claurst/settings.json cannot enable or disable it.
- /yolo [on|off|toggle]: runtime toggle. Turning on goes through the
  BypassPermissionsModeDialog gate (accept activates, decline cancels
  without exiting). /yolo off restores the mode active before /yolo on
  instead of hard-setting Default, so plan/acceptEdits survive.
- Session-only: runtime /yolo does not write settings.json.
- Tests: merge global-only (3 core tests incl. tempdir isolation via
  CLAURST_HOME), dialog accept/decline, mode restore, toggle (5 TUI
  tests). No test writes the real user settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant