@hasna/hooks 0.12.3 → 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 +33 -2
- package/bin/hooks-mcp.js +2013 -847
- package/bin/index.js +2489 -1255
- package/bin/native-safety-entry.js +15 -15
- package/bin/native-safety-worker.cjs +20 -0
- package/dist/index.js +2267 -1046
- package/dist/lib/claude-skills-coordination.d.ts +25 -3
- package/dist/lib/codex-safety-trust.d.ts +9 -2
- package/dist/lib/codex-settings.d.ts +6 -3
- package/dist/lib/installer.d.ts +9 -1
- package/dist/lib/native-safety-registration.d.ts +8 -2
- package/dist/native-safety.d.ts +4 -1
- package/dist/native-safety.js +2 -0
- package/hooks/codewith-native-common.ts +3 -3
- package/hooks/hook-signed-link-guard/src/hook.ts +5 -2
- package/hooks/hook-trash-guard/src/hook.ts +7 -4
- package/hooks/hook-workspace-repos-guard/src/hook.ts +8 -5
- package/hooks/native-safety-composite.ts +75 -0
- package/hooks/native-safety-entry.ts +7 -53
- package/hooks/native-safety-worker.ts +19 -0
- package/package.json +5 -4
- package/scripts/build-native-worker.ts +152 -0
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
|
-
|
|
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
|
|