@hasna/skills 0.9.11 → 0.9.13

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
@@ -160,6 +160,39 @@ the same command with `--recovery-plan-digest <reviewed-digest>` to record the
160
160
  receipt. Any unreviewed change refuses. This mode preserves the policy and
161
161
  native configuration and cannot be combined with `--supersede-binding`.
162
162
 
163
+ If another reviewed producer appended a user hook after the interrupted write,
164
+ add `--review-native-hook-additions <private-review.json>`. This is a separate
165
+ explicit review; a producer receipt alone never authorizes recovery. The review
166
+ must be an absolute, owner-only regular file with these exact fields:
167
+
168
+ - `version: 1`, `kind: "native-hook-additions"`, a nonempty `reason`, and a
169
+ `producerEvidence` reference to the independently reviewed producer operation.
170
+ - `journalIntentSha256`, `policySha256`, `configCurrentSha256`, and
171
+ `hooksCurrentSha256` pin the complete current inputs and immutable intent.
172
+ - `producerBefore` contains `configPath`, `configSha256`, `hooksPath`, and
173
+ `hooksSha256`. These owner-only backup files must reproduce exactly the
174
+ completed original trust write and the original hook declarations.
175
+ - `additions` contains one or more `{ event, nativeHook }` records. `event` is
176
+ `UserPromptSubmit`, `SessionStart`, or `SubagentStart`. `nativeHook` contains
177
+ exactly the native inventory fields `key`, `eventName`, `handlerType`,
178
+ `command`, `matcher`, `timeoutSec`, `async`, `statusMessage`,
179
+ `additionalContextLimit`, `sourcePath`, `source`, `pluginId`, `isManaged`,
180
+ `currentHash`, `enabled`, and `trustStatus`.
181
+
182
+ Only appended single-command groups from the same user hook file are supported:
183
+ no matcher, asynchronous handler, custom status/context limit, plugin source,
184
+ duplicate command, replacement or reordering. The added hooks must already be
185
+ enabled and trusted in the actual native inventory. Every original hook and
186
+ unrelated configuration byte remains verified. Combine this flag with
187
+ `--review-claude-discovery` only when that independent policy transition is also
188
+ present. The package provenance flags, private preview, exact
189
+ `--recovery-plan-digest`, and subsequent explicit binding refresh are still
190
+ required. Reconciliation writes only its journal receipt.
191
+
192
+ When updating the Codex binding afterward, Skills replaces its single hook
193
+ group in place so neighboring hooks retain their native indexes and trust
194
+ identities. Ambiguous duplicate or mixed Skills groups refuse installation.
195
+
163
196
  Each supported agent gets one small `skills-cli` native skill containing CLI
164
197
  instructions, without a copied catalogue. Claude's native Skill tool admits
165
198
  that bridge after other copies are retired. Prompt guards verify the owned
@@ -353,6 +386,25 @@ directory within your home, add `--allow-root-aliases` to hook installation and
353
386
  native migration. The plan records and rechecks the exact link and target;
354
387
  links inside skill contents or configuration files remain refused.
355
388
 
389
+ Cooperating installers can use the root package's
390
+ `planClaudeStopHookUpdate({ expectedSettingsSha256, replacement })`, then
391
+ `applyAgentIntegration(plan)`, to write an explicitly authorized Claude settings
392
+ replacement changing only `hooks.Stop`, together with every existing discovery
393
+ witness for that file. Every other field and hook must retain the same value;
394
+ this includes discovery configuration and display/model preferences.
395
+ The caller must authorize its own exact change; this API does not grant approval
396
+ to change another owner's hooks. It checks the current native bridge, inventory,
397
+ policy, executable witnesses and root aliases, preserves each witness mode, and
398
+ verifies the consumer guard after applying. A concurrent edit or pre-existing
399
+ drift refuses renewal. Failed post-write checks compensate only unchanged writes,
400
+ retaining private backups. A `null` plan means no Skills policy exists; malformed
401
+ or untrusted policy throws instead. This local integration operation requires no
402
+ hosted credential, does not reload an existing agent, and cannot adopt a stale
403
+ policy after another installer has already changed settings.
404
+ Settings and policy are separate files: this is a guarded sequence with
405
+ compensation, not a cross-file atomic commit. A concurrent hook can fail closed
406
+ during installation. A successful update does not reload an existing session.
407
+
356
408
  At session start, the hook authenticates and refreshes the profile. Prompt hooks
357
409
  select complete skill instructions from that verified cache using explicit
358
410
  `$skill` references, profile keywords, paths and always-required selections.
@@ -1978,3 +2030,18 @@ operation did not execute. The client does not retry or issue a status read
1978
2030
  automatically: explicitly call `get` with the same request ID to reconcile.
1979
2031
  Aborting locally does not establish server cancellation. An already-aborted
1980
2032
  signal refuses before calling the transport.
2033
+
2034
+ ### Authoring destination checks
2035
+
2036
+ Payload writers reject known native skill folders, physical aliases of the account's native roots, and configured home discovery roots (including OpenCode `skills.paths`) before creating directories. Malformed or unresolved native registrations fail closed and require the existing Skills discovery review. Changing the authoring data directory does not hide the account's native policy.
2037
+
2038
+ Other authoring tools can use the same read-only guard from the package root:
2039
+
2040
+ ```ts
2041
+ import { assertPortableAuthoringPath } from "@hasna/skills";
2042
+
2043
+ assertPortableAuthoringPath(destination, { homeDir: accountHome });
2044
+ // Only now create or change the private authoring destination.
2045
+ ```
2046
+
2047
+ `homeDir` defaults to the current account home. Missing destination descendants are supported. The check reads configuration without loading plugins, fetching skills, or creating directories; it throws on refusal. It is a pre-write check, not a reservation against concurrent configuration or symlink changes. Call it again immediately before each later write. Native inventory and migration remain available for preserving existing copies.