@wrongstack/plugins 0.300.0 → 0.302.0

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.
@@ -3,13 +3,21 @@
3
3
  * destructive shell commands that touch protected paths.
4
4
  *
5
5
  * `branch-guard` protects git *branches*; this plugin protects
6
- * *files and directories*. A `PreToolUse` hook on `write|edit|bash`
7
- * matches the target path against a configurable glob list:
6
+ * *files and directories*. A `PreToolUse` hook matches the target path
7
+ * against a configurable glob list:
8
8
  *
9
- * - `write` / `edit` the `path` / `file_path` input field
10
- * - `bash` destructive commands only (`rm`, `rmdir`,
11
- * `mv`, `del`, output redirection `>` / `>>`, `truncate`) whose
12
- * arguments mention a protected path
9
+ * - any tool that declares `fs.write` (or, absent a capability list,
10
+ * `mutating: true`) the `path` / `file_path` / `output_path` / …
11
+ * input field
12
+ * - shell commands destructive ones only (`rm`, `rmdir`, `mv`, `cp`,
13
+ * `install`, `tee`, `dd of=`, output redirection `>` / `>>`, `truncate`)
14
+ * whose arguments mention a protected path
15
+ *
16
+ * The hook is registered for `*` and decides from the tool's own
17
+ * declaration. It used to be registered for `write|edit|bash|exec` and to
18
+ * branch on those four names, which meant `patch`, `scaffold`, every
19
+ * plugin-registered writer and every MCP filesystem server wrote past it
20
+ * untouched.
13
21
  *
14
22
  * Default protected set: lockfiles, `.env*` secrets, `.git/`
15
23
  * internals, and production migration folders — files an agent
@@ -40,12 +48,6 @@ import type { Plugin } from '@wrongstack/core/types';
40
48
  * (`.env` matches `sub/dir/.env`).
41
49
  */
42
50
  export declare function compilePathGlob(pattern: string): RegExp;
43
- /**
44
- * Extract candidate target paths from a shell command, but only when
45
- * the command looks destructive. Non-destructive commands (cat, ls,
46
- * grep …) never trigger the guard, even if they mention a protected
47
- * path.
48
- */
49
51
  export declare function destructiveTargets(command: string): string[];
50
52
  declare const plugin: Plugin;
51
53
  export default plugin;