feat: add --dangerously-skip-permissions flag to opencode run (#21266)
parent
f4975ef32a
commit
885df8eb54
|
|
@ -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 () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue