feat: add --dangerously-skip-permissions flag to opencode run (#21266)

pull/20534/merge
Aiden Cline 2026-04-06 23:30:05 -05:00 committed by GitHub
parent f4975ef32a
commit 885df8eb54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 22 additions and 9 deletions

View File

@ -302,6 +302,11 @@ export const RunCommand = cmd({
describe: "show thinking blocks",
default: false,
})
.option("dangerously-skip-permissions", {
type: "boolean",
describe: "auto-approve permissions that are not explicitly denied (dangerous!)",
default: false,
})
},
handler: async (args) => {
let message = [...args.message, ...(args["--"] || [])]
@ -544,6 +549,13 @@ export const RunCommand = cmd({
if (event.type === "permission.asked") {
const permission = event.properties
if (permission.sessionID !== sessionID) continue
if (args["dangerously-skip-permissions"]) {
await sdk.permission.reply({
requestID: permission.id,
reply: "once",
})
} else {
UI.println(
UI.Style.TEXT_WARNING_BOLD + "!",
UI.Style.TEXT_NORMAL +
@ -556,6 +568,7 @@ export const RunCommand = cmd({
}
}
}
}
// Validate agent if specified
const agent = await (async () => {