opencode-fs-plugin 1.1.1 → 1.2.1

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/INSTALL.md CHANGED
@@ -17,14 +17,14 @@ Add the registry package to the plugin list:
17
17
 
18
18
  ```jsonc
19
19
  {
20
- "plugins": ["opencode-fs-plugin@1.1.1"]
20
+ "plugins": ["opencode-fs-plugin@1.2.1"]
21
21
  }
22
22
  ```
23
23
 
24
24
  Or let the CLI install and configure it:
25
25
 
26
26
  ```bash
27
- opencode plugin add opencode-fs-plugin@1.1.1
27
+ opencode plugin add opencode-fs-plugin@1.2.1
28
28
  ```
29
29
 
30
30
  A bare `opencode-fs-plugin` follows `latest`. OpenCode installs it into its
@@ -36,7 +36,7 @@ Option A if you also want the skill.
36
36
  Download the release artifact and install it as a normal npm package:
37
37
 
38
38
  ```bash
39
- VERSION=1.1.1
39
+ VERSION=1.2.1
40
40
  curl -L -o "opencode-fs-plugin-${VERSION}.tgz" \
41
41
  "https://github.com/masterjg/opencode-fs-plugin/releases/download/v${VERSION}/opencode-fs-plugin-${VERSION}.tgz"
42
42
  npm install "./opencode-fs-plugin-${VERSION}.tgz"
@@ -64,20 +64,20 @@ OpenCode installs it from Git:
64
64
 
65
65
  ```jsonc
66
66
  {
67
- "plugins": ["github:masterjg/opencode-fs-plugin#v1.1.1"]
67
+ "plugins": ["github:masterjg/opencode-fs-plugin#v1.2.1"]
68
68
  }
69
69
  ```
70
70
 
71
- `opencode plugin add 'github:masterjg/opencode-fs-plugin#v1.1.1'` installs the
71
+ `opencode plugin add 'github:masterjg/opencode-fs-plugin#v1.2.1'` installs the
72
72
  same spec and writes the entry for you. The equivalent full URL is
73
- `git+https://github.com/masterjg/opencode-fs-plugin.git#v1.1.1`. A tag is
73
+ `git+https://github.com/masterjg/opencode-fs-plugin.git#v1.2.1`. A tag is
74
74
  checked for updates; use a full commit hash to pin it.
75
75
 
76
76
  Git plugins are installed under OpenCode's cache, so their package path is not
77
77
  stable. For a stable skill path, install the tag with npm instead:
78
78
 
79
79
  ```bash
80
- npm install "github:masterjg/opencode-fs-plugin#v1.1.1"
80
+ npm install "github:masterjg/opencode-fs-plugin#v1.2.1"
81
81
  ```
82
82
 
83
83
  Then configure `./node_modules/opencode-fs-plugin` in `plugins` as in the
@@ -174,9 +174,9 @@ and description until the model loads it.
174
174
  To let a coding agent install the plugin, use:
175
175
 
176
176
  ```text
177
- Install opencode-fs-plugin 1.1.1 with "npm install opencode-fs-plugin@1.1.1",
177
+ Install opencode-fs-plugin 1.2.1 with "npm install opencode-fs-plugin@1.2.1",
178
178
  or from its release tarball or the Git tag
179
- "github:masterjg/opencode-fs-plugin#v1.1.1". Add
179
+ "github:masterjg/opencode-fs-plugin#v1.2.1". Add
180
180
  "./node_modules/opencode-fs-plugin" to the plugins array in opencode.jsonc, add
181
181
  "./node_modules/opencode-fs-plugin/skills" to the skills array, then verify that
182
182
  the filesystem skill loads with the skill tool using id "filesystem".
package/README.md CHANGED
@@ -15,8 +15,8 @@ unit, end-to-end and coverage tests.
15
15
  | `rm` | `fs.rm` | `recursive`, `force`, `dir`, `verbose` |
16
16
  | `cp` | `fs.cp` | `recursive`, `archive`, `force`, `noClobber`, `update`, `preserve`, `dereference`, `verbose` |
17
17
  | `mv` | `fs.mv` | `force`, `noClobber`, `update`, `verbose` |
18
- | `ls` | `fs.ls` | `all`, `almostAll`, `long`, `human`, `recursive`, `directory`, `inode`, `classify`, `sortBy`, `reverse`, `onePerLine` |
19
- | `stat` | `fs.stat` | `follow`, `format`, `filesystem` |
18
+ | `ls` | `fs.ls` | `all`, `almostAll`, `long`, `human`, `recursive`, `directory`, `inode`, `classify`, `size`, `numericIds`, `noGroup`, `noOwner`, `slash`, `quote`, `versionSort`, `extensionSort`, `fullTime`, `timeStyle`, `hide`, `ignore`, `groupDirectoriesFirst`, `sortBy`, `reverse`, `onePerLine` |
19
+ | `stat` | `fs.stat` | `follow`, `format`, `terse`, `filesystem` |
20
20
  | `touch` | `fs.touch` | `accessOnly`, `modifyOnly`, `noCreate`, `date`, `timestamp`, `reference`, `noDereference` |
21
21
  | `truncate` | `fs.truncate` | `size`, `reference`, `noCreate`, `noDereference` |
22
22
  | `ln` | `fs.ln` | `symbolic`, `force`, `noDereference`, `relative`, `verbose` |
@@ -25,20 +25,20 @@ unit, end-to-end and coverage tests.
25
25
  | `sha256sum`/`md5sum` | `fs.hash` | `algorithm`, `tag`; hashes files or stdin |
26
26
  | `du` | `fs.du` | `summarize`, `all`, `human`, `total`, `maxDepth`, `follow`, `oneFileSystem` |
27
27
  | `df` | `fs.df` | `human`, `inodes`, `printType`, `all` |
28
- | `find` | `fs.find` | `name`, `iname`, `pathPattern`, `type`, `size`, `mtime`, `mmin`, `maxDepth`, `minDepth`, `empty`, `perm`, `newer`, `follow`, `print0`, `sort` |
28
+ | `find` | `fs.find` | `name`, `iname`, `pathPattern`, `lname`, `ilname`, `regex`, `iregex`, `type`, `size`, `mtime`, `mmin`, `maxDepth`, `minDepth`, `empty`, `perm`, `uid`, `gid`, `user`, `group`, `links`, `inum`, `samefile`, `fstype`, `newer`, `newerXY`, `printf`, `follow`, `print0`, `sort` |
29
29
  | `cat` | `fs.cat` | `number`, `numberNonBlank`, `squeezeBlank`, `showEnds`, `showTabs`, `showNonPrinting` |
30
30
  | `head` | `fs.head` | `lines`, `bytes`, `quiet`, `verbose` |
31
- | `tail` | `fs.tail` | `lines`, `bytes`, `fromStart`, `quiet`, `verbose` |
31
+ | `tail` | `fs.tail` | `lines`, `bytes`, `fromStart`, `quiet`, `verbose`, `follow`, `timeoutMs`, `intervalMs`, `maxBytes` |
32
32
  | `tee` | `fs.tee` | `append`, `content` |
33
33
  | `wc` | `fs.wc` | `lines`, `words`, `bytes`, `chars`, `maxLineLength` |
34
- | `sort` | `fs.sort` | `numeric`, `reverse`, `unique`, `ignoreCase`, `ignoreLeadingBlanks`, `field`, `separator` |
34
+ | `sort` | `fs.sort` | `numeric`, `generalNumeric`, `humanNumeric`, `version`, `reverse`, `unique`, `ignoreCase`, `dictionary`, `ignoreNonPrinting`, `ignoreLeadingBlanks`, `stable`, `check`, `checkQuiet`, `zeroTerminated`, `keys`, `field`, `separator` |
35
35
  | `uniq` | `fs.uniq` | `count`, `repeated`, `uniqueOnly`, `ignoreCase`, `skipFields`, `skipChars` |
36
36
  | `cut` | `fs.cut` | `fields`, `characters`, `bytes`, `delimiter`, `outputDelimiter`, `complement`, `onlyDelimited` |
37
37
  | `tr` | `fs.tr` | `set1`, `set2`, `delete`, `squeeze`, `complement`; ranges and classes |
38
38
  | `sed` | `fs.sed` | `script`, `expressions`, `inPlace`, `extendedRegexp`, `quiet`; `s///` subset |
39
39
  | `grep` | `fs.grep` | `recursive`, `include`, `exclude`, `ignoreCase`, `invert`, `lineNumbers`, `withFilename`, `noFilename`, `filesWithMatches`, `filesWithoutMatch`, `count`, `onlyMatching`, `word`, `line`, `fixed`, `context`, `before`, `after`, `maxCount`, `noMessages` |
40
- | `tar` | `fs.tar` | `create`/`extract`/`list`, `gzip`, `directory`, `stripComponents`, `exclude`, `verbose` |
41
- | `zip` | `fs.zip` | `archive`, `paths`, `level` |
40
+ | `tar` | `fs.tar` | `create`/`extract`/`list`, `gzip`, `directory`, `stripComponents`, `exclude`, `verbose`, `input`, `member` |
41
+ | `zip` | `fs.zip` | `archive`, `paths`, `level`, `input`, `member` |
42
42
  | `unzip` | `fs.unzip` | `extract`/`list`, `directory`, `overwrite`, `noOverwrite` |
43
43
  | `gzip` | `fs.gzip` | `keep`, `force`, `stdout`, `level` |
44
44
  | `gunzip` | `fs.gunzip` | `keep`, `force`, `stdout`, `suffix` |
@@ -127,18 +127,18 @@ Add the registry package directly to the plugin list:
127
127
 
128
128
  ```jsonc
129
129
  {
130
- "plugins": ["opencode-fs-plugin@1.1.1"]
130
+ "plugins": ["opencode-fs-plugin@1.2.1"]
131
131
  }
132
132
  ```
133
133
 
134
- `opencode plugin add opencode-fs-plugin@1.1.1` installs it and writes the config
134
+ `opencode plugin add opencode-fs-plugin@1.2.1` installs it and writes the config
135
135
  entry. A bare `opencode-fs-plugin` follows the `latest` tag.
136
136
 
137
137
  OpenCode manages the package under its cache, so the path is not stable. If you
138
138
  also want the packaged skill, install it into a project instead:
139
139
 
140
140
  ```bash
141
- npm install opencode-fs-plugin@1.1.1
141
+ npm install opencode-fs-plugin@1.2.1
142
142
  ```
143
143
 
144
144
  ```jsonc
@@ -153,7 +153,7 @@ npm install opencode-fs-plugin@1.1.1
153
153
  Download the release tarball, then install it as a normal npm package:
154
154
 
155
155
  ```bash
156
- VERSION=1.1.1
156
+ VERSION=1.2.1
157
157
  curl -L -o "opencode-fs-plugin-${VERSION}.tgz" \
158
158
  "https://github.com/masterjg/opencode-fs-plugin/releases/download/v${VERSION}/opencode-fs-plugin-${VERSION}.tgz"
159
159
  npm install "./opencode-fs-plugin-${VERSION}.tgz"
@@ -182,20 +182,20 @@ OpenCode installs it from Git:
182
182
 
183
183
  ```jsonc
184
184
  {
185
- "plugins": ["github:masterjg/opencode-fs-plugin#v1.1.1"]
185
+ "plugins": ["github:masterjg/opencode-fs-plugin#v1.2.1"]
186
186
  }
187
187
  ```
188
188
 
189
- `opencode plugin add 'github:masterjg/opencode-fs-plugin#v1.1.1'` installs the
189
+ `opencode plugin add 'github:masterjg/opencode-fs-plugin#v1.2.1'` installs the
190
190
  same spec and writes the config entry. The equivalent full URL is
191
- `git+https://github.com/masterjg/opencode-fs-plugin.git#v1.1.1`. A tag is
191
+ `git+https://github.com/masterjg/opencode-fs-plugin.git#v1.2.1`. A tag is
192
192
  checked for updates; use a full commit hash to pin it.
193
193
 
194
194
  Git plugins are installed under OpenCode's cache, so their package path is not
195
195
  stable. If you also want the packaged skill, install with npm instead:
196
196
 
197
197
  ```bash
198
- npm install "github:masterjg/opencode-fs-plugin#v1.1.1"
198
+ npm install "github:masterjg/opencode-fs-plugin#v1.2.1"
199
199
  ```
200
200
 
201
201
  Then use `./node_modules/opencode-fs-plugin` in `plugins` and
package/SPEC.md CHANGED
@@ -30,23 +30,28 @@ the `fs` namespace (`tools.fs.cp`, direct `fs_cp`).
30
30
  These are not implemented:
31
31
 
32
32
  - `xz`, `zstd`, `7z`, `rar`
33
- - `awk`, full `sed` command language, `find -exec`, `tail -f`
33
+ - `awk`, full `sed` command language, `find -exec`
34
34
  - `chown`, `chgrp`, `chattr`, `dd`, `rsync`
35
35
  - ACL and xattr preservation in `cp -a`
36
- - full GNU edge-flag parity for `ls`, `stat`, `sort`, `find`
36
+ - remaining GNU edge-flag parity for `ls`, `stat`, `sort`, `find`
37
37
  - symlink-race-proof sandboxing
38
- - `tar`/`zip` creation from arbitrary streams; archives are file-backed
38
+ - unbounded `tail -f`; use bounded `follow` or the wait plugin
39
+ - archive extraction from arbitrary streams; create accepts text/stdin stream input
39
40
  - cross-filesystem `trash`; use `rm` or a mount-trash helper
40
41
 
41
42
  ## Format details
42
43
 
43
- - `stat` supports `%n %N %s %F %a %A %u %U %g %G %d %i %h %b %B %o %x %X %y
44
- %Y %z %Z %t %T %L`, plus `\n`, `\t`, `\\` and `%%`.
44
+ - `stat` supports `%n %N %s %F %a %A %f %u %U %g %G %d %i %h %b %B %o %m %r
45
+ %x %X %y %Y %z %Z %w %W %t %T %C %L`, plus `\n`, `\t`, `\\` and `%%`.
46
+ `%C` returns `?` because Node does not expose the SELinux file context.
45
47
  - `chmod` supports octal modes and symbolic `[ugoa]*[-+=][rwxXst]*` clauses.
46
- - `find -size` uses binary suffixes (`K`, `M`, `G`, ...); `-mtime`/`-mmin`
47
- accept `+N` (older), `-N` (newer), and exact `N`.
48
+ - `find -size` accepts `c` (bytes), `w` (2-byte words), `b` (512-byte blocks),
49
+ and binary `K`/`M`/`G`/... suffixes; `-mtime`/`-mmin` accept `+N` (older),
50
+ `-N` (newer), and exact `N`. `newerXY` uses `XY:path`.
51
+ - `sort -k` accepts field/character ranges with modifiers `bdfghiMnrV`.
48
52
  - `tar`/`zip` extraction rejects path traversal and escaping links.
49
- - `pipe` passes raw bytes and only accepts registered pipeable stages.
53
+ - `pipe` passes raw bytes and only accepts registered pipeable stages; `tar` and
54
+ `zip` are sink stages.
50
55
 
51
56
  ## Coverage policy
52
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-fs-plugin",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "description": "OpenCode 2 plugin: Linux-style filesystem and text tools under the fs namespace.",
6
6
  "repository": {
@@ -24,6 +24,7 @@ With `execute` allowed, call it as `tools.fs.<command>`; agents without
24
24
  | Metadata/predicate search | `fs.find` |
25
25
  | Regex substitution or in-place edit | `fs.sed` |
26
26
  | Recoverable deletion | `fs.trash` |
27
+ | Batching or loops | `execute` JS loops over `tools.fs.*` |
27
28
 
28
29
  Do not duplicate a built-in when it already covers the job. `fs` exists for the
29
30
  operations the built-ins do not cover, and for composable text/archive work.
@@ -51,6 +52,11 @@ what `fs.stat`, `fs.ls`, `fs.hash`, `fs.diff`, or `fs.cat` can confirm.
51
52
  | Compose filters | `fs.pipe` |
52
53
  | Background jobs | `background: true`, then `fs.job` |
53
54
 
55
+ Parity additions: `fs.sort` accepts GNU key ranges (`keys: ["2,2n"]`);
56
+ `fs.find` adds `lname`/`regex`/owner/link/inode/fstype/`newerXY`/`printf`;
57
+ `fs.ls` and `fs.stat` add more GNU flags and format tokens; `fs.tail` has
58
+ bounded `follow`; `fs.tar`/`fs.zip` accept `input`/`member` and pipe stdin.
59
+
54
60
  ## Argument shapes
55
61
 
56
62
  Use the exact field names; scalar `path` is only valid for `fs.mkdir`.
@@ -136,6 +142,52 @@ const status = JSON.parse(await tools.fs.job({ id: job.jobId }))
136
142
  A job that produces no text returns empty content from `fs.job wait`; verify the
137
143
  effect with `fs.stat`, `fs.ls`, or `fs.diff`, and use `fs.job({ id })` for state.
138
144
 
145
+ ## Loops and batching
146
+
147
+ `execute` is always available and is the orchestration layer for every `fs` tool.
148
+ Use ordinary JavaScript for iteration, conditionals, retries, and parallel calls.
149
+ Do not use a shell or `toolbox.run` for batching.
150
+
151
+ Sequential is the safe default for writes, destructive work, ordering, and
152
+ permission prompts:
153
+
154
+ ```js
155
+ const files = (
156
+ await tools.fs.find({
157
+ paths: ["src"],
158
+ name: "*.sh",
159
+ type: "f",
160
+ print0: true,
161
+ })
162
+ ).split("\0").filter(Boolean)
163
+
164
+ for (const file of files) {
165
+ await tools.fs.chmod({ paths: [file], mode: "640" })
166
+ }
167
+ ```
168
+
169
+ Use `Promise.all` only for independent work. It rejects on the first failure
170
+ while the other calls continue, so prefer `Promise.allSettled` when partial
171
+ results are useful. Bound concurrency to about 4–8:
172
+
173
+ ```js
174
+ async function mapLimit(items, limit, fn) {
175
+ const results = []
176
+ for (let i = 0; i < items.length; i += limit) {
177
+ results.push(...(await Promise.all(items.slice(i, i + limit).map(fn))))
178
+ }
179
+ return results
180
+ }
181
+
182
+ const stats = await mapLimit(files, 4, (file) =>
183
+ tools.fs.stat({ paths: [file], format: "%n %s" }),
184
+ )
185
+ ```
186
+
187
+ Each call still enforces its own `fs_<tool>` and `external_directory`
188
+ permissions; loops do not bypass them. Code Mode has no timers, so use
189
+ `wait_for` for time-based waits and `background: true` for long jobs.
190
+
139
191
  ## Recipes
140
192
 
141
193
  ```js