@hasna/hooks 0.12.2 → 0.12.4

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
@@ -175,11 +175,38 @@ install; see "Rolling out a new native worker" below.
175
175
 
176
176
  For the default global Claude settings path, a managed Skills installation
177
177
  coordinates hook changes and discovery witnesses in one guarded update. Existing
178
- drift or concurrent edits refuse installation before an uncoordinated write;
179
- standalone installation remains available when no Skills policy exists. This
178
+ drift or concurrent edits refuse installation before an uncoordinated write.
179
+ Standalone installation remains available only while Skills is absent. When the
180
+ file carries Skills' own `hook user-prompt` entries, or the Skills bridge
181
+ `~/.claude/skills/skills-cli/SKILL.md` exists, but no Skills agent policy
182
+ resolves, installing, removing and pruning refuse with `skills_policy_unresolved`,
183
+ list every location searched and write nothing; run Hooks with the environment
184
+ that selects the Skills data directory (for example `HASNA_SKILLS_DIR`). This
180
185
  coordination includes project or custom paths resolving to that same file; it
181
186
  does not cover separate project settings files.
182
187
 
188
+ At every Claude or Gemini settings path, a settings file that exists but cannot
189
+ be read or does not parse as a JSON object is never replaced: installing (also
190
+ through `hooks_enable`) refuses with `settings_unreadable` and writes nothing.
191
+ Repair the file or move it aside, then retry. A missing file is still created.
192
+
193
+ The MCP tools `hooks_disable` and `hooks_enable` use the same writer, and a
194
+ refusal is an MCP error carrying its `code` and message. `hooks_disable` removes
195
+ the hook's Claude registration, which is equivalent to `hooks_remove` for that
196
+ registration; the hook stays installed. For the safety guards `trash-guard` and
197
+ `workspace-repos-guard` that also removes their protection until the guard is
198
+ enabled or installed again. `hooks_enable` is equivalent to a non-overwrite
199
+ `hooks_install`: it installs a hook that was never installed, and does nothing
200
+ when the hook is already registered. It only registers hooks that `hooks_install`
201
+ can install, so after disabling `trash-readiness`, or a stale registration of a
202
+ hook that no longer exists, `hooks_enable` fails with `Hook '<name>' not found`.
203
+ No separate disabled state is stored, so a disable then enable is not an exact
204
+ round trip. The registration comes back with the default matcher and timeout,
205
+ at the end of its event's list, in a group of its own rather than one it shared
206
+ with other hooks, and once per event even where disable removed duplicates. A
207
+ `--profile` binding returns only if `profile` is passed to `hooks_enable` again,
208
+ and Mementos options set at the original install are not restored.
209
+
183
210
  Supported controls cover shell `rm` rewrites through a verified `@hasna/trash`
184
211
  guard, explicit unsupported delete commands, and whole-file `apply_patch`
185
212
  deletions. They do not intercept arbitrary filesystem syscalls, application APIs,
@@ -220,6 +247,10 @@ The SDK exports `planNativeSafetyRegistration` and
220
247
  `applyNativeSafetyRegistration`. Both return `nativeAdoptionVerified: false`.
221
248
  A changed or uncertain apply requires a fresh read-only plan and inspection of
222
249
  its recorded operation; no automatic retry or direct overwrite is performed.
250
+ A refusal before the write returns `apply_refused` with its cause as
251
+ `refusal: {code, message}` and records `refused.json` beside the operation's
252
+ intent; settings are unchanged. Only a failure after the write may have started
253
+ returns `apply_outcome_uncertain`.
223
254
 
224
255
  After registration, Codex trust uses its supported native configuration writer:
225
256
 
@@ -309,9 +340,11 @@ Known limits of the native entry:
309
340
  harness environment are outside it (details in the guard's README).
310
341
  - Codex's input into a running unified exec session (`write_stdin`) has not
311
342
  been verified to pass through PreToolUse.
312
- - The repository guard still reads a here-document body line by line, so prose
313
- in a `--body "$(cat <<'EOF' … EOF)"` body that mentions a delete command
314
- beside an unbalanced quote can still be refused by that guard.
343
+ - The repository guard reads a here-document body as data only when every
344
+ command word of the command is a data command such as `cat`, `git commit`
345
+ or `gh pr` (the list is in the guard's README). With any other command word
346
+ it reads the body line by line, so prose in such a body that mentions a
347
+ delete command can still be refused inside a protected checkout.
315
348
 
316
349
  ## Codex safety readiness
317
350
 
@@ -331,8 +364,8 @@ architecture (arm64 or x64); script launchers are refused before execution. When
331
364
  Codex is installed through npm, pass the platform package's native binary rather
332
365
  than its JavaScript launcher. Executable ownership, permissions, ancestry and
333
366
  bytes are checked. Supported protocol versions are 0.153.0, 0.154.0,
334
- 0.154.0-alpha.6.1, 0.155.0, 0.155.1, 0.156.1, 0.157.0, 0.157.1, 0.158.0, 0.159.0, 0.159.2
335
- and 0.159.3;
367
+ 0.154.0-alpha.6.1, 0.155.0, 0.155.1, 0.156.1, 0.157.0, 0.157.1, 0.158.0, 0.159.0, 0.159.2,
368
+ 0.159.3 and 0.160.0;
336
369
  other versions refuse pending compatibility validation. Updating Codex can
337
370
  therefore require a compatible Hooks release before native safety verification
338
371
  and trust provisioning succeed. Keep existing hook definitions and trust intact