@hasna/hooks 0.12.22 → 0.13.0
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 +36 -0
- package/bin/hooks/scratch-lifecycle.js +5 -5
- package/bin/hooks/stop-review.js +23 -8
- package/bin/hooks-mcp.js +1901 -1213
- package/bin/index.js +3355 -1978
- package/bin/native-safety-entry.js +37 -37
- package/bin/native-safety-worker.cjs +37 -37
- package/bin/serve.js +125 -121
- package/dist/index.js +2304 -1548
- package/dist/lib/claude-skills-coordination.d.ts +1 -1
- package/dist/lib/installer.d.ts +44 -5
- package/dist/lib/manifest.d.ts +21 -0
- package/dist/lib/native-safety.d.ts +24 -0
- package/dist/lib/native-target.d.ts +11 -2
- package/dist/lib/registry.d.ts +12 -0
- package/dist/lib/sumi-stop-plugin.d.ts +4 -0
- package/dist/lib/target-adapters.d.ts +151 -0
- package/dist/lib/targets.d.ts +99 -0
- package/dist/native-readiness.js +11 -11
- package/dist/native-safety.js +183 -24
- package/dist/opencode-stop-plugin.js +17 -7
- package/dist/sdk/index.js +60 -16
- package/dist/storage.js +34 -34
- package/dist/sumi-stop-plugin.js +29 -10
- package/hooks/hook-announce-stop/src/hook.ts +91 -15
- package/hooks/hook-stop-review/README.md +7 -0
- package/hooks/hook-stop-review/src/policy.ts +21 -4
- package/hooks/hook-stop-review/src/runtime.ts +4 -3
- package/hooks/hook-stop-review/src/types.ts +6 -0
- package/hooks/hook-trash-guard/src/hook.ts +108 -12
- package/package.json +2 -2
package/bin/serve.js
CHANGED
|
@@ -731,119 +731,119 @@ function getHook(name) {
|
|
|
731
731
|
import { existsSync as existsSync2, mkdirSync, readFileSync, readdirSync, realpathSync, writeFileSync } from "fs";
|
|
732
732
|
import { basename, dirname, isAbsolute, join as join3, normalize, resolve as resolve2, sep } from "path";
|
|
733
733
|
|
|
734
|
-
// node_modules/zod/v3/external.js
|
|
734
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
|
|
735
735
|
var exports_external = {};
|
|
736
736
|
__export(exports_external, {
|
|
737
|
-
|
|
738
|
-
util: () => util,
|
|
739
|
-
unknown: () => unknownType,
|
|
740
|
-
union: () => unionType,
|
|
741
|
-
undefined: () => undefinedType,
|
|
742
|
-
tuple: () => tupleType,
|
|
743
|
-
transformer: () => effectsType,
|
|
744
|
-
symbol: () => symbolType,
|
|
745
|
-
string: () => stringType,
|
|
746
|
-
strictObject: () => strictObjectType,
|
|
747
|
-
setErrorMap: () => setErrorMap,
|
|
748
|
-
set: () => setType,
|
|
749
|
-
record: () => recordType,
|
|
750
|
-
quotelessJson: () => quotelessJson,
|
|
751
|
-
promise: () => promiseType,
|
|
752
|
-
preprocess: () => preprocessType,
|
|
753
|
-
pipeline: () => pipelineType,
|
|
754
|
-
ostring: () => ostring,
|
|
755
|
-
optional: () => optionalType,
|
|
756
|
-
onumber: () => onumber,
|
|
757
|
-
oboolean: () => oboolean,
|
|
758
|
-
objectUtil: () => objectUtil,
|
|
759
|
-
object: () => objectType,
|
|
760
|
-
number: () => numberType,
|
|
761
|
-
nullable: () => nullableType,
|
|
762
|
-
null: () => nullType,
|
|
763
|
-
never: () => neverType,
|
|
764
|
-
nativeEnum: () => nativeEnumType,
|
|
765
|
-
nan: () => nanType,
|
|
766
|
-
map: () => mapType,
|
|
767
|
-
makeIssue: () => makeIssue,
|
|
768
|
-
literal: () => literalType,
|
|
769
|
-
lazy: () => lazyType,
|
|
770
|
-
late: () => late,
|
|
771
|
-
isValid: () => isValid,
|
|
772
|
-
isDirty: () => isDirty,
|
|
773
|
-
isAsync: () => isAsync,
|
|
774
|
-
isAborted: () => isAborted,
|
|
775
|
-
intersection: () => intersectionType,
|
|
776
|
-
instanceof: () => instanceOfType,
|
|
777
|
-
getParsedType: () => getParsedType,
|
|
778
|
-
getErrorMap: () => getErrorMap,
|
|
779
|
-
function: () => functionType,
|
|
780
|
-
enum: () => enumType,
|
|
781
|
-
effect: () => effectsType,
|
|
782
|
-
discriminatedUnion: () => discriminatedUnionType,
|
|
783
|
-
defaultErrorMap: () => en_default,
|
|
784
|
-
datetimeRegex: () => datetimeRegex,
|
|
785
|
-
date: () => dateType,
|
|
786
|
-
custom: () => custom,
|
|
787
|
-
coerce: () => coerce,
|
|
788
|
-
boolean: () => booleanType,
|
|
789
|
-
bigint: () => bigIntType,
|
|
790
|
-
array: () => arrayType,
|
|
791
|
-
any: () => anyType,
|
|
792
|
-
addIssueToContext: () => addIssueToContext,
|
|
793
|
-
ZodVoid: () => ZodVoid,
|
|
794
|
-
ZodUnknown: () => ZodUnknown,
|
|
795
|
-
ZodUnion: () => ZodUnion,
|
|
796
|
-
ZodUndefined: () => ZodUndefined,
|
|
797
|
-
ZodType: () => ZodType,
|
|
798
|
-
ZodTuple: () => ZodTuple,
|
|
799
|
-
ZodTransformer: () => ZodEffects,
|
|
800
|
-
ZodSymbol: () => ZodSymbol,
|
|
801
|
-
ZodString: () => ZodString,
|
|
802
|
-
ZodSet: () => ZodSet,
|
|
803
|
-
ZodSchema: () => ZodType,
|
|
804
|
-
ZodRecord: () => ZodRecord,
|
|
805
|
-
ZodReadonly: () => ZodReadonly,
|
|
806
|
-
ZodPromise: () => ZodPromise,
|
|
807
|
-
ZodPipeline: () => ZodPipeline,
|
|
808
|
-
ZodParsedType: () => ZodParsedType,
|
|
809
|
-
ZodOptional: () => ZodOptional,
|
|
810
|
-
ZodObject: () => ZodObject,
|
|
811
|
-
ZodNumber: () => ZodNumber,
|
|
812
|
-
ZodNullable: () => ZodNullable,
|
|
813
|
-
ZodNull: () => ZodNull,
|
|
814
|
-
ZodNever: () => ZodNever,
|
|
815
|
-
ZodNativeEnum: () => ZodNativeEnum,
|
|
816
|
-
ZodNaN: () => ZodNaN,
|
|
817
|
-
ZodMap: () => ZodMap,
|
|
818
|
-
ZodLiteral: () => ZodLiteral,
|
|
819
|
-
ZodLazy: () => ZodLazy,
|
|
820
|
-
ZodIssueCode: () => ZodIssueCode,
|
|
821
|
-
ZodIntersection: () => ZodIntersection,
|
|
822
|
-
ZodFunction: () => ZodFunction,
|
|
823
|
-
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
824
|
-
ZodError: () => ZodError,
|
|
825
|
-
ZodEnum: () => ZodEnum,
|
|
826
|
-
ZodEffects: () => ZodEffects,
|
|
827
|
-
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
828
|
-
ZodDefault: () => ZodDefault,
|
|
829
|
-
ZodDate: () => ZodDate,
|
|
830
|
-
ZodCatch: () => ZodCatch,
|
|
831
|
-
ZodBranded: () => ZodBranded,
|
|
832
|
-
ZodBoolean: () => ZodBoolean,
|
|
833
|
-
ZodBigInt: () => ZodBigInt,
|
|
834
|
-
ZodArray: () => ZodArray,
|
|
835
|
-
ZodAny: () => ZodAny,
|
|
836
|
-
Schema: () => ZodType,
|
|
837
|
-
ParseStatus: () => ParseStatus,
|
|
838
|
-
OK: () => OK,
|
|
839
|
-
NEVER: () => NEVER,
|
|
840
|
-
INVALID: () => INVALID,
|
|
841
|
-
EMPTY_PATH: () => EMPTY_PATH,
|
|
737
|
+
BRAND: () => BRAND,
|
|
842
738
|
DIRTY: () => DIRTY,
|
|
843
|
-
|
|
739
|
+
EMPTY_PATH: () => EMPTY_PATH,
|
|
740
|
+
INVALID: () => INVALID,
|
|
741
|
+
NEVER: () => NEVER,
|
|
742
|
+
OK: () => OK,
|
|
743
|
+
ParseStatus: () => ParseStatus,
|
|
744
|
+
Schema: () => ZodType,
|
|
745
|
+
ZodAny: () => ZodAny,
|
|
746
|
+
ZodArray: () => ZodArray,
|
|
747
|
+
ZodBigInt: () => ZodBigInt,
|
|
748
|
+
ZodBoolean: () => ZodBoolean,
|
|
749
|
+
ZodBranded: () => ZodBranded,
|
|
750
|
+
ZodCatch: () => ZodCatch,
|
|
751
|
+
ZodDate: () => ZodDate,
|
|
752
|
+
ZodDefault: () => ZodDefault,
|
|
753
|
+
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
754
|
+
ZodEffects: () => ZodEffects,
|
|
755
|
+
ZodEnum: () => ZodEnum,
|
|
756
|
+
ZodError: () => ZodError,
|
|
757
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
758
|
+
ZodFunction: () => ZodFunction,
|
|
759
|
+
ZodIntersection: () => ZodIntersection,
|
|
760
|
+
ZodIssueCode: () => ZodIssueCode,
|
|
761
|
+
ZodLazy: () => ZodLazy,
|
|
762
|
+
ZodLiteral: () => ZodLiteral,
|
|
763
|
+
ZodMap: () => ZodMap,
|
|
764
|
+
ZodNaN: () => ZodNaN,
|
|
765
|
+
ZodNativeEnum: () => ZodNativeEnum,
|
|
766
|
+
ZodNever: () => ZodNever,
|
|
767
|
+
ZodNull: () => ZodNull,
|
|
768
|
+
ZodNullable: () => ZodNullable,
|
|
769
|
+
ZodNumber: () => ZodNumber,
|
|
770
|
+
ZodObject: () => ZodObject,
|
|
771
|
+
ZodOptional: () => ZodOptional,
|
|
772
|
+
ZodParsedType: () => ZodParsedType,
|
|
773
|
+
ZodPipeline: () => ZodPipeline,
|
|
774
|
+
ZodPromise: () => ZodPromise,
|
|
775
|
+
ZodReadonly: () => ZodReadonly,
|
|
776
|
+
ZodRecord: () => ZodRecord,
|
|
777
|
+
ZodSchema: () => ZodType,
|
|
778
|
+
ZodSet: () => ZodSet,
|
|
779
|
+
ZodString: () => ZodString,
|
|
780
|
+
ZodSymbol: () => ZodSymbol,
|
|
781
|
+
ZodTransformer: () => ZodEffects,
|
|
782
|
+
ZodTuple: () => ZodTuple,
|
|
783
|
+
ZodType: () => ZodType,
|
|
784
|
+
ZodUndefined: () => ZodUndefined,
|
|
785
|
+
ZodUnion: () => ZodUnion,
|
|
786
|
+
ZodUnknown: () => ZodUnknown,
|
|
787
|
+
ZodVoid: () => ZodVoid,
|
|
788
|
+
addIssueToContext: () => addIssueToContext,
|
|
789
|
+
any: () => anyType,
|
|
790
|
+
array: () => arrayType,
|
|
791
|
+
bigint: () => bigIntType,
|
|
792
|
+
boolean: () => booleanType,
|
|
793
|
+
coerce: () => coerce,
|
|
794
|
+
custom: () => custom,
|
|
795
|
+
date: () => dateType,
|
|
796
|
+
datetimeRegex: () => datetimeRegex,
|
|
797
|
+
defaultErrorMap: () => en_default,
|
|
798
|
+
discriminatedUnion: () => discriminatedUnionType,
|
|
799
|
+
effect: () => effectsType,
|
|
800
|
+
enum: () => enumType,
|
|
801
|
+
function: () => functionType,
|
|
802
|
+
getErrorMap: () => getErrorMap,
|
|
803
|
+
getParsedType: () => getParsedType,
|
|
804
|
+
instanceof: () => instanceOfType,
|
|
805
|
+
intersection: () => intersectionType,
|
|
806
|
+
isAborted: () => isAborted,
|
|
807
|
+
isAsync: () => isAsync,
|
|
808
|
+
isDirty: () => isDirty,
|
|
809
|
+
isValid: () => isValid,
|
|
810
|
+
late: () => late,
|
|
811
|
+
lazy: () => lazyType,
|
|
812
|
+
literal: () => literalType,
|
|
813
|
+
makeIssue: () => makeIssue,
|
|
814
|
+
map: () => mapType,
|
|
815
|
+
nan: () => nanType,
|
|
816
|
+
nativeEnum: () => nativeEnumType,
|
|
817
|
+
never: () => neverType,
|
|
818
|
+
null: () => nullType,
|
|
819
|
+
nullable: () => nullableType,
|
|
820
|
+
number: () => numberType,
|
|
821
|
+
object: () => objectType,
|
|
822
|
+
objectUtil: () => objectUtil,
|
|
823
|
+
oboolean: () => oboolean,
|
|
824
|
+
onumber: () => onumber,
|
|
825
|
+
optional: () => optionalType,
|
|
826
|
+
ostring: () => ostring,
|
|
827
|
+
pipeline: () => pipelineType,
|
|
828
|
+
preprocess: () => preprocessType,
|
|
829
|
+
promise: () => promiseType,
|
|
830
|
+
quotelessJson: () => quotelessJson,
|
|
831
|
+
record: () => recordType,
|
|
832
|
+
set: () => setType,
|
|
833
|
+
setErrorMap: () => setErrorMap,
|
|
834
|
+
strictObject: () => strictObjectType,
|
|
835
|
+
string: () => stringType,
|
|
836
|
+
symbol: () => symbolType,
|
|
837
|
+
transformer: () => effectsType,
|
|
838
|
+
tuple: () => tupleType,
|
|
839
|
+
undefined: () => undefinedType,
|
|
840
|
+
union: () => unionType,
|
|
841
|
+
unknown: () => unknownType,
|
|
842
|
+
util: () => util,
|
|
843
|
+
void: () => voidType
|
|
844
844
|
});
|
|
845
845
|
|
|
846
|
-
// node_modules/zod/v3/helpers/util.js
|
|
846
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
847
847
|
var util;
|
|
848
848
|
(function(util2) {
|
|
849
849
|
util2.assertEqual = (_) => {};
|
|
@@ -974,7 +974,7 @@ var getParsedType = (data) => {
|
|
|
974
974
|
}
|
|
975
975
|
};
|
|
976
976
|
|
|
977
|
-
// node_modules/zod/v3/ZodError.js
|
|
977
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/ZodError.js
|
|
978
978
|
var ZodIssueCode = util.arrayToEnum([
|
|
979
979
|
"invalid_type",
|
|
980
980
|
"invalid_literal",
|
|
@@ -1093,7 +1093,7 @@ ZodError.create = (issues) => {
|
|
|
1093
1093
|
return error;
|
|
1094
1094
|
};
|
|
1095
1095
|
|
|
1096
|
-
// node_modules/zod/v3/locales/en.js
|
|
1096
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/locales/en.js
|
|
1097
1097
|
var errorMap = (issue, _ctx) => {
|
|
1098
1098
|
let message;
|
|
1099
1099
|
switch (issue.code) {
|
|
@@ -1196,7 +1196,7 @@ var errorMap = (issue, _ctx) => {
|
|
|
1196
1196
|
};
|
|
1197
1197
|
var en_default = errorMap;
|
|
1198
1198
|
|
|
1199
|
-
// node_modules/zod/v3/errors.js
|
|
1199
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/errors.js
|
|
1200
1200
|
var overrideErrorMap = en_default;
|
|
1201
1201
|
function setErrorMap(map) {
|
|
1202
1202
|
overrideErrorMap = map;
|
|
@@ -1204,7 +1204,7 @@ function setErrorMap(map) {
|
|
|
1204
1204
|
function getErrorMap() {
|
|
1205
1205
|
return overrideErrorMap;
|
|
1206
1206
|
}
|
|
1207
|
-
// node_modules/zod/v3/helpers/parseUtil.js
|
|
1207
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
1208
1208
|
var makeIssue = (params) => {
|
|
1209
1209
|
const { data, path, errorMaps, issueData } = params;
|
|
1210
1210
|
const fullPath = [...path, ...issueData.path || []];
|
|
@@ -1310,14 +1310,14 @@ var isAborted = (x) => x.status === "aborted";
|
|
|
1310
1310
|
var isDirty = (x) => x.status === "dirty";
|
|
1311
1311
|
var isValid = (x) => x.status === "valid";
|
|
1312
1312
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
1313
|
-
// node_modules/zod/v3/helpers/errorUtil.js
|
|
1313
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
|
|
1314
1314
|
var errorUtil;
|
|
1315
1315
|
(function(errorUtil2) {
|
|
1316
1316
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
1317
1317
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
1318
1318
|
})(errorUtil || (errorUtil = {}));
|
|
1319
1319
|
|
|
1320
|
-
// node_modules/zod/v3/types.js
|
|
1320
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/types.js
|
|
1321
1321
|
class ParseInputLazyPath {
|
|
1322
1322
|
constructor(parent, value, path, key) {
|
|
1323
1323
|
this._cachedPath = [];
|
|
@@ -4785,6 +4785,8 @@ var manifestSchema = exports_external.object({
|
|
|
4785
4785
|
script_kind: exports_external.enum(["inline", "file"]).optional(),
|
|
4786
4786
|
args: exports_external.array(exports_external.string()).optional(),
|
|
4787
4787
|
nativeTargetDispatch: exports_external.boolean().optional(),
|
|
4788
|
+
requires_final_message: exports_external.boolean().optional(),
|
|
4789
|
+
requires_block: exports_external.boolean().optional(),
|
|
4788
4790
|
timeout_ms: exports_external.number().int().positive().optional(),
|
|
4789
4791
|
env: exports_external.record(exports_external.string(), exports_external.string()).optional()
|
|
4790
4792
|
});
|
|
@@ -5507,6 +5509,8 @@ function resolveHookMeta(name) {
|
|
|
5507
5509
|
matcher: "",
|
|
5508
5510
|
tags: ["custom"],
|
|
5509
5511
|
nativeTargetDispatch: manifest.nativeTargetDispatch,
|
|
5512
|
+
requiresFinalMessage: manifest.requires_final_message,
|
|
5513
|
+
requiresBlock: manifest.requires_block,
|
|
5510
5514
|
timeoutSeconds: manifest.timeout_ms === undefined ? undefined : Math.ceil(manifest.timeout_ms / 1000)
|
|
5511
5515
|
};
|
|
5512
5516
|
}
|
|
@@ -5548,7 +5552,7 @@ import { readFileSync as readFileSync5 } from "fs";
|
|
|
5548
5552
|
import { dirname as dirname4, join as join9 } from "path";
|
|
5549
5553
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
5550
5554
|
|
|
5551
|
-
//
|
|
5555
|
+
// ../contracts/dist/client/transport.js
|
|
5552
5556
|
import { spawnSync } from "child_process";
|
|
5553
5557
|
import { closeSync as closeSync2, fstatSync as fstatSync2, openSync as openSync2, readFileSync as readFileSync22 } from "fs";
|
|
5554
5558
|
import { O_NOFOLLOW as O_NOFOLLOW2, O_NONBLOCK as O_NONBLOCK2, O_RDONLY as O_RDONLY2 } from "constants";
|
|
@@ -7017,7 +7021,7 @@ function getStorageBackend() {
|
|
|
7017
7021
|
return getStorageDatabaseUrl() ? "postgresql" : "sqlite";
|
|
7018
7022
|
}
|
|
7019
7023
|
|
|
7020
|
-
//
|
|
7024
|
+
// ../contracts/dist/auth/index.js
|
|
7021
7025
|
import { createHash as createHash3, createHmac, randomBytes as randomBytes2, timingSafeEqual } from "crypto";
|
|
7022
7026
|
var MAX_TENANT_ID_LENGTH = 64;
|
|
7023
7027
|
var TENANT_ID_PATTERN = new RegExp(`^[A-Za-z0-9][A-Za-z0-9._-]{0,${MAX_TENANT_ID_LENGTH - 1}}$`);
|
|
@@ -7999,10 +8003,10 @@ options:
|
|
|
7999
8003
|
});
|
|
8000
8004
|
}
|
|
8001
8005
|
export {
|
|
8002
|
-
|
|
8003
|
-
resolveServeOptions,
|
|
8004
|
-
handleServeRequest,
|
|
8005
|
-
SERVE_SERVICE_NAME,
|
|
8006
|
+
DEFAULT_SERVE_PORT,
|
|
8006
8007
|
SERVE_HOST,
|
|
8007
|
-
|
|
8008
|
+
SERVE_SERVICE_NAME,
|
|
8009
|
+
handleServeRequest,
|
|
8010
|
+
resolveServeOptions,
|
|
8011
|
+
startServeServer
|
|
8008
8012
|
};
|