@hasna/hooks 0.12.10 → 0.12.14
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 +69 -6
- package/bin/hooks/stop-review.js +1235 -0
- package/bin/hooks-mcp.js +298 -85
- package/bin/index.js +3309 -1086
- package/bin/native-readiness-entry.js +5 -1
- package/bin/native-safety-entry.js +27 -25
- package/bin/native-safety-worker.cjs +27 -25
- package/bin/serve.js +1362 -70
- package/dist/db/remote-storage.d.ts +7 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1665 -257
- package/dist/lib/codex-safety-check.d.ts +1 -1
- package/dist/lib/hosted-registry.d.ts +70 -0
- package/dist/lib/legacy-registry-artifact.d.ts +23 -0
- package/dist/lib/manifest.d.ts +7 -0
- package/dist/lib/native-safety.d.ts +1 -0
- package/dist/lib/native-target.d.ts +7 -0
- package/dist/lib/opencode-stop-plugin.d.ts +55 -0
- package/dist/lib/registry-artifact.d.ts +36 -0
- package/dist/lib/registry.d.ts +4 -0
- package/dist/lib/stop-review-context.d.ts +12 -0
- package/dist/lib/store.d.ts +4 -0
- package/dist/lib/sumi-stop-plugin.d.ts +129 -0
- package/dist/lib/sync.d.ts +10 -0
- package/dist/lib/transport.d.ts +1 -1
- package/dist/native-readiness.d.ts +1 -1
- package/dist/native-readiness.js +5 -1
- package/dist/openapi.d.ts +160 -16
- package/dist/opencode-stop-plugin.js +384 -0
- package/dist/registry-auth.d.ts +5 -0
- package/dist/registry-http.d.ts +4 -0
- package/dist/sdk/generated.d.ts +32 -12
- package/dist/sdk/index.d.ts +28 -5
- package/dist/sdk/index.js +49 -24
- package/dist/sdk/registry-client.d.ts +1 -1
- package/dist/serve.d.ts +4 -4
- package/dist/storage.js +33 -2
- package/dist/sumi-stop-plugin.js +380 -0
- package/hooks/hook-stop-review/README.md +109 -0
- package/hooks/hook-stop-review/manifest.json +10 -0
- package/hooks/hook-stop-review/package.json +11 -0
- package/hooks/hook-stop-review/src/hook.ts +59 -0
- package/hooks/hook-stop-review/src/index.ts +3 -0
- package/hooks/hook-stop-review/src/jev.ts +121 -0
- package/hooks/hook-stop-review/src/native.ts +246 -0
- package/hooks/hook-stop-review/src/policy.ts +145 -0
- package/hooks/hook-stop-review/src/runtime.ts +309 -0
- package/hooks/hook-stop-review/src/types.ts +121 -0
- package/hooks/hook-trash-guard/src/hook.ts +96 -0
- package/hooks/hook-workspace-repos-guard/src/hook.ts +116 -3
- package/hooks/local-executors.ts +841 -0
- package/package.json +22 -4
- package/scripts/build-bundled-hooks.ts +40 -0
- package/scripts/validate-bundled-hooks.ts +78 -0
- package/scripts/validate-opencode-stop-plugin.ts +42 -0
- package/scripts/validate-package.ts +9 -0
- package/scripts/validate-sumi-stop-plugin.ts +47 -0
package/dist/openapi.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
3
3
|
readonly info: {
|
|
4
4
|
readonly title: "Hooks Registry API";
|
|
5
5
|
readonly version: string;
|
|
6
|
-
readonly description: "
|
|
6
|
+
readonly description: "Authenticated hosted registry for @hasna/hooks: immutable executable artifacts and version-guarded selection profiles. Canonical /v1 routes require PostgreSQL; legacy /api/v1 self-hosted routes remain compatible.";
|
|
7
7
|
};
|
|
8
8
|
readonly servers: readonly [{
|
|
9
9
|
readonly url: "/";
|
|
@@ -29,7 +29,7 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
29
29
|
};
|
|
30
30
|
readonly "/ready": {
|
|
31
31
|
readonly get: {
|
|
32
|
-
readonly summary: "Readiness probe —
|
|
32
|
+
readonly summary: "Readiness probe — hosted registry tables are readable";
|
|
33
33
|
readonly operationId: "getReady";
|
|
34
34
|
readonly responses: {
|
|
35
35
|
readonly "200": {
|
|
@@ -92,10 +92,13 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
92
92
|
};
|
|
93
93
|
};
|
|
94
94
|
};
|
|
95
|
-
readonly "/
|
|
95
|
+
readonly "/v1/catalog": {
|
|
96
96
|
readonly get: {
|
|
97
97
|
readonly summary: "List the full hook catalog with versions and sha256";
|
|
98
98
|
readonly operationId: "getCatalog";
|
|
99
|
+
readonly security: readonly [{
|
|
100
|
+
readonly apiKey: readonly [];
|
|
101
|
+
}];
|
|
99
102
|
readonly responses: {
|
|
100
103
|
readonly "200": {
|
|
101
104
|
readonly description: "Catalog entries";
|
|
@@ -110,10 +113,22 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
110
113
|
};
|
|
111
114
|
};
|
|
112
115
|
};
|
|
113
|
-
readonly "/
|
|
116
|
+
readonly "/v1/lock": {
|
|
114
117
|
readonly get: {
|
|
115
118
|
readonly summary: "Read the published hooks.lock with per-hook versions";
|
|
116
119
|
readonly operationId: "getLock";
|
|
120
|
+
readonly parameters: readonly [{
|
|
121
|
+
readonly name: "profile";
|
|
122
|
+
readonly in: "query";
|
|
123
|
+
readonly required: false;
|
|
124
|
+
readonly schema: {
|
|
125
|
+
readonly type: "string";
|
|
126
|
+
readonly default: "fleet";
|
|
127
|
+
};
|
|
128
|
+
}];
|
|
129
|
+
readonly security: readonly [{
|
|
130
|
+
readonly apiKey: readonly [];
|
|
131
|
+
}];
|
|
117
132
|
readonly responses: {
|
|
118
133
|
readonly "200": {
|
|
119
134
|
readonly description: "The lock file";
|
|
@@ -128,10 +143,13 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
128
143
|
};
|
|
129
144
|
};
|
|
130
145
|
};
|
|
131
|
-
readonly "/
|
|
146
|
+
readonly "/v1/hooks/{name}/{version}": {
|
|
132
147
|
readonly get: {
|
|
133
148
|
readonly summary: "Fetch one hook's manifest and script";
|
|
134
149
|
readonly operationId: "getHookArtifact";
|
|
150
|
+
readonly security: readonly [{
|
|
151
|
+
readonly apiKey: readonly [];
|
|
152
|
+
}];
|
|
135
153
|
readonly parameters: readonly [{
|
|
136
154
|
readonly name: "name";
|
|
137
155
|
readonly in: "path";
|
|
@@ -151,6 +169,12 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
151
169
|
readonly "200": {
|
|
152
170
|
readonly description: "Hook artifact; x-hook-sha256 header carries the script hash";
|
|
153
171
|
readonly headers: {
|
|
172
|
+
readonly "x-hook-bundle-sha256": {
|
|
173
|
+
readonly description: "SHA256 of canonical manifest and script";
|
|
174
|
+
readonly schema: {
|
|
175
|
+
readonly type: "string";
|
|
176
|
+
};
|
|
177
|
+
};
|
|
154
178
|
readonly "x-hook-sha256": {
|
|
155
179
|
readonly description: "sha256 of the served script, the same value the lock pins";
|
|
156
180
|
readonly schema: {
|
|
@@ -177,7 +201,7 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
177
201
|
};
|
|
178
202
|
};
|
|
179
203
|
readonly "404": {
|
|
180
|
-
readonly description: "
|
|
204
|
+
readonly description: "Exact published version not found";
|
|
181
205
|
readonly content: {
|
|
182
206
|
readonly "application/json": {
|
|
183
207
|
readonly schema: {
|
|
@@ -189,9 +213,78 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
189
213
|
};
|
|
190
214
|
};
|
|
191
215
|
};
|
|
192
|
-
readonly "/
|
|
216
|
+
readonly "/v1/selections/{profile}": {
|
|
217
|
+
readonly get: {
|
|
218
|
+
readonly summary: "Read one exact hosted selection profile";
|
|
219
|
+
readonly operationId: "getSelection";
|
|
220
|
+
readonly parameters: readonly [{
|
|
221
|
+
readonly name: "profile";
|
|
222
|
+
readonly in: "path";
|
|
223
|
+
readonly required: true;
|
|
224
|
+
readonly schema: {
|
|
225
|
+
readonly type: "string";
|
|
226
|
+
};
|
|
227
|
+
}];
|
|
228
|
+
readonly security: readonly [{
|
|
229
|
+
readonly apiKey: readonly [];
|
|
230
|
+
}];
|
|
231
|
+
readonly responses: {
|
|
232
|
+
readonly "200": {
|
|
233
|
+
readonly description: "Current exact selection";
|
|
234
|
+
readonly content: {
|
|
235
|
+
readonly "application/json": {
|
|
236
|
+
readonly schema: {
|
|
237
|
+
readonly $ref: "#/components/schemas/HooksLock";
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
readonly put: {
|
|
245
|
+
readonly summary: "Append a selection revision under its exact predecessor guard";
|
|
246
|
+
readonly operationId: "putSelection";
|
|
247
|
+
readonly parameters: readonly [{
|
|
248
|
+
readonly name: "profile";
|
|
249
|
+
readonly in: "path";
|
|
250
|
+
readonly required: true;
|
|
251
|
+
readonly schema: {
|
|
252
|
+
readonly type: "string";
|
|
253
|
+
};
|
|
254
|
+
}];
|
|
255
|
+
readonly security: readonly [{
|
|
256
|
+
readonly apiKey: readonly [];
|
|
257
|
+
}];
|
|
258
|
+
readonly requestBody: {
|
|
259
|
+
readonly required: true;
|
|
260
|
+
readonly content: {
|
|
261
|
+
readonly "application/json": {
|
|
262
|
+
readonly schema: {
|
|
263
|
+
readonly $ref: "#/components/schemas/HooksSelectionRequest";
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
readonly responses: {
|
|
269
|
+
readonly "200": {
|
|
270
|
+
readonly description: "Accepted or idempotently reconciled selection";
|
|
271
|
+
readonly content: {
|
|
272
|
+
readonly "application/json": {
|
|
273
|
+
readonly schema: {
|
|
274
|
+
readonly $ref: "#/components/schemas/HooksLock";
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
readonly "409": {
|
|
280
|
+
readonly description: "Stale revision or mismatched artifact digest";
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
readonly "/v1/hooks": {
|
|
193
286
|
readonly put: {
|
|
194
|
-
readonly summary: "Publish
|
|
287
|
+
readonly summary: "Publish an immutable executable artifact (requires the API key)";
|
|
195
288
|
readonly operationId: "putHook";
|
|
196
289
|
readonly requestBody: {
|
|
197
290
|
readonly required: true;
|
|
@@ -205,7 +298,7 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
205
298
|
};
|
|
206
299
|
readonly responses: {
|
|
207
300
|
readonly "200": {
|
|
208
|
-
readonly description: "
|
|
301
|
+
readonly description: "Immutable artifact accepted or identical prior publication reconciled";
|
|
209
302
|
readonly content: {
|
|
210
303
|
readonly "application/json": {
|
|
211
304
|
readonly schema: {
|
|
@@ -245,7 +338,7 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
245
338
|
};
|
|
246
339
|
};
|
|
247
340
|
readonly "409": {
|
|
248
|
-
readonly description: "
|
|
341
|
+
readonly description: "Conflicting bytes for an existing name and version";
|
|
249
342
|
readonly content: {
|
|
250
343
|
readonly "application/json": {
|
|
251
344
|
readonly schema: {
|
|
@@ -307,6 +400,9 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
307
400
|
readonly sha256: {
|
|
308
401
|
readonly type: "string";
|
|
309
402
|
};
|
|
403
|
+
readonly bundle_sha256: {
|
|
404
|
+
readonly type: "string";
|
|
405
|
+
};
|
|
310
406
|
readonly events: {
|
|
311
407
|
readonly type: "array";
|
|
312
408
|
readonly items: {
|
|
@@ -352,6 +448,9 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
352
448
|
readonly sha256: {
|
|
353
449
|
readonly type: "string";
|
|
354
450
|
};
|
|
451
|
+
readonly bundle_sha256: {
|
|
452
|
+
readonly type: "string";
|
|
453
|
+
};
|
|
355
454
|
readonly source: {
|
|
356
455
|
readonly type: "string";
|
|
357
456
|
};
|
|
@@ -372,6 +471,12 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
372
471
|
readonly additionalProperties: false;
|
|
373
472
|
readonly required: readonly ["hooks"];
|
|
374
473
|
readonly properties: {
|
|
474
|
+
readonly profile: {
|
|
475
|
+
readonly type: "string";
|
|
476
|
+
};
|
|
477
|
+
readonly revision: {
|
|
478
|
+
readonly type: "integer";
|
|
479
|
+
};
|
|
375
480
|
readonly hooks: {
|
|
376
481
|
readonly type: "object";
|
|
377
482
|
readonly additionalProperties: {
|
|
@@ -383,8 +488,12 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
383
488
|
readonly HooksManifest: {
|
|
384
489
|
readonly type: "object";
|
|
385
490
|
readonly additionalProperties: false;
|
|
386
|
-
readonly required: readonly ["name", "version", "events", "script"];
|
|
491
|
+
readonly required: readonly ["name", "version", "events", "script", "script_kind"];
|
|
387
492
|
readonly properties: {
|
|
493
|
+
readonly nativeTargetDispatch: {
|
|
494
|
+
readonly type: "boolean";
|
|
495
|
+
readonly description: "Pass the trusted installed target through the Hooks runner";
|
|
496
|
+
};
|
|
388
497
|
readonly name: {
|
|
389
498
|
readonly type: "string";
|
|
390
499
|
};
|
|
@@ -402,10 +511,11 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
402
511
|
};
|
|
403
512
|
readonly script: {
|
|
404
513
|
readonly type: "string";
|
|
514
|
+
readonly enum: readonly ["hook.js"];
|
|
405
515
|
};
|
|
406
516
|
readonly script_kind: {
|
|
407
517
|
readonly type: "string";
|
|
408
|
-
readonly enum: readonly ["
|
|
518
|
+
readonly enum: readonly ["file"];
|
|
409
519
|
};
|
|
410
520
|
readonly args: {
|
|
411
521
|
readonly type: "array";
|
|
@@ -444,16 +554,44 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
444
554
|
readonly HooksPublishRequest: {
|
|
445
555
|
readonly type: "object";
|
|
446
556
|
readonly additionalProperties: false;
|
|
447
|
-
readonly required: readonly ["
|
|
557
|
+
readonly required: readonly ["manifest", "script"];
|
|
448
558
|
readonly properties: {
|
|
449
|
-
readonly
|
|
450
|
-
readonly
|
|
559
|
+
readonly manifest: {
|
|
560
|
+
readonly $ref: "#/components/schemas/HooksManifest";
|
|
451
561
|
};
|
|
452
|
-
readonly
|
|
562
|
+
readonly script: {
|
|
453
563
|
readonly type: "string";
|
|
454
564
|
};
|
|
455
565
|
};
|
|
456
566
|
};
|
|
567
|
+
readonly HooksSelectionRequest: {
|
|
568
|
+
readonly type: "object";
|
|
569
|
+
readonly additionalProperties: false;
|
|
570
|
+
readonly required: readonly ["expected_revision", "hooks"];
|
|
571
|
+
readonly properties: {
|
|
572
|
+
readonly expected_revision: {
|
|
573
|
+
readonly type: "integer";
|
|
574
|
+
readonly minimum: 0;
|
|
575
|
+
};
|
|
576
|
+
readonly hooks: {
|
|
577
|
+
readonly type: "object";
|
|
578
|
+
readonly additionalProperties: {
|
|
579
|
+
readonly type: "object";
|
|
580
|
+
readonly additionalProperties: false;
|
|
581
|
+
readonly required: readonly ["version", "bundle_sha256"];
|
|
582
|
+
readonly properties: {
|
|
583
|
+
readonly version: {
|
|
584
|
+
readonly type: "string";
|
|
585
|
+
};
|
|
586
|
+
readonly bundle_sha256: {
|
|
587
|
+
readonly type: "string";
|
|
588
|
+
readonly pattern: "^[a-f0-9]{64}$";
|
|
589
|
+
};
|
|
590
|
+
};
|
|
591
|
+
};
|
|
592
|
+
};
|
|
593
|
+
};
|
|
594
|
+
};
|
|
457
595
|
readonly HooksPublishResponse: {
|
|
458
596
|
readonly type: "object";
|
|
459
597
|
readonly additionalProperties: false;
|
|
@@ -462,6 +600,9 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
462
600
|
readonly ok: {
|
|
463
601
|
readonly type: "boolean";
|
|
464
602
|
};
|
|
603
|
+
readonly idempotent: {
|
|
604
|
+
readonly type: "boolean";
|
|
605
|
+
};
|
|
465
606
|
readonly hook: {
|
|
466
607
|
readonly type: "object";
|
|
467
608
|
readonly additionalProperties: false;
|
|
@@ -476,6 +617,9 @@ export declare function buildOpenApiDocument(version: string): {
|
|
|
476
617
|
readonly sha256: {
|
|
477
618
|
readonly type: "string";
|
|
478
619
|
};
|
|
620
|
+
readonly bundle_sha256: {
|
|
621
|
+
readonly type: "string";
|
|
622
|
+
};
|
|
479
623
|
};
|
|
480
624
|
};
|
|
481
625
|
};
|