@hasna/hooks 0.9.4 → 0.9.6

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 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.
@@ -181,6 +208,17 @@ export HASNA_HOOKS_API_KEY_REF=<vault-key-name> # resolved through the vault a
181
208
  secrets exec <vault-key-name> --as HASNA_HOOKS_API_KEY -- hooks serve
182
209
  ```
183
210
 
211
+ The owner-only `~/.hasna/hooks/config/credentials` file also accepts a reference:
212
+
213
+ ```dotenv
214
+ HASNA_HOOKS_API_URL=https://registry.example.com
215
+ HASNA_HOOKS_API_KEY_REF=your-team/hooks/live/api-key
216
+ ```
217
+
218
+ Keep this file at mode `0400` or `0600`, and configure Secrets through its normal independent credential resolver. Hooks resolves the selected reference through the Secrets SDK for each registry request and each server publish-key check. References retain their existing precedence: a locked Keychain remains a refusal ahead of a file reference, and a missing reference never falls through to a stale literal key. A file cannot contain both a literal key and a reference.
219
+
220
+ `hooks list` displays catalog metadata and does not prove that the remote registry is reachable. Use `hooks sync --dry-run` to exercise registry reads without changing installed hooks. SDK consumers use `createHooksClient()`; callers working directly with transport metadata must await `resolveHooksRequestAuthority()` before sending a request. The server uses `resolveHooksServePublishKeyAsync()` for references.
221
+
184
222
  **Cloudflare provisioning.** `hooks cf deploy` creates the D1 database and R2 bucket via the Cloudflare API, then prints the exact wrangler commands for the worker upload (the worker needs the workerd target, which only wrangler can bundle):
185
223
 
186
224
  ```bash
@@ -193,8 +231,8 @@ The worker (`src/cf/worker.ts`) implements the same API routes against D1 + R2,
193
231
 
194
232
  ## Storage
195
233
 
196
- Hooks stores data locally by default in `~/.hasna/hooks/` and uses SQLite
197
- directly for hook event history. The package owns its database schema and
234
+ When local mode is explicitly selected, Hooks stores data in `~/.hasna/hooks/`
235
+ and uses SQLite for hook event history. The package owns its database schema and
198
236
  migrations; it does not depend on the deprecated shared runtime or its CLI.
199
237
  The repo includes its own PostgreSQL migration definitions for the optional
200
238
  `hooks storage push|pull|sync` commands. Use the `hooks log` commands to inspect