From 565731d73baa486002306aa36c1faff26fc705a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Cabanillas?= <76893296+Nicoo01x@users.noreply.github.com> Date: Sat, 21 Feb 2026 14:31:49 -0300 Subject: [PATCH] feat(cli): add --dangerously-skip-permissions flag Add a CLI flag that auto-accepts all permission prompts by setting OPENCODE_PERMISSION={"*":"allow"} in the yargs middleware before any command handler runs. This leverages the existing permission evaluation pipeline without any changes to the permission system itself. The TUI worker subprocess inherits the env var automatically via the existing Object.fromEntries(process.env) spread in thread.ts. Co-Authored-By: Claude Opus 4.6 --- packages/opencode/src/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/opencode/src/index.ts b/packages/opencode/src/index.ts index 65515658862b..420165a4d8f7 100644 --- a/packages/opencode/src/index.ts +++ b/packages/opencode/src/index.ts @@ -62,7 +62,15 @@ const cli = yargs(hideBin(process.argv)) type: "string", choices: ["DEBUG", "INFO", "WARN", "ERROR"], }) + .option("dangerously-skip-permissions", { + describe: "skip all permission prompts (allow everything)", + type: "boolean", + default: false, + }) .middleware(async (opts) => { + if (opts.dangerouslySkipPermissions) { + process.env.OPENCODE_PERMISSION = JSON.stringify({ "*": "allow" }) + } await Log.init({ print: process.argv.includes("--print-logs"), dev: Installation.isLocal(),