@flue/cli 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/flue.js +7 -39
  2. package/package.json +1 -1
package/dist/flue.js CHANGED
@@ -215,7 +215,6 @@ async function run() {
215
215
  }
216
216
  }
217
217
  await preflight(workdir, modelStr);
218
- await setPermissions(workdir);
219
218
  const eventStream = startEventStream(workdir);
220
219
  eventStreamAbort = eventStream;
221
220
  const model = modelStr ? parseModel(modelStr) : void 0;
@@ -266,43 +265,6 @@ async function preflight(workdir, modelOverride) {
266
265
  process.exit(1);
267
266
  }
268
267
  }
269
- /**
270
- * Configure OpenCode to auto-approve all tool operations.
271
- * In headless/CI mode there's no human to respond to permission prompts,
272
- * so we must allow everything upfront. This mirrors what the Cloudflare
273
- * runner does via `'*': 'allow'` in its config.
274
- *
275
- * NOTE: We set each permission field explicitly here. The OpenCode config
276
- * also supports a wildcard `'*': 'allow'` key (used by the Cloudflare
277
- * runner with @ts-expect-error), but the typed Config schema doesn't
278
- * expose it. We should try wildcard support at some point to future-proof
279
- * against new permission types being added.
280
- */
281
- async function setPermissions(workdir) {
282
- const permission = {
283
- "*": "allow",
284
- edit: "allow",
285
- bash: "allow",
286
- webfetch: "allow",
287
- doom_loop: "allow",
288
- external_directory: "allow"
289
- };
290
- const res = await fetch(`${OPENCODE_URL}/config?directory=${encodeURIComponent(workdir)}`, {
291
- method: "PATCH",
292
- headers: { "Content-Type": "application/json" },
293
- body: JSON.stringify({ permission })
294
- });
295
- if (!res.ok) {
296
- const body = await res.text().catch(() => "");
297
- console.error(`[flue] Error: failed to set permissions (HTTP ${res.status}).\n Response: ${body}\n Headless mode requires all permissions to be pre-approved.\n The agent will hang on any permission prompt without this.`);
298
- process.exit(1);
299
- }
300
- const verify = await fetch(`${OPENCODE_URL}/config?directory=${encodeURIComponent(workdir)}`);
301
- if (verify.ok) {
302
- const config = await verify.json();
303
- console.log(`[flue] permissions set:`, JSON.stringify(config.permission));
304
- }
305
- }
306
268
  async function isOpenCodeRunning() {
307
269
  try {
308
270
  const controller = new AbortController();
@@ -319,7 +281,13 @@ function startOpenCodeServer() {
319
281
  "serve",
320
282
  "--port",
321
283
  "48765"
322
- ], { stdio: "inherit" });
284
+ ], {
285
+ stdio: "inherit",
286
+ env: {
287
+ ...process.env,
288
+ OPENCODE_PERMISSION: JSON.stringify({ "*": "allow" })
289
+ }
290
+ });
323
291
  child.on("error", (error) => {
324
292
  console.error("Failed to start OpenCode server:", error instanceof Error ? error.message : error);
325
293
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flue/cli",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "flue": "dist/flue.js"