@flue/cli 0.0.12 → 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 -32
  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,36 +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 res = await fetch(`${OPENCODE_URL}/config?directory=${encodeURIComponent(workdir)}`, {
283
- method: "PATCH",
284
- headers: { "Content-Type": "application/json" },
285
- body: JSON.stringify({ permission: {
286
- edit: "allow",
287
- bash: "allow",
288
- webfetch: "allow",
289
- doom_loop: "allow",
290
- external_directory: "allow"
291
- } })
292
- });
293
- if (!res.ok) {
294
- const body = await res.text().catch(() => "");
295
- 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.`);
296
- process.exit(1);
297
- }
298
- }
299
268
  async function isOpenCodeRunning() {
300
269
  try {
301
270
  const controller = new AbortController();
@@ -312,7 +281,13 @@ function startOpenCodeServer() {
312
281
  "serve",
313
282
  "--port",
314
283
  "48765"
315
- ], { stdio: "inherit" });
284
+ ], {
285
+ stdio: "inherit",
286
+ env: {
287
+ ...process.env,
288
+ OPENCODE_PERMISSION: JSON.stringify({ "*": "allow" })
289
+ }
290
+ });
316
291
  child.on("error", (error) => {
317
292
  console.error("Failed to start OpenCode server:", error instanceof Error ? error.message : error);
318
293
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flue/cli",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "flue": "dist/flue.js"