@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
package/src/governance.ts
CHANGED
|
@@ -133,10 +133,15 @@ const componentCapabilityRecordSchema = z.object({
|
|
|
133
133
|
capability: z.string().min(1),
|
|
134
134
|
});
|
|
135
135
|
|
|
136
|
+
const requiredComponentGovernanceValueSchema = z.custom<unknown>(
|
|
137
|
+
(value) => value !== undefined,
|
|
138
|
+
"Expected an explicitly present governance value"
|
|
139
|
+
);
|
|
140
|
+
|
|
136
141
|
const propValueAvoidRecordSchema = z.object({
|
|
137
142
|
kind: z.literal("prop.value.avoid"),
|
|
138
143
|
prop: z.string().min(1),
|
|
139
|
-
value:
|
|
144
|
+
value: requiredComponentGovernanceValueSchema,
|
|
140
145
|
because: z.string(),
|
|
141
146
|
suggest: z.string().optional(),
|
|
142
147
|
severity: governanceSeveritySchema,
|
|
@@ -145,10 +150,10 @@ const propValueAvoidRecordSchema = z.object({
|
|
|
145
150
|
const propValueForbidRecordSchema = z.object({
|
|
146
151
|
kind: z.literal("prop.value.forbid"),
|
|
147
152
|
prop: z.string().min(1),
|
|
148
|
-
value:
|
|
153
|
+
value: requiredComponentGovernanceValueSchema,
|
|
149
154
|
when: z.object({ path: z.string().min(1).optional() }).optional(),
|
|
150
155
|
because: z.string(),
|
|
151
|
-
fix: z.object({ replaceWith:
|
|
156
|
+
fix: z.object({ replaceWith: requiredComponentGovernanceValueSchema }).optional(),
|
|
152
157
|
severity: governanceSeveritySchema,
|
|
153
158
|
});
|
|
154
159
|
|
|
@@ -587,10 +592,15 @@ export interface ComponentGovernanceBuilder<TProps> {
|
|
|
587
592
|
accessibility(): AccessibilityGovernanceBuilder;
|
|
588
593
|
}
|
|
589
594
|
|
|
590
|
-
|
|
595
|
+
/**
|
|
596
|
+
* One-argument governed definition. Requires an explicit `govern` function
|
|
597
|
+
* and/or `governance` records — both optional keys previously let plain v2
|
|
598
|
+
* definitions satisfy this type (the optional-key type lie).
|
|
599
|
+
*/
|
|
600
|
+
type GovernedFragmentDefinitionBase<
|
|
591
601
|
TProps = unknown,
|
|
592
602
|
TComponent extends FragmentComponent<TProps> = FragmentComponent<TProps>,
|
|
593
|
-
> {
|
|
603
|
+
> = {
|
|
594
604
|
component: TComponent;
|
|
595
605
|
meta: FragmentMeta;
|
|
596
606
|
guidance: FragmentGuidance;
|
|
@@ -605,9 +615,22 @@ export interface GovernedFragmentDefinition<
|
|
|
605
615
|
};
|
|
606
616
|
contract?: FragmentContract;
|
|
607
617
|
_provenance?: FragmentProvenance;
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
export type GovernedFragmentDefinition<
|
|
621
|
+
TProps = unknown,
|
|
622
|
+
TComponent extends FragmentComponent<TProps> = FragmentComponent<TProps>,
|
|
623
|
+
> = GovernedFragmentDefinitionBase<TProps, TComponent> &
|
|
624
|
+
(
|
|
625
|
+
| {
|
|
626
|
+
govern: (g: ComponentGovernanceBuilder<TProps>) => ComponentGovernanceRecord[];
|
|
627
|
+
governance?: ComponentGovernanceRecord[];
|
|
628
|
+
}
|
|
629
|
+
| {
|
|
630
|
+
governance: ComponentGovernanceRecord[];
|
|
631
|
+
govern?: (g: ComponentGovernanceBuilder<TProps>) => ComponentGovernanceRecord[];
|
|
632
|
+
}
|
|
633
|
+
);
|
|
611
634
|
|
|
612
635
|
export type ResolvedGovernedFragmentDefinition<
|
|
613
636
|
TProps = unknown,
|
|
@@ -668,6 +691,27 @@ export function resolveComponentGovernance<TProps>(
|
|
|
668
691
|
return componentGovernanceRecordsSchema.parse(records);
|
|
669
692
|
}
|
|
670
693
|
|
|
694
|
+
/**
|
|
695
|
+
* Resolve the component governance records that belong in the FCID preimage.
|
|
696
|
+
*
|
|
697
|
+
* Prefer an already-resolved `governance` array (Cloud mint / compiled payloads).
|
|
698
|
+
* Fall back to evaluating `govern` when present. Returns `undefined` when the
|
|
699
|
+
* fragment carries no governance surface — callers omit the field from identity.
|
|
700
|
+
*/
|
|
701
|
+
export function resolveGovernanceRecordsForIdentity(
|
|
702
|
+
definition: Pick<GovernedFragmentDefinition, "govern" | "governance"> | null | undefined
|
|
703
|
+
): ComponentGovernanceRecord[] | undefined {
|
|
704
|
+
if (!definition) return undefined;
|
|
705
|
+
if (Array.isArray(definition.governance)) {
|
|
706
|
+
return componentGovernanceRecordsSchema.parse(definition.governance);
|
|
707
|
+
}
|
|
708
|
+
if (typeof definition.govern === "function") {
|
|
709
|
+
const builder = createComponentGovernanceBuilder();
|
|
710
|
+
return componentGovernanceRecordsSchema.parse(definition.govern(builder));
|
|
711
|
+
}
|
|
712
|
+
return undefined;
|
|
713
|
+
}
|
|
714
|
+
|
|
671
715
|
export function normalizeGovernanceConfig<TConfig extends { govern?: GovernanceConfig }>(
|
|
672
716
|
config: TConfig
|
|
673
717
|
): TConfig {
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// Brand and default constants
|
|
7
|
-
export { BRAND, DEFAULTS } from "./constants.js";
|
|
7
|
+
export { BRAND, DEFAULTS, FRAGMENT_V3_SCHEMA_URL } from "./constants.js";
|
|
8
8
|
export type { Brand, Defaults } from "./constants.js";
|
|
9
9
|
|
|
10
10
|
export {
|
|
@@ -167,14 +167,20 @@ export type {
|
|
|
167
167
|
FragmentsConfig,
|
|
168
168
|
SnippetPolicyConfig,
|
|
169
169
|
RegistryOptions,
|
|
170
|
+
FragmentIndex,
|
|
171
|
+
FragmentRegistry,
|
|
172
|
+
RegistryComponentEntry,
|
|
173
|
+
RegistryPropEntry,
|
|
174
|
+
FragmentContextOptions,
|
|
170
175
|
CompiledFragment,
|
|
176
|
+
CompiledFragmentDesign,
|
|
177
|
+
CompiledFragmentMatrix,
|
|
178
|
+
CompiledFragmentPreview,
|
|
171
179
|
CompiledFragmentsFile,
|
|
172
180
|
ObservedComponentUsage,
|
|
173
181
|
ObservedUsageProp,
|
|
174
182
|
BlockDefinition,
|
|
175
183
|
CompiledBlock,
|
|
176
|
-
RecipeDefinition, // @deprecated - use BlockDefinition
|
|
177
|
-
CompiledRecipe, // @deprecated - use CompiledBlock
|
|
178
184
|
// Contract and provenance types
|
|
179
185
|
FragmentContract,
|
|
180
186
|
FragmentGenerated,
|
|
@@ -186,6 +192,18 @@ export type {
|
|
|
186
192
|
CompositionMetadata,
|
|
187
193
|
FragmentProvenance,
|
|
188
194
|
FragmentDefinitionV2,
|
|
195
|
+
// v3 types (arity-discriminated)
|
|
196
|
+
FragmentMetaV3,
|
|
197
|
+
FragmentStateV3,
|
|
198
|
+
FragmentDontExampleV3,
|
|
199
|
+
FragmentGuidanceV3,
|
|
200
|
+
FragmentMatrixV3,
|
|
201
|
+
FragmentPreviewV3,
|
|
202
|
+
FragmentDesignV3,
|
|
203
|
+
PropAnnotation,
|
|
204
|
+
FragmentAnnotationsV3,
|
|
205
|
+
FragmentDefinitionV3Body,
|
|
206
|
+
FragmentDefinitionV3,
|
|
189
207
|
// Screenshot types
|
|
190
208
|
ScreenshotConfig,
|
|
191
209
|
ServiceConfig,
|
|
@@ -207,8 +225,6 @@ export type {
|
|
|
207
225
|
FigmaInstanceMapping,
|
|
208
226
|
FigmaChildrenMapping,
|
|
209
227
|
FigmaTextContentMapping,
|
|
210
|
-
// Storybook filter configuration
|
|
211
|
-
StorybookFilterConfig,
|
|
212
228
|
// Token configuration
|
|
213
229
|
AppConfig,
|
|
214
230
|
DesignSystemConfig,
|
|
@@ -284,12 +300,18 @@ export type {
|
|
|
284
300
|
// Fragments Registry Protocol contracts
|
|
285
301
|
export {
|
|
286
302
|
REGISTRY_ARTIFACT_SCHEMA_VERSION,
|
|
303
|
+
REGISTRY_INDEX_SCHEMA_VERSION,
|
|
287
304
|
REGISTRY_INSTALL_RECEIPT_SCHEMA_VERSION,
|
|
288
305
|
REGISTRY_MANIFEST_SCHEMA_VERSION,
|
|
306
|
+
REGISTRY_POINTER_SCHEMA_VERSION,
|
|
307
|
+
REGISTRY_SHARD_SCHEMA_VERSION,
|
|
308
|
+
assembleRegistryArtifact,
|
|
289
309
|
assertValidRegistryArtifact,
|
|
290
310
|
buildRegistryArtifact,
|
|
291
311
|
buildRegistryFile,
|
|
312
|
+
buildRegistryPointer,
|
|
292
313
|
computeRegistryHash,
|
|
314
|
+
defaultRegistryShardPath,
|
|
293
315
|
finalizeRegistryManifest,
|
|
294
316
|
hashRegistryFileContent,
|
|
295
317
|
registryArtifactDigest,
|
|
@@ -303,14 +325,21 @@ export {
|
|
|
303
325
|
registryFileRoleSchema,
|
|
304
326
|
registryFileSchema,
|
|
305
327
|
registryFileSize,
|
|
328
|
+
registryIndexSchema,
|
|
306
329
|
registryInstallProfileSchema,
|
|
307
330
|
registryInstallReceiptComponentSchema,
|
|
308
331
|
registryInstallReceiptFileSchema,
|
|
309
332
|
registryInstallReceiptSchema,
|
|
310
333
|
registryManifestCanonicalPreimage,
|
|
311
334
|
registryManifestDraftSchema,
|
|
335
|
+
registryManifestFileMetadata,
|
|
336
|
+
registryManifestFilePaths,
|
|
312
337
|
registryManifestSchema,
|
|
338
|
+
registryPointerSchema,
|
|
339
|
+
registryShardSchema,
|
|
340
|
+
registryShardsForPaths,
|
|
313
341
|
registrySourceSchema,
|
|
342
|
+
shardRegistryArtifact,
|
|
314
343
|
} from "./registry.js";
|
|
315
344
|
export type {
|
|
316
345
|
RegistryArtifact,
|
|
@@ -324,13 +353,17 @@ export type {
|
|
|
324
353
|
RegistryFileContent,
|
|
325
354
|
RegistryFileInput,
|
|
326
355
|
RegistryFileRole,
|
|
356
|
+
RegistryIndex,
|
|
327
357
|
RegistryInstallProfile,
|
|
328
358
|
RegistryInstallReceipt,
|
|
329
359
|
RegistryInstallReceiptComponent,
|
|
330
360
|
RegistryInstallReceiptFile,
|
|
331
361
|
RegistryManifest,
|
|
332
362
|
RegistryManifestDraft,
|
|
363
|
+
RegistryPointer,
|
|
364
|
+
RegistryShard,
|
|
333
365
|
RegistrySource,
|
|
366
|
+
ShardedRegistryArtifact,
|
|
334
367
|
} from "./registry.js";
|
|
335
368
|
|
|
336
369
|
export {
|
|
@@ -338,13 +371,21 @@ export {
|
|
|
338
371
|
buildRegistryInstallPlan,
|
|
339
372
|
buildRegistryInstallReceipt,
|
|
340
373
|
collectRegistryInstallDependencies,
|
|
374
|
+
expandRegistryComponentClosure,
|
|
341
375
|
normalizeRegistryRepoPath,
|
|
342
|
-
|
|
376
|
+
resolveRegistryComponentId,
|
|
377
|
+
resolveRegistryInstallSelection,
|
|
378
|
+
resolveRegistryInstallSources,
|
|
343
379
|
sourceToRegistryTargetPath,
|
|
344
380
|
} from "./registry-install-plan.js";
|
|
345
381
|
export type {
|
|
346
382
|
BuildRegistryInstallPlanInput,
|
|
347
383
|
RegistryInstallPlan,
|
|
384
|
+
RegistryInstallSelection,
|
|
385
|
+
RegistryInstallSelectionInput,
|
|
386
|
+
RegistryInstallSourceFile,
|
|
387
|
+
RegistryInstallSources,
|
|
388
|
+
RegistryInstallSourcesInput,
|
|
348
389
|
RegistryWritePlan,
|
|
349
390
|
} from "./registry-install-plan.js";
|
|
350
391
|
|
|
@@ -427,10 +468,10 @@ export {
|
|
|
427
468
|
figmaPropMappingSchema,
|
|
428
469
|
// Contract and provenance schemas
|
|
429
470
|
fragmentContractSchema,
|
|
471
|
+
fragmentSourceValues,
|
|
430
472
|
fragmentGeneratedSchema,
|
|
431
473
|
fragmentBanSchema,
|
|
432
474
|
blockDefinitionSchema,
|
|
433
|
-
recipeDefinitionSchema, // @deprecated - use blockDefinitionSchema
|
|
434
475
|
// AI metadata schema
|
|
435
476
|
aiMetadataSchema,
|
|
436
477
|
// v2 schemas
|
|
@@ -438,6 +479,18 @@ export {
|
|
|
438
479
|
fragmentProvenanceSchema,
|
|
439
480
|
fragmentDefinitionV2Schema,
|
|
440
481
|
governedFragmentDefinitionSchema,
|
|
482
|
+
// v3 schemas
|
|
483
|
+
fragmentMetaV3Schema,
|
|
484
|
+
fragmentStateV3Schema,
|
|
485
|
+
fragmentDontExampleV3Schema,
|
|
486
|
+
fragmentGuidanceV3Schema,
|
|
487
|
+
fragmentMatrixV3Schema,
|
|
488
|
+
fragmentPreviewV3Schema,
|
|
489
|
+
fragmentDesignV3Schema,
|
|
490
|
+
propAnnotationSchema,
|
|
491
|
+
fragmentAnnotationsV3Schema,
|
|
492
|
+
fragmentDefinitionV3BodySchema,
|
|
493
|
+
fragmentDefinitionV3Schema,
|
|
441
494
|
} from "./schema.js";
|
|
442
495
|
|
|
443
496
|
// Main API
|
|
@@ -448,8 +501,6 @@ export {
|
|
|
448
501
|
normalizeToV1,
|
|
449
502
|
defineBlock,
|
|
450
503
|
compileBlock,
|
|
451
|
-
defineRecipe,
|
|
452
|
-
compileRecipe,
|
|
453
504
|
} from "./defineFragment.js";
|
|
454
505
|
export type { InferProps } from "./defineFragment.js";
|
|
455
506
|
|
|
@@ -467,6 +518,8 @@ export {
|
|
|
467
518
|
isPresetSourcedRule,
|
|
468
519
|
markPresetSourcedRules,
|
|
469
520
|
normalizeGovernanceConfig,
|
|
521
|
+
resolveComponentGovernance,
|
|
522
|
+
resolveGovernanceRecordsForIdentity,
|
|
470
523
|
scaleGovernanceRecordSchema,
|
|
471
524
|
} from "./governance.js";
|
|
472
525
|
export type {
|
|
@@ -501,15 +554,6 @@ export {
|
|
|
501
554
|
} from "./policy-exclude.js";
|
|
502
555
|
export type { PolicyExclude, PolicyExcludeInput } from "./policy-exclude.js";
|
|
503
556
|
|
|
504
|
-
// Storybook adapter filtering
|
|
505
|
-
export {
|
|
506
|
-
checkStoryExclusion,
|
|
507
|
-
detectSubComponentPaths,
|
|
508
|
-
isForceIncluded,
|
|
509
|
-
isConfigExcluded,
|
|
510
|
-
} from "./storyFilters.js";
|
|
511
|
-
export type { ExclusionReason, ExclusionResult, CheckStoryExclusionOpts } from "./storyFilters.js";
|
|
512
|
-
|
|
513
557
|
// Context generation for AI agents
|
|
514
558
|
export { generateContext } from "./context.js";
|
|
515
559
|
export type { ContextOptions, ContextResult } from "./context.js";
|
|
@@ -517,23 +561,6 @@ export type { ContextOptions, ContextResult } from "./context.js";
|
|
|
517
561
|
// Figma property mapping DSL
|
|
518
562
|
export { figma, isFigmaPropMapping, resolveFigmaMapping } from "./figma.js";
|
|
519
563
|
|
|
520
|
-
// Fragment JSON types (for .fragment.json files)
|
|
521
|
-
export type {
|
|
522
|
-
Fragment,
|
|
523
|
-
FragmentFigma,
|
|
524
|
-
FragmentUsage as FragmentJsonUsage,
|
|
525
|
-
FragmentDoNotItem,
|
|
526
|
-
FragmentPattern,
|
|
527
|
-
FragmentAccessibility,
|
|
528
|
-
FragmentRelated,
|
|
529
|
-
FragmentMeta as FragmentJsonMeta,
|
|
530
|
-
FragmentIndex,
|
|
531
|
-
FragmentRegistry,
|
|
532
|
-
RegistryComponentEntry,
|
|
533
|
-
RegistryPropEntry,
|
|
534
|
-
FragmentContextOptions,
|
|
535
|
-
} from "./fragment-types.js";
|
|
536
|
-
|
|
537
564
|
// Token parsing and token-domain helpers
|
|
538
565
|
export {
|
|
539
566
|
calculateDeltaE,
|
|
@@ -649,6 +676,12 @@ export {
|
|
|
649
676
|
ruleA11yRequiredAccessibleName,
|
|
650
677
|
ruleA11yStandard,
|
|
651
678
|
} from "./rules/index.js";
|
|
679
|
+
export {
|
|
680
|
+
capConfiguredSeverity,
|
|
681
|
+
configuredFindingSeverity,
|
|
682
|
+
readRuleConfig,
|
|
683
|
+
type RuleConfigView,
|
|
684
|
+
} from "./rules/rule-config.js";
|
|
652
685
|
export { indexComponentIdentityUsage, type ComponentIdentityUsage } from "./identity/usage.js";
|
|
653
686
|
export { nearestSignedScaleValue } from "./rules/utils.js";
|
|
654
687
|
export {
|
|
@@ -705,7 +738,11 @@ export type { RuleTier, PresetRuleState } from "./rules/index.js";
|
|
|
705
738
|
// Contract-site health denominator: how many style-declaration sites the
|
|
706
739
|
// token-vocabulary rule actually judged. Consumed by the CLI's per-scan
|
|
707
740
|
// `contract-site-health:v1` metric next to the identity usage index.
|
|
708
|
-
export {
|
|
741
|
+
export {
|
|
742
|
+
contractTokenReferenceCensus,
|
|
743
|
+
EMPTY_VOCABULARY_MESSAGE,
|
|
744
|
+
emptyVocabularyConfigFile,
|
|
745
|
+
} from "./rules/index.js";
|
|
709
746
|
export type { ContractTokenReferenceCensus } from "./rules/index.js";
|
|
710
747
|
|
|
711
748
|
// Rule families — the ONE expansion of a broad `govern.rules` id (`tokens/hardcoded-values`)
|
|
@@ -826,24 +863,39 @@ export {
|
|
|
826
863
|
} from "./facts/index.js";
|
|
827
864
|
export type { SupersededImportPathPreference } from "./facts/index.js";
|
|
828
865
|
export {
|
|
829
|
-
canonicalPreimage,
|
|
830
866
|
AGENT_CONTEXT_RELATIVE_PATH,
|
|
867
|
+
artifactContentHash,
|
|
831
868
|
CATALOG_FIXTURE_A_FCID,
|
|
832
869
|
catalogFixtureA,
|
|
833
870
|
catalogFixtureAContractPayload,
|
|
834
871
|
catalogFixtureATokensDtcg,
|
|
872
|
+
canonicalPreimage,
|
|
873
|
+
CONTRACT_DISPLAY_ONLY_FIELDS,
|
|
835
874
|
CONTRACT_DOMAINS,
|
|
875
|
+
CONTRACT_ENFORCEMENT_FIELDS,
|
|
836
876
|
CONTRACT_PREIMAGE_CAPABILITY_HEADER,
|
|
837
877
|
CONTRACT_PREIMAGE_SCHEMA,
|
|
878
|
+
ContractCatalogValidationError,
|
|
838
879
|
contractComponentsFromFragments,
|
|
839
880
|
contractHash,
|
|
840
881
|
contractPolicyFromGovernanceConfig,
|
|
882
|
+
deriveArtifactId,
|
|
841
883
|
diffContractDomains,
|
|
842
884
|
formatStampHeader,
|
|
843
885
|
formatStampPin,
|
|
844
886
|
formatStampVersionHash,
|
|
887
|
+
FRAGMENTS_MANIFEST_FILENAME,
|
|
888
|
+
FRAGMENTS_MANIFEST_SCHEMA_VERSION,
|
|
889
|
+
FRAGMENTS_MANIFEST_TOKEN_RULE,
|
|
890
|
+
fragmentsManifestFcid,
|
|
891
|
+
fragmentsManifestGrammarSchema,
|
|
892
|
+
fragmentsManifestPatternSchema,
|
|
893
|
+
fragmentsManifestPrimitiveSchema,
|
|
894
|
+
fragmentsManifestSchema,
|
|
845
895
|
parseContractStamp,
|
|
896
|
+
parseFragmentsManifest,
|
|
846
897
|
projectContractPreimage,
|
|
898
|
+
projectEnforcementContract,
|
|
847
899
|
serializeContractStamp,
|
|
848
900
|
sha256Hex,
|
|
849
901
|
verifiedContractPreimageFromPin,
|
|
@@ -866,6 +918,7 @@ export type {
|
|
|
866
918
|
ContractCatalogInput,
|
|
867
919
|
ContractComponentInput,
|
|
868
920
|
ContractDomain,
|
|
921
|
+
ContractEnforcementField,
|
|
869
922
|
ContractIdentityPin,
|
|
870
923
|
ContractPolicyInput,
|
|
871
924
|
ContractPreimage,
|
|
@@ -874,6 +927,10 @@ export type {
|
|
|
874
927
|
ContractStampRecord,
|
|
875
928
|
ContractTokenInput,
|
|
876
929
|
ContractWaiverInput,
|
|
930
|
+
FragmentsManifest,
|
|
931
|
+
FragmentsManifestGrammar,
|
|
932
|
+
FragmentsManifestPattern,
|
|
933
|
+
FragmentsManifestPrimitive,
|
|
877
934
|
} from "./contract/index.js";
|
|
878
935
|
export {
|
|
879
936
|
governanceConfigWithLocalCanonical,
|
|
@@ -920,6 +977,9 @@ export type {
|
|
|
920
977
|
FactLocation,
|
|
921
978
|
FactEvidence,
|
|
922
979
|
CanonicalCandidateFact,
|
|
980
|
+
CanonicalFactConflictV1,
|
|
981
|
+
CanonicalFactConflictValueV1,
|
|
982
|
+
CanonicalFactIntegrityV1,
|
|
923
983
|
CanonicalMappingFact,
|
|
924
984
|
CanonicalReplacementFact,
|
|
925
985
|
ComponentLevelFact,
|
|
@@ -978,8 +1038,210 @@ export type {
|
|
|
978
1038
|
SuppressionDirectiveFact,
|
|
979
1039
|
ComponentFactInput,
|
|
980
1040
|
} from "./facts/index.js";
|
|
1041
|
+
export {
|
|
1042
|
+
CANONICAL_FACT_MAX_CONFLICTS_V1,
|
|
1043
|
+
CANONICAL_FACT_MAX_PROVENANCE_PER_VALUE_V1,
|
|
1044
|
+
CANONICAL_FACT_MAX_VALUES_PER_CONFLICT_V1,
|
|
1045
|
+
canonicalFactConflictV1Schema,
|
|
1046
|
+
canonicalFactConflictValueV1Schema,
|
|
1047
|
+
canonicalFactIntegrityV1Schema,
|
|
1048
|
+
normalizeCanonicalFactIntegrityV1,
|
|
1049
|
+
} from "./facts/index.js";
|
|
1050
|
+
|
|
1051
|
+
// V1 authority and analysis contracts. These remain browser-safe and have no
|
|
1052
|
+
// Cloud, provider, engine, model, or Node-only dependency.
|
|
1053
|
+
export {
|
|
1054
|
+
analysisPlanIdFromDigest,
|
|
1055
|
+
analysisPlanIdSchema,
|
|
1056
|
+
analysisPlanIdStringSchema,
|
|
1057
|
+
digestHexSchema,
|
|
1058
|
+
digestHexStringSchema,
|
|
1059
|
+
evaluationReceiptIdFromDigest,
|
|
1060
|
+
mintEvaluationReceiptId,
|
|
1061
|
+
evaluationReceiptIdSchema,
|
|
1062
|
+
evaluationReceiptIdStringSchema,
|
|
1063
|
+
featurePlanIdFromEntropy,
|
|
1064
|
+
featurePlanIdSchema,
|
|
1065
|
+
featurePlanIdStringSchema,
|
|
1066
|
+
featureRevisionIdFromDigest,
|
|
1067
|
+
featureRevisionIdSchema,
|
|
1068
|
+
featureRevisionIdStringSchema,
|
|
1069
|
+
parseAnalysisPlanId,
|
|
1070
|
+
parseDigestHex,
|
|
1071
|
+
parseEvaluationReceiptId,
|
|
1072
|
+
parseFeaturePlanId,
|
|
1073
|
+
parseFeatureRevisionId,
|
|
1074
|
+
} from "./domain-ids.js";
|
|
1075
|
+
export type {
|
|
1076
|
+
AnalysisPlanId,
|
|
1077
|
+
DigestHex,
|
|
1078
|
+
EvaluationReceiptId,
|
|
1079
|
+
FeaturePlanId,
|
|
1080
|
+
FeatureRevisionId,
|
|
1081
|
+
} from "./domain-ids.js";
|
|
1082
|
+
export {
|
|
1083
|
+
PROVIDER_ID_MAX_BYTES_V1,
|
|
1084
|
+
REPOSITORY_BINDING_ID_MAX_BYTES_V1,
|
|
1085
|
+
normalizeRepositoryBindingKeyV1,
|
|
1086
|
+
repositoryBindingDigestV1,
|
|
1087
|
+
repositoryBindingKeyV1Schema,
|
|
1088
|
+
} from "./repository-binding.js";
|
|
1089
|
+
export type { RepositoryBindingKeyV1, RepositoryBindingKeyV1Input } from "./repository-binding.js";
|
|
1090
|
+
export {
|
|
1091
|
+
ANALYSIS_LIMIT_CEILINGS_V1,
|
|
1092
|
+
ANALYSIS_PLAN_MAX_CAPABILITIES_V1,
|
|
1093
|
+
ANALYSIS_PLAN_MAX_DIALECTS_PER_REGION_V1,
|
|
1094
|
+
ANALYSIS_PLAN_MAX_REGIONS_V1,
|
|
1095
|
+
CoverageValidationErrorV1,
|
|
1096
|
+
analysisLimitsV1Schema,
|
|
1097
|
+
analysisObligationsDigestV1,
|
|
1098
|
+
analysisPlanDigestV1,
|
|
1099
|
+
analysisPlanInputV1Schema,
|
|
1100
|
+
analysisPlanV1Schema,
|
|
1101
|
+
analysisRegionV1Schema,
|
|
1102
|
+
buildAnalysisPlanV1,
|
|
1103
|
+
coverageArtifactDigestV1,
|
|
1104
|
+
coverageRegionV1Schema,
|
|
1105
|
+
coverageStateV1Schema,
|
|
1106
|
+
coverageSummaryV1Schema,
|
|
1107
|
+
deriveCoverageSummaryV1,
|
|
1108
|
+
normalizeAnalysisPlanInputV1,
|
|
1109
|
+
parseAnalysisPlanV1,
|
|
1110
|
+
} from "./analysis-plan/index.js";
|
|
1111
|
+
export type {
|
|
1112
|
+
AnalysisLimitsV1,
|
|
1113
|
+
AnalysisPlanInputV1,
|
|
1114
|
+
AnalysisPlanV1,
|
|
1115
|
+
AnalysisRegionV1,
|
|
1116
|
+
CoverageRegionV1,
|
|
1117
|
+
CoverageStateV1,
|
|
1118
|
+
CoverageSummaryV1,
|
|
1119
|
+
} from "./analysis-plan/index.js";
|
|
1120
|
+
|
|
1121
|
+
export {
|
|
1122
|
+
AGENT_FEATURE_CONTEXT_MAX_BYTES_V1,
|
|
1123
|
+
FEATURE_PLAN_MAX_ACCEPTANCE_ITEMS_V1,
|
|
1124
|
+
FEATURE_PLAN_MAX_DECISIONS_V1,
|
|
1125
|
+
FEATURE_PLAN_MAX_EVIDENCE_REFS_V1,
|
|
1126
|
+
FEATURE_PLAN_MAX_GAPS_V1,
|
|
1127
|
+
FEATURE_PLAN_MAX_SCENARIOS_V1,
|
|
1128
|
+
FEATURE_PLAN_MAX_TEXT_BYTES_V1,
|
|
1129
|
+
FEATURE_PLAN_MAX_USES_PER_KIND_V1,
|
|
1130
|
+
agentFeatureContextV1Schema,
|
|
1131
|
+
approvedFeatureManifestInputV1Schema,
|
|
1132
|
+
approvedFeatureManifestRevisionDigestV1,
|
|
1133
|
+
approvedFeatureManifestV1Schema,
|
|
1134
|
+
buildApprovedFeatureManifestV1,
|
|
1135
|
+
buildFeatureProposalV1,
|
|
1136
|
+
capabilityGapV1Schema,
|
|
1137
|
+
componentUseDecisionV1Schema,
|
|
1138
|
+
decisionRequestV1Schema,
|
|
1139
|
+
decisionResolutionV1Schema,
|
|
1140
|
+
evidenceRefV1Schema,
|
|
1141
|
+
featureAcceptanceItemV1Schema,
|
|
1142
|
+
featurePinsV1Schema,
|
|
1143
|
+
featureProposalInputV1Schema,
|
|
1144
|
+
featureProposalRevisionDigestV1,
|
|
1145
|
+
featureProposalV1Schema,
|
|
1146
|
+
gapDispositionV1Schema,
|
|
1147
|
+
layoutConcernV1Schema,
|
|
1148
|
+
layoutOwnershipV1Schema,
|
|
1149
|
+
normalizeApprovedFeatureManifestInputV1,
|
|
1150
|
+
normalizeFeatureProposalInputV1,
|
|
1151
|
+
parseAgentFeatureContextV1,
|
|
1152
|
+
parseApprovedFeatureManifestV1,
|
|
1153
|
+
parseFeatureProposalV1,
|
|
1154
|
+
patternStatusV1Schema,
|
|
1155
|
+
patternUseDecisionV1Schema,
|
|
1156
|
+
placementDecisionV1Schema,
|
|
1157
|
+
responsiveDecisionV1Schema,
|
|
1158
|
+
scenarioRequirementV1Schema,
|
|
1159
|
+
tokenUseDecisionV1Schema,
|
|
1160
|
+
} from "./feature-plan/index.js";
|
|
1161
|
+
export type {
|
|
1162
|
+
AgentFeatureContextV1,
|
|
1163
|
+
ApprovedFeatureManifestInputV1,
|
|
1164
|
+
ApprovedFeatureManifestV1,
|
|
1165
|
+
CapabilityGapV1,
|
|
1166
|
+
ComponentUseDecisionV1,
|
|
1167
|
+
DecisionRequestV1,
|
|
1168
|
+
DecisionResolutionV1,
|
|
1169
|
+
EvidenceRefV1,
|
|
1170
|
+
FeatureAcceptanceItemV1,
|
|
1171
|
+
FeaturePinsV1,
|
|
1172
|
+
FeatureProposalInputV1,
|
|
1173
|
+
FeatureProposalV1,
|
|
1174
|
+
GapDispositionV1,
|
|
1175
|
+
LayoutConcernV1,
|
|
1176
|
+
LayoutOwnershipV1,
|
|
1177
|
+
PatternStatusV1,
|
|
1178
|
+
PatternUseDecisionV1,
|
|
1179
|
+
PlacementDecisionV1,
|
|
1180
|
+
ResponsiveDecisionV1,
|
|
1181
|
+
ScenarioRequirementV1,
|
|
1182
|
+
TokenUseDecisionV1,
|
|
1183
|
+
} from "./feature-plan/index.js";
|
|
981
1184
|
|
|
982
1185
|
// Topology — map file paths to product areas (area-scoped governance).
|
|
983
1186
|
// Also available at the `@usefragments/core/topology` subpath.
|
|
984
1187
|
export { resolveArea } from "./topology/index.js";
|
|
985
1188
|
export type { Area, AreaCriticality, AreaMatch, Topology } from "./topology/index.js";
|
|
1189
|
+
|
|
1190
|
+
// Evaluation Module — the pure governance kernel (architecture spec §§1–2):
|
|
1191
|
+
// deterministic verdicts with kernel-owned FCID verification, four-state
|
|
1192
|
+
// finding classification, and three-state trust facts. Shipped in shadow mode
|
|
1193
|
+
// alongside the legacy CLI/Cloud verdict machines.
|
|
1194
|
+
export {
|
|
1195
|
+
EVALUATION_MAX_FINDINGS_V2,
|
|
1196
|
+
EVALUATION_MAX_MAP_ENTRIES_V2,
|
|
1197
|
+
EVALUATION_MAX_POLICY_RULES_V2,
|
|
1198
|
+
EVALUATION_MAX_REASON_CODES_V2,
|
|
1199
|
+
EVALUATION_MAX_WAIVERS_V2,
|
|
1200
|
+
EVALUATION_MAX_WAIVER_MATCHES_V2,
|
|
1201
|
+
EVALUATION_RECEIPT_STRING_MAX_BYTES_V1,
|
|
1202
|
+
EVALUATOR_VERSION,
|
|
1203
|
+
EVALUATOR_VERSION_V2,
|
|
1204
|
+
effectiveEvaluationWaiverV2Schema,
|
|
1205
|
+
evaluate,
|
|
1206
|
+
evaluationInputV2Schema,
|
|
1207
|
+
evaluationReceiptDigestV1,
|
|
1208
|
+
evaluationReceiptMintInputV1Schema,
|
|
1209
|
+
evaluationReceiptV1Schema,
|
|
1210
|
+
evaluationResultV2Schema,
|
|
1211
|
+
parseEvaluationReceiptV1,
|
|
1212
|
+
providerProofDigestV1,
|
|
1213
|
+
providerProofV1Schema,
|
|
1214
|
+
} from "./evaluation/index.js";
|
|
1215
|
+
export type {
|
|
1216
|
+
EffectivePolicy,
|
|
1217
|
+
EffectiveRulePolicy,
|
|
1218
|
+
EvaluatedFinding,
|
|
1219
|
+
EvaluationBaseline,
|
|
1220
|
+
EvaluationContractInput,
|
|
1221
|
+
EvaluationEvidence,
|
|
1222
|
+
EvaluationFindingInput,
|
|
1223
|
+
EvaluationFindingState,
|
|
1224
|
+
EvaluationInput,
|
|
1225
|
+
EvaluationIntegrityInput,
|
|
1226
|
+
EvaluationMappingTrust,
|
|
1227
|
+
EvaluationReason,
|
|
1228
|
+
EvaluationResult,
|
|
1229
|
+
EvaluationScope,
|
|
1230
|
+
EvaluationSourceTrust,
|
|
1231
|
+
EvaluationTrust,
|
|
1232
|
+
EvaluationVerdict,
|
|
1233
|
+
EvaluationWaiver,
|
|
1234
|
+
EffectiveEvaluationWaiverV2,
|
|
1235
|
+
EvaluationAuthorityV1,
|
|
1236
|
+
EvaluationEvidenceTrustV1,
|
|
1237
|
+
EvaluationInputV2,
|
|
1238
|
+
EvaluationIntegrityInputV2,
|
|
1239
|
+
EvaluationReasonV2,
|
|
1240
|
+
EvaluationReceiptMintInputV1,
|
|
1241
|
+
EvaluationReceiptSemanticV1,
|
|
1242
|
+
EvaluationReceiptV1,
|
|
1243
|
+
EvaluationResultV2,
|
|
1244
|
+
FindingV2,
|
|
1245
|
+
ProviderProofSemanticV1,
|
|
1246
|
+
ProviderProofV1,
|
|
1247
|
+
} from "./evaluation/index.js";
|
|
@@ -128,6 +128,68 @@ describe("@usefragments/core/preview artifact validation", () => {
|
|
|
128
128
|
).toThrow(/unsupported source "storybook"/);
|
|
129
129
|
});
|
|
130
130
|
|
|
131
|
+
it("requires component map keys to match unique normalized component keys", () => {
|
|
132
|
+
const mismatched = {
|
|
133
|
+
...manifest,
|
|
134
|
+
components: {
|
|
135
|
+
RenamedButton: {
|
|
136
|
+
...manifest.components.Button,
|
|
137
|
+
componentKey: "Button",
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
const duplicated = {
|
|
142
|
+
...manifest,
|
|
143
|
+
components: {
|
|
144
|
+
Button: manifest.components.Button,
|
|
145
|
+
" Button ": {
|
|
146
|
+
...manifest.components.Button,
|
|
147
|
+
componentKey: " Button ",
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
expect(() =>
|
|
153
|
+
definePreviewArtifactManifest(mismatched as unknown as PreviewArtifactManifest)
|
|
154
|
+
).toThrow(/componentKey must match its components map key/);
|
|
155
|
+
expect(() =>
|
|
156
|
+
definePreviewArtifactManifest(duplicated as unknown as PreviewArtifactManifest)
|
|
157
|
+
).toThrow(/duplicate normalized componentKey/);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it("requires supported previewability values and unique non-empty variant ids", () => {
|
|
161
|
+
const invalid = {
|
|
162
|
+
...manifest,
|
|
163
|
+
components: {
|
|
164
|
+
Button: {
|
|
165
|
+
...manifest.components.Button,
|
|
166
|
+
previewability: "unknown",
|
|
167
|
+
variants: [
|
|
168
|
+
...manifest.components.Button.variants,
|
|
169
|
+
{
|
|
170
|
+
...manifest.components.Button.variants[0],
|
|
171
|
+
id: " default ",
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
...manifest.components.Button.variants[0],
|
|
175
|
+
id: " ",
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
expect(() =>
|
|
183
|
+
definePreviewArtifactManifest(invalid as unknown as PreviewArtifactManifest)
|
|
184
|
+
).toThrow(/previewability must be one of/);
|
|
185
|
+
expect(() =>
|
|
186
|
+
definePreviewArtifactManifest(invalid as unknown as PreviewArtifactManifest)
|
|
187
|
+
).toThrow(/variants.1.id must be unique within the component/);
|
|
188
|
+
expect(() =>
|
|
189
|
+
definePreviewArtifactManifest(invalid as unknown as PreviewArtifactManifest)
|
|
190
|
+
).toThrow(/variants.2.id must be a non-empty string/);
|
|
191
|
+
});
|
|
192
|
+
|
|
131
193
|
it("rejects malformed design comparison evidence", () => {
|
|
132
194
|
const invalid = {
|
|
133
195
|
...manifest,
|