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",
|
describe: "show thinking blocks",
|
||||||
default: false,
|
default: false,
|
||||||
})
|
})
|
||||||
|
.option("dangerously-skip-permissions", {
|
||||||
|
type: "boolean",
|
||||||
|
describe: "auto-approve permissions that are not explicitly denied (dangerous!)",
|
||||||
|
default: false,
|
||||||
|
})
|
||||||
},
|
},
|
||||||
handler: async (args) => {
|
handler: async (args) => {
|
||||||
let message = [...args.message, ...(args["--"] || [])]
|
let message = [...args.message, ...(args["--"] || [])]
|
||||||
|
|
@ -544,15 +549,23 @@ export const RunCommand = cmd({
|
||||||
if (event.type === "permission.asked") {
|
if (event.type === "permission.asked") {
|
||||||
const permission = event.properties
|
const permission = event.properties
|
||||||
if (permission.sessionID !== sessionID) continue
|
if (permission.sessionID !== sessionID) continue
|
||||||
UI.println(
|
|
||||||
UI.Style.TEXT_WARNING_BOLD + "!",
|
if (args["dangerously-skip-permissions"]) {
|
||||||
UI.Style.TEXT_NORMAL +
|
await sdk.permission.reply({
|
||||||
`permission requested: ${permission.permission} (${permission.patterns.join(", ")}); auto-rejecting`,
|
requestID: permission.id,
|
||||||
)
|
reply: "once",
|
||||||
await sdk.permission.reply({
|
})
|
||||||
requestID: permission.id,
|
} else {
|
||||||
reply: "reject",
|
UI.println(
|
||||||
})
|
UI.Style.TEXT_WARNING_BOLD + "!",
|
||||||
|
UI.Style.TEXT_NORMAL +
|
||||||
|
`permission requested: ${permission.permission} (${permission.patterns.join(", ")}); auto-rejecting`,
|
||||||
|
)
|
||||||
|
await sdk.permission.reply({
|
||||||
|
requestID: permission.id,
|
||||||
|
reply: "reject",
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue