GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(cli): expose --dangerously-skip-permissions as a top-level flag by YumaKakuya · Pull Request #22047 · anomalyco/opencode

Conversation

@YumaKakuya

@YumaKakuya YumaKakuya commented Apr 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Issue for this PR

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

Related: #7137 (broader top-level + TUI UI integration by @surma) — this PR is a minimal alternative if a smaller surface area is preferred.

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 opencode run, TUI sessions, serve, attach, etc. Setting OPENCODE_DANGEROUSLY_SKIP_PERMISSIONS=1 (or passing --dangerously-skip-permissions) makes Permission.ask() skip the interactive prompt for ask rules.

Deny rules are still respected. The bypass is placed after the deny/allow evaluation loop and after the if (!needsAsk) return early-exit, so:

  • deny rules → still throw DeniedError (user-configured prohibitions are honored)
  • allow rules → still pass through unchanged
  • ask rules → auto-approved (the --dangerously-skip-permissions semantic)

This matches the behavior of #21266 (which auto-replies after the deny check at the event-loop level).

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/core/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.ts — early-return inside Permission.ask() after the deny/allow loop.

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

How did you verify your code works?

  • bun typecheck (all 13 packages) — green.
  • bun test test/permission/ — 85/85 pass (no regressions in arity.test.ts / next.test.ts).
  • Manual: top-level TUI session with --dangerously-skip-permissions skips ask prompts; a deny rule in config still throws DeniedError as expected.
  • Happy to add a unit test covering the new early-return + deny-rule preservation if a maintainer wants it.

Notes

  • Rebased onto current dev (post permission barrel collapse refactor: collapse permission barrel into permission/index.ts #22915 and shared→core consolidation). Original commit was based on the older permission/next.ts / packages/opencode/src/flag/flag.ts layout.
  • I'd be happy to close this in favor of feat: add --dangerously-skip-permissions flag #7137 if @surma's broader version is the preferred direction. Posting this minimal alternative because the env-var pattern matches the existing --pure / OPENCODE_PURE convention and avoids touching TUI UI files.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

brocar and anduimagui reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@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

github-actions Bot commented Apr 11, 2026

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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

github-actions Bot commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@opencode-agent
opencode-agent Bot force-pushed the dev branch from 2f2ed11 to 9f201d6 Compare April 16, 2026 21:55
@github-actions github-actions Bot mentioned this pull request Apr 19, 2026
docs: document --dangerously-skip-permissions CLI flag #23371
Merged
3 of 6 tasks
@LakshmanTurlapati

LakshmanTurlapati commented Apr 26, 2026

Copy link
Copy Markdown

Much-awaited merge! This would be super helpful for folks who want the full TUI experience while running in trusted/YOLO workflows. Please consider landing this when you get a chance.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

YumaKakuya added 2 commits April 28, 2026 07:59
@YumaKakuya
feat(cli): expose --dangerously-skip-permissions as a top-level flag
e909aa1
Extends #21266 (which added the flag to `opencode run` only) by making
the flag available across all subcommands including TUI, serve, and
attach. Sets OPENCODE_DANGEROUSLY_SKIP_PERMISSIONS=1 in the top-level
middleware; Permission.ask reads it via the existing Flag getter.

Bypass is placed AFTER the deny/allow rule loop (and after `if (!needsAsk)
return`), so user-configured `deny` rules still throw DeniedError. Only
the interactive prompt for `ask` rules is skipped — matching the behavior
of #21266 and #7137.

Minimal alternative to #7137 — env-var pattern (consistent with --pure),
no TUI UI changes, defers to maintainer choice between this minimal
version and #7137's broader integration.
@YumaKakuya
Merge branch 'dev' into feat/top-level-skip-permissions
443ed81
@github-actions github-actions Bot mentioned this pull request May 2, 2026
📊 AI CLI 工具社区动态日报 2026-05-02 zx0828/big_model_radar#19
Open
@github-actions github-actions Bot mentioned this pull request May 16, 2026
feat(opencode): add /yolo toggle and per-agent thinking control #27851
Closed
3 tasks done
@HomuraTokido

HomuraTokido commented Jun 18, 2026

Copy link
Copy Markdown

Would love to see this land. Desktop users currently have no way to use --dangerously-skip-permissions\ at all — the flag only works in \opencode run. This 3-file PR is the minimal fix. Any chance of a review?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sorted-ai sorted-ai closed this by deleting the head repository Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@YumaKakuya @LakshmanTurlapati @HomuraTokido @sorted-ai
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.