@hasna/hooks 0.9.5 → 0.10.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.
- package/README.md +27 -0
- package/bin/hooks-mcp.js +282 -123
- package/bin/index.js +625 -252
- package/bin/native-safety-entry.js +1136 -0
- package/bin/serve.js +329 -127
- package/dist/index.js +610 -249
- package/dist/lib/native-safety.d.ts +15 -0
- package/dist/openapi.d.ts +314 -45
- package/dist/sdk/authority.d.ts +31 -0
- package/dist/sdk/generated.d.ts +97 -0
- package/dist/sdk/index.d.ts +14 -15
- package/dist/sdk/index.js +172 -1
- package/dist/sdk/registry-client.d.ts +75 -0
- package/hooks/native-safety-entry.ts +28 -0
- package/package.json +7 -4
- package/scripts/generate-sdk.ts +60 -0
- package/scripts/validate-package.ts +34 -0
- package/scripts/verify-generated-artifacts.ts +237 -0
package/README.md
CHANGED
|
@@ -48,6 +48,33 @@ tools return compact summaries by default, while explicit flags such as
|
|
|
48
48
|
`compact:false`, `verbose:true`, or a detail tool like `hooks_info` return full
|
|
49
49
|
records.
|
|
50
50
|
|
|
51
|
+
## Recoverable deletion guards
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
hooks safety install trash-guard --target codex
|
|
55
|
+
# Or --target claude. Use --overwrite to update an existing registration.
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
This installs a bundled, synchronous safety capability without requiring a Hooks
|
|
59
|
+
registry credential. Generic `hooks run`, registry commands, and custom hooks keep
|
|
60
|
+
their existing authentication requirements. The Trash guard also evaluates the
|
|
61
|
+
protected repository policy, so its handoff cannot silently permit deletion.
|
|
62
|
+
|
|
63
|
+
The installed command pins its absolute Bun runtime and complete worker bundle.
|
|
64
|
+
It verifies those bytes before execution and blocks startup failures, malformed
|
|
65
|
+
input/output, changed files and deadlines. Native execution has a ten-second
|
|
66
|
+
budget; its own watchdog refuses after six seconds. Updating Bun or Hooks requires
|
|
67
|
+
reinstalling the registration and reviewing the new native trust definition. Unsafe
|
|
68
|
+
installation paths are refused before settings are written. Codex also requires
|
|
69
|
+
trust through `/hooks`; registration alone does not prove interception.
|
|
70
|
+
|
|
71
|
+
Supported controls cover shell `rm` rewrites through a verified `@hasna/trash`
|
|
72
|
+
guard, explicit unsupported delete commands, and whole-file `apply_patch`
|
|
73
|
+
deletions. They do not intercept arbitrary filesystem syscalls, application APIs,
|
|
74
|
+
or in-place edits. A missing or unauthenticated Trash client refuses the rewritten
|
|
75
|
+
operation; it never falls back to raw removal. Configure hosted Trash and verify a
|
|
76
|
+
disposable capture/restore before relying on recoverable deletion.
|
|
77
|
+
|
|
51
78
|
## Optional Mementos prompt context
|
|
52
79
|
|
|
53
80
|
`hooks install mementos-context --target codex` registers a native prompt hook.
|