feat(cli): expose --dangerously-skip-permissions as a top-level flag#22047
Open
YumaKakuya wants to merge 1 commit intoanomalyco:devfrom
Open
feat(cli): expose --dangerously-skip-permissions as a top-level flag#22047YumaKakuya wants to merge 1 commit intoanomalyco:devfrom
YumaKakuya wants to merge 1 commit intoanomalyco:devfrom
Conversation
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 This appears to be an older PR that introduced the |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue for this PR
Follow-up to #21266 (no separate issue filed).
Type of change
What does this PR do?
#21266 added
--dangerously-skip-permissionsas anopencode runflag. 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 runand TUI sessions. SettingOPENCODE_DANGEROUSLY_SKIP_PERMISSIONS=1(or passing--dangerously-skip-permissions) makesPermission.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 intoprocess.env.OPENCODE_DANGEROUSLY_SKIP_PERMISSIONS.packages/opencode/src/flag/flag.ts— dynamic getter forOPENCODE_DANGEROUSLY_SKIP_PERMISSIONSusing the same access-time evaluation pattern as the existingOPENCODE_PUREgetter (the CLI sets the env var at runtime, so it must not be evaluated at module load).packages/opencode/src/permission/index.ts—Permission.ask()early-return when the flag is set.opencode runis untouched — #21266 still owns that path.How did you verify your code works?
OPENCODE_DANGEROUSLY_SKIP_PERMISSIONS=1and confirmed tool permission prompts no longer appear and the session runs without manual approval. Without the flag, prompts behave normally.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.permission/index.tsor for the middleware env plumb if a maintainer wants it.Screenshots / recordings
N/A — behavioural change only, no UI.
Checklist