dsh-delete-guard 0.0.0-stage → 2.4.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/CHANGELOG.md ADDED
@@ -0,0 +1,459 @@
1
+ # Changelog
2
+
3
+ All notable changes to this plugin. Dates are the day the tarball was packed on
4
+ this machine (`temp/pack/dsh-delete-guard-<ver>.tgz`), which is the artifact
5
+ each profile actually ran.
6
+
7
+ The long-form reasoning behind every entry — what was measured, what was
8
+ rejected, what the trade-off costs — lives in the maintainer's engineering notes (`INCIDENTS.md`, not shipped since 2.2.0).
9
+
10
+ ## [2.4.1] — 2026-11-24
11
+
12
+ The publish workflow's first run, and what it found. No production code changed.
13
+
14
+ Releasing 2.4.0 ran `test/run-all.mjs` on Ubuntu for the first time in this
15
+ repository's history — no tags, no releases, no prior workflow runs; 2.2.3 reached
16
+ npm through a hand-run `npm publish`. Layer ④ came back **4 pass / 11 fail**:
17
+ `move-guard.test.mjs` asserts Windows path semantics (`C:\` is a drive root,
18
+ `..\..` resolves inside a volume, `\\host\share` is a UNC share, `C:\Program Files`
19
+ is refused), and on a POSIX runner `node:path` is posix, so `C:\` is an ordinary
20
+ relative name and `resolve()` prepends the checkout path.
21
+
22
+ Fix: layers ③ ④ ⑦ are gated on `process.platform === 'win32'` in
23
+ `test/run-all.mjs` and report **skipped** elsewhere, with the measurement recorded
24
+ in the comment. The plugin is `os: ["win32"]` and the bridge is
25
+ `SHFileOperationW`: a POSIX runner cannot exercise those paths at all, so gating is
26
+ the honest answer rather than a workaround.
27
+
28
+ This also corrects a claim in 2.3.0 — "layers ① ② ④ ⑥ pass anywhere" was derived
29
+ from forcing `process.platform='linux'` on Windows, which leaves `node:path` bound
30
+ to win32 at load time, so the check proved nothing about the other platform. CI was
31
+ the only evidence, and it had never run. Same failure mode as the rules this
32
+ release series added: a check that looks green because it never exercised the thing
33
+ it names.
34
+
35
+ ## [2.4.0] — 2026-11-15
36
+
37
+ **Deleting from a network share now works instead of being refused.** A share has
38
+ no Recycle Bin: `SHFileOperationW(FOF_ALLOWUNDO)` erases there and returns 0
39
+ (reproduced 2026-10-23), so 2.3.0 refused every UNC path — safe, but the deletion
40
+ never happened and the model had to invent a workaround.
41
+
42
+ `file_trash` now does what a person does by hand, in one call, in this order:
43
+
44
+ 1. copy the item to a staging directory on a volume that does have a bin
45
+ (`%LOCALAPPDATA%\dsh-delete-guard\staging\<yyyyMMdd-HHmmss>-<name>`, override
46
+ with `stagingRoot`);
47
+ 2. verify the copy against the original — same relative paths, same kinds, same
48
+ file sizes;
49
+ 3. recycle the staging folder — the copy is now in the bin and restorable;
50
+ 4. only then remove the original.
51
+
52
+ **What this guarantees, stated exactly**: the *content* is recoverable from the
53
+ local Recycle Bin; the *original path* is not, because the share has no bin to hold
54
+ it. Step 4 is an ordinary permanent delete. That is why the order is the safety
55
+ property — every failure before step 4 leaves the original untouched, and step 4
56
+ runs only after the bridge confirms the staged copy left for the bin. A failure in
57
+ step 4 is reported with the paths that remain, never as success.
58
+
59
+ Restoring lands in the staging path, not back on the share: the bin's `$I` record
60
+ holds the staging location, so `file_trash` prints it in its result and the render
61
+ says so. That is the one place where "delete a share file" is not the same as
62
+ "delete a local file", and it is visible rather than implied.
63
+
64
+ **Refused, with the reason** (each one stops before any copy):
65
+ - a share root (`\\host\share`) or a bare host — those are not items, and staging
66
+ them would copy and then delete everything on the share;
67
+ - a tree containing a **reparse point** (junction/symlink): a copy either
68
+ duplicates the target's contents or needs privileges to recreate the link, so it
69
+ is not a faithful copy;
70
+ - **insufficient free space** on the staging volume, checked from the measured size
71
+ before copying, so a 50 GB tree fails in a second instead of halfway.
72
+
73
+ **Verified vs not**: entry sets, kinds and sizes are compared; content hashes are
74
+ not (both sides of a 50 GB tree). The result reports `verification` so nobody reads
75
+ more into "verified" than it means.
76
+
77
+ New config: `uncRecoverableMove` (default `true`; `false` restores the plain 2.3.0
78
+ refusal and deletes nothing), `stagingRoot`. New required output field `staged[]`
79
+ (`path`, `staged`, `recycled`, `sourceRemoved`, optional `verification` and
80
+ `remaining`) — a share deletion is *not* reported in `recycled`, because the
81
+ original path never goes to a bin.
82
+
83
+ Also found while reading the resolution path: `file_trash` with `\\host` (no share)
84
+ used to resolve to `<cwd drive>:\host` — a *local* file that has nothing to do with
85
+ the share the caller meant — and would happily recycle it. The shape is now refused.
86
+
87
+ Cost, stated: a share delete copies the whole item, so it is O(size) in time and
88
+ needs that much free space on the staging volume; a very large tree may exceed the
89
+ tool call's timeout. Windows' own cross-volume `Move-Item` has the same cost, but no
90
+ verification and no bin record.
91
+
92
+ Tests: 116 → 128. New layer ③ `test/staging.test.mjs` (8 cases: step order, a
93
+ truncated copy that never reaches the bin, a failed recycle that keeps the
94
+ original, a junction that stops the delete, share-root/host refusal) plus three
95
+ `file_trash`-level cases in `e2e.test.mjs`, one of which deletes a real
96
+ `\\localhost\C$\…` path end to end (reported **skipped** where the admin share is
97
+ unreachable, rather than passing vacuously).
98
+
99
+ **A documentation incident, recorded because it is the same failure mode as 2.3.0's.**
100
+ Applying these README changes with a scripted `String.replace(needle, text)` put one
101
+ replacement string containing `` $` `` (the `\\localhost\C$` code span, closed by a
102
+ backtick). JavaScript reads `` $` `` in a string replacement as "everything before
103
+ the match" and expanded it, so each README ended up containing itself twice — 6.5 KB
104
+ became 13 KB, silently, and it survived a heading-level spot check because both
105
+ copies were plausible. Caught by counting H1s (2 instead of 1) and by noticing a
106
+ `README.md` whose first copy had no 文档/许可 sections. Rebuilt from `HEAD` with a
107
+ function-based replacer (never `String.replace(_, string)` when the replacement
108
+ contains `$`), every anchor asserted to match exactly once, and the result checked
109
+ structurally: 11 sections and 44 table rows in each of the three files. The lesson is
110
+ 2.3.0's lesson one layer up: a rule that silently matches more than intended looks
111
+ exactly like a rule that worked.
112
+
113
+ ## [2.3.0] — 2026-11-15
114
+
115
+ Content destroyed **without a delete verb** is now covered. Found by measurement,
116
+ not by review: a 605-line ledger was rewritten to 24 lines by
117
+
118
+ ```powershell
119
+ $lines=Get-Content $f
120
+ $idx=($lines | Select-String -Pattern '^# 备用|同步电机' | Select-Object -First 1).LineNumber
121
+ $keep=$lines[0..($idx-2)]
122
+ Set-Content -LiteralPath $f -Value ($keep + $new) -Encoding UTF8
123
+ ```
124
+
125
+ There is no delete verb in that command, so every 2.2.3 rule was correctly silent.
126
+ `$idx` was `$null` (the anchor matched nothing) and PowerShell reads
127
+ `$lines[0..($null-2)]` as `$lines[0..-2]` — `$lines[0,-1,-2]`, the first line plus
128
+ the last two. Measured on pwsh 7 with a 10-element array: `L1,L10,L9`. No error,
129
+ no warning. Record and verbatim evidence:
130
+ `docs/incidents/2026-11-14-full-file-rewrite-truncation.md`.
131
+
132
+ New module `lib/rewrite-guard.js` (pure, no I/O), wired into `classifyCommand`
133
+ after the erase/script rules and **before** the redirect collection — `file_trash`
134
+ is the remedy for a delete, and it is the wrong remedy here (see below). New
135
+ config key `blockTruncatingWrites` (default `true`).
136
+
137
+ **Rule 1 — `in-place-rewrite`.** The same file is read *and* written by one
138
+ command (`Get-Content f … | Set-Content f`, `$c = Get-Content f; Set-Content f $c`,
139
+ `sed -i f`, `cat f > f`, `[IO.File]::ReadAllText` → `::WriteAllText`). Reused or
140
+ rewritten: the operand-key comparison resolves `$f` against a `$f='literal'`
141
+ assignment in the same command, so a literal on one side and a variable on the
142
+ other still match. Allowed when the command itself keeps a copy (`.bak`/`.orig`
143
+ destination, or a temp file it copies over the original) — which is exactly the
144
+ safe pattern the incident record's §6 recommends, so that spelling passes
145
+ untouched.
146
+
147
+ **Rule 2 — `slice-risk`.** A range/slice endpoint of the form `<var> ± n` whose
148
+ variable is never asserted, in a command that also writes a file. Endpoints proven
149
+ non-null (`.Count`, `Measure-Object`, a literal) and asserted variables
150
+ (`if (-not $idx)`, `$idx -eq $null`, …) do not fire. A read-only command with the
151
+ same bad slice stays allowed: it prints the wrong lines and destroys nothing, and
152
+ refusing it would cost a round trip and protect nothing.
153
+
154
+ **Rejected: "overwrite an existing file = delete it" (proposed as R1).** Three
155
+ reasons, in order of weight. (a) The remedy does not exist where the failure
156
+ happened: the target was on a UNC share, and `scripts/recycle-bin.ps1` refuses
157
+ those because `SHFileOperationW` erases there and reports success — "recycle the
158
+ old copy, then write" is a no-op on the case that motivated it. (b) The rule is a
159
+ verb list one vocabulary later, i.e. the same structural blind spot: `Export-Csv`,
160
+ `[IO.File]::WriteAllText`, `Invoke-WebRequest -OutFile`, `tee`, `dd of=`, `cp`,
161
+ `truncate`, `sed -i`, a compiler over its own output — any enumeration is
162
+ incomplete and reads as complete. (c) Its consequence, "every overwrite is a
163
+ delete", is the opposite of this plugin's own policy: `write` and `edit` overwrite
164
+ files, and the prompt says to prefer them.
165
+
166
+ **Rejected: post-write size fuse, refuse-and-roll-back (R2).** Roll-back requires
167
+ the old bytes, so the copy has to be taken *before* the write — which needs the
168
+ target set (the same enumeration problem) — and `tools/post-execute` cannot undo
169
+ anything: `PostToolDecision.block` only turns the result into feedback for the
170
+ next request, after the truncation already happened. Snapshotting a tree per shell
171
+ call is O(workspace) and would still have missed this incident's file, which sat
172
+ on a UNC share outside every workspace root.
173
+
174
+ **Not `ask`.** In an auto-approving deployment (this machine: approval policy
175
+ `never`) `ask` resolves to allow in the same tick — a rule that looks present and
176
+ does nothing. Deny-with-a-recipe is honest whether or not a human is watching.
177
+
178
+ **Also fixed, found while doing the above.** Maintaining this repository was
179
+ refused by the published 2.2.3: the rule that looks for a wipe-program name inside
180
+ an inline body matched the name **anywhere** in the body, so a `node -e` script
181
+ whose *prose* quoted `shred` was denied as if it were about to erase the disk
182
+ (measured 2026-11-15 — the guard blocked the `node -e` edit of this very README).
183
+ A shell body (`bash -c "…"`) is shell text, so the name anywhere in it may run; a
184
+ JavaScript or Python body is not, and the name only becomes a command when it
185
+ reaches `exec`/`execSync`/`spawn`/`system`/`subprocess.*`. Split at
186
+ `wipeProgramInInlineBody`: shell interpreters keep the whole-name rule, other
187
+ interpreters require a process-spawning call after the name. Spawned wipes are
188
+ still refused (`execSync('shred -u x')`, `os.system('sdelete …')`).
189
+
190
+ Costs, stated: the in-place rule is deliberately over-inclusive for "read a file,
191
+ then regenerate it from something else in the same command" (the fix is one
192
+ `Copy-Item` line, and the message says so); `Add-Content`, `>>`, `-Append`,
193
+ `2> $null`, `> /dev/null` and `Clear-Content`-only commands are untouched; `>` onto
194
+ an existing file *without* reading it is still allowed and is listed in the
195
+ README's 「不挡什么」.
196
+
197
+ Tests: 90 → 116. New layer ② `test/rewrite.test.mjs` (22 cases: the incident
198
+ verbatim, the assertion fix, the §6 safe pattern, every in-place spelling, the
199
+ null-device/appendix exceptions, dialect spellings, the precedence case) plus three
200
+ hook-level cases in `registration.test.mjs` proving `apply()` actually wires the
201
+ rules and that `blockTruncatingWrites: false` disables them, plus the inline-body
202
+ scoping cases in `guard.test.mjs`. The "ordinary work stays allowed" corpus (42
203
+ commands: build, git, publish, log and config plumbing) lives in the same file as
204
+ the incident regression on purpose — a rule that catches the incident and also
205
+ refuses `npm run build` is not a fix.
206
+
207
+ `lib/shell-text.js` extracted: the lexer (`splitStatements`, `tokenize`,
208
+ `unquote`, `commandWord`) is now shared by both rule modules instead of imported
209
+ across them, which would have been a cycle. `guard.js` re-exports the same four
210
+ names, so nothing downstream changes.
211
+
212
+ ## [2.2.3] — 2026-10-23
213
+
214
+ npm publish prerequisites; no behaviour change.
215
+
216
+ - READMEs (`zh`/`en`/`ja`): the first install line is now the registry spec
217
+ `dsh plugin --profile web add dsh-delete-guard`, with `github:deepestevan/dsh-delete-guard`
218
+ and the local tarball kept as the alternatives.
219
+ - `.github/workflows/publish.yml`: release-time publish over GitHub OIDC (trusted
220
+ publishing, `id-token: write`), no `NPM_TOKEN` secret. It upgrades npm first —
221
+ Node 22 ships npm 10, and trusted publishing needs ≥ 11.5.1.
222
+ - `test/run-all.mjs`: the e2e layer is gated on `win32`, so the same command is
223
+ green on the Linux CI runner (one suite skipped, reported as such). Verified by
224
+ forcing `process.platform='linux'`.
225
+ - `package.json`: `publishConfig.access` explicit; the root-package-only
226
+ `repository.directory` removed.
227
+
228
+ ## [2.2.2] — 2026-10-23
229
+
230
+ - All three READMEs now open the install section with the repository spec
231
+ (`dsh plugin --profile web add github:deepestevan/dsh-delete-guard`) and keep the
232
+ local tarball flow as the "you changed the source" alternative. A public repo
233
+ whose first command is a `pnpm pack` path is written for its author, not its user.
234
+
235
+ ## [2.2.1] — 2026-10-23
236
+
237
+ Registry metadata for the first publish; no behaviour change.
238
+
239
+ - `package.json`: `repository` / `homepage` / `bugs` / `author` filled with
240
+ `github.com/deepestevan/dsh-delete-guard`.
241
+ - `LICENSE`: copyright holder is the account name, not "contributors" — this is a
242
+ single-author project, and the handle is already the repo owner on every commit.
243
+
244
+ ## [2.2.0] — 2026-10-23
245
+
246
+ Publishing policy; no behaviour change. The repository now ships only what a user
247
+ or an integrator needs; the engineering notes moved out of it.
248
+
249
+ - `docs/` removed from the repository and from the package (`files`). The three
250
+ documents (design rationale, per-round incident log, release runbook) moved to
251
+ the maintainer's notes tree. They described how this plugin was built, not how to
252
+ use it — and one of them quoted a private hostname and UNC path from the
253
+ measurement that proved the 1.0.5 hole.
254
+ - What used to be a link now sits in the READMEs as one sentence: "the decision is
255
+ made on the statement's command word, the shape of the call, and program
256
+ position — never on a word appearing somewhere in the line." The threat model
257
+ stays in `SECURITY.md`.
258
+ - Reference for the split: the upstream project keeps architecture documents in its
259
+ repository `docs/` but publishes packages with a runtime-only `files` whitelist
260
+ (`packages/shell/tool-pwsh/package.json` → `locale/*.json`, `lib/index.js`,
261
+ `lib/types/**/*.d.ts`). Nothing in the published artifact is a build record.
262
+
263
+ ## [2.1.2] — 2026-10-23
264
+
265
+ - `docs/RELEASING.md` quoted this machine's absolute paths and user name
266
+ (`C:\Users\<user>\…`, the author's workspace layout). Generalised to
267
+ `%DSH_HOME%` / `<repo>\temp\pack`. A release runbook that leaks its author's
268
+ directory layout is not publishable.
269
+
270
+ ## [2.1.1] — 2026-10-23
271
+
272
+ - Three READMEs pointed at `docs/DESIGN.md` for both "judging criteria" and the
273
+ measurements. The measurements are in `INCIDENTS.md`; the pointer was split.
274
+
275
+ ## [2.1.0] — 2026-10-23
276
+
277
+ Docs restructure; no behaviour change. The README had become a lab notebook —
278
+ 361 lines of per-version forensics, defensive caveats and provenance maths — which
279
+ is the wrong document for a repository's front page.
280
+
281
+ - `README.md` rewritten as a release document: what it is in one line, the problem
282
+ it removes, install in three commands, a before/after of a blocked delete, what
283
+ gets redirected vs refused, the two tools, configuration, how to restore, then
284
+ the limits as one compact table. 361 → ~170 lines.
285
+ - The evidence moved verbatim (nothing retyped) into two documents:
286
+ `DESIGN.md` (why this shape: judging criteria, rejected alternatives, costs,
287
+ implementation notes) and `INCIDENTS.md` (per-round incidents, measurements,
288
+ and the lesson about verification method). These two, plus the release runbook,
289
+ were moved out of the repository in 2.2.0.
290
+ - `README.en.md` and `README.ja.md` rebuilt to the same shape and length.
291
+ - Stale cross-references (`README.md` 「已知限制」, `README.md` 「1.0.x 修的是
292
+ 什么」) repointed to `SECURITY.md` and this
293
+ changelog.
294
+
295
+ ## [2.0.2] — 2026-10-23
296
+
297
+ `trash_status` reported `Recycle Bin on F:: 59 item(s)` — the caller's drive
298
+ string already carries its colon and the render appended a second one. Found by
299
+ the live probe right after the 2.0.0 restart, i.e. by using the tool the way a
300
+ model does.
301
+
302
+ (2.0.1 carried the same code fix; it was superseded within the hour because its
303
+ changelog entry was written after packing, which breaks the "installed == packed"
304
+ invariant this file exists to protect.)
305
+
306
+ ## [2.0.0] — 2026-10-23
307
+
308
+ **Renamed: `dsh-recycle-bin-guard` → `dsh-delete-guard`** (cordis id
309
+ `recycle-bin-guard` → `delete-guard`, error `RecycleBinGuardError` →
310
+ `DeleteGuardError`, prompt section `delete-guard`). No behaviour change; the
311
+ package had never been published, so no alias is needed.
312
+
313
+ Why: the old name puts "guard" on the wrong noun. What is guarded is *deletion* —
314
+ the plugin refuses every unrecoverable delete and routes it into the bin. It does
315
+ not protect the bin; it protects the user from the bin being bypassed, and it also
316
+ refuses emptying the bin. Named for the bin, a reader can conclude the opposite of
317
+ what it does.
318
+
319
+ Measured on a local snapshot of the ecosystem index (4,377 plugins, from awesome-dsh-plugin.com):
320
+
321
+ - 3,740 names (85 %) start with `dsh-`; median name length 15, p90 22. `dsh-delete-guard` is 16.
322
+ - 62 names are `…-guard` with the **target** in the middle (`dsh-egress-guard`,
323
+ `dsh-write-rule-guard`, `dsh-tool-call-guard`, `dsh-disk-guard`). The target of
324
+ this one is deletion, so the convention points at `delete-guard`.
325
+ - `trash` and `recycle` appear in 0 of 4,377 names, so the old name had no search
326
+ overlap in the ecosystem; `dsh-safe-delete` (the closest neighbour) owns the
327
+ "safe delete" phrase.
328
+ - The platform stays out of the name (only ~10 of 4,377 put `win`/`windows` in it);
329
+ it belongs in the description and the `windows` topic, which both carry it.
330
+
331
+ ## [1.0.11] — 2026-10-23
332
+
333
+ Docs; no behaviour change.
334
+
335
+ - Three READMEs with a language switcher line at the top of each:
336
+ `README.md` (简体中文, the measurement log — GitHub's default display),
337
+ `README.en.md`, `README.ja.md`. The English and Japanese files contain no
338
+ Chinese prose; the switcher is the only CJK in the English one.
339
+ - Release runbook (`RELEASING.md`, maintainer-side): how to create the repository and set topics, with the
340
+ measured topic table (which topics this ecosystem actually uses, and the counts
341
+ they were measured at), plus the `gh repo create` / `gh repo edit` commands.
342
+ - `package.json` `keywords` aligned with the topic list.
343
+
344
+ ## [1.0.10] — 2026-10-23
345
+
346
+ Docs and test portability; no behaviour change.
347
+
348
+ - `test/dsh-install.mjs`: the two layers that import the host's schema validators
349
+ no longer hard-code this machine's DSH install path. They locate it
350
+ automatically and **report as skipped** (not failed) when there is none, with
351
+ `DSH_NODE_MODULES` as an override. A public repository cannot ship a test
352
+ command that only runs on the author's box.
353
+ - `README.en.md` / the release runbook: say how that lookup works and that a
354
+ `pass 0` run means the host layers were skipped.
355
+
356
+ ## [1.0.9] — 2026-10-23
357
+
358
+ Publishing metadata only; no behaviour change.
359
+
360
+ - Add `LICENSE` (MIT), `SECURITY.md`, `CHANGELOG.md`, `README.en.md`,
361
+ the release runbook.
362
+ - `package.json`: drop the `types` field — it pointed at `lib/index.d.ts`, which
363
+ has never existed, so TypeScript consumers resolved nothing. Declare
364
+ `"os": ["win32"]` (the Recycle Bin bridge is Win32-only). Ship the new
365
+ documents in the package (`files`).
366
+
367
+ ## [1.0.8] — 2026-10-23
368
+
369
+ Coverage for shells other than `pwsh`.
370
+
371
+ - **Persistent terminal is now inspected.** `terminal_send` types into a live
372
+ PTY and never passes through the `pwsh`/`bash` tools, so a delete there ran
373
+ unguarded (measured: `Remove-Item …` executed with the guard on the same call
374
+ path). The hook now reads a tool table (`SHELL_TOOLS`) instead of two hard-coded
375
+ names.
376
+ - **Git Bash paths are translated.** `rm -rf /c/tmp/x` used to be redirected with
377
+ the literal POSIX path, which Node resolves to `<cwd drive>:\c\tmp\x` — a
378
+ different location. `/x/…` and `/cygdrive/x/…` now become `X:\…`; `~`, `/tmp`,
379
+ `/usr` and other MSYS mount points are refused rather than guessed.
380
+
381
+ ## [1.0.7] — 2026-10-23
382
+
383
+ Emptying the Recycle Bin, in every spelling.
384
+
385
+ - 1.0.6 blocked only the literal `Clear-RecycleBin` at the start of a statement.
386
+ Also blocked now: `& "Clear-RecycleBin"`, `pwsh -Command "…"` and
387
+ `Start-Process … -ArgumentList "…"`, `-EncodedCommand` bodies (decoded before
388
+ judging), `SHEmptyRecycleBin`, and driving the bin items' own shell verbs
389
+ (`InvokeVerb('delete')`, `Verbs()` + `DoIt()`).
390
+ - Measured, not assumed: PowerShell rejects abbreviated cmdlet names (`Clear-R`,
391
+ `Get-Loc` → `CommandNotFoundException`), and the OS confirmation dialog only
392
+ covers the shell-verb path — `Clear-RecycleBin -Force`, `SHEmptyRecycleBin` and
393
+ deleting `$Recycle.Bin` contents directly are silent.
394
+
395
+ ## [1.0.6] — 2026-10-23
396
+
397
+ - Remove the dead capacity gate (`checkCapacity`, the bridge's `capacity` op, and
398
+ the `minFreeBytes` / `reserveBytes` config keys). On NTFS the bin shares the
399
+ item's volume, so a recycle is a rename that consumes no space; a free-space
400
+ gate could only refuse harmless deletes. The real question — does this volume
401
+ have a bin at all — is answered since 1.0.5.
402
+
403
+ ## [1.0.5] — 2026-10-23
404
+
405
+ - **Refuse locations that have no Recycle Bin** (UNC shares, exFAT/FAT32
406
+ volumes). `SHFileOperationW` with `FOF_ALLOWUNDO` does not fail there: it erases
407
+ the item, returns 0, and the "did the path leave?" check cannot tell that from
408
+ a recycle. Reproduced on a UNC share: file gone, no `$I`/`$R` record on any
409
+ local volume, `SHQueryRecycleBin` unchanged, tool reporting "Moved to the
410
+ Recycle Bin". The bridge now decides before the call
411
+ (`Test-RecyclableVolume`).
412
+
413
+ ## [1.0.4] — 2026-10-23
414
+
415
+ Structure instead of substrings.
416
+
417
+ - `.NET` erases are matched as **calls** (`::Delete(`, `.Delete(`, `.Delete()`),
418
+ not as the type literal `[System.IO.File]` — that pattern refused every
419
+ read-only System.IO call, e.g. reading a `.bat` file to count its bytes.
420
+ - Permanent-erase program names are matched in **program position** (command
421
+ word, launcher argument, or an inline shell body), so `Get-Content shred.exe`
422
+ and `grep -n "shred" *.md` are no longer refused.
423
+ - `Clear-RecycleBin` is matched in command position only, so searching for the
424
+ string in this README is allowed.
425
+ - Closed the reverse hole: the no-argument instance form
426
+ (`(Get-Item $p).Delete()`) was never caught.
427
+
428
+ ## [1.0.3] — 2026-10-18
429
+
430
+ - Evidence may not cross statements. `python -c "…del d['a']…" ; bash -c "echo ok"`
431
+ was refused because `bash` in one statement convicted the `del` in another. The
432
+ shell-inline and script-write rules are judged per statement; the two rules that
433
+ must stay whole-command (non-shell inline bodies, script-file writes) say why in
434
+ the code.
435
+
436
+ ## [1.0.2] — 2026-10-18
437
+
438
+ - **Block-wrapped deletes are seen.** `{` `}` joined the statement separators
439
+ (a real `Remove-Item` had run unguarded inside an `if (…) { … }`), and the
440
+ operand parser steps over wrapper prefixes (`(`, `&`, `.`, `$x =`).
441
+ - **Erases without a delete verb are denied** (`ERASE_CONSTRUCTS`).
442
+ - Flag values are no longer mistaken for targets
443
+ (`-ErrorAction SilentlyContinue`), splats are refused, and the whole-text
444
+ substring rules that refused read-only work were replaced by shape-specific
445
+ checks.
446
+
447
+ ## [1.0.1] — 2026-09-28
448
+
449
+ - Add the landing-side operand guard (`lib/move-guard.js`): the shell rules only
450
+ policed commands, so a direct `file_trash` call could target a drive root, the
451
+ Windows directory, or the session workspace root.
452
+ - Fix two stale tests that compiled the hand-written JSON Schema with the
453
+ `defineTool` DSL helpers and always reported `UNSUPPORTED_SCHEMA`.
454
+
455
+ ## [1.0.0] — 2026-09-25
456
+
457
+ - First working version: `tools/pre-execute` hook, the `file_trash` /
458
+ `trash_status` tools, the `SHFileOperationW(FOF_ALLOWUNDO)` bridge, and the
459
+ command-side rule table.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 deepestevan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.