@flue/cli 0.0.8 → 0.0.10

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 +31 -0
  2. package/package.json +1 -1
package/dist/flue.js CHANGED
@@ -215,6 +215,7 @@ async function run() {
215
215
  }
216
216
  }
217
217
  await preflight(workdir, modelStr);
218
+ await setPermissions(workdir);
218
219
  const eventStream = startEventStream(workdir);
219
220
  eventStreamAbort = eventStream;
220
221
  const model = modelStr ? parseModel(modelStr) : void 0;
@@ -265,6 +266,36 @@ async function preflight(workdir, modelOverride) {
265
266
  process.exit(1);
266
267
  }
267
268
  }
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
+ }
268
299
  async function isOpenCodeRunning() {
269
300
  try {
270
301
  const controller = new AbortController();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flue/cli",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "flue": "dist/flue.js"