@usefragments/core 1.10.2 → 1.11.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/dist/{chunk-MZ4SW3TP.js → chunk-3IOWHECM.js} +8 -1
- package/dist/{chunk-MZ4SW3TP.js.map → chunk-3IOWHECM.js.map} +1 -1
- package/dist/chunk-7ULGH74M.js +66 -0
- package/dist/chunk-7ULGH74M.js.map +1 -0
- package/dist/{chunk-YF65VYRY.js → chunk-ML5S6QNU.js} +191 -169
- package/dist/chunk-ML5S6QNU.js.map +1 -0
- package/dist/chunk-PWIJMOI4.js +202 -0
- package/dist/chunk-PWIJMOI4.js.map +1 -0
- package/dist/{chunk-XN3LSDPY.js → chunk-RPSEABY3.js} +622 -344
- package/dist/chunk-RPSEABY3.js.map +1 -0
- package/dist/chunk-RYFULE43.js +578 -0
- package/dist/chunk-RYFULE43.js.map +1 -0
- package/dist/codes/index.d.ts +2 -2
- package/dist/codes/index.js +3 -2
- package/dist/compiled-types/index.d.ts +327 -2
- package/dist/compiled-types/index.js +1 -1
- package/dist/generate/index.d.ts +3 -2
- package/dist/{governance-CLk_wkP9.d.ts → governance-BAsy1k2H.d.ts} +472 -513
- package/dist/governance-telemetry.d.ts +6 -0
- package/dist/governance-telemetry.js +1 -1
- package/dist/{index-_sxhUNqx.d.ts → index-C8bcXVav.d.ts} +448 -448
- package/dist/index.d.ts +9165 -1297
- package/dist/index.js +3041 -350
- package/dist/index.js.map +1 -1
- package/dist/manifest.d.ts +228 -0
- package/dist/manifest.js +24 -0
- package/dist/manifest.js.map +1 -0
- package/dist/preview/index.js +45 -1
- package/dist/preview/index.js.map +1 -1
- package/dist/preview-runtime.d.ts +1 -2
- package/dist/preview-runtime.js +150 -14
- package/dist/preview-runtime.js.map +1 -1
- package/dist/react-types.d.ts +1 -2
- package/dist/registry.d.ts +1412 -203
- package/dist/registry.js +30 -3
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.js +3 -2
- package/dist/storyAdapter.d.ts +1 -2
- package/dist/storyAdapter.js +11 -49
- package/dist/storyAdapter.js.map +1 -1
- package/dist/test-utils.d.ts +3 -2
- package/package.json +8 -2
- package/src/__tests__/contract-parser.test.ts +318 -277
- package/src/__tests__/preview-runtime-hook.test.tsx +315 -0
- package/src/__tests__/preview-runtime.test.tsx +30 -8
- package/src/__tests__/schema.test.ts +191 -14
- package/src/analysis-plan/analysis-plan-v1.test.ts +320 -0
- package/src/analysis-plan/coverage.ts +181 -0
- package/src/analysis-plan/digest.ts +141 -0
- package/src/analysis-plan/index.ts +34 -0
- package/src/analysis-plan/types.ts +207 -0
- package/src/codes/__tests__/codes.test.ts +9 -0
- package/src/codes/codes.ts +30 -0
- package/src/compiled-types/index.ts +640 -39
- package/src/compiled-types/parse.test.ts +145 -4
- package/src/component-contract.ts +95 -53
- package/src/composition.ts +7 -13
- package/src/constants.ts +3 -6
- package/src/contract/hash.test.ts +20 -0
- package/src/contract/hash.ts +66 -9
- package/src/contract/index.ts +24 -1
- package/src/contract/manifest.test.ts +94 -0
- package/src/contract/manifest.ts +68 -0
- package/src/contract/preimage.test.ts +219 -1
- package/src/contract/preimage.ts +326 -6
- package/src/contract/stamp.test.ts +3 -0
- package/src/contract/stamp.ts +1 -1
- package/src/contract-parser.ts +54 -30
- package/src/defineFragment.test.ts +476 -91
- package/src/defineFragment.ts +204 -114
- package/src/domain-ids.test.ts +52 -0
- package/src/domain-ids.ts +106 -0
- package/src/evaluation/evaluate.test.ts +522 -0
- package/src/evaluation/evaluate.ts +680 -0
- package/src/evaluation/evaluation-v2-receipt-v1.test.ts +760 -0
- package/src/evaluation/index.ts +58 -0
- package/src/evaluation/receipt.ts +753 -0
- package/src/evaluation/types.ts +406 -0
- package/src/facts/builders.ts +2 -0
- package/src/facts/compile.ts +29 -6
- package/src/facts/fact-index.ts +13 -3
- package/src/facts/fact-integrity-v1.test.ts +172 -0
- package/src/facts/facts.test.ts +15 -0
- package/src/facts/ids.ts +46 -3
- package/src/facts/index.ts +14 -1
- package/src/facts/integrity.ts +134 -0
- package/src/facts/types.ts +36 -0
- package/src/feature-plan/digest.ts +217 -0
- package/src/feature-plan/feature-plan-v1.test.ts +529 -0
- package/src/feature-plan/index.ts +65 -0
- package/src/feature-plan/types.ts +628 -0
- package/src/governance-integrity.test.ts +1 -0
- package/src/governance-integrity.ts +5 -3
- package/src/governance-telemetry.ts +8 -0
- package/src/governance.ts +52 -8
- package/src/index.ts +299 -37
- package/src/preview/validation.test.ts +62 -0
- package/src/preview/validation.ts +48 -2
- package/src/preview-runtime.tsx +227 -20
- package/src/registry-install-plan.ts +200 -109
- package/src/registry-shards.test.ts +263 -0
- package/src/registry.ts +237 -0
- package/src/repository-binding.test.ts +50 -0
- package/src/repository-binding.ts +96 -0
- package/src/rules/families.test.ts +36 -0
- package/src/rules/finding.ts +7 -2
- package/src/rules/index.ts +17 -1
- package/src/rules/rule-config.test.ts +66 -0
- package/src/rules/rule-config.ts +73 -0
- package/src/rules/rules.test.ts +26 -0
- package/src/rules/tokens-css-vars-must-be-defined.test.ts +51 -2
- package/src/rules/tokens-css-vars-must-be-defined.ts +34 -1
- package/src/schema.ts +293 -113
- package/src/schemas/index.ts +1 -1
- package/src/storyAdapter.test.ts +68 -12
- package/src/storyAdapter.ts +44 -75
- package/src/types.ts +258 -37
- package/dist/chunk-RANPUC6C.js +0 -72
- package/dist/chunk-RANPUC6C.js.map +0 -1
- package/dist/chunk-XN3LSDPY.js.map +0 -1
- package/dist/chunk-YF65VYRY.js.map +0 -1
- package/src/fragment-types.ts +0 -214
- package/src/react-create-element.test.ts +0 -22
- package/src/react-create-element.ts +0 -12
- package/src/storyFilters.test.ts +0 -350
- package/src/storyFilters.ts +0 -253
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
portableRepoPathError
|
|
3
|
+
} from "./chunk-EIYNNS77.js";
|
|
4
|
+
import {
|
|
5
|
+
compareCanonicalStrings
|
|
6
|
+
} from "./chunk-PWIJMOI4.js";
|
|
1
7
|
import {
|
|
2
8
|
authorOwnedImport,
|
|
3
9
|
canonicalizeOwnedComponentId,
|
|
@@ -6,9 +12,6 @@ import {
|
|
|
6
12
|
projectV1OwnedComponentId,
|
|
7
13
|
projectV1OwnedImportIdentity
|
|
8
14
|
} from "./chunk-JNBFJ34I.js";
|
|
9
|
-
import {
|
|
10
|
-
portableRepoPathError
|
|
11
|
-
} from "./chunk-EIYNNS77.js";
|
|
12
15
|
import {
|
|
13
16
|
legacySeverityLevelSchema,
|
|
14
17
|
severityFromLevel,
|
|
@@ -285,6 +288,16 @@ var CODES = [
|
|
|
285
288
|
lifecycle: "experimental",
|
|
286
289
|
evidenceRequired: true
|
|
287
290
|
}),
|
|
291
|
+
code({
|
|
292
|
+
code: "FUI2018",
|
|
293
|
+
ruleId: "config/empty-token-vocabulary",
|
|
294
|
+
category: "system",
|
|
295
|
+
defaultSeverity: "serious",
|
|
296
|
+
title: "Token sources resolved to 0 tokens",
|
|
297
|
+
lifecycle: "experimental",
|
|
298
|
+
fixAvailable: false,
|
|
299
|
+
evidenceRequired: true
|
|
300
|
+
}),
|
|
288
301
|
ruleCode({
|
|
289
302
|
code: "FUI3001",
|
|
290
303
|
ruleId: "a11y/required-accessible-name",
|
|
@@ -538,6 +551,26 @@ var CODES = [
|
|
|
538
551
|
lifecycle: "experimental",
|
|
539
552
|
fixAvailable: false,
|
|
540
553
|
evidenceRequired: false
|
|
554
|
+
}),
|
|
555
|
+
code({
|
|
556
|
+
code: "FUI9010",
|
|
557
|
+
ruleId: "fragment/invalid-definition",
|
|
558
|
+
category: "system",
|
|
559
|
+
defaultSeverity: "critical",
|
|
560
|
+
title: "Fragment definition is not valid",
|
|
561
|
+
lifecycle: "experimental",
|
|
562
|
+
fixAvailable: false,
|
|
563
|
+
evidenceRequired: false
|
|
564
|
+
}),
|
|
565
|
+
code({
|
|
566
|
+
code: "FUI9011",
|
|
567
|
+
ruleId: "fragment/source-drift",
|
|
568
|
+
category: "system",
|
|
569
|
+
defaultSeverity: "critical",
|
|
570
|
+
title: "Fragment definition drifted from its component source",
|
|
571
|
+
lifecycle: "experimental",
|
|
572
|
+
fixAvailable: false,
|
|
573
|
+
evidenceRequired: false
|
|
541
574
|
})
|
|
542
575
|
];
|
|
543
576
|
var byCode = new Map(
|
|
@@ -550,15 +583,203 @@ function explainUrlForCode(code2) {
|
|
|
550
583
|
return `${EXPLAIN_URL_BASE}${code2}`;
|
|
551
584
|
}
|
|
552
585
|
|
|
586
|
+
// src/facts/integrity.ts
|
|
587
|
+
import { z as z2 } from "zod";
|
|
588
|
+
|
|
589
|
+
// src/domain-ids.ts
|
|
590
|
+
import { z } from "zod";
|
|
591
|
+
var FULL_DIGEST_PATTERN = /^[0-9a-f]{64}$/u;
|
|
592
|
+
var WORKFLOW_ENTROPY_PATTERN = /^[0-9a-f]{32}$/u;
|
|
593
|
+
var digestHexStringSchema = z.string().regex(FULL_DIGEST_PATTERN, "Expected 64 lowercase hexadecimal characters");
|
|
594
|
+
var digestHexSchema = digestHexStringSchema;
|
|
595
|
+
var analysisPlanIdStringSchema = z.string().regex(/^apl_[0-9a-f]{64}$/u, "Invalid analysis plan ID");
|
|
596
|
+
var analysisPlanIdSchema = analysisPlanIdStringSchema.transform(
|
|
597
|
+
(value) => value
|
|
598
|
+
);
|
|
599
|
+
var evaluationReceiptIdSchema = z.string().regex(/^evr_[0-9a-f]{64}$/u, "Invalid evaluation receipt ID").transform((value) => value);
|
|
600
|
+
var evaluationReceiptIdStringSchema = z.string().regex(/^evr_[0-9a-f]{64}$/u, "Invalid evaluation receipt ID");
|
|
601
|
+
var featurePlanIdStringSchema = z.string().regex(/^fpl_[0-9a-f]{32}$/u, "Invalid feature plan ID");
|
|
602
|
+
var featurePlanIdSchema = featurePlanIdStringSchema.transform(
|
|
603
|
+
(value) => value
|
|
604
|
+
);
|
|
605
|
+
var featureRevisionIdStringSchema = z.string().regex(/^fpr_[0-9a-f]{64}$/u, "Invalid feature revision ID");
|
|
606
|
+
var featureRevisionIdSchema = featureRevisionIdStringSchema.transform(
|
|
607
|
+
(value) => value
|
|
608
|
+
);
|
|
609
|
+
function parseDigestHex(value) {
|
|
610
|
+
return digestHexSchema.parse(value);
|
|
611
|
+
}
|
|
612
|
+
function analysisPlanIdFromDigest(digest) {
|
|
613
|
+
return analysisPlanIdSchema.parse(`apl_${parseDigestHex(digest)}`);
|
|
614
|
+
}
|
|
615
|
+
function evaluationReceiptIdFromDigest(digest) {
|
|
616
|
+
return evaluationReceiptIdSchema.parse(`evr_${parseDigestHex(digest)}`);
|
|
617
|
+
}
|
|
618
|
+
function mintEvaluationReceiptId(resultDigest) {
|
|
619
|
+
return evaluationReceiptIdFromDigest(resultDigest);
|
|
620
|
+
}
|
|
621
|
+
function featureRevisionIdFromDigest(digest) {
|
|
622
|
+
return featureRevisionIdSchema.parse(`fpr_${parseDigestHex(digest)}`);
|
|
623
|
+
}
|
|
624
|
+
function featurePlanIdFromEntropy(entropyHex) {
|
|
625
|
+
if (!WORKFLOW_ENTROPY_PATTERN.test(entropyHex)) {
|
|
626
|
+
throw new TypeError("Feature plan entropy must be exactly 128-bit lowercase hexadecimal");
|
|
627
|
+
}
|
|
628
|
+
return featurePlanIdSchema.parse(`fpl_${entropyHex}`);
|
|
629
|
+
}
|
|
630
|
+
function parseAnalysisPlanId(value) {
|
|
631
|
+
return analysisPlanIdSchema.parse(value);
|
|
632
|
+
}
|
|
633
|
+
function parseEvaluationReceiptId(value) {
|
|
634
|
+
return evaluationReceiptIdSchema.parse(value);
|
|
635
|
+
}
|
|
636
|
+
function parseFeaturePlanId(value) {
|
|
637
|
+
return featurePlanIdSchema.parse(value);
|
|
638
|
+
}
|
|
639
|
+
function parseFeatureRevisionId(value) {
|
|
640
|
+
return featureRevisionIdSchema.parse(value);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
// src/facts/integrity.ts
|
|
644
|
+
var CANONICAL_FACT_MAX_CONFLICTS_V1 = 1e3;
|
|
645
|
+
var CANONICAL_FACT_MAX_VALUES_PER_CONFLICT_V1 = 64;
|
|
646
|
+
var CANONICAL_FACT_MAX_PROVENANCE_PER_VALUE_V1 = 1e3;
|
|
647
|
+
var boundedString = z2.string().min(1).max(4096);
|
|
648
|
+
var unique = (values) => new Set(values).size === values.length;
|
|
649
|
+
var provenance = z2.array(boundedString).min(1).max(CANONICAL_FACT_MAX_PROVENANCE_PER_VALUE_V1).refine(unique, "provenance values must be unique");
|
|
650
|
+
var canonicalFactConflictValueV1Schema = z2.object({
|
|
651
|
+
valueDigest: digestHexStringSchema,
|
|
652
|
+
factIds: provenance,
|
|
653
|
+
totalFactIdCount: z2.number().int().positive().optional(),
|
|
654
|
+
analyzerIds: provenance,
|
|
655
|
+
totalAnalyzerIdCount: z2.number().int().positive().optional(),
|
|
656
|
+
evidenceRefs: provenance,
|
|
657
|
+
totalEvidenceRefCount: z2.number().int().positive().optional()
|
|
658
|
+
}).strict().superRefine((value, context) => {
|
|
659
|
+
for (const [path, total, retained] of [
|
|
660
|
+
["totalFactIdCount", value.totalFactIdCount, value.factIds.length],
|
|
661
|
+
["totalAnalyzerIdCount", value.totalAnalyzerIdCount, value.analyzerIds.length],
|
|
662
|
+
["totalEvidenceRefCount", value.totalEvidenceRefCount, value.evidenceRefs.length]
|
|
663
|
+
]) {
|
|
664
|
+
if (total !== void 0 && total < retained) {
|
|
665
|
+
context.addIssue({
|
|
666
|
+
code: z2.ZodIssueCode.custom,
|
|
667
|
+
path: [path],
|
|
668
|
+
message: `${path} cannot be smaller than retained provenance`
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
var canonicalFactConflictV1Schema = z2.object({
|
|
674
|
+
canonicalKey: boundedString,
|
|
675
|
+
factKind: boundedString,
|
|
676
|
+
state: z2.literal("conflict"),
|
|
677
|
+
values: z2.array(canonicalFactConflictValueV1Schema).min(2).max(CANONICAL_FACT_MAX_VALUES_PER_CONFLICT_V1).refine(
|
|
678
|
+
(values) => new Set(values.map((value) => value.valueDigest)).size === values.length,
|
|
679
|
+
"conflict values must have distinct material digests"
|
|
680
|
+
),
|
|
681
|
+
totalValueCount: z2.number().int().min(2).optional()
|
|
682
|
+
}).strict().superRefine((value, context) => {
|
|
683
|
+
if (value.totalValueCount !== void 0 && value.totalValueCount < value.values.length) {
|
|
684
|
+
context.addIssue({
|
|
685
|
+
code: z2.ZodIssueCode.custom,
|
|
686
|
+
path: ["totalValueCount"],
|
|
687
|
+
message: "totalValueCount cannot be smaller than retained values"
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
var canonicalFactIntegrityV1Schema = z2.union([
|
|
692
|
+
z2.object({
|
|
693
|
+
state: z2.literal("healthy"),
|
|
694
|
+
coalescedDuplicateCount: z2.number().int().nonnegative()
|
|
695
|
+
}).strict(),
|
|
696
|
+
z2.object({
|
|
697
|
+
state: z2.literal("conflict"),
|
|
698
|
+
coalescedDuplicateCount: z2.number().int().nonnegative(),
|
|
699
|
+
conflicts: z2.array(canonicalFactConflictV1Schema).min(1).max(CANONICAL_FACT_MAX_CONFLICTS_V1).refine(
|
|
700
|
+
(conflicts) => new Set(conflicts.map((conflict) => conflict.canonicalKey)).size === conflicts.length,
|
|
701
|
+
"canonical conflict keys must be unique"
|
|
702
|
+
),
|
|
703
|
+
totalConflictCount: z2.number().int().positive().optional()
|
|
704
|
+
}).strict().superRefine((value, context) => {
|
|
705
|
+
if (value.totalConflictCount !== void 0 && value.totalConflictCount < value.conflicts.length) {
|
|
706
|
+
context.addIssue({
|
|
707
|
+
code: z2.ZodIssueCode.custom,
|
|
708
|
+
path: ["totalConflictCount"],
|
|
709
|
+
message: "totalConflictCount cannot be smaller than retained conflicts"
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
})
|
|
713
|
+
]);
|
|
714
|
+
var sorted = (values) => [...values].sort();
|
|
715
|
+
function normalizeCanonicalFactIntegrityV1(value) {
|
|
716
|
+
const parsed = canonicalFactIntegrityV1Schema.parse(value);
|
|
717
|
+
if (parsed.state === "healthy") return parsed;
|
|
718
|
+
return {
|
|
719
|
+
...parsed,
|
|
720
|
+
totalConflictCount: parsed.totalConflictCount ?? parsed.conflicts.length,
|
|
721
|
+
conflicts: parsed.conflicts.map((conflict) => ({
|
|
722
|
+
...conflict,
|
|
723
|
+
totalValueCount: conflict.totalValueCount ?? conflict.values.length,
|
|
724
|
+
values: conflict.values.map((entry) => ({
|
|
725
|
+
...entry,
|
|
726
|
+
factIds: sorted(entry.factIds),
|
|
727
|
+
totalFactIdCount: entry.totalFactIdCount ?? entry.factIds.length,
|
|
728
|
+
analyzerIds: sorted(entry.analyzerIds),
|
|
729
|
+
totalAnalyzerIdCount: entry.totalAnalyzerIdCount ?? entry.analyzerIds.length,
|
|
730
|
+
evidenceRefs: sorted(entry.evidenceRefs),
|
|
731
|
+
totalEvidenceRefCount: entry.totalEvidenceRefCount ?? entry.evidenceRefs.length
|
|
732
|
+
})).sort((left, right) => compareCanonicalStrings(left.valueDigest, right.valueDigest))
|
|
733
|
+
})).sort((left, right) => compareCanonicalStrings(left.canonicalKey, right.canonicalKey))
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
|
|
553
737
|
// src/facts/ids.ts
|
|
554
738
|
function canonicalJson(value) {
|
|
739
|
+
return canonicalJsonValue(value, /* @__PURE__ */ new Set(), "(root)");
|
|
740
|
+
}
|
|
741
|
+
function canonicalJsonValue(value, ancestors, path) {
|
|
555
742
|
if (value === void 0) return "null";
|
|
556
|
-
if (value === null || typeof value
|
|
743
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") {
|
|
744
|
+
return JSON.stringify(value);
|
|
745
|
+
}
|
|
746
|
+
if (typeof value === "number") {
|
|
747
|
+
if (!Number.isFinite(value)) {
|
|
748
|
+
throw new TypeError(`Unsupported fact identity value at ${path}: non-finite number`);
|
|
749
|
+
}
|
|
750
|
+
const serialized = JSON.stringify(value);
|
|
751
|
+
if (serialized === void 0) {
|
|
752
|
+
throw new TypeError(`Unsupported fact identity value at ${path}: number`);
|
|
753
|
+
}
|
|
754
|
+
return serialized;
|
|
755
|
+
}
|
|
756
|
+
if (typeof value !== "object") {
|
|
757
|
+
throw new TypeError(`Unsupported fact identity value at ${path}: ${typeof value}`);
|
|
758
|
+
}
|
|
557
759
|
if (Array.isArray(value)) {
|
|
558
|
-
|
|
760
|
+
if (ancestors.has(value)) throw new TypeError(`Circular fact identity value at ${path}`);
|
|
761
|
+
ancestors.add(value);
|
|
762
|
+
try {
|
|
763
|
+
return `[${value.map((entry, index) => canonicalJsonValue(entry, ancestors, `${path}[${index}]`)).join(",")}]`;
|
|
764
|
+
} finally {
|
|
765
|
+
ancestors.delete(value);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
const prototype = Object.getPrototypeOf(value);
|
|
769
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
770
|
+
const objectType = prototype?.constructor?.name ?? "unknown";
|
|
771
|
+
throw new TypeError(`Unsupported fact identity object at ${path}: ${objectType}`);
|
|
559
772
|
}
|
|
773
|
+
if (ancestors.has(value)) throw new TypeError(`Circular fact identity value at ${path}`);
|
|
774
|
+
ancestors.add(value);
|
|
560
775
|
const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
561
|
-
|
|
776
|
+
try {
|
|
777
|
+
return `{${entries.map(
|
|
778
|
+
([key, entry]) => `${JSON.stringify(key)}:${canonicalJsonValue(entry, ancestors, `${path}.${key}`)}`
|
|
779
|
+
).join(",")}}`;
|
|
780
|
+
} finally {
|
|
781
|
+
ancestors.delete(value);
|
|
782
|
+
}
|
|
562
783
|
}
|
|
563
784
|
var FNV_PRIME = 16777619;
|
|
564
785
|
var FNV_SEED_A = 2166136261;
|
|
@@ -854,6 +1075,7 @@ function makeStyleCssVarsMustBeDefinedFact(input) {
|
|
|
854
1075
|
id: factId("style_css_vars_must_be_defined", {}),
|
|
855
1076
|
kind: "style_css_vars_must_be_defined",
|
|
856
1077
|
severity: input.severity,
|
|
1078
|
+
...input.configPath ? { configPath: input.configPath } : {},
|
|
857
1079
|
...policyExcludeField(input.exclude)
|
|
858
1080
|
};
|
|
859
1081
|
}
|
|
@@ -1267,11 +1489,14 @@ var FactIndex = class {
|
|
|
1267
1489
|
}
|
|
1268
1490
|
const existing = this.facts.get(fact.id);
|
|
1269
1491
|
if (existing) {
|
|
1270
|
-
|
|
1492
|
+
const differs = canonicalJson(logicalFactForComparison(existing)) !== canonicalJson(logicalFactForComparison(fact));
|
|
1493
|
+
if (differs) {
|
|
1271
1494
|
this.options.onConflict?.(
|
|
1272
1495
|
`FactIndex: conflicting facts for id ${fact.id} \u2014 keeping ${describeFactForConflict(existing)}, skipping ${describeFactForConflict(fact)}`,
|
|
1273
1496
|
{ kept: existing, skipped: fact }
|
|
1274
1497
|
);
|
|
1498
|
+
} else {
|
|
1499
|
+
this.options.onDuplicate?.({ kept: existing, duplicate: fact });
|
|
1275
1500
|
}
|
|
1276
1501
|
return;
|
|
1277
1502
|
}
|
|
@@ -1490,16 +1715,16 @@ function describeFactForConflict(fact) {
|
|
|
1490
1715
|
}
|
|
1491
1716
|
|
|
1492
1717
|
// src/governance.ts
|
|
1493
|
-
import { z as
|
|
1718
|
+
import { z as z4 } from "zod";
|
|
1494
1719
|
|
|
1495
1720
|
// src/policy-exclude.ts
|
|
1496
|
-
import { z } from "zod";
|
|
1497
|
-
var policyExcludeSchema =
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
glob:
|
|
1502
|
-
reason:
|
|
1721
|
+
import { z as z3 } from "zod";
|
|
1722
|
+
var policyExcludeSchema = z3.array(
|
|
1723
|
+
z3.union([
|
|
1724
|
+
z3.string().min(1),
|
|
1725
|
+
z3.object({
|
|
1726
|
+
glob: z3.string().min(1),
|
|
1727
|
+
reason: z3.string().min(1).optional()
|
|
1503
1728
|
})
|
|
1504
1729
|
])
|
|
1505
1730
|
);
|
|
@@ -1543,90 +1768,90 @@ function describePolicyExclude(scope, exclude) {
|
|
|
1543
1768
|
}
|
|
1544
1769
|
|
|
1545
1770
|
// src/governance.ts
|
|
1546
|
-
var governanceSeveritySchema =
|
|
1771
|
+
var governanceSeveritySchema = z4.enum(["error", "warn", "info"]);
|
|
1547
1772
|
var recordExcludeSchema = policyExcludeSchema.optional();
|
|
1548
|
-
var scaleGovernanceRecordSchema =
|
|
1549
|
-
kind:
|
|
1550
|
-
name:
|
|
1551
|
-
unit:
|
|
1552
|
-
values:
|
|
1553
|
-
rootFontSizePx:
|
|
1554
|
-
emBasePx:
|
|
1773
|
+
var scaleGovernanceRecordSchema = z4.object({
|
|
1774
|
+
kind: z4.literal("scale").default("scale"),
|
|
1775
|
+
name: z4.string().min(1).optional(),
|
|
1776
|
+
unit: z4.enum(["px", "rem"]),
|
|
1777
|
+
values: z4.array(z4.number()),
|
|
1778
|
+
rootFontSizePx: z4.number().positive().optional(),
|
|
1779
|
+
emBasePx: z4.number().positive().optional()
|
|
1555
1780
|
});
|
|
1556
|
-
var styleRawColorsForbidRecordSchema =
|
|
1557
|
-
kind:
|
|
1558
|
-
except:
|
|
1559
|
-
prefer:
|
|
1781
|
+
var styleRawColorsForbidRecordSchema = z4.object({
|
|
1782
|
+
kind: z4.literal("style.rawColors.forbid"),
|
|
1783
|
+
except: z4.array(z4.string()),
|
|
1784
|
+
prefer: z4.enum(["token", "css-variable"]),
|
|
1560
1785
|
severity: governanceSeveritySchema,
|
|
1561
1786
|
exclude: recordExcludeSchema
|
|
1562
1787
|
});
|
|
1563
|
-
var styleRawDimensionsForbidRecordSchema =
|
|
1564
|
-
kind:
|
|
1565
|
-
appliesTo:
|
|
1566
|
-
prefer:
|
|
1788
|
+
var styleRawDimensionsForbidRecordSchema = z4.object({
|
|
1789
|
+
kind: z4.literal("style.rawDimensions.forbid"),
|
|
1790
|
+
appliesTo: z4.array(z4.string().min(1)),
|
|
1791
|
+
prefer: z4.enum(["token", "css-variable"]),
|
|
1567
1792
|
severity: governanceSeveritySchema,
|
|
1568
1793
|
exclude: recordExcludeSchema
|
|
1569
1794
|
});
|
|
1570
|
-
var styleRawSpacingMustMatchScaleRecordSchema =
|
|
1571
|
-
kind:
|
|
1572
|
-
scale:
|
|
1573
|
-
appliesTo:
|
|
1795
|
+
var styleRawSpacingMustMatchScaleRecordSchema = z4.object({
|
|
1796
|
+
kind: z4.literal("style.rawSpacing.mustMatchScale"),
|
|
1797
|
+
scale: z4.string().min(1),
|
|
1798
|
+
appliesTo: z4.array(z4.string().min(1)),
|
|
1574
1799
|
severity: governanceSeveritySchema,
|
|
1575
1800
|
exclude: recordExcludeSchema
|
|
1576
1801
|
});
|
|
1577
|
-
var styleFontSizeMustMatchScaleRecordSchema =
|
|
1578
|
-
kind:
|
|
1579
|
-
scale:
|
|
1802
|
+
var styleFontSizeMustMatchScaleRecordSchema = z4.object({
|
|
1803
|
+
kind: z4.literal("style.fontSize.mustMatchScale"),
|
|
1804
|
+
scale: z4.string().min(1),
|
|
1580
1805
|
severity: governanceSeveritySchema,
|
|
1581
1806
|
exclude: recordExcludeSchema
|
|
1582
1807
|
});
|
|
1583
|
-
var styleCssVarsMustBeDefinedRecordSchema =
|
|
1584
|
-
kind:
|
|
1808
|
+
var styleCssVarsMustBeDefinedRecordSchema = z4.object({
|
|
1809
|
+
kind: z4.literal("style.cssVars.mustBeDefined"),
|
|
1585
1810
|
severity: governanceSeveritySchema,
|
|
1586
1811
|
exclude: recordExcludeSchema
|
|
1587
1812
|
});
|
|
1588
|
-
var globalStyleGovernanceRecordSchema =
|
|
1813
|
+
var globalStyleGovernanceRecordSchema = z4.discriminatedUnion("kind", [
|
|
1589
1814
|
styleRawColorsForbidRecordSchema,
|
|
1590
1815
|
styleRawDimensionsForbidRecordSchema,
|
|
1591
1816
|
styleRawSpacingMustMatchScaleRecordSchema,
|
|
1592
1817
|
styleFontSizeMustMatchScaleRecordSchema,
|
|
1593
1818
|
styleCssVarsMustBeDefinedRecordSchema
|
|
1594
1819
|
]);
|
|
1595
|
-
var jsxUnknownPropsForbidRecordSchema =
|
|
1596
|
-
kind:
|
|
1820
|
+
var jsxUnknownPropsForbidRecordSchema = z4.object({
|
|
1821
|
+
kind: z4.literal("jsx.unknownProps.forbid"),
|
|
1597
1822
|
severity: governanceSeveritySchema,
|
|
1598
1823
|
exclude: recordExcludeSchema
|
|
1599
1824
|
});
|
|
1600
|
-
var jsxInlineStyleForbidRawRecordSchema =
|
|
1601
|
-
kind:
|
|
1602
|
-
properties:
|
|
1825
|
+
var jsxInlineStyleForbidRawRecordSchema = z4.object({
|
|
1826
|
+
kind: z4.literal("jsx.inlineStyle.forbidRaw"),
|
|
1827
|
+
properties: z4.array(z4.string().min(1)),
|
|
1603
1828
|
severity: governanceSeveritySchema,
|
|
1604
1829
|
exclude: recordExcludeSchema
|
|
1605
1830
|
});
|
|
1606
|
-
var jsxImportPathPreferRecordSchema =
|
|
1607
|
-
kind:
|
|
1608
|
-
from:
|
|
1609
|
-
to:
|
|
1610
|
-
imported:
|
|
1611
|
-
because:
|
|
1831
|
+
var jsxImportPathPreferRecordSchema = z4.object({
|
|
1832
|
+
kind: z4.literal("jsx.importPath.prefer"),
|
|
1833
|
+
from: z4.string().min(1),
|
|
1834
|
+
to: z4.string().min(1),
|
|
1835
|
+
imported: z4.string().min(1).optional(),
|
|
1836
|
+
because: z4.string().optional(),
|
|
1612
1837
|
severity: governanceSeveritySchema,
|
|
1613
1838
|
exclude: recordExcludeSchema
|
|
1614
1839
|
});
|
|
1615
|
-
var jsxComponentPreferRecordSchema =
|
|
1616
|
-
kind:
|
|
1617
|
-
from:
|
|
1618
|
-
to:
|
|
1619
|
-
because:
|
|
1840
|
+
var jsxComponentPreferRecordSchema = z4.object({
|
|
1841
|
+
kind: z4.literal("jsx.component.prefer"),
|
|
1842
|
+
from: z4.string().min(1),
|
|
1843
|
+
to: z4.string().min(1),
|
|
1844
|
+
because: z4.string().optional(),
|
|
1620
1845
|
severity: governanceSeveritySchema,
|
|
1621
1846
|
exclude: recordExcludeSchema
|
|
1622
1847
|
});
|
|
1623
|
-
var globalJsxGovernanceRecordSchema =
|
|
1848
|
+
var globalJsxGovernanceRecordSchema = z4.discriminatedUnion("kind", [
|
|
1624
1849
|
jsxUnknownPropsForbidRecordSchema,
|
|
1625
1850
|
jsxInlineStyleForbidRawRecordSchema,
|
|
1626
1851
|
jsxImportPathPreferRecordSchema,
|
|
1627
1852
|
jsxComponentPreferRecordSchema
|
|
1628
1853
|
]);
|
|
1629
|
-
var globalGovernanceRecordSchema =
|
|
1854
|
+
var globalGovernanceRecordSchema = z4.discriminatedUnion("kind", [
|
|
1630
1855
|
scaleGovernanceRecordSchema,
|
|
1631
1856
|
styleRawColorsForbidRecordSchema,
|
|
1632
1857
|
styleRawDimensionsForbidRecordSchema,
|
|
@@ -1638,99 +1863,103 @@ var globalGovernanceRecordSchema = z2.discriminatedUnion("kind", [
|
|
|
1638
1863
|
jsxImportPathPreferRecordSchema,
|
|
1639
1864
|
jsxComponentPreferRecordSchema
|
|
1640
1865
|
]);
|
|
1641
|
-
var componentCapabilityRecordSchema =
|
|
1642
|
-
kind:
|
|
1643
|
-
capability:
|
|
1866
|
+
var componentCapabilityRecordSchema = z4.object({
|
|
1867
|
+
kind: z4.literal("capability"),
|
|
1868
|
+
capability: z4.string().min(1)
|
|
1644
1869
|
});
|
|
1645
|
-
var
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1870
|
+
var requiredComponentGovernanceValueSchema = z4.custom(
|
|
1871
|
+
(value) => value !== void 0,
|
|
1872
|
+
"Expected an explicitly present governance value"
|
|
1873
|
+
);
|
|
1874
|
+
var propValueAvoidRecordSchema = z4.object({
|
|
1875
|
+
kind: z4.literal("prop.value.avoid"),
|
|
1876
|
+
prop: z4.string().min(1),
|
|
1877
|
+
value: requiredComponentGovernanceValueSchema,
|
|
1878
|
+
because: z4.string(),
|
|
1879
|
+
suggest: z4.string().optional(),
|
|
1651
1880
|
severity: governanceSeveritySchema
|
|
1652
1881
|
});
|
|
1653
|
-
var propValueForbidRecordSchema =
|
|
1654
|
-
kind:
|
|
1655
|
-
prop:
|
|
1656
|
-
value:
|
|
1657
|
-
when:
|
|
1658
|
-
because:
|
|
1659
|
-
fix:
|
|
1882
|
+
var propValueForbidRecordSchema = z4.object({
|
|
1883
|
+
kind: z4.literal("prop.value.forbid"),
|
|
1884
|
+
prop: z4.string().min(1),
|
|
1885
|
+
value: requiredComponentGovernanceValueSchema,
|
|
1886
|
+
when: z4.object({ path: z4.string().min(1).optional() }).optional(),
|
|
1887
|
+
because: z4.string(),
|
|
1888
|
+
fix: z4.object({ replaceWith: requiredComponentGovernanceValueSchema }).optional(),
|
|
1660
1889
|
severity: governanceSeveritySchema
|
|
1661
1890
|
});
|
|
1662
|
-
var a11yRequireNameRecordSchema =
|
|
1663
|
-
kind:
|
|
1664
|
-
because:
|
|
1891
|
+
var a11yRequireNameRecordSchema = z4.object({
|
|
1892
|
+
kind: z4.literal("a11y.requireName"),
|
|
1893
|
+
because: z4.string(),
|
|
1665
1894
|
severity: governanceSeveritySchema
|
|
1666
1895
|
});
|
|
1667
|
-
var componentGovernanceRecordSchema =
|
|
1896
|
+
var componentGovernanceRecordSchema = z4.discriminatedUnion("kind", [
|
|
1668
1897
|
componentCapabilityRecordSchema,
|
|
1669
1898
|
propValueAvoidRecordSchema,
|
|
1670
1899
|
propValueForbidRecordSchema,
|
|
1671
1900
|
a11yRequireNameRecordSchema
|
|
1672
1901
|
]);
|
|
1673
|
-
var componentGovernanceRecordsSchema =
|
|
1674
|
-
var componentPolicyMatchSchema =
|
|
1675
|
-
componentKey:
|
|
1676
|
-
componentId:
|
|
1677
|
-
publicRef:
|
|
1678
|
-
importPath:
|
|
1679
|
-
sourcePath:
|
|
1680
|
-
path:
|
|
1681
|
-
exportName:
|
|
1682
|
-
export:
|
|
1683
|
-
name:
|
|
1684
|
-
scope:
|
|
1902
|
+
var componentGovernanceRecordsSchema = z4.array(componentGovernanceRecordSchema);
|
|
1903
|
+
var componentPolicyMatchSchema = z4.object({
|
|
1904
|
+
componentKey: z4.string().min(1).optional(),
|
|
1905
|
+
componentId: z4.string().min(1).optional(),
|
|
1906
|
+
publicRef: z4.string().min(1).optional(),
|
|
1907
|
+
importPath: z4.string().min(1).optional(),
|
|
1908
|
+
sourcePath: z4.string().min(1).optional(),
|
|
1909
|
+
path: z4.string().min(1).optional(),
|
|
1910
|
+
exportName: z4.string().min(1).optional(),
|
|
1911
|
+
export: z4.string().min(1).optional(),
|
|
1912
|
+
name: z4.string().min(1).optional(),
|
|
1913
|
+
scope: z4.enum(["one", "all"]).optional()
|
|
1685
1914
|
}).strict();
|
|
1686
|
-
var componentPolicyRecordSchema =
|
|
1915
|
+
var componentPolicyRecordSchema = z4.object({
|
|
1687
1916
|
rules: componentGovernanceRecordsSchema,
|
|
1688
|
-
status:
|
|
1917
|
+
status: z4.enum(["active", "draft", "disabled"]).optional()
|
|
1689
1918
|
}).strict();
|
|
1690
|
-
var componentPolicyOverrideSchema =
|
|
1919
|
+
var componentPolicyOverrideSchema = z4.object({
|
|
1691
1920
|
match: componentPolicyMatchSchema,
|
|
1692
1921
|
rules: componentGovernanceRecordsSchema,
|
|
1693
|
-
status:
|
|
1922
|
+
status: z4.enum(["active", "draft", "disabled"]).optional()
|
|
1694
1923
|
}).strict();
|
|
1695
|
-
var canonicalSourcePathSchema =
|
|
1924
|
+
var canonicalSourcePathSchema = z4.string().min(1).superRefine((value, ctx) => {
|
|
1696
1925
|
const error = portableRepoPathError(value);
|
|
1697
1926
|
if (error) {
|
|
1698
|
-
ctx.addIssue({ code:
|
|
1927
|
+
ctx.addIssue({ code: z4.ZodIssueCode.custom, message: error });
|
|
1699
1928
|
}
|
|
1700
1929
|
});
|
|
1701
|
-
var canonicalSourceRegistryHashSchema =
|
|
1702
|
-
var canonicalBridgeModuleSpecifierSchema =
|
|
1930
|
+
var canonicalSourceRegistryHashSchema = z4.string().regex(/^[0-9a-f]{64}$/);
|
|
1931
|
+
var canonicalBridgeModuleSpecifierSchema = z4.string().min(1).superRefine((value, ctx) => {
|
|
1703
1932
|
const normalized = value.replace(/\\/gu, "/");
|
|
1704
1933
|
if (normalized.startsWith("/") || /^[A-Za-z]:\//u.test(normalized)) {
|
|
1705
1934
|
ctx.addIssue({
|
|
1706
|
-
code:
|
|
1935
|
+
code: z4.ZodIssueCode.custom,
|
|
1707
1936
|
message: "Canonical bridge moduleSpecifier must be a portable import specifier"
|
|
1708
1937
|
});
|
|
1709
1938
|
}
|
|
1710
1939
|
if (normalized.split("/").includes("..")) {
|
|
1711
1940
|
ctx.addIssue({
|
|
1712
|
-
code:
|
|
1941
|
+
code: z4.ZodIssueCode.custom,
|
|
1713
1942
|
message: "Canonical bridge moduleSpecifier must not traverse outside the project"
|
|
1714
1943
|
});
|
|
1715
1944
|
}
|
|
1716
1945
|
});
|
|
1717
|
-
var canonicalBridgeV1Schema =
|
|
1718
|
-
underlying:
|
|
1719
|
-
packageName:
|
|
1720
|
-
exportName:
|
|
1946
|
+
var canonicalBridgeV1Schema = z4.object({
|
|
1947
|
+
underlying: z4.object({
|
|
1948
|
+
packageName: z4.string().min(1),
|
|
1949
|
+
exportName: z4.string().min(1)
|
|
1721
1950
|
}).strict(),
|
|
1722
|
-
local:
|
|
1723
|
-
componentKey:
|
|
1951
|
+
local: z4.object({
|
|
1952
|
+
componentKey: z4.string().min(1),
|
|
1724
1953
|
moduleSpecifier: canonicalBridgeModuleSpecifierSchema,
|
|
1725
|
-
exportName:
|
|
1726
|
-
implementationFiles:
|
|
1954
|
+
exportName: z4.string().min(1),
|
|
1955
|
+
implementationFiles: z4.array(canonicalSourcePathSchema).min(1)
|
|
1727
1956
|
}).strict(),
|
|
1728
|
-
decision:
|
|
1729
|
-
state:
|
|
1730
|
-
source:
|
|
1957
|
+
decision: z4.object({
|
|
1958
|
+
state: z4.literal("confirmed"),
|
|
1959
|
+
source: z4.enum(["authored", "migration"])
|
|
1731
1960
|
}).strict()
|
|
1732
1961
|
}).strict();
|
|
1733
|
-
var canonicalBridgesV1Schema =
|
|
1962
|
+
var canonicalBridgesV1Schema = z4.array(canonicalBridgeV1Schema).superRefine((bridges, ctx) => {
|
|
1734
1963
|
const underlying = /* @__PURE__ */ new Map();
|
|
1735
1964
|
const componentKeys = /* @__PURE__ */ new Map();
|
|
1736
1965
|
for (const [index, bridge] of bridges.entries()) {
|
|
@@ -1738,7 +1967,7 @@ var canonicalBridgesV1Schema = z2.array(canonicalBridgeV1Schema).superRefine((br
|
|
|
1738
1967
|
const previousUnderlying = underlying.get(underlyingKey);
|
|
1739
1968
|
if (previousUnderlying !== void 0) {
|
|
1740
1969
|
ctx.addIssue({
|
|
1741
|
-
code:
|
|
1970
|
+
code: z4.ZodIssueCode.custom,
|
|
1742
1971
|
message: `Duplicate confirmed bridge target for ${bridge.underlying.packageName}#${bridge.underlying.exportName} (also at canonicalBridges.${previousUnderlying})`,
|
|
1743
1972
|
path: [index, "underlying"]
|
|
1744
1973
|
});
|
|
@@ -1748,7 +1977,7 @@ var canonicalBridgesV1Schema = z2.array(canonicalBridgeV1Schema).superRefine((br
|
|
|
1748
1977
|
const previousComponent = componentKeys.get(bridge.local.componentKey);
|
|
1749
1978
|
if (previousComponent !== void 0) {
|
|
1750
1979
|
ctx.addIssue({
|
|
1751
|
-
code:
|
|
1980
|
+
code: z4.ZodIssueCode.custom,
|
|
1752
1981
|
message: `Local component key overlaps canonicalBridges.${previousComponent}`,
|
|
1753
1982
|
path: [index, "local", "componentKey"]
|
|
1754
1983
|
});
|
|
@@ -1757,65 +1986,65 @@ var canonicalBridgesV1Schema = z2.array(canonicalBridgeV1Schema).superRefine((br
|
|
|
1757
1986
|
}
|
|
1758
1987
|
}
|
|
1759
1988
|
});
|
|
1760
|
-
var canonicalSourceSchema =
|
|
1761
|
-
|
|
1762
|
-
kind:
|
|
1763
|
-
specifier:
|
|
1764
|
-
implementationPath:
|
|
1765
|
-
include:
|
|
1766
|
-
exclude:
|
|
1989
|
+
var canonicalSourceSchema = z4.discriminatedUnion("kind", [
|
|
1990
|
+
z4.object({
|
|
1991
|
+
kind: z4.literal("npm"),
|
|
1992
|
+
specifier: z4.string().min(1),
|
|
1993
|
+
implementationPath: z4.string().min(1).optional(),
|
|
1994
|
+
include: z4.array(z4.string().min(1)).optional(),
|
|
1995
|
+
exclude: z4.array(z4.string().min(1)).optional()
|
|
1767
1996
|
}),
|
|
1768
|
-
|
|
1769
|
-
kind:
|
|
1770
|
-
path:
|
|
1771
|
-
include:
|
|
1772
|
-
exclude:
|
|
1997
|
+
z4.object({
|
|
1998
|
+
kind: z4.literal("directory"),
|
|
1999
|
+
path: z4.string().min(1),
|
|
2000
|
+
include: z4.array(z4.string().min(1)).optional(),
|
|
2001
|
+
exclude: z4.array(z4.string().min(1)).optional()
|
|
1773
2002
|
}),
|
|
1774
|
-
|
|
1775
|
-
kind:
|
|
1776
|
-
registryId:
|
|
2003
|
+
z4.object({
|
|
2004
|
+
kind: z4.literal("registry"),
|
|
2005
|
+
registryId: z4.string().min(1),
|
|
1777
2006
|
registryHash: canonicalSourceRegistryHashSchema.optional(),
|
|
1778
2007
|
receiptPath: canonicalSourcePathSchema.default(".fragments/registry-lock.json"),
|
|
1779
2008
|
installPath: canonicalSourcePathSchema,
|
|
1780
|
-
importPath:
|
|
1781
|
-
include:
|
|
1782
|
-
exclude:
|
|
2009
|
+
importPath: z4.string().min(1).optional(),
|
|
2010
|
+
include: z4.array(z4.string().min(1)).optional(),
|
|
2011
|
+
exclude: z4.array(z4.string().min(1)).optional(),
|
|
1783
2012
|
severity: governanceSeveritySchema.optional()
|
|
1784
2013
|
})
|
|
1785
2014
|
]);
|
|
1786
|
-
var governanceConfigSchema =
|
|
1787
|
-
extends:
|
|
2015
|
+
var governanceConfigSchema = z4.object({
|
|
2016
|
+
extends: z4.array(z4.string()).optional(),
|
|
1788
2017
|
severity: governanceSeveritySchema.optional(),
|
|
1789
|
-
rules:
|
|
1790
|
-
agents:
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
rules:
|
|
2018
|
+
rules: z4.record(z4.string(), z4.unknown()).optional(),
|
|
2019
|
+
agents: z4.record(
|
|
2020
|
+
z4.string(),
|
|
2021
|
+
z4.object({
|
|
2022
|
+
rules: z4.record(z4.string(), z4.unknown()).optional()
|
|
1794
2023
|
}).passthrough()
|
|
1795
2024
|
).optional(),
|
|
1796
|
-
audit:
|
|
1797
|
-
runners:
|
|
1798
|
-
canonicalSources:
|
|
2025
|
+
audit: z4.object({}).passthrough().optional(),
|
|
2026
|
+
runners: z4.record(z4.string(), z4.object({}).passthrough()).optional(),
|
|
2027
|
+
canonicalSources: z4.array(canonicalSourceSchema).optional(),
|
|
1799
2028
|
canonicalBridges: canonicalBridgesV1Schema.optional(),
|
|
1800
|
-
presets:
|
|
1801
|
-
scales:
|
|
1802
|
-
styles:
|
|
1803
|
-
jsx:
|
|
1804
|
-
tailwind:
|
|
1805
|
-
palette:
|
|
1806
|
-
allow:
|
|
1807
|
-
deny:
|
|
2029
|
+
presets: z4.array(z4.string()).optional(),
|
|
2030
|
+
scales: z4.record(z4.string(), scaleGovernanceRecordSchema).optional(),
|
|
2031
|
+
styles: z4.array(globalStyleGovernanceRecordSchema).optional(),
|
|
2032
|
+
jsx: z4.array(globalJsxGovernanceRecordSchema).optional(),
|
|
2033
|
+
tailwind: z4.object({
|
|
2034
|
+
palette: z4.object({
|
|
2035
|
+
allow: z4.array(z4.string().min(1)).optional(),
|
|
2036
|
+
deny: z4.array(z4.string().min(1)).optional()
|
|
1808
2037
|
}).optional()
|
|
1809
2038
|
}).passthrough().optional(),
|
|
1810
|
-
agent:
|
|
1811
|
-
repairOrder:
|
|
2039
|
+
agent: z4.object({
|
|
2040
|
+
repairOrder: z4.array(z4.string().min(1)).optional()
|
|
1812
2041
|
}).passthrough().optional(),
|
|
1813
|
-
components:
|
|
1814
|
-
overrides:
|
|
1815
|
-
ci:
|
|
1816
|
-
failOnWarnings:
|
|
1817
|
-
failOnInert:
|
|
1818
|
-
failOnAdoptionRegression:
|
|
2042
|
+
components: z4.record(componentPolicyRecordSchema).optional(),
|
|
2043
|
+
overrides: z4.array(componentPolicyOverrideSchema).optional(),
|
|
2044
|
+
ci: z4.object({
|
|
2045
|
+
failOnWarnings: z4.boolean().optional(),
|
|
2046
|
+
failOnInert: z4.boolean().optional(),
|
|
2047
|
+
failOnAdoptionRegression: z4.boolean().optional()
|
|
1819
2048
|
}).passthrough().optional()
|
|
1820
2049
|
}).strict();
|
|
1821
2050
|
var PRESET_SOURCED_RULE = /* @__PURE__ */ Symbol.for("@usefragments/core:preset-sourced-rule");
|
|
@@ -1881,6 +2110,17 @@ function resolveComponentGovernance(definition) {
|
|
|
1881
2110
|
const records = definition.govern ? definition.govern(builder) : definition.governance ?? [];
|
|
1882
2111
|
return componentGovernanceRecordsSchema.parse(records);
|
|
1883
2112
|
}
|
|
2113
|
+
function resolveGovernanceRecordsForIdentity(definition) {
|
|
2114
|
+
if (!definition) return void 0;
|
|
2115
|
+
if (Array.isArray(definition.governance)) {
|
|
2116
|
+
return componentGovernanceRecordsSchema.parse(definition.governance);
|
|
2117
|
+
}
|
|
2118
|
+
if (typeof definition.govern === "function") {
|
|
2119
|
+
const builder = createComponentGovernanceBuilder();
|
|
2120
|
+
return componentGovernanceRecordsSchema.parse(definition.govern(builder));
|
|
2121
|
+
}
|
|
2122
|
+
return void 0;
|
|
2123
|
+
}
|
|
1884
2124
|
function normalizeGovernanceConfig(config) {
|
|
1885
2125
|
if (!config.govern?.scales) {
|
|
1886
2126
|
return config;
|
|
@@ -2040,6 +2280,10 @@ function recordExclude(record) {
|
|
|
2040
2280
|
const exclude = normalizePolicyExcludes(record.exclude);
|
|
2041
2281
|
return exclude ? { exclude } : {};
|
|
2042
2282
|
}
|
|
2283
|
+
function cssVarsConfigPathField(style) {
|
|
2284
|
+
const value = style.configPath;
|
|
2285
|
+
return typeof value === "string" && value.length > 0 ? { configPath: value } : {};
|
|
2286
|
+
}
|
|
2043
2287
|
function unionExcludesBySharedFactId(facts) {
|
|
2044
2288
|
const byId = /* @__PURE__ */ new Map();
|
|
2045
2289
|
for (const fact of facts) {
|
|
@@ -2126,7 +2370,8 @@ function compileGlobalGovernanceFacts(govern) {
|
|
|
2126
2370
|
out.push(
|
|
2127
2371
|
makeStyleCssVarsMustBeDefinedFact({
|
|
2128
2372
|
severity: style.severity,
|
|
2129
|
-
...recordExclude(style)
|
|
2373
|
+
...recordExclude(style),
|
|
2374
|
+
...cssVarsConfigPathField(style)
|
|
2130
2375
|
})
|
|
2131
2376
|
);
|
|
2132
2377
|
break;
|
|
@@ -2265,14 +2510,19 @@ function compileRuleConfigFacts(govern) {
|
|
|
2265
2510
|
const rules = govern.rules;
|
|
2266
2511
|
if (!rules && !govern.canonicalSources?.length) return [];
|
|
2267
2512
|
const configs = /* @__PURE__ */ new Map();
|
|
2513
|
+
for (const [ruleId, value] of Object.entries(rules ?? {})) {
|
|
2514
|
+
configs.set(ruleId, ruleConfigFromValue(value, govern.severity ?? "warn"));
|
|
2515
|
+
}
|
|
2268
2516
|
for (const [ruleId, value] of Object.entries(rules ?? {})) {
|
|
2269
2517
|
const family = RULE_FAMILY_MEMBERS[ruleId];
|
|
2270
2518
|
if (!family) continue;
|
|
2519
|
+
const aggregateIsPreset = isPresetSourcedRule(value);
|
|
2271
2520
|
const config = ruleConfigFromValue(value, govern.severity ?? "warn");
|
|
2272
|
-
for (const memberRuleId of family)
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2521
|
+
for (const memberRuleId of family) {
|
|
2522
|
+
const member = rules?.[memberRuleId];
|
|
2523
|
+
if (member !== void 0 && (aggregateIsPreset || !isPresetSourcedRule(member))) continue;
|
|
2524
|
+
configs.set(memberRuleId, config);
|
|
2525
|
+
}
|
|
2276
2526
|
}
|
|
2277
2527
|
if (govern.canonicalSources?.length) {
|
|
2278
2528
|
for (const ruleId of ["components/prefer-library", "components/shadow-component"]) {
|
|
@@ -2424,244 +2674,244 @@ function compileComponentGovernanceRecord(componentId2, record) {
|
|
|
2424
2674
|
}
|
|
2425
2675
|
|
|
2426
2676
|
// src/schemas/index.ts
|
|
2427
|
-
import { z as
|
|
2428
|
-
var evidenceGradeSchema =
|
|
2677
|
+
import { z as z5 } from "zod";
|
|
2678
|
+
var evidenceGradeSchema = z5.enum([
|
|
2429
2679
|
"none",
|
|
2430
2680
|
"runtime_advisory",
|
|
2431
2681
|
"provenance_bound",
|
|
2432
2682
|
"source_backed",
|
|
2433
2683
|
"receipt_backed"
|
|
2434
2684
|
]);
|
|
2435
|
-
var factLocationSchema =
|
|
2436
|
-
file:
|
|
2437
|
-
line:
|
|
2438
|
-
column:
|
|
2439
|
-
endLine:
|
|
2440
|
-
endColumn:
|
|
2685
|
+
var factLocationSchema = z5.object({
|
|
2686
|
+
file: z5.string(),
|
|
2687
|
+
line: z5.number().int().nonnegative(),
|
|
2688
|
+
column: z5.number().int().nonnegative(),
|
|
2689
|
+
endLine: z5.number().int().nonnegative().optional(),
|
|
2690
|
+
endColumn: z5.number().int().nonnegative().optional()
|
|
2441
2691
|
});
|
|
2442
|
-
var findingReplacePropValueFixSchema =
|
|
2443
|
-
kind:
|
|
2444
|
-
title:
|
|
2445
|
-
prop:
|
|
2446
|
-
value:
|
|
2447
|
-
deterministic:
|
|
2692
|
+
var findingReplacePropValueFixSchema = z5.object({
|
|
2693
|
+
kind: z5.literal("replacePropValue"),
|
|
2694
|
+
title: z5.string(),
|
|
2695
|
+
prop: z5.string(),
|
|
2696
|
+
value: z5.unknown(),
|
|
2697
|
+
deterministic: z5.boolean().optional()
|
|
2448
2698
|
});
|
|
2449
|
-
var findingReplaceStyleValueFixSchema =
|
|
2450
|
-
kind:
|
|
2451
|
-
title:
|
|
2452
|
-
property:
|
|
2453
|
-
value:
|
|
2454
|
-
deterministic:
|
|
2699
|
+
var findingReplaceStyleValueFixSchema = z5.object({
|
|
2700
|
+
kind: z5.literal("replaceStyleValue"),
|
|
2701
|
+
title: z5.string(),
|
|
2702
|
+
property: z5.string(),
|
|
2703
|
+
value: z5.string(),
|
|
2704
|
+
deterministic: z5.boolean().optional()
|
|
2455
2705
|
});
|
|
2456
|
-
var findingReplaceImportFixSchema =
|
|
2457
|
-
kind:
|
|
2458
|
-
title:
|
|
2459
|
-
from:
|
|
2460
|
-
to:
|
|
2461
|
-
deterministic:
|
|
2706
|
+
var findingReplaceImportFixSchema = z5.object({
|
|
2707
|
+
kind: z5.literal("replaceImport"),
|
|
2708
|
+
title: z5.string(),
|
|
2709
|
+
from: z5.string(),
|
|
2710
|
+
to: z5.string(),
|
|
2711
|
+
deterministic: z5.boolean().optional()
|
|
2462
2712
|
});
|
|
2463
|
-
var findingReplaceComponentFixSchema =
|
|
2464
|
-
kind:
|
|
2465
|
-
title:
|
|
2466
|
-
from:
|
|
2467
|
-
to:
|
|
2468
|
-
deterministic:
|
|
2713
|
+
var findingReplaceComponentFixSchema = z5.object({
|
|
2714
|
+
kind: z5.literal("replaceComponent"),
|
|
2715
|
+
title: z5.string(),
|
|
2716
|
+
from: z5.string(),
|
|
2717
|
+
to: z5.string(),
|
|
2718
|
+
deterministic: z5.boolean().optional()
|
|
2469
2719
|
});
|
|
2470
|
-
var findingReplaceClassTokenFixSchema =
|
|
2471
|
-
kind:
|
|
2472
|
-
title:
|
|
2473
|
-
from:
|
|
2474
|
-
to:
|
|
2475
|
-
utility:
|
|
2476
|
-
deterministic:
|
|
2720
|
+
var findingReplaceClassTokenFixSchema = z5.object({
|
|
2721
|
+
kind: z5.literal("replaceClassToken"),
|
|
2722
|
+
title: z5.string(),
|
|
2723
|
+
from: z5.string(),
|
|
2724
|
+
to: z5.string().nullable(),
|
|
2725
|
+
utility: z5.string(),
|
|
2726
|
+
deterministic: z5.boolean().optional()
|
|
2477
2727
|
});
|
|
2478
|
-
var findingFixSchema =
|
|
2728
|
+
var findingFixSchema = z5.discriminatedUnion("kind", [
|
|
2479
2729
|
findingReplacePropValueFixSchema,
|
|
2480
2730
|
findingReplaceStyleValueFixSchema,
|
|
2481
2731
|
findingReplaceImportFixSchema,
|
|
2482
2732
|
findingReplaceComponentFixSchema,
|
|
2483
2733
|
findingReplaceClassTokenFixSchema
|
|
2484
2734
|
]);
|
|
2485
|
-
var factEvidenceSchema =
|
|
2486
|
-
factId:
|
|
2487
|
-
fact:
|
|
2488
|
-
kind:
|
|
2735
|
+
var factEvidenceSchema = z5.object({
|
|
2736
|
+
factId: z5.string(),
|
|
2737
|
+
fact: z5.object({
|
|
2738
|
+
kind: z5.string(),
|
|
2489
2739
|
location: factLocationSchema.optional()
|
|
2490
2740
|
}).passthrough()
|
|
2491
2741
|
});
|
|
2492
|
-
var findingSchema =
|
|
2493
|
-
ruleId:
|
|
2494
|
-
ruleVersion:
|
|
2742
|
+
var findingSchema = z5.object({
|
|
2743
|
+
ruleId: z5.string(),
|
|
2744
|
+
ruleVersion: z5.string(),
|
|
2495
2745
|
severity: severitySchema,
|
|
2496
2746
|
level: severityLevelSchema,
|
|
2497
|
-
code:
|
|
2498
|
-
helpUrl:
|
|
2499
|
-
message:
|
|
2500
|
-
fingerprint:
|
|
2747
|
+
code: z5.string().regex(/^FUI\d{4}$/).optional(),
|
|
2748
|
+
helpUrl: z5.string().url().optional(),
|
|
2749
|
+
message: z5.string(),
|
|
2750
|
+
fingerprint: z5.string(),
|
|
2501
2751
|
/**
|
|
2502
2752
|
* Fingerprint this finding carried before a fingerprint-identity migration.
|
|
2503
2753
|
* Emitted only by migrated rules during the grace window so baseline
|
|
2504
2754
|
* records keyed on the legacy hash keep matching instead of churning.
|
|
2505
2755
|
*/
|
|
2506
|
-
previousFingerprint:
|
|
2756
|
+
previousFingerprint: z5.string().optional(),
|
|
2507
2757
|
location: factLocationSchema,
|
|
2508
|
-
evidence:
|
|
2758
|
+
evidence: z5.array(factEvidenceSchema).min(1),
|
|
2509
2759
|
evidenceGrade: evidenceGradeSchema.optional(),
|
|
2510
2760
|
fix: findingFixSchema.optional(),
|
|
2511
|
-
attributes:
|
|
2761
|
+
attributes: z5.record(z5.unknown()).optional(),
|
|
2512
2762
|
/**
|
|
2513
2763
|
* Product area this finding's file resolved to (topology layer). Optional —
|
|
2514
2764
|
* absent when the repo has no `topology` config. See `topology/resolve-area`.
|
|
2515
2765
|
*/
|
|
2516
|
-
area:
|
|
2517
|
-
areaId:
|
|
2518
|
-
areaName:
|
|
2519
|
-
criticality:
|
|
2520
|
-
owners:
|
|
2521
|
-
matchedGlob:
|
|
2766
|
+
area: z5.object({
|
|
2767
|
+
areaId: z5.string(),
|
|
2768
|
+
areaName: z5.string(),
|
|
2769
|
+
criticality: z5.enum(["low", "medium", "high", "revenue", "regulated"]),
|
|
2770
|
+
owners: z5.array(z5.string()),
|
|
2771
|
+
matchedGlob: z5.string()
|
|
2522
2772
|
}).optional()
|
|
2523
2773
|
});
|
|
2524
|
-
var violationSchema =
|
|
2525
|
-
nodeId:
|
|
2526
|
-
nodeType:
|
|
2527
|
-
rule:
|
|
2774
|
+
var violationSchema = z5.object({
|
|
2775
|
+
nodeId: z5.string(),
|
|
2776
|
+
nodeType: z5.string(),
|
|
2777
|
+
rule: z5.string(),
|
|
2528
2778
|
severity: severitySchema,
|
|
2529
2779
|
level: severityLevelSchema.optional(),
|
|
2530
|
-
code:
|
|
2531
|
-
helpUrl:
|
|
2532
|
-
message:
|
|
2533
|
-
path:
|
|
2534
|
-
suggestion:
|
|
2535
|
-
prop:
|
|
2536
|
-
filePath:
|
|
2537
|
-
line:
|
|
2538
|
-
column:
|
|
2539
|
-
rawValue:
|
|
2540
|
-
extra:
|
|
2780
|
+
code: z5.string().regex(/^FUI\d{4}$/).optional(),
|
|
2781
|
+
helpUrl: z5.string().url().optional(),
|
|
2782
|
+
message: z5.string(),
|
|
2783
|
+
path: z5.string().optional(),
|
|
2784
|
+
suggestion: z5.string().optional(),
|
|
2785
|
+
prop: z5.string().optional(),
|
|
2786
|
+
filePath: z5.string().optional(),
|
|
2787
|
+
line: z5.number().int().nonnegative().optional(),
|
|
2788
|
+
column: z5.number().int().nonnegative().optional(),
|
|
2789
|
+
rawValue: z5.string().optional(),
|
|
2790
|
+
extra: z5.record(z5.unknown()).optional()
|
|
2541
2791
|
});
|
|
2542
|
-
var fixSchema =
|
|
2543
|
-
nodeId:
|
|
2544
|
-
prop:
|
|
2545
|
-
action:
|
|
2546
|
-
value:
|
|
2547
|
-
description:
|
|
2792
|
+
var fixSchema = z5.object({
|
|
2793
|
+
nodeId: z5.string(),
|
|
2794
|
+
prop: z5.string().optional(),
|
|
2795
|
+
action: z5.enum(["remove", "replace", "add"]),
|
|
2796
|
+
value: z5.unknown().optional(),
|
|
2797
|
+
description: z5.string()
|
|
2548
2798
|
});
|
|
2549
|
-
var validatorResultSchema =
|
|
2550
|
-
validator:
|
|
2799
|
+
var validatorResultSchema = z5.object({
|
|
2800
|
+
validator: z5.string(),
|
|
2551
2801
|
severity: severitySchema,
|
|
2552
|
-
passed:
|
|
2553
|
-
violations:
|
|
2554
|
-
findings:
|
|
2555
|
-
suggestions:
|
|
2802
|
+
passed: z5.boolean(),
|
|
2803
|
+
violations: z5.array(violationSchema),
|
|
2804
|
+
findings: z5.array(findingSchema).optional(),
|
|
2805
|
+
suggestions: z5.array(fixSchema).optional()
|
|
2556
2806
|
});
|
|
2557
|
-
var governanceVerdictMetadataSchema =
|
|
2558
|
-
runner:
|
|
2559
|
-
policyVersion:
|
|
2560
|
-
duration:
|
|
2561
|
-
nodeCount:
|
|
2562
|
-
componentTypes:
|
|
2807
|
+
var governanceVerdictMetadataSchema = z5.object({
|
|
2808
|
+
runner: z5.string(),
|
|
2809
|
+
policyVersion: z5.string().optional(),
|
|
2810
|
+
duration: z5.number().nonnegative(),
|
|
2811
|
+
nodeCount: z5.number().int().nonnegative(),
|
|
2812
|
+
componentTypes: z5.array(z5.string())
|
|
2563
2813
|
});
|
|
2564
|
-
var governanceVerdictSchema =
|
|
2565
|
-
verdict:
|
|
2566
|
-
passed:
|
|
2567
|
-
score:
|
|
2568
|
-
results:
|
|
2814
|
+
var governanceVerdictSchema = z5.object({
|
|
2815
|
+
verdict: z5.enum(["pass", "warn", "fail"]).optional(),
|
|
2816
|
+
passed: z5.boolean(),
|
|
2817
|
+
score: z5.number(),
|
|
2818
|
+
results: z5.array(validatorResultSchema),
|
|
2569
2819
|
metadata: governanceVerdictMetadataSchema
|
|
2570
2820
|
});
|
|
2571
|
-
var suppressionDirectiveSchema =
|
|
2572
|
-
ruleId:
|
|
2573
|
-
reason:
|
|
2574
|
-
expiresAt:
|
|
2575
|
-
expiresOn:
|
|
2576
|
-
scope:
|
|
2577
|
-
code:
|
|
2821
|
+
var suppressionDirectiveSchema = z5.object({
|
|
2822
|
+
ruleId: z5.string().optional(),
|
|
2823
|
+
reason: z5.string().min(1),
|
|
2824
|
+
expiresAt: z5.string().datetime().optional(),
|
|
2825
|
+
expiresOn: z5.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(),
|
|
2826
|
+
scope: z5.enum(["line", "block", "file"]).default("line"),
|
|
2827
|
+
code: z5.string().regex(/^FUI\d{4}$/).optional()
|
|
2578
2828
|
});
|
|
2579
|
-
var agentPlanSchema =
|
|
2580
|
-
tool:
|
|
2829
|
+
var agentPlanSchema = z5.object({
|
|
2830
|
+
tool: z5.enum([
|
|
2581
2831
|
"design_system/list_primitives",
|
|
2582
2832
|
"design_system/conform",
|
|
2583
2833
|
"design_system/prove_compliant"
|
|
2584
2834
|
]),
|
|
2585
|
-
args:
|
|
2586
|
-
confidence:
|
|
2835
|
+
args: z5.record(z5.unknown()),
|
|
2836
|
+
confidence: z5.number().min(0).max(1)
|
|
2587
2837
|
});
|
|
2588
|
-
var agentFindingSchema =
|
|
2589
|
-
code:
|
|
2590
|
-
ruleId:
|
|
2591
|
-
filePath:
|
|
2592
|
-
line:
|
|
2593
|
-
col:
|
|
2838
|
+
var agentFindingSchema = z5.object({
|
|
2839
|
+
code: z5.string().regex(/^FUI\d{4}$/).optional(),
|
|
2840
|
+
ruleId: z5.string(),
|
|
2841
|
+
filePath: z5.string(),
|
|
2842
|
+
line: z5.number().int().nonnegative(),
|
|
2843
|
+
col: z5.number().int().nonnegative(),
|
|
2594
2844
|
severity: severitySchema,
|
|
2595
2845
|
level: severityLevelSchema,
|
|
2596
|
-
message:
|
|
2846
|
+
message: z5.string(),
|
|
2597
2847
|
evidenceGrade: evidenceGradeSchema.optional(),
|
|
2598
|
-
evidence:
|
|
2848
|
+
evidence: z5.array(factEvidenceSchema),
|
|
2599
2849
|
plan: agentPlanSchema
|
|
2600
2850
|
});
|
|
2601
2851
|
var AGENT_FORMAT_SCHEMA_VERSION = "typestyle.agent.v2";
|
|
2602
|
-
var agentIntegritySchema =
|
|
2603
|
-
rulesLoaded:
|
|
2604
|
-
status:
|
|
2605
|
-
healthy:
|
|
2606
|
-
inert:
|
|
2607
|
-
reasons:
|
|
2852
|
+
var agentIntegritySchema = z5.object({
|
|
2853
|
+
rulesLoaded: z5.number().int().nonnegative(),
|
|
2854
|
+
status: z5.enum(["healthy", "degraded", "inert"]),
|
|
2855
|
+
healthy: z5.boolean(),
|
|
2856
|
+
inert: z5.boolean(),
|
|
2857
|
+
reasons: z5.array(z5.string())
|
|
2608
2858
|
});
|
|
2609
|
-
var agentRunProvenanceSchema =
|
|
2610
|
-
runId:
|
|
2611
|
-
fcid:
|
|
2612
|
-
baselineId:
|
|
2613
|
-
scope:
|
|
2614
|
-
method:
|
|
2615
|
-
gitOk:
|
|
2859
|
+
var agentRunProvenanceSchema = z5.object({
|
|
2860
|
+
runId: z5.string().regex(/^run_[a-f0-9]{12}$/),
|
|
2861
|
+
fcid: z5.string().min(1),
|
|
2862
|
+
baselineId: z5.string().min(1).optional(),
|
|
2863
|
+
scope: z5.object({
|
|
2864
|
+
method: z5.enum(["three-dot", "tree-diff", "status", "fallback-full", "explicit", "full"]),
|
|
2865
|
+
gitOk: z5.boolean()
|
|
2616
2866
|
}),
|
|
2617
|
-
engineVersion:
|
|
2618
|
-
scopeHash:
|
|
2619
|
-
inputsHash:
|
|
2620
|
-
inputFilesHash:
|
|
2867
|
+
engineVersion: z5.string().min(1),
|
|
2868
|
+
scopeHash: z5.string().regex(/^[a-f0-9]{64}$/),
|
|
2869
|
+
inputsHash: z5.string().regex(/^[a-f0-9]{64}$/).optional(),
|
|
2870
|
+
inputFilesHash: z5.string().regex(/^[a-f0-9]{64}$/)
|
|
2621
2871
|
});
|
|
2622
|
-
var agentRunVerdictSchema =
|
|
2623
|
-
exitCode:
|
|
2624
|
-
reasons:
|
|
2625
|
-
gatingFindingCount:
|
|
2872
|
+
var agentRunVerdictSchema = z5.object({
|
|
2873
|
+
exitCode: z5.union([z5.literal(0), z5.literal(1)]),
|
|
2874
|
+
reasons: z5.array(z5.string()),
|
|
2875
|
+
gatingFindingCount: z5.number().int().nonnegative()
|
|
2626
2876
|
});
|
|
2627
|
-
var agentFormatBaseSchema =
|
|
2628
|
-
schemaVersion:
|
|
2629
|
-
summary:
|
|
2877
|
+
var agentFormatBaseSchema = z5.object({
|
|
2878
|
+
schemaVersion: z5.literal(AGENT_FORMAT_SCHEMA_VERSION),
|
|
2879
|
+
summary: z5.string(),
|
|
2630
2880
|
integrity: agentIntegritySchema,
|
|
2631
|
-
fix_first:
|
|
2632
|
-
remaining:
|
|
2633
|
-
suppression_template:
|
|
2634
|
-
directive:
|
|
2635
|
-
requiredFields:
|
|
2636
|
-
example:
|
|
2881
|
+
fix_first: z5.array(agentFindingSchema),
|
|
2882
|
+
remaining: z5.array(agentFindingSchema),
|
|
2883
|
+
suppression_template: z5.object({
|
|
2884
|
+
directive: z5.string(),
|
|
2885
|
+
requiredFields: z5.array(z5.string()),
|
|
2886
|
+
example: z5.string()
|
|
2637
2887
|
}),
|
|
2638
|
-
budget:
|
|
2639
|
-
iteration:
|
|
2640
|
-
maxIterations:
|
|
2641
|
-
scoreDelta:
|
|
2888
|
+
budget: z5.object({
|
|
2889
|
+
iteration: z5.number().int().nonnegative(),
|
|
2890
|
+
maxIterations: z5.number().int().positive(),
|
|
2891
|
+
scoreDelta: z5.number()
|
|
2642
2892
|
}),
|
|
2643
|
-
findings:
|
|
2644
|
-
suppressions:
|
|
2893
|
+
findings: z5.array(findingSchema).optional(),
|
|
2894
|
+
suppressions: z5.array(suppressionDirectiveSchema).optional(),
|
|
2645
2895
|
provenance: agentRunProvenanceSchema.optional(),
|
|
2646
2896
|
verdict: agentRunVerdictSchema.optional()
|
|
2647
2897
|
});
|
|
2648
|
-
var agentFormatSchema =
|
|
2898
|
+
var agentFormatSchema = z5.union([
|
|
2649
2899
|
agentFormatBaseSchema.extend({
|
|
2650
|
-
passed:
|
|
2651
|
-
score:
|
|
2652
|
-
status:
|
|
2653
|
-
reasons:
|
|
2900
|
+
passed: z5.boolean(),
|
|
2901
|
+
score: z5.number(),
|
|
2902
|
+
status: z5.never().optional(),
|
|
2903
|
+
reasons: z5.never().optional(),
|
|
2654
2904
|
integrity: agentIntegritySchema.extend({
|
|
2655
|
-
rulesLoaded:
|
|
2905
|
+
rulesLoaded: z5.number().int().positive()
|
|
2656
2906
|
})
|
|
2657
2907
|
}),
|
|
2658
2908
|
agentFormatBaseSchema.extend({
|
|
2659
|
-
passed:
|
|
2660
|
-
score:
|
|
2661
|
-
status:
|
|
2662
|
-
reasons:
|
|
2909
|
+
passed: z5.literal(false),
|
|
2910
|
+
score: z5.never().optional(),
|
|
2911
|
+
status: z5.literal("indeterminate"),
|
|
2912
|
+
reasons: z5.tuple([z5.literal("zero_rules_loaded")]),
|
|
2663
2913
|
integrity: agentIntegritySchema.extend({
|
|
2664
|
-
rulesLoaded:
|
|
2914
|
+
rulesLoaded: z5.literal(0)
|
|
2665
2915
|
})
|
|
2666
2916
|
}),
|
|
2667
2917
|
// A finalized Run can explicitly allow inert governance. Preserve the
|
|
@@ -2669,30 +2919,30 @@ var agentFormatSchema = z3.union([
|
|
|
2669
2919
|
// verdict; requiring Run pins prevents generic zero-rule envelopes from
|
|
2670
2920
|
// accidentally becoming green.
|
|
2671
2921
|
agentFormatBaseSchema.extend({
|
|
2672
|
-
passed:
|
|
2673
|
-
score:
|
|
2674
|
-
status:
|
|
2675
|
-
reasons:
|
|
2922
|
+
passed: z5.literal(true),
|
|
2923
|
+
score: z5.never().optional(),
|
|
2924
|
+
status: z5.literal("indeterminate"),
|
|
2925
|
+
reasons: z5.tuple([z5.literal("zero_rules_loaded")]),
|
|
2676
2926
|
integrity: agentIntegritySchema.extend({
|
|
2677
|
-
rulesLoaded:
|
|
2927
|
+
rulesLoaded: z5.literal(0)
|
|
2678
2928
|
}),
|
|
2679
2929
|
provenance: agentRunProvenanceSchema,
|
|
2680
|
-
verdict: agentRunVerdictSchema.extend({ exitCode:
|
|
2930
|
+
verdict: agentRunVerdictSchema.extend({ exitCode: z5.literal(0) })
|
|
2681
2931
|
})
|
|
2682
2932
|
]);
|
|
2683
|
-
var agentErrorEnvelopeSchema =
|
|
2684
|
-
schemaVersion:
|
|
2685
|
-
passed:
|
|
2686
|
-
error:
|
|
2687
|
-
code:
|
|
2688
|
-
message:
|
|
2933
|
+
var agentErrorEnvelopeSchema = z5.object({
|
|
2934
|
+
schemaVersion: z5.literal(AGENT_FORMAT_SCHEMA_VERSION),
|
|
2935
|
+
passed: z5.literal(false),
|
|
2936
|
+
error: z5.object({
|
|
2937
|
+
code: z5.string().min(1),
|
|
2938
|
+
message: z5.string().min(1)
|
|
2689
2939
|
}),
|
|
2690
2940
|
provenance: agentRunProvenanceSchema.optional(),
|
|
2691
2941
|
verdict: agentRunVerdictSchema.optional(),
|
|
2692
|
-
cloudReport:
|
|
2693
|
-
notices:
|
|
2942
|
+
cloudReport: z5.enum(["accepted", "reported", "failed", "skipped"]).optional(),
|
|
2943
|
+
notices: z5.array(z5.string()).optional()
|
|
2694
2944
|
});
|
|
2695
|
-
var agentOutputSchema =
|
|
2945
|
+
var agentOutputSchema = z5.union([agentFormatSchema, agentErrorEnvelopeSchema]);
|
|
2696
2946
|
function normalizeSeverity(severity) {
|
|
2697
2947
|
return severitySchema.safeParse(severity).success ? severity : severityFromLevel(legacySeverityLevelSchema.parse(severity));
|
|
2698
2948
|
}
|
|
@@ -2805,6 +3055,33 @@ export {
|
|
|
2805
3055
|
byCode,
|
|
2806
3056
|
byRuleId,
|
|
2807
3057
|
explainUrlForCode,
|
|
3058
|
+
digestHexStringSchema,
|
|
3059
|
+
digestHexSchema,
|
|
3060
|
+
analysisPlanIdStringSchema,
|
|
3061
|
+
analysisPlanIdSchema,
|
|
3062
|
+
evaluationReceiptIdSchema,
|
|
3063
|
+
evaluationReceiptIdStringSchema,
|
|
3064
|
+
featurePlanIdStringSchema,
|
|
3065
|
+
featurePlanIdSchema,
|
|
3066
|
+
featureRevisionIdStringSchema,
|
|
3067
|
+
featureRevisionIdSchema,
|
|
3068
|
+
parseDigestHex,
|
|
3069
|
+
analysisPlanIdFromDigest,
|
|
3070
|
+
evaluationReceiptIdFromDigest,
|
|
3071
|
+
mintEvaluationReceiptId,
|
|
3072
|
+
featureRevisionIdFromDigest,
|
|
3073
|
+
featurePlanIdFromEntropy,
|
|
3074
|
+
parseAnalysisPlanId,
|
|
3075
|
+
parseEvaluationReceiptId,
|
|
3076
|
+
parseFeaturePlanId,
|
|
3077
|
+
parseFeatureRevisionId,
|
|
3078
|
+
CANONICAL_FACT_MAX_CONFLICTS_V1,
|
|
3079
|
+
CANONICAL_FACT_MAX_VALUES_PER_CONFLICT_V1,
|
|
3080
|
+
CANONICAL_FACT_MAX_PROVENANCE_PER_VALUE_V1,
|
|
3081
|
+
canonicalFactConflictValueV1Schema,
|
|
3082
|
+
canonicalFactConflictV1Schema,
|
|
3083
|
+
canonicalFactIntegrityV1Schema,
|
|
3084
|
+
normalizeCanonicalFactIntegrityV1,
|
|
2808
3085
|
canonicalJson,
|
|
2809
3086
|
hash64Hex,
|
|
2810
3087
|
componentId,
|
|
@@ -2875,6 +3152,7 @@ export {
|
|
|
2875
3152
|
markPresetSourcedRules,
|
|
2876
3153
|
isPresetSourcedRule,
|
|
2877
3154
|
resolveComponentGovernance,
|
|
3155
|
+
resolveGovernanceRecordsForIdentity,
|
|
2878
3156
|
normalizeGovernanceConfig,
|
|
2879
3157
|
g,
|
|
2880
3158
|
RULE_FAMILY_MEMBERS,
|
|
@@ -2912,4 +3190,4 @@ export {
|
|
|
2912
3190
|
normalizeFinding,
|
|
2913
3191
|
normalizeViolation
|
|
2914
3192
|
};
|
|
2915
|
-
//# sourceMappingURL=chunk-
|
|
3193
|
+
//# sourceMappingURL=chunk-RPSEABY3.js.map
|