opencode-fs-plugin 1.6.1 → 1.6.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-fs-plugin",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "type": "module",
5
5
  "description": "OpenCode 2 plugin: Linux-style filesystem, text, and HTTP(S) tools under the fs namespace.",
6
6
  "repository": {
@@ -277,59 +277,23 @@ const status = JSON.parse(await tools.fs.job({ id: job.jobId }))
277
277
  A job that produces no text returns empty content from `fs.job wait`; verify the
278
278
  effect with `fs.stat`, `fs.ls`, or `fs.diff`, and use `fs.job({ id })` for state.
279
279
 
280
- ## Loops and batching
280
+ ## Orchestration notes
281
281
 
282
- `execute` is always available and is the orchestration layer for every `fs` tool.
283
- Use ordinary JavaScript for iteration, conditionals, retries, and parallel calls.
284
- Do not use a shell or `toolbox.run` for batching.
285
-
286
- Sequential is the safe default for writes, destructive work, ordering, and
287
- permission prompts:
288
-
289
- ```js
290
- const files = (
291
- await tools.fs.find({
292
- paths: ["src"],
293
- name: "*.sh",
294
- type: "f",
295
- print0: true,
296
- })
297
- ).split("\0").filter(Boolean)
298
-
299
- for (const file of files) {
300
- await tools.fs.chmod({ paths: [file], mode: "640" })
301
- }
302
- ```
303
-
304
- Use `Promise.all` only for independent work. It rejects on the first failure
305
- while the other calls continue, so prefer `Promise.allSettled` when partial
306
- results are useful. Bound concurrency to about 4–8:
307
-
308
- ```js
309
- async function mapLimit(items, limit, fn) {
310
- const results = []
311
- for (let i = 0; i < items.length; i += limit) {
312
- results.push(...(await Promise.all(items.slice(i, i + limit).map(fn))))
313
- }
314
- return results
315
- }
316
-
317
- const stats = await mapLimit(files, 4, (file) =>
318
- tools.fs.stat({ paths: [file], format: "%n %s" }),
319
- )
320
- ```
321
-
322
- Each call still enforces its own `fs_<tool>` and `external_directory`
323
- permissions; loops do not bypass them. Code Mode has no timers, so use
324
- `wait_for` for time-based waits and `background: true` for long jobs.
282
+ `execute` is the orchestration layer for every `fs` tool. Each batched call still
283
+ asserts its own `fs_<tool>` and `external_directory` permission, so fan-out does
284
+ not bypass permissions. Code Mode has no timers: use `wait_for` for time-based
285
+ waits and `background: true` for long jobs. Writes and destructive operations
286
+ may fan out too when their targets are independent; keep ordering only when a
287
+ later step depends on an earlier result.
325
288
 
326
289
  ## Performance
327
290
 
328
291
  All `fs` I/O is asynchronous. Independent work is parallelized automatically
329
292
  within each call, up to `os.availableParallelism()`: tree copies, hashing,
330
293
  gzip/gunzip, grep reads, `find`/`du`/`grep -r`/`chmod -R`/`chown -R` traversal,
331
- `diff -r`, `ls` formatting, `ps` /proc scans, and `split` writes. Do not add
332
- your own concurrency for those.
294
+ `diff -r`, `ls` formatting, `ps` /proc scans, and `split` writes. Do not
295
+ re-implement that internal concurrency; fan out separate tool calls only as
296
+ described in Batch independent calls.
333
297
 
334
298
  The limit comes from the plugin `concurrency` option or
335
299
  `OPENCODE_FS_CONCURRENCY`. CPU-bound `sort`, `sed`, and text diffing stay