@hailstails/hone 0.1.0-pre.8 → 1.0.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/ADOPTING.md +2 -2
- package/CHANGELOG.md +12 -0
- package/MIGRATING.md +1 -1
- package/README.md +13 -11
- package/api/audit.js +0 -1
- package/api/testing.js +8 -9
- package/chunks/chunk-5X2BR42Y.js +117 -0
- package/chunks/{chunk-NRXSM7BY.js → chunk-LHVFZMXD.js} +10 -7
- package/chunks/{chunk-5LCLBXP7.js → chunk-NILRE23T.js} +1 -1
- package/chunks/{chunk-P3NLETF5.js → chunk-OKQHVZLO.js} +1 -1
- package/chunks/{chunk-POZL7G62.js → chunk-OVEQ37JQ.js} +40 -37
- package/chunks/chunk-RNXPEK2U.js +77 -0
- package/chunks/{chunk-XXLMIBLS.js → chunk-XE6RNNZB.js} +162 -143
- package/chunks/{chunk-WPRR2MPJ.js → chunk-YL6WR3QW.js} +5 -5
- package/core/check/tool-command.js +20 -20
- package/mechanisms/audit/CD-1/any-cast.js +0 -1
- package/mechanisms/audit/CD-10/throws-in-tests.js +0 -1
- package/mechanisms/audit/CD-14/class-syntax.js +0 -1
- package/mechanisms/audit/CD-15/loops.js +0 -1
- package/mechanisms/audit/CD-17/clock-sources.js +0 -1
- package/mechanisms/audit/CD-19/import-boundaries.js +2 -3
- package/mechanisms/audit/CD-2/cast-expressions.js +0 -1
- package/mechanisms/audit/CD-23/export-test-sibling.js +0 -1
- package/mechanisms/audit/CD-25/dependency-isolation.js +0 -1
- package/mechanisms/audit/CD-26/module-mocking.js +0 -1
- package/mechanisms/audit/CD-27/test-body-logic.js +0 -1
- package/mechanisms/audit/CD-3/compiler-overrides.js +2 -861
- package/mechanisms/audit/CD-43/boolean-signatures.js +0 -1
- package/mechanisms/audit/CD-44/parameter-mutation.js +0 -1
- package/mechanisms/audit/CD-47/hermetic-git-spawns.js +0 -1
- package/mechanisms/audit/CD-5/comments-directives.js +3 -4
- package/mechanisms/audit/CD-6/identifier-names.js +0 -1
- package/mechanisms/audit/CD-7/categorical-paths.js +0 -1
- package/mechanisms/audit/CD-7a/factory-return-types.js +0 -1
- package/mechanisms/audit/CD-8/switch-defaults.js +0 -1
- package/mechanisms/audit/runner/runner.js +31 -27
- package/mechanisms/eslint/CD-1/cd1/cd1.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-10/cd10/cd10.eslint-plugin.js +0 -2
- package/mechanisms/eslint/CD-14/cd14/cd14.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-2/cd2/cd2.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-27/cd27/cd27.eslint-plugin.js +0 -2
- package/mechanisms/eslint/CD-40/cd40/cd40.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-41/cd41/cd41.eslint-plugin.js +0 -2
- package/mechanisms/eslint/CD-42/cd42/cd42.eslint-plugin.js +0 -2
- package/mechanisms/eslint/CD-44/cd44/cd44.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-6/cd6/cd6.eslint-plugin.js +0 -1
- package/mechanisms/eslint/CD-7/cd7/cd7.eslint-plugin.js +0 -2
- package/mechanisms/eslint/runner/README.md +1 -1
- package/mechanisms/eslint/runner/runner.js +58 -2532
- package/package.json +6 -2
- package/THIRD-PARTY-NOTICES.md +0 -354
- package/chunks/chunk-MYX7GAVM.js +0 -73
- package/chunks/chunk-NCDYOPHG.js +0 -19832
- package/chunks/chunk-NZLE2WMY.js +0 -35
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
nativeExceptionKindSchema,
|
|
4
4
|
projectionWriteSchema,
|
|
5
5
|
runnerResultSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RNXPEK2U.js";
|
|
7
7
|
import {
|
|
8
8
|
JSON_KIND_NAMES,
|
|
9
9
|
disciplineFilePath,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
readPieceFile,
|
|
16
16
|
readVersionOneJson,
|
|
17
17
|
sameJsonValue
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-OVEQ37JQ.js";
|
|
19
19
|
import {
|
|
20
20
|
NOT_INSTALLED,
|
|
21
21
|
brandedRepoPathSchema,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
repoPathSchema,
|
|
24
24
|
repoPathTextSchema,
|
|
25
25
|
runnerModuleSegmentsOf
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-LHVFZMXD.js";
|
|
27
27
|
import {
|
|
28
28
|
NOT_ADOPTED,
|
|
29
29
|
NOT_RUN,
|
|
@@ -32,11 +32,10 @@ import {
|
|
|
32
32
|
clauseAddressObjectSchema,
|
|
33
33
|
clauseAddressSchema,
|
|
34
34
|
clauseAddressText,
|
|
35
|
-
external_exports,
|
|
36
35
|
mechanismIdSchema,
|
|
37
36
|
ruleSetNameSchema,
|
|
38
37
|
sameClauseAddress
|
|
39
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-5X2BR42Y.js";
|
|
40
39
|
|
|
41
40
|
// core/check/load-failure-text.ts
|
|
42
41
|
var escapedLineBreaks = (request) => request.text.replaceAll("\n", "\\n").replaceAll("\r", "\\r");
|
|
@@ -155,7 +154,8 @@ var installRootOf = (request) => installRootAbove({ ...request, entry: "command"
|
|
|
155
154
|
var installRootOfApiEntry = (request) => installRootAbove({ ...request, entry: "api" });
|
|
156
155
|
|
|
157
156
|
// core/values/assessment.ts
|
|
158
|
-
|
|
157
|
+
import { z } from "zod";
|
|
158
|
+
var forfeitureAssessmentSchema = z.enum(["this-run", "elsewhere"]);
|
|
159
159
|
var ASSESSMENT_CONCERNS = {
|
|
160
160
|
forfeiture: forfeitureAssessmentSchema.default("this-run")
|
|
161
161
|
};
|
|
@@ -171,7 +171,7 @@ var unbuiltKeyMessages = (request) => {
|
|
|
171
171
|
const unbuilt = request.keys.filter((key) => !REMOVED_CONCERNS.has(key));
|
|
172
172
|
return unbuilt.length === 0 ? [] : [`not available in this version: ${quotedKeys({ keys: unbuilt })}; assessment takes ${quotedKeys({ keys: Object.keys(ASSESSMENT_CONCERNS) })} only`];
|
|
173
173
|
};
|
|
174
|
-
var assessmentSchema =
|
|
174
|
+
var assessmentSchema = z.strictObject(ASSESSMENT_CONCERNS, {
|
|
175
175
|
error: (issue) => issue.code === "unrecognized_keys" ? [...removedKeyMessages({ keys: issue.keys }), ...unbuiltKeyMessages({ keys: issue.keys })].join(". ") : void 0
|
|
176
176
|
});
|
|
177
177
|
var DEFAULT_ASSESSMENT = assessmentSchema.parse({});
|
|
@@ -180,7 +180,8 @@ var assessmentInEffect = (request) => ({
|
|
|
180
180
|
});
|
|
181
181
|
|
|
182
182
|
// core/values/report-output.ts
|
|
183
|
-
|
|
183
|
+
import { z as z2 } from "zod";
|
|
184
|
+
var reportOutputSchema = z2.enum(["full", "failures-only", "counts", "verdict-only"]);
|
|
184
185
|
var reportOutputInEffect = (request) => request.requested ?? request.configured;
|
|
185
186
|
|
|
186
187
|
// core/check/package-link.ts
|
|
@@ -256,7 +257,8 @@ var shownFailureOf = (request) => {
|
|
|
256
257
|
};
|
|
257
258
|
|
|
258
259
|
// core/consumer-selection/clause-settings.ts
|
|
259
|
-
|
|
260
|
+
import { z as z3 } from "zod";
|
|
261
|
+
var clauseSettingsSchema = z3.record(z3.string(), z3.record(z3.string(), z3.json())).transform(
|
|
260
262
|
(settings, context) => Object.entries(settings).flatMap(([key, values]) => {
|
|
261
263
|
const address = clauseAddressSchema.safeParse(key);
|
|
262
264
|
if (address.success) return [[address.data, values]];
|
|
@@ -299,16 +301,18 @@ var settledClauseSettings = (request) => {
|
|
|
299
301
|
};
|
|
300
302
|
|
|
301
303
|
// core/values/file-exception-why-chains.ts
|
|
302
|
-
|
|
304
|
+
import { z as z4 } from "zod";
|
|
305
|
+
var fileExceptionWhyChainsSchema = z4.enum(["required", "optional"]);
|
|
303
306
|
|
|
304
307
|
// core/consumer-selection/consumer-selection.ts
|
|
308
|
+
import { z as z5 } from "zod";
|
|
305
309
|
var RULE_SET_SUFFIX_SEPARATOR = "-";
|
|
306
310
|
var CLAUSE_ADDRESS_RULE_SET_SEPARATOR = "/";
|
|
307
311
|
var LEADING_CURRENT_DIRECTORY = "./";
|
|
308
|
-
var clauseChoiceSchema =
|
|
312
|
+
var clauseChoiceSchema = z5.union(
|
|
309
313
|
[
|
|
310
|
-
|
|
311
|
-
|
|
314
|
+
z5.literal(NOT_RUN).transform(() => ({ state: "not-run" })),
|
|
315
|
+
z5.literal(NOT_ADOPTED).transform(() => ({ state: "not-adopted" })),
|
|
312
316
|
mechanismIdSchema.transform((mechanism) => ({ state: "run", mechanism }))
|
|
313
317
|
],
|
|
314
318
|
{ error: `a clause takes a mechanism id, "${NOT_RUN}" or "${NOT_ADOPTED}"` }
|
|
@@ -319,17 +323,17 @@ var UNSETTABLE_LISTING_REFUSALS = {
|
|
|
319
323
|
"not-adopted": "clauses does not adopt it, so remove its settings"
|
|
320
324
|
};
|
|
321
325
|
var clauseListingOf = (request) => request.clauses.find(([listed2]) => sameClauseAddress({ left: listed2, right: request.address }) === "same")?.[1].state ?? "unlisted";
|
|
322
|
-
var ruleSetLocationSchema =
|
|
323
|
-
|
|
324
|
-
|
|
326
|
+
var ruleSetLocationSchema = z5.union([
|
|
327
|
+
z5.enum([".", LEADING_CURRENT_DIRECTORY]).transform(() => ({ location: "repo-root" })),
|
|
328
|
+
z5.string().transform(
|
|
325
329
|
(text) => text.startsWith(LEADING_CURRENT_DIRECTORY) ? text.slice(LEADING_CURRENT_DIRECTORY.length) : text
|
|
326
330
|
).pipe(repoPathSchema).transform((path) => ({ location: "folder", path }))
|
|
327
331
|
]);
|
|
328
|
-
var consumerSelectionFileSchema =
|
|
329
|
-
version:
|
|
330
|
-
ruleSets:
|
|
331
|
-
clauses:
|
|
332
|
-
exclude:
|
|
332
|
+
var consumerSelectionFileSchema = z5.strictObject({
|
|
333
|
+
version: z5.literal(1),
|
|
334
|
+
ruleSets: z5.record(ruleSetNameSchema, z5.string()).transform((ruleSets) => Object.entries(ruleSets)).pipe(z5.array(z5.tuple([ruleSetNameSchema, ruleSetLocationSchema]))),
|
|
335
|
+
clauses: z5.record(z5.string(), z5.string()).transform((clauses) => Object.entries(clauses)).pipe(z5.array(z5.tuple([clauseAddressSchema, clauseChoiceSchema]))),
|
|
336
|
+
exclude: z5.array(
|
|
333
337
|
brandedRepoPathSchema({
|
|
334
338
|
text: repoPathTextSchema.refine((excludedPath) => !excludedPath.includes("*"), {
|
|
335
339
|
error: "an exclude entry is a repository path, not a glob"
|
|
@@ -337,7 +341,7 @@ var consumerSelectionFileSchema = external_exports.strictObject({
|
|
|
337
341
|
})
|
|
338
342
|
).default([]),
|
|
339
343
|
eslintConfigLookup: eslintConfigLookupSchema.optional(),
|
|
340
|
-
eslintConfigRoots:
|
|
344
|
+
eslintConfigRoots: z5.array(
|
|
341
345
|
brandedRepoPathSchema({
|
|
342
346
|
text: repoPathTextSchema.refine((rootPath) => !rootPath.includes("*"), {
|
|
343
347
|
error: "an eslintConfigRoots entry is a repository folder, not a glob"
|
|
@@ -582,7 +586,7 @@ var parsedSelectionFile = (request) => {
|
|
|
582
586
|
}
|
|
583
587
|
const parsed = consumerSelectionFileSchema.safeParse(document.value);
|
|
584
588
|
if (!parsed.success) {
|
|
585
|
-
return failed({ kind: "file-malformed", path: request.path, detail:
|
|
589
|
+
return failed({ kind: "file-malformed", path: request.path, detail: z5.prettifyError(parsed.error) });
|
|
586
590
|
}
|
|
587
591
|
const refusal2 = selectionFileRefusalOf({ file: parsed.data });
|
|
588
592
|
return refusal2 === void 0 ? { outcome: "ok", value: parsed.data } : failed(refusal2);
|
|
@@ -683,6 +687,15 @@ var readSelection = (request) => {
|
|
|
683
687
|
return { outcome: "ok", value: selectionReadingOf({ resolved: settled.value, unrun: unrun.value, file: file.value }) };
|
|
684
688
|
};
|
|
685
689
|
|
|
690
|
+
// core/check/run-check.ts
|
|
691
|
+
import { z as z12 } from "zod";
|
|
692
|
+
|
|
693
|
+
// core/exception-records/exception-records.ts
|
|
694
|
+
import { z as z7 } from "zod";
|
|
695
|
+
|
|
696
|
+
// core/values/why-chain.ts
|
|
697
|
+
import { z as z6 } from "zod";
|
|
698
|
+
|
|
686
699
|
// core/values/chain-stems.ts
|
|
687
700
|
var FUNCTION_WORDS = /* @__PURE__ */ new Set([
|
|
688
701
|
"about",
|
|
@@ -953,7 +966,7 @@ var THEREFORE = /\btherefore\b/i;
|
|
|
953
966
|
var rootCauseReading = (request) => RESTATEMENT_OPENING.test(request.rootCause.trim()) ? "restates-the-exception" : "names-a-cause";
|
|
954
967
|
var answerSubstance = (request) => request.answer.trim().length >= MINIMUM_ANSWER_CHARACTERS && !ONE_REPEATED_CHARACTER.test(request.answer.trim()) ? "substantive" : "placeholder";
|
|
955
968
|
var evidenceReading = (request) => CHECKABLE_LOCATORS.some((locator) => locator.test(request.evidence.replace(PROSE_LOOKALIKES, " "))) ? "checkable" : "unlocated";
|
|
956
|
-
var substantiveTextSchema = (request) =>
|
|
969
|
+
var substantiveTextSchema = (request) => z6.string({ error: request.refusal }).refine((answer) => answerSubstance({ answer }) === "substantive", {
|
|
957
970
|
error: request.refusal
|
|
958
971
|
});
|
|
959
972
|
var checkableTextSchema = (request) => substantiveTextSchema({ refusal: request.missing }).refine((evidence) => evidenceReading({ evidence }) === "checkable", {
|
|
@@ -968,10 +981,10 @@ var ROOT_CHECK_REQUIRED = "`whyChain.rootCheck` is required beside `readback` in
|
|
|
968
981
|
var ROOT_CHECK_UNLOCATED = "`whyChain.rootCheck` cites nothing checkable: name the path, record, measurement or link you checked today";
|
|
969
982
|
var READBACK_REQUIRED = '`whyChain.readback` is required beside `rootCheck` in a causal chain: read from the root back to the symptom with "therefore"';
|
|
970
983
|
var OWNER_REQUIRED = "`whyChain.owner` is required: a record dir, a capture id, or the holder of the reserved authority";
|
|
971
|
-
var whyQuestionSchema =
|
|
984
|
+
var whyQuestionSchema = z6.string({ error: WHY_QUESTION_MISSING }).refine((question) => question.trim().length > 0, {
|
|
972
985
|
error: WHY_QUESTION_MISSING
|
|
973
986
|
});
|
|
974
|
-
var legacyWhySchema =
|
|
987
|
+
var legacyWhySchema = z6.object(
|
|
975
988
|
{
|
|
976
989
|
why: whyQuestionSchema,
|
|
977
990
|
because: substantiveTextSchema({ refusal: BECAUSE_MISSING }),
|
|
@@ -979,7 +992,7 @@ var legacyWhySchema = external_exports.object(
|
|
|
979
992
|
},
|
|
980
993
|
{ error: "is not a JSON object" }
|
|
981
994
|
);
|
|
982
|
-
var causalWhySchema =
|
|
995
|
+
var causalWhySchema = z6.object(
|
|
983
996
|
{
|
|
984
997
|
why: whyQuestionSchema,
|
|
985
998
|
because: substantiveTextSchema({ refusal: BECAUSE_MISSING }),
|
|
@@ -987,19 +1000,19 @@ var causalWhySchema = external_exports.object(
|
|
|
987
1000
|
},
|
|
988
1001
|
{ error: "is not a JSON object" }
|
|
989
1002
|
);
|
|
990
|
-
var fiveWhysSchema = (request) =>
|
|
1003
|
+
var fiveWhysSchema = (request) => z6.tuple([request.why, request.why, request.why, request.why, request.why], {
|
|
991
1004
|
error: "`whyChain.whys` must hold exactly 5 whys"
|
|
992
1005
|
});
|
|
993
|
-
var rootCauseSchema =
|
|
1006
|
+
var rootCauseSchema = z6.string({ error: ROOT_CAUSE_REQUIRED }).refine((answer) => answerSubstance({ answer }) === "substantive", {
|
|
994
1007
|
error: ROOT_CAUSE_REQUIRED,
|
|
995
1008
|
abort: true
|
|
996
1009
|
}).refine((rootCause) => rootCauseReading({ rootCause }) === "names-a-cause", {
|
|
997
1010
|
error: "`whyChain.rootCause` restates the exception rather than naming its cause"
|
|
998
1011
|
});
|
|
999
|
-
var ownerSchema =
|
|
1012
|
+
var ownerSchema = z6.string({ error: OWNER_REQUIRED }).refine((owner) => owner.trim().length >= MINIMUM_OWNER_CHARACTERS, {
|
|
1000
1013
|
error: OWNER_REQUIRED
|
|
1001
1014
|
});
|
|
1002
|
-
var legacyWhyChainSchema =
|
|
1015
|
+
var legacyWhyChainSchema = z6.object(
|
|
1003
1016
|
{
|
|
1004
1017
|
whys: fiveWhysSchema({ why: legacyWhySchema }),
|
|
1005
1018
|
rootCause: rootCauseSchema,
|
|
@@ -1056,7 +1069,7 @@ var causalProblemsOf = (request) => {
|
|
|
1056
1069
|
...readbackProblems({ readback, rootCause, symptom })
|
|
1057
1070
|
];
|
|
1058
1071
|
};
|
|
1059
|
-
var whyChainSchema =
|
|
1072
|
+
var whyChainSchema = z6.object(
|
|
1060
1073
|
{
|
|
1061
1074
|
whys: fiveWhysSchema({ why: causalWhySchema }),
|
|
1062
1075
|
rootCause: rootCauseSchema,
|
|
@@ -1073,31 +1086,31 @@ var whyChainSchema = external_exports.object(
|
|
|
1073
1086
|
var whyChainFormOf = (request) => typeof request.chain === "object" && request.chain !== null && !Array.isArray(request.chain) && !("rootCheck" in request.chain) && !("readback" in request.chain) ? "legacy" : "causal";
|
|
1074
1087
|
|
|
1075
1088
|
// core/exception-records/exception-records.ts
|
|
1076
|
-
var exceptionsFileSchema =
|
|
1077
|
-
version:
|
|
1078
|
-
exceptions:
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
kind:
|
|
1082
|
-
clause:
|
|
1083
|
-
file:
|
|
1084
|
-
reason:
|
|
1085
|
-
whyChain:
|
|
1086
|
-
provenance:
|
|
1089
|
+
var exceptionsFileSchema = z7.object({
|
|
1090
|
+
version: z7.literal(1),
|
|
1091
|
+
exceptions: z7.array(
|
|
1092
|
+
z7.discriminatedUnion("kind", [
|
|
1093
|
+
z7.strictObject({
|
|
1094
|
+
kind: z7.literal("authorised-location"),
|
|
1095
|
+
clause: z7.string(),
|
|
1096
|
+
file: z7.string(),
|
|
1097
|
+
reason: z7.string(),
|
|
1098
|
+
whyChain: z7.unknown().optional(),
|
|
1099
|
+
provenance: z7.unknown().optional()
|
|
1087
1100
|
}),
|
|
1088
|
-
|
|
1089
|
-
kind:
|
|
1090
|
-
clause:
|
|
1091
|
-
file:
|
|
1092
|
-
reason:
|
|
1093
|
-
whyChain:
|
|
1094
|
-
provenance:
|
|
1101
|
+
z7.strictObject({
|
|
1102
|
+
kind: z7.literal("file-carve-out"),
|
|
1103
|
+
clause: z7.string(),
|
|
1104
|
+
file: z7.string(),
|
|
1105
|
+
reason: z7.string(),
|
|
1106
|
+
whyChain: z7.unknown().optional(),
|
|
1107
|
+
provenance: z7.unknown().optional()
|
|
1095
1108
|
}),
|
|
1096
|
-
|
|
1097
|
-
kind:
|
|
1098
|
-
clause:
|
|
1099
|
-
reason:
|
|
1100
|
-
whyChain:
|
|
1109
|
+
z7.strictObject({
|
|
1110
|
+
kind: z7.literal("clause-wide-carve-out"),
|
|
1111
|
+
clause: z7.string(),
|
|
1112
|
+
reason: z7.string(),
|
|
1113
|
+
whyChain: z7.unknown()
|
|
1101
1114
|
})
|
|
1102
1115
|
])
|
|
1103
1116
|
)
|
|
@@ -1108,51 +1121,51 @@ var LEGACY_DIRECTORY_OF = {
|
|
|
1108
1121
|
"existing-authorisation": ".constitution-authorised-locations"
|
|
1109
1122
|
};
|
|
1110
1123
|
var LEGACY_SOURCE = /^(?<directory>[^/#]+)\/(?<stem>cd-[0-9a-z]+)\.json#(?<index>\d+)$/;
|
|
1111
|
-
var legacySourceGroupsSchema =
|
|
1112
|
-
directory:
|
|
1113
|
-
stem:
|
|
1114
|
-
index:
|
|
1124
|
+
var legacySourceGroupsSchema = z7.object({
|
|
1125
|
+
directory: z7.enum([LEGACY_DIRECTORY_OF["inherited-debt"], LEGACY_DIRECTORY_OF["existing-authorisation"]]),
|
|
1126
|
+
stem: z7.string(),
|
|
1127
|
+
index: z7.coerce.number().int().nonnegative()
|
|
1115
1128
|
});
|
|
1116
|
-
var legacyRecordsSchema =
|
|
1117
|
-
var recordedTextSchema =
|
|
1118
|
-
var existingAuthorisationProvenanceSchema =
|
|
1119
|
-
kind:
|
|
1129
|
+
var legacyRecordsSchema = z7.array(z7.looseObject({ files: z7.array(z7.string()) }));
|
|
1130
|
+
var recordedTextSchema = z7.string().refine((text) => text.trim().length > 0, { error: "must not be blank" });
|
|
1131
|
+
var existingAuthorisationProvenanceSchema = z7.strictObject({
|
|
1132
|
+
kind: z7.literal("existing-authorisation"),
|
|
1120
1133
|
source: recordedTextSchema,
|
|
1121
1134
|
decision: recordedTextSchema.optional()
|
|
1122
1135
|
});
|
|
1123
|
-
var inheritedDebtProvenanceSchema =
|
|
1124
|
-
kind:
|
|
1136
|
+
var inheritedDebtProvenanceSchema = z7.strictObject({
|
|
1137
|
+
kind: z7.literal("inherited-debt"),
|
|
1125
1138
|
source: recordedTextSchema,
|
|
1126
1139
|
decision: recordedTextSchema
|
|
1127
1140
|
});
|
|
1128
1141
|
var authorisedLocationFields = {
|
|
1129
|
-
kind:
|
|
1130
|
-
clause:
|
|
1131
|
-
file:
|
|
1132
|
-
reason:
|
|
1133
|
-
};
|
|
1134
|
-
var unjudgedWhyChainSchema =
|
|
1135
|
-
var reasonOnlyFields = { reason: recordedTextSchema, whyChain:
|
|
1136
|
-
var chainedAuthorisedLocationSchema =
|
|
1137
|
-
var importedAuthorisedLocationSchema =
|
|
1138
|
-
var reasonedAuthorisedLocationSchema =
|
|
1142
|
+
kind: z7.literal("authorised-location"),
|
|
1143
|
+
clause: z7.string(),
|
|
1144
|
+
file: z7.string(),
|
|
1145
|
+
reason: z7.string()
|
|
1146
|
+
};
|
|
1147
|
+
var unjudgedWhyChainSchema = z7.custom((whyChain) => whyChain !== void 0);
|
|
1148
|
+
var reasonOnlyFields = { reason: recordedTextSchema, whyChain: z7.never().optional(), provenance: z7.never().optional() };
|
|
1149
|
+
var chainedAuthorisedLocationSchema = z7.strictObject({ ...authorisedLocationFields, whyChain: unjudgedWhyChainSchema, provenance: existingAuthorisationProvenanceSchema.optional() });
|
|
1150
|
+
var importedAuthorisedLocationSchema = z7.strictObject({ ...authorisedLocationFields, whyChain: z7.never().optional(), provenance: existingAuthorisationProvenanceSchema });
|
|
1151
|
+
var reasonedAuthorisedLocationSchema = z7.strictObject({ ...authorisedLocationFields, ...reasonOnlyFields });
|
|
1139
1152
|
var fileCarveOutFields = {
|
|
1140
|
-
kind:
|
|
1141
|
-
clause:
|
|
1142
|
-
file:
|
|
1143
|
-
reason:
|
|
1144
|
-
};
|
|
1145
|
-
var chainedFileCarveOutSchema =
|
|
1146
|
-
var importedFileCarveOutSchema =
|
|
1147
|
-
var reasonedFileCarveOutSchema =
|
|
1153
|
+
kind: z7.literal("file-carve-out"),
|
|
1154
|
+
clause: z7.string(),
|
|
1155
|
+
file: z7.string(),
|
|
1156
|
+
reason: z7.string()
|
|
1157
|
+
};
|
|
1158
|
+
var chainedFileCarveOutSchema = z7.strictObject({ ...fileCarveOutFields, whyChain: unjudgedWhyChainSchema, provenance: inheritedDebtProvenanceSchema.optional() });
|
|
1159
|
+
var importedFileCarveOutSchema = z7.strictObject({ ...fileCarveOutFields, whyChain: z7.never().optional(), provenance: inheritedDebtProvenanceSchema });
|
|
1160
|
+
var reasonedFileCarveOutSchema = z7.strictObject({ ...fileCarveOutFields, ...reasonOnlyFields });
|
|
1148
1161
|
var FILE_EVIDENCE_SCHEMAS_OF = {
|
|
1149
1162
|
required: {
|
|
1150
|
-
"authorised-location":
|
|
1151
|
-
"file-carve-out":
|
|
1163
|
+
"authorised-location": z7.union([chainedAuthorisedLocationSchema, importedAuthorisedLocationSchema]),
|
|
1164
|
+
"file-carve-out": z7.union([chainedFileCarveOutSchema, importedFileCarveOutSchema])
|
|
1152
1165
|
},
|
|
1153
1166
|
optional: {
|
|
1154
|
-
"authorised-location":
|
|
1155
|
-
"file-carve-out":
|
|
1167
|
+
"authorised-location": z7.union([chainedAuthorisedLocationSchema, importedAuthorisedLocationSchema, reasonedAuthorisedLocationSchema]),
|
|
1168
|
+
"file-carve-out": z7.union([chainedFileCarveOutSchema, importedFileCarveOutSchema, reasonedFileCarveOutSchema])
|
|
1156
1169
|
}
|
|
1157
1170
|
};
|
|
1158
1171
|
var legacySourceOf = (request) => {
|
|
@@ -1212,11 +1225,11 @@ var chainRefused = (request) => ({
|
|
|
1212
1225
|
});
|
|
1213
1226
|
var causalChainOf = (request) => {
|
|
1214
1227
|
const parsed = whyChainSchema.safeParse(request.whyChain);
|
|
1215
|
-
return parsed.success ? { outcome: "ok", value: parsed.data } : chainRefused({ detail: [...request.preface,
|
|
1228
|
+
return parsed.success ? { outcome: "ok", value: parsed.data } : chainRefused({ detail: [...request.preface, z7.prettifyError(parsed.error)].join("\n") });
|
|
1216
1229
|
};
|
|
1217
1230
|
var legacyChainOf = (request) => {
|
|
1218
1231
|
const parsed = legacyWhyChainSchema.safeParse(request.whyChain);
|
|
1219
|
-
return parsed.success ? { outcome: "ok", value: parsed.data } : chainRefused({ detail:
|
|
1232
|
+
return parsed.success ? { outcome: "ok", value: parsed.data } : chainRefused({ detail: z7.prettifyError(parsed.error) });
|
|
1220
1233
|
};
|
|
1221
1234
|
var judgedWhyChain = (request) => {
|
|
1222
1235
|
if (whyChainFormOf({ chain: request.whyChain }) === "causal") {
|
|
@@ -1241,7 +1254,7 @@ var selectedClauseOf = (request) => {
|
|
|
1241
1254
|
if (!address.success) {
|
|
1242
1255
|
return {
|
|
1243
1256
|
outcome: "failed",
|
|
1244
|
-
error: { kind: "clause-unparseable", detail:
|
|
1257
|
+
error: { kind: "clause-unparseable", detail: z7.prettifyError(address.error) }
|
|
1245
1258
|
};
|
|
1246
1259
|
}
|
|
1247
1260
|
const clause = address.data;
|
|
@@ -1288,7 +1301,7 @@ var parsedRecord = (request) => {
|
|
|
1288
1301
|
return file;
|
|
1289
1302
|
}
|
|
1290
1303
|
const evidence = request.fileEvidence["authorised-location"].safeParse(entry);
|
|
1291
|
-
return evidence.success ? fileRecordOf({ evidence: evidence.data, entry, clause, mechanism, file: file.value, baseline: request.baseline }) : { outcome: "failed", error: { kind: "evidence-refused", detail:
|
|
1304
|
+
return evidence.success ? fileRecordOf({ evidence: evidence.data, entry, clause, mechanism, file: file.value, baseline: request.baseline }) : { outcome: "failed", error: { kind: "evidence-refused", detail: z7.prettifyError(evidence.error) } };
|
|
1292
1305
|
}
|
|
1293
1306
|
case "file-carve-out": {
|
|
1294
1307
|
const file = recordedFile({ file: entry.file });
|
|
@@ -1296,7 +1309,7 @@ var parsedRecord = (request) => {
|
|
|
1296
1309
|
return file;
|
|
1297
1310
|
}
|
|
1298
1311
|
const evidence = request.fileEvidence["file-carve-out"].safeParse(entry);
|
|
1299
|
-
return evidence.success ? fileRecordOf({ evidence: evidence.data, entry, clause, mechanism, file: file.value, baseline: request.baseline }) : { outcome: "failed", error: { kind: "evidence-refused", detail:
|
|
1312
|
+
return evidence.success ? fileRecordOf({ evidence: evidence.data, entry, clause, mechanism, file: file.value, baseline: request.baseline }) : { outcome: "failed", error: { kind: "evidence-refused", detail: z7.prettifyError(evidence.error) } };
|
|
1300
1313
|
}
|
|
1301
1314
|
case "clause-wide-carve-out": {
|
|
1302
1315
|
const whyChain = judgedWhyChain({ whyChain: entry.whyChain, entry, baseline: request.baseline });
|
|
@@ -1366,7 +1379,7 @@ var readExceptionEntries = (request) => {
|
|
|
1366
1379
|
if (!parsed.success) {
|
|
1367
1380
|
return {
|
|
1368
1381
|
outcome: "failed",
|
|
1369
|
-
error: { kind: "file-malformed", path, detail:
|
|
1382
|
+
error: { kind: "file-malformed", path, detail: z7.prettifyError(parsed.error) }
|
|
1370
1383
|
};
|
|
1371
1384
|
}
|
|
1372
1385
|
return { outcome: "ok", value: parsed.data.exceptions };
|
|
@@ -1525,23 +1538,24 @@ var applyGovernance = (request) => {
|
|
|
1525
1538
|
};
|
|
1526
1539
|
|
|
1527
1540
|
// core/mechanism-port/runner-module-schema.ts
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1541
|
+
import { z as z8 } from "zod";
|
|
1542
|
+
var runnerCallSchema = z8.function({
|
|
1543
|
+
input: [z8.unknown()],
|
|
1544
|
+
output: z8.promise(z8.unknown())
|
|
1531
1545
|
});
|
|
1532
|
-
var standaloneRunnerModuleSchema =
|
|
1533
|
-
exceptionPath:
|
|
1546
|
+
var standaloneRunnerModuleSchema = z8.object({
|
|
1547
|
+
exceptionPath: z8.literal("standalone"),
|
|
1534
1548
|
run: runnerCallSchema,
|
|
1535
1549
|
conform: runnerCallSchema
|
|
1536
1550
|
});
|
|
1537
|
-
var embeddedRunnerModuleSchema =
|
|
1538
|
-
exceptionPath:
|
|
1539
|
-
projectedKinds:
|
|
1551
|
+
var embeddedRunnerModuleSchema = z8.object({
|
|
1552
|
+
exceptionPath: z8.literal("embedded"),
|
|
1553
|
+
projectedKinds: z8.array(nativeExceptionKindSchema),
|
|
1540
1554
|
run: runnerCallSchema,
|
|
1541
1555
|
conform: runnerCallSchema,
|
|
1542
1556
|
project: runnerCallSchema
|
|
1543
1557
|
});
|
|
1544
|
-
var runnerModuleSchema =
|
|
1558
|
+
var runnerModuleSchema = z8.discriminatedUnion("exceptionPath", [
|
|
1545
1559
|
standaloneRunnerModuleSchema,
|
|
1546
1560
|
embeddedRunnerModuleSchema
|
|
1547
1561
|
]);
|
|
@@ -1636,60 +1650,64 @@ var clauseReadingsOf = (request) => {
|
|
|
1636
1650
|
];
|
|
1637
1651
|
};
|
|
1638
1652
|
|
|
1653
|
+
// core/check/mechanism-dispatch.ts
|
|
1654
|
+
import { z as z11 } from "zod";
|
|
1655
|
+
|
|
1639
1656
|
// core/mechanism-port/embedded-run-report-schema.ts
|
|
1640
|
-
|
|
1641
|
-
var
|
|
1642
|
-
|
|
1657
|
+
import { z as z9 } from "zod";
|
|
1658
|
+
var inlineLineSchema = z9.number().int().min(1);
|
|
1659
|
+
var inlineDisableSchema = z9.object({
|
|
1660
|
+
kind: z9.literal("inline-disable"),
|
|
1643
1661
|
clause: clauseAddressObjectSchema,
|
|
1644
1662
|
file: repoPathSchema,
|
|
1645
1663
|
line: inlineLineSchema,
|
|
1646
|
-
text:
|
|
1647
|
-
reach:
|
|
1664
|
+
text: z9.string(),
|
|
1665
|
+
reach: z9.enum(["one-clause", "every-selected-clause"])
|
|
1648
1666
|
}).readonly();
|
|
1649
|
-
var scriptOptionCauseSchema =
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1667
|
+
var scriptOptionCauseSchema = z9.discriminatedUnion("kind", [
|
|
1668
|
+
z9.object({ kind: z9.literal("weakens-run") }).readonly(),
|
|
1669
|
+
z9.object({ kind: z9.literal("after-another-command"), command: z9.string(), invocation: z9.string() }).readonly(),
|
|
1670
|
+
z9.object({ kind: z9.literal("wrapped"), command: z9.string(), wrapper: z9.string() }).readonly()
|
|
1653
1671
|
]);
|
|
1654
|
-
var nativeExceptionSchema =
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
kind:
|
|
1672
|
+
var nativeExceptionSchema = z9.discriminatedUnion("kind", [
|
|
1673
|
+
z9.object({ kind: z9.literal("ignore"), clause: clauseAddressObjectSchema, file: repoPathSchema }).readonly(),
|
|
1674
|
+
z9.object({
|
|
1675
|
+
kind: z9.literal("config-override"),
|
|
1658
1676
|
clause: clauseAddressObjectSchema,
|
|
1659
1677
|
file: repoPathSchema
|
|
1660
1678
|
}).readonly(),
|
|
1661
|
-
|
|
1662
|
-
kind:
|
|
1679
|
+
z9.object({
|
|
1680
|
+
kind: z9.literal("suppression-entry"),
|
|
1663
1681
|
clause: clauseAddressObjectSchema,
|
|
1664
1682
|
file: repoPathSchema,
|
|
1665
1683
|
location: repoPathSchema
|
|
1666
1684
|
}).readonly(),
|
|
1667
1685
|
inlineDisableSchema,
|
|
1668
|
-
|
|
1669
|
-
kind:
|
|
1686
|
+
z9.object({
|
|
1687
|
+
kind: z9.literal("inline-rule-config"),
|
|
1670
1688
|
clause: clauseAddressObjectSchema,
|
|
1671
1689
|
file: repoPathSchema,
|
|
1672
1690
|
line: inlineLineSchema,
|
|
1673
|
-
text:
|
|
1691
|
+
text: z9.string()
|
|
1674
1692
|
}).readonly(),
|
|
1675
|
-
|
|
1676
|
-
kind:
|
|
1693
|
+
z9.object({
|
|
1694
|
+
kind: z9.literal("command-line-option"),
|
|
1677
1695
|
clause: clauseAddressObjectSchema,
|
|
1678
1696
|
location: repoPathSchema,
|
|
1679
|
-
script:
|
|
1680
|
-
option:
|
|
1697
|
+
script: z9.string(),
|
|
1698
|
+
option: z9.string(),
|
|
1681
1699
|
cause: scriptOptionCauseSchema
|
|
1682
1700
|
}).readonly()
|
|
1683
1701
|
]);
|
|
1684
|
-
var sliceProblemSchema =
|
|
1702
|
+
var sliceProblemSchema = z9.object({
|
|
1685
1703
|
slice: repoPathSchema,
|
|
1686
|
-
state:
|
|
1704
|
+
state: z9.enum(["out-of-date", "missing", "not-applied", "unconfigured", "nested-configuration"])
|
|
1687
1705
|
}).readonly();
|
|
1688
|
-
var embeddedRunReportSchema =
|
|
1689
|
-
hits:
|
|
1690
|
-
nativeExceptions:
|
|
1691
|
-
projection:
|
|
1692
|
-
slices:
|
|
1706
|
+
var embeddedRunReportSchema = z9.object({
|
|
1707
|
+
hits: z9.array(hitSchema).readonly(),
|
|
1708
|
+
nativeExceptions: z9.array(nativeExceptionSchema).readonly(),
|
|
1709
|
+
projection: z9.enum(["current", "out-of-date", "missing", "not-included"]),
|
|
1710
|
+
slices: z9.array(sliceProblemSchema).readonly().default([])
|
|
1693
1711
|
}).readonly();
|
|
1694
1712
|
|
|
1695
1713
|
// core/mechanism-port/runner-failure.ts
|
|
@@ -1701,11 +1719,12 @@ var thrownMessage = (request) => request.thrown instanceof Error ? request.throw
|
|
|
1701
1719
|
var rejectedCall = (request) => runnerInvalidOutput({ detail: `the runner call threw or rejected: ${thrownMessage(request)}` });
|
|
1702
1720
|
|
|
1703
1721
|
// core/mechanism-port/standalone-run-report-schema.ts
|
|
1722
|
+
import { z as z10 } from "zod";
|
|
1704
1723
|
var STANDALONE_RUN_SHAPE_MESSAGE = "a standalone run's value is { hits, nativeExceptions }, not a bare list of hits";
|
|
1705
|
-
var standaloneRunReportSchema =
|
|
1724
|
+
var standaloneRunReportSchema = z10.object(
|
|
1706
1725
|
{
|
|
1707
|
-
hits:
|
|
1708
|
-
nativeExceptions:
|
|
1726
|
+
hits: z10.array(hitSchema).readonly(),
|
|
1727
|
+
nativeExceptions: z10.array(inlineDisableSchema).readonly()
|
|
1709
1728
|
},
|
|
1710
1729
|
{ error: STANDALONE_RUN_SHAPE_MESSAGE }
|
|
1711
1730
|
).readonly();
|
|
@@ -1718,14 +1737,14 @@ var unrequestedHit = (request) => request.hits.find(
|
|
|
1718
1737
|
(clause) => sameClauseAddress({ left: clause.address, right: hit.clause }) === "same"
|
|
1719
1738
|
)
|
|
1720
1739
|
);
|
|
1721
|
-
var okOutcomeSchema =
|
|
1722
|
-
var okStandaloneSchema =
|
|
1740
|
+
var okOutcomeSchema = z11.object({ outcome: z11.literal("ok") });
|
|
1741
|
+
var okStandaloneSchema = z11.object({ outcome: z11.literal("ok"), value: standaloneRunReportSchema });
|
|
1723
1742
|
var invalidStandaloneDetail = (request) => {
|
|
1724
1743
|
if (!okOutcomeSchema.safeParse(request.returned).success) {
|
|
1725
|
-
return
|
|
1744
|
+
return z11.prettifyError(request.error);
|
|
1726
1745
|
}
|
|
1727
1746
|
const report = okStandaloneSchema.safeParse(request.returned);
|
|
1728
|
-
return
|
|
1747
|
+
return z11.prettifyError(report.success ? request.error : report.error);
|
|
1729
1748
|
};
|
|
1730
1749
|
var standaloneRun = (request) => {
|
|
1731
1750
|
const parsed = standaloneResultSchema.safeParse(request.returned);
|
|
@@ -1761,7 +1780,7 @@ var standaloneRun = (request) => {
|
|
|
1761
1780
|
};
|
|
1762
1781
|
};
|
|
1763
1782
|
var reportResultSchema = runnerResultSchema({ value: embeddedRunReportSchema });
|
|
1764
|
-
var projectionWriteResultSchema = runnerResultSchema({ value:
|
|
1783
|
+
var projectionWriteResultSchema = runnerResultSchema({ value: z11.array(projectionWriteSchema).readonly() });
|
|
1765
1784
|
var unrequestedNativeException = (request) => request.nativeExceptions.find(
|
|
1766
1785
|
(nativeException) => !request.run.clauses.some(
|
|
1767
1786
|
(clause) => sameClauseAddress({ left: clause.address, right: nativeException.clause }) === "same"
|
|
@@ -1770,7 +1789,7 @@ var unrequestedNativeException = (request) => request.nativeExceptions.find(
|
|
|
1770
1789
|
var embeddedRun = (request) => {
|
|
1771
1790
|
const parsed = reportResultSchema.safeParse(request.returned);
|
|
1772
1791
|
if (!parsed.success) {
|
|
1773
|
-
return runnerInvalidOutput({ detail:
|
|
1792
|
+
return runnerInvalidOutput({ detail: z11.prettifyError(parsed.error) });
|
|
1774
1793
|
}
|
|
1775
1794
|
if (parsed.data.outcome === "failed") {
|
|
1776
1795
|
return parsed.data;
|
|
@@ -1806,7 +1825,7 @@ var embeddedRun = (request) => {
|
|
|
1806
1825
|
var embeddedProjection = (request) => {
|
|
1807
1826
|
const parsed = projectionWriteResultSchema.safeParse(request.returned);
|
|
1808
1827
|
if (!parsed.success) {
|
|
1809
|
-
return runnerInvalidOutput({ detail:
|
|
1828
|
+
return runnerInvalidOutput({ detail: z11.prettifyError(parsed.error) });
|
|
1810
1829
|
}
|
|
1811
1830
|
if (parsed.data.outcome === "failed") {
|
|
1812
1831
|
return parsed.data;
|
|
@@ -1856,7 +1875,7 @@ var projectMechanism = (request) => {
|
|
|
1856
1875
|
// core/check/run-check.ts
|
|
1857
1876
|
var TYPESCRIPT_FILE = /\.(?:ts|tsx|mts|cts)$/;
|
|
1858
1877
|
var EXCEPTIONS_FILE = repoPathSchema.parse("discipline-exceptions.json");
|
|
1859
|
-
var runnerExportSchema =
|
|
1878
|
+
var runnerExportSchema = z12.object({ runner: runnerModuleSchema });
|
|
1860
1879
|
var failed2 = (error) => ({
|
|
1861
1880
|
outcome: "failed",
|
|
1862
1881
|
error
|
|
@@ -1885,7 +1904,7 @@ var loadRunner = async (request) => {
|
|
|
1885
1904
|
}
|
|
1886
1905
|
const parsed = runnerExportSchema.safeParse(loaded.value);
|
|
1887
1906
|
if (!parsed.success) {
|
|
1888
|
-
return failed2({ kind: "runner-invalid", mechanism: request.mechanism, detail:
|
|
1907
|
+
return failed2({ kind: "runner-invalid", mechanism: request.mechanism, detail: z12.prettifyError(parsed.error) });
|
|
1889
1908
|
}
|
|
1890
1909
|
return { outcome: "ok", value: parsed.data.runner };
|
|
1891
1910
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
-
clauseAddressText
|
|
3
|
-
|
|
4
|
-
} from "./chunk-NCDYOPHG.js";
|
|
2
|
+
clauseAddressText
|
|
3
|
+
} from "./chunk-5X2BR42Y.js";
|
|
5
4
|
|
|
6
5
|
// mechanisms/audit/runner/piece-clause-settings.ts
|
|
6
|
+
import { z } from "zod";
|
|
7
7
|
var stringListClauseSettings = (request) => {
|
|
8
|
-
const parsed =
|
|
8
|
+
const parsed = z.record(z.enum(request.keys), z.array(z.string().min(1)).readonly()).safeParse(request.clause.clauseSettings);
|
|
9
9
|
if (parsed.success) return { outcome: "ok", value: parsed.data };
|
|
10
10
|
return {
|
|
11
11
|
outcome: "failed",
|
|
12
12
|
error: {
|
|
13
13
|
kind: "piece-invalid",
|
|
14
14
|
pieceRoot: request.clause.pieceRoot,
|
|
15
|
-
detail: `the clauseSettings of ${clauseAddressText({ address: request.clause.address })} are malformed: ${
|
|
15
|
+
detail: `the clauseSettings of ${clauseAddressText({ address: request.clause.address })} are malformed: ${z.prettifyError(parsed.error)}`
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
};
|