@hasna/skills 0.9.5 → 0.9.7
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/bin/index.js +44 -11
- package/bin/mcp.js +1 -1
- package/bin/migrate.js +1 -1
- package/bin/server.js +1 -1
- package/bin/worker.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/codex-hook-trust-layout.d.ts +7 -1
- package/dist/sdk/index.js +1 -1
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -36868,7 +36868,7 @@ var package_default;
|
|
|
36868
36868
|
var init_package = __esm(() => {
|
|
36869
36869
|
package_default = {
|
|
36870
36870
|
name: "@hasna/skills",
|
|
36871
|
-
version: "0.9.
|
|
36871
|
+
version: "0.9.7",
|
|
36872
36872
|
description: "Skills library for AI coding agents",
|
|
36873
36873
|
type: "module",
|
|
36874
36874
|
bin: {
|
|
@@ -108033,7 +108033,7 @@ var init_codex_hook_rpc = __esm(() => {
|
|
|
108033
108033
|
|
|
108034
108034
|
// src/lib/codex-hook-trust-layout.ts
|
|
108035
108035
|
import { isDeepStrictEqual as isDeepStrictEqual5 } from "util";
|
|
108036
|
-
function codexTrustTextWitness(text3, keys3) {
|
|
108036
|
+
function codexTrustTextWitness(text3, keys3, canonicalize = true) {
|
|
108037
108037
|
const parsed = Bun.TOML.parse(text3), wanted = new Set(keys3);
|
|
108038
108038
|
const headers = [...text3.matchAll(/^[ \t]*(\[[^\r\n]+\])[ \t]*(#[^\r\n]*)?(?:\r?\n|$)/gm)];
|
|
108039
108039
|
if (headers.length > 512)
|
|
@@ -108105,9 +108105,19 @@ function codexTrustTextWitness(text3, keys3) {
|
|
|
108105
108105
|
let result2 = text3;
|
|
108106
108106
|
for (const span of replacements2.reverse())
|
|
108107
108107
|
result2 = result2.slice(0, span.start) + span.comments + result2.slice(span.end);
|
|
108108
|
-
return canonicalizeTableOrder(result2).split(/\r?\n/).filter((line) => line.trim()).join(`
|
|
108108
|
+
return (canonicalize ? canonicalizeTableOrder(result2) : result2).split(/\r?\n/).filter((line) => line.trim()).join(`
|
|
108109
108109
|
`);
|
|
108110
108110
|
}
|
|
108111
|
+
function codexTrustReconcileWitness(text3, keys3) {
|
|
108112
|
+
return codexTrustTextWitness(text3, keys3, false).replace(/[ \t]+$/gm, "");
|
|
108113
|
+
}
|
|
108114
|
+
function codexTrustUnmanagedSemantic(text3, keys3) {
|
|
108115
|
+
const parsed = structuredClone(Bun.TOML.parse(text3));
|
|
108116
|
+
for (const key of keys3)
|
|
108117
|
+
if (parsed.hooks?.state?.[key] !== undefined)
|
|
108118
|
+
delete parsed.hooks.state[key];
|
|
108119
|
+
return JSON.stringify(stableSemantic(prune(parsed)));
|
|
108120
|
+
}
|
|
108111
108121
|
var fail4 = () => new Error('CODEX_HOOK_TRUST_UNSUPPORTED_LAYOUT: preserve and convert hook trust to ordinary [hooks.state."<key>"] tables before enrollment'), prune = (value) => {
|
|
108112
108122
|
if (value.hooks?.state && !Object.keys(value.hooks.state).length)
|
|
108113
108123
|
delete value.hooks.state;
|
|
@@ -108119,11 +108129,23 @@ var fail4 = () => new Error('CODEX_HOOK_TRUST_UNSUPPORTED_LAYOUT: preserve and c
|
|
|
108119
108129
|
if (!headers.length)
|
|
108120
108130
|
return text3;
|
|
108121
108131
|
const keys3 = headers.map((header) => header[1].trim());
|
|
108122
|
-
|
|
108123
|
-
|
|
108124
|
-
const plain = keys3.map((key) => key.
|
|
108125
|
-
|
|
108132
|
+
const repeated = keys3.filter((key) => !key.startsWith("[[")).filter((key, index, simple2) => simple2.indexOf(key) !== index);
|
|
108133
|
+
const arrayKeys = keys3.filter((key) => key.startsWith("[["));
|
|
108134
|
+
const plain = keys3.map((key) => key.replace(/^\[\[?/, "").replace(/\]\]?$/, "").trim());
|
|
108135
|
+
const parentChild = plain.some((key, index) => plain.some((other, otherIndex) => index !== otherIndex && (other.startsWith(`${key}.`) || key.startsWith(`${other}.`))));
|
|
108136
|
+
if (repeated.length || parentChild)
|
|
108126
108137
|
return text3;
|
|
108138
|
+
if (!arrayKeys.length) {
|
|
108139
|
+
const first2 = headers[0].index;
|
|
108140
|
+
const prefix2 = text3.slice(0, first2);
|
|
108141
|
+
const blocks2 = headers.map((header, index) => ({
|
|
108142
|
+
key: header[1],
|
|
108143
|
+
order: index,
|
|
108144
|
+
text: text3.slice(header.index, headers[index + 1]?.index ?? text3.length)
|
|
108145
|
+
}));
|
|
108146
|
+
blocks2.sort((a, b) => a.key.localeCompare(b.key) || a.order - b.order);
|
|
108147
|
+
return prefix2 + blocks2.map((block) => block.text).join("");
|
|
108148
|
+
}
|
|
108127
108149
|
const first = headers[0].index;
|
|
108128
108150
|
const prefix = text3.slice(0, first);
|
|
108129
108151
|
const blocks = headers.map((header, index) => ({
|
|
@@ -108131,8 +108153,15 @@ var fail4 = () => new Error('CODEX_HOOK_TRUST_UNSUPPORTED_LAYOUT: preserve and c
|
|
|
108131
108153
|
order: index,
|
|
108132
108154
|
text: text3.slice(header.index, headers[index + 1]?.index ?? text3.length)
|
|
108133
108155
|
}));
|
|
108134
|
-
blocks.
|
|
108135
|
-
|
|
108156
|
+
const simple = blocks.filter((block) => !block.key.startsWith("[["));
|
|
108157
|
+
const arrays = blocks.filter((block) => block.key.startsWith("[["));
|
|
108158
|
+
return prefix + [...simple, ...arrays].map((block) => block.text).join("");
|
|
108159
|
+
}, stableSemantic = (value) => {
|
|
108160
|
+
if (Array.isArray(value))
|
|
108161
|
+
return value.map(stableSemantic);
|
|
108162
|
+
if (value && typeof value === "object")
|
|
108163
|
+
return Object.fromEntries(Object.keys(value).sort().map((key) => [key, stableSemantic(value[key])]));
|
|
108164
|
+
return value;
|
|
108136
108165
|
};
|
|
108137
108166
|
var init_codex_hook_trust_layout = () => {};
|
|
108138
108167
|
|
|
@@ -108255,7 +108284,9 @@ async function reconcileCodexNativeHooks(options, connect = connectCodexHookRpc)
|
|
|
108255
108284
|
need4(isDeepStrictEqual6(intent.hooks, admitted.filter((hook) => !hook.enabled || hook.trustStatus !== "trusted")), "RECONCILE_INTENT_HOOKS_CHANGED");
|
|
108256
108285
|
need4(configBefore.sha256 === intent.beforeSha256 && hooksBefore.sha256 === intent.hooksSha256 && policyBefore.sha256 === intent.policySha256, "RECONCILE_JOURNAL_CHANGED");
|
|
108257
108286
|
const currentConfig = snapshot(intent.configPath, true);
|
|
108258
|
-
|
|
108287
|
+
const managedKeys = intent.hooks.map((h) => h.key);
|
|
108288
|
+
need4(codexTrustReconcileWitness(configBefore.text, managedKeys) === codexTrustReconcileWitness(currentConfig.text, managedKeys), "RECONCILE_UNRELATED_CONFIG_CHANGED");
|
|
108289
|
+
need4(codexTrustUnmanagedSemantic(configBefore.text, managedKeys) === codexTrustUnmanagedSemantic(currentConfig.text, managedKeys), "RECONCILE_UNRELATED_CONFIG_CHANGED");
|
|
108259
108290
|
const before2 = structure(configBefore.text), current = structure(currentConfig.text), expectedConfig = structuredClone(before2);
|
|
108260
108291
|
expectedConfig.hooks ??= {};
|
|
108261
108292
|
expectedConfig.hooks.state ??= {};
|
|
@@ -108625,8 +108656,10 @@ function registerAgentIntegration(parent) {
|
|
|
108625
108656
|
process.exitCode = 1;
|
|
108626
108657
|
}
|
|
108627
108658
|
});
|
|
108628
|
-
const trust = hook.command("trust").
|
|
108659
|
+
const trust = hook.command("trust").option("--agent <agent>", "Native trust adapter (codex)").option("--codex-command <path>", "Installed Codex executable used for its native configuration API", "codex").option("--apply", "Enable and trust only the exact managed Skills hook identities", false).option("--plan-digest <sha256>", "Exact reviewed dry-run digest required with --apply").option("--json", "Output the native trust plan or receipt", false).description("Plan or enroll exact Skills hooks through Codex native trust controls").action(async (options) => {
|
|
108629
108660
|
try {
|
|
108661
|
+
if (!options.agent)
|
|
108662
|
+
throw new Error("Native trust enrollment requires --agent codex");
|
|
108630
108663
|
if (options.agent !== "codex")
|
|
108631
108664
|
throw new Error("Native trust enrollment currently supports --agent codex only");
|
|
108632
108665
|
const result2 = await enrollCodexNativeHooks({ codexCommand: options.codexCommand, apply: options.apply, reviewedPlanDigest: options.planDigest });
|
package/bin/mcp.js
CHANGED
|
@@ -20019,7 +20019,7 @@ var package_default;
|
|
|
20019
20019
|
var init_package = __esm(() => {
|
|
20020
20020
|
package_default = {
|
|
20021
20021
|
name: "@hasna/skills",
|
|
20022
|
-
version: "0.9.
|
|
20022
|
+
version: "0.9.7",
|
|
20023
20023
|
description: "Skills library for AI coding agents",
|
|
20024
20024
|
type: "module",
|
|
20025
20025
|
bin: {
|
package/bin/migrate.js
CHANGED
package/bin/server.js
CHANGED
|
@@ -24122,7 +24122,7 @@ var init_dist_es9 = __esm(() => {
|
|
|
24122
24122
|
// package.json
|
|
24123
24123
|
var package_default = {
|
|
24124
24124
|
name: "@hasna/skills",
|
|
24125
|
-
version: "0.9.
|
|
24125
|
+
version: "0.9.7",
|
|
24126
24126
|
description: "Skills library for AI coding agents",
|
|
24127
24127
|
type: "module",
|
|
24128
24128
|
bin: {
|
package/bin/worker.js
CHANGED
|
@@ -24125,7 +24125,7 @@ import { randomUUID as randomUUID6 } from "crypto";
|
|
|
24125
24125
|
// package.json
|
|
24126
24126
|
var package_default = {
|
|
24127
24127
|
name: "@hasna/skills",
|
|
24128
|
-
version: "0.9.
|
|
24128
|
+
version: "0.9.7",
|
|
24129
24129
|
description: "Skills library for AI coding agents",
|
|
24130
24130
|
type: "module",
|
|
24131
24131
|
bin: {
|
package/dist/index.js
CHANGED
|
@@ -11448,7 +11448,7 @@ import { isAbsolute as isAbsolute10, join as join20, resolve as resolve10 } from
|
|
|
11448
11448
|
// package.json
|
|
11449
11449
|
var package_default = {
|
|
11450
11450
|
name: "@hasna/skills",
|
|
11451
|
-
version: "0.9.
|
|
11451
|
+
version: "0.9.7",
|
|
11452
11452
|
description: "Skills library for AI coding agents",
|
|
11453
11453
|
type: "module",
|
|
11454
11454
|
bin: {
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
/** Conservative admission and text witness, never a TOML writer. Native Codex
|
|
2
2
|
* performs the versioned write; unrecognized inline/dotted trust shapes refuse. */
|
|
3
|
-
export declare function codexTrustTextWitness(text: string, keys: string[]): string;
|
|
3
|
+
export declare function codexTrustTextWitness(text: string, keys: string[], canonicalize?: boolean): string;
|
|
4
|
+
/** Reconciliation witness: retain table/array order while tolerating only
|
|
5
|
+
* blank-line and line-ending formatting emitted by the native writer. */
|
|
6
|
+
export declare function codexTrustReconcileWitness(text: string, keys: string[]): string;
|
|
7
|
+
/** Parsed unmanaged TOML semantics. Arrays retain order; managed trust entries
|
|
8
|
+
* are excluded by exact journal key and all other keys/values remain bound. */
|
|
9
|
+
export declare function codexTrustUnmanagedSemantic(text: string, keys: string[]): string;
|
package/dist/sdk/index.js
CHANGED
|
@@ -32373,7 +32373,7 @@ var init_event_sink = __esm(() => {
|
|
|
32373
32373
|
// package.json
|
|
32374
32374
|
var package_default = {
|
|
32375
32375
|
name: "@hasna/skills",
|
|
32376
|
-
version: "0.9.
|
|
32376
|
+
version: "0.9.7",
|
|
32377
32377
|
description: "Skills library for AI coding agents",
|
|
32378
32378
|
type: "module",
|
|
32379
32379
|
bin: {
|