Skip to content

feat(cli): expose --dangerously-skip-permissions as a top-level flag#22047

Open
YumaKakuya wants to merge 1 commit intoanomalyco:devfrom
sorted-ai:feat/top-level-skip-permissions
Open

feat(cli): expose --dangerously-skip-permissions as a top-level flag#22047
YumaKakuya wants to merge 1 commit intoanomalyco:devfrom
sorted-ai:feat/top-level-skip-permissions

Conversation

@YumaKakuya
Copy link
Copy Markdown

@YumaKakuya YumaKakuya commented Apr 11, 2026

Issue for this PR

Follow-up to #21266 (no separate issue filed).

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

#21266 added --dangerously-skip-permissions as an opencode run flag. When opencode is started as a TUI session (top-level CLI), the flag is unavailable, so users have to configure per-agent permission overrides to get the same auto-accept behaviour.

This PR exposes the same flag at the top-level CLI so one flag covers both opencode run and TUI sessions. Setting OPENCODE_DANGEROUSLY_SKIP_PERMISSIONS=1 (or passing --dangerously-skip-permissions) makes Permission.ask() return early, so every tool call skips the prompt loop.

Three small additions:

  • packages/opencode/src/index.ts — top-level .option("dangerously-skip-permissions", ...) and a middleware line that pipes the arg into process.env.OPENCODE_DANGEROUSLY_SKIP_PERMISSIONS.
  • packages/opencode/src/flag/flag.ts — dynamic getter for OPENCODE_DANGEROUSLY_SKIP_PERMISSIONS using the same access-time evaluation pattern as the existing OPENCODE_PURE getter (the CLI sets the env var at runtime, so it must not be evaluated at module load).
  • packages/opencode/src/permission/index.tsPermission.ask() early-return when the flag is set.

opencode run is untouched — #21266 still owns that path.

How did you verify your code works?

  • Ran a local TUI session with OPENCODE_DANGEROUSLY_SKIP_PERMISSIONS=1 and confirmed tool permission prompts no longer appear and the session runs without manual approval. Without the flag, prompts behave normally.
  • Ran opencode run --dangerously-skip-permissions "..." before and after the change to confirm feat: add --dangerously-skip-permissions flag to opencode run #21266 semantics are unchanged.
  • No new tests added. Happy to add coverage for the early-return path in permission/index.ts or for the middleware env plumb if a maintainer wants it.

Screenshots / recordings

N/A — behavioural change only, no UI.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potentially related PR:

PR #7137: feat: add --dangerously-skip-permissions flag
#7137

This appears to be an older PR that introduced the --dangerously-skip-permissions flag, while the current PR (#22047) is a follow-up that exposes it as a top-level flag for TUI sessions. These are related but not duplicates—the current PR extends functionality introduced in the earlier PR.

@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Apr 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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