@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
|
@@ -301,6 +301,13 @@ var GOVERNANCE_TELEMETRY_FIELDS = [
|
|
|
301
301
|
carriage: "derived",
|
|
302
302
|
topLevelField: "adoption"
|
|
303
303
|
},
|
|
304
|
+
{
|
|
305
|
+
path: "adoption.adopted[].{componentKey,displayName,canonicalTarget,usageCount}",
|
|
306
|
+
type: "bounded adopted component-identity summaries",
|
|
307
|
+
purpose: "Explains which canonical components account for current adopted call sites without uploading source.",
|
|
308
|
+
carriage: "derived",
|
|
309
|
+
topLevelField: "adoption"
|
|
310
|
+
},
|
|
304
311
|
{
|
|
305
312
|
path: "adoption.shadows[].{componentKey,displayName,canonicalTarget,usageCount}",
|
|
306
313
|
type: "bounded component-identity summaries",
|
|
@@ -372,4 +379,4 @@ export {
|
|
|
372
379
|
GOVERNANCE_TELEMETRY_FIELDS,
|
|
373
380
|
GOVERNANCE_TELEMETRY_SOURCE_DISCLOSURE
|
|
374
381
|
};
|
|
375
|
-
//# sourceMappingURL=chunk-
|
|
382
|
+
//# sourceMappingURL=chunk-3IOWHECM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/governance-telemetry.ts"],"sourcesContent":["/**\n * Public disclosure contract for `fragments-governance-report:v1`.\n *\n * Brace groups enumerate closed sibling fields without hiding additions behind\n * `*`. The three named placeholder fields are the only intentionally open\n * records: configured ignore reasons, configured categories, and rule-specific\n * evidence facts.\n */\nexport type GovernanceTelemetryCarriage =\n | \"none\"\n | \"derived\"\n | \"source-literal\"\n | \"structured-source\";\n\nexport interface GovernanceTelemetryField {\n path: string;\n type: string;\n purpose: string;\n carriage: GovernanceTelemetryCarriage;\n topLevelField: GovernanceTelemetryTopLevelField;\n}\n\nexport const GOVERNANCE_TELEMETRY_TOP_LEVEL_FIELDS = [\n \"contractHash\",\n \"schemaVersion\",\n \"generatedAt\",\n \"root\",\n \"hook\",\n \"git\",\n \"summary\",\n \"groups\",\n \"suppressions\",\n \"bypassEvents\",\n \"hookEvents\",\n \"packageVocabularies\",\n \"adoption\",\n \"health\",\n \"topology\",\n \"source\",\n \"gateRung\",\n \"diffOnly\",\n \"failOnWarnings\",\n] as const;\n\nexport type GovernanceTelemetryTopLevelField =\n (typeof GOVERNANCE_TELEMETRY_TOP_LEVEL_FIELDS)[number];\n\nexport const GOVERNANCE_TELEMETRY_FIELDS = [\n {\n path: \"schemaVersion\",\n type: '\"fragments-governance-report:v1\"',\n purpose: \"Pins the accepted wire shape and compatibility policy.\",\n carriage: \"none\",\n topLevelField: \"schemaVersion\",\n },\n {\n path: \"generatedAt\",\n type: \"ISO-8601 string\",\n purpose: \"Records when the CLI produced the report.\",\n carriage: \"none\",\n topLevelField: \"generatedAt\",\n },\n {\n path: \"root.{workspaceRoot,packageRoot,packageName}\",\n type: \"string fields\",\n purpose: \"Identifies the scanned workspace and package roots.\",\n carriage: \"none\",\n topLevelField: \"root\",\n },\n {\n path: \"hook.{installedAt,mode,agents[]}\",\n type: \"installation metadata\",\n purpose: \"Describes the local hook installation that produced evidence.\",\n carriage: \"none\",\n topLevelField: \"hook\",\n },\n {\n path: \"git.{baseRef,headSha,branch,repoFullName,pullRequestNumber}\",\n type: \"Git and provider identifiers\",\n purpose: \"Attaches results to the correct repository, commit and pull request.\",\n carriage: \"none\",\n topLevelField: \"git\",\n },\n {\n path: \"summary.{filesScanned,rulesActive,presetsLoaded[],groupCount,occurrenceCount,ignoredCount,classnamesScanned,classnamesDynamic,classnamesResolved,totalFindings,errorCount,warnCount,infoCount,passed}\",\n type: \"counts, verdict and active preset names\",\n purpose: \"Reports scan volume and result totals without finding rows.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.ignoredByReason.{reason}\",\n type: \"configured reason name → count\",\n purpose: \"Counts ignored findings by the reason configured by the repository.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.countsBySeverity.{error,warn,info}\",\n type: \"severity counts\",\n purpose: \"Counts findings in each fixed severity bucket.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.countsByCategory.{category}\",\n type: \"configured category name → count\",\n purpose: \"Counts findings by the rule categories present in the scan.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.integrity.{status,declared,fatalForCi,blockingCapable,summary}\",\n type: \"governance-integrity verdict\",\n purpose: \"Explains whether the resolved policy is capable of enforcement.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.integrity.families[].{id,armed,reason,remediation}\",\n type: \"integrity-family status\",\n purpose: \"Explains the enforcement readiness of each governance family.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.integrity.families[].rules[]\",\n type: \"rule identifiers\",\n purpose: \"Names the active rules contributing to an integrity family.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.integrity.armed[]\",\n type: \"integrity-family identifiers\",\n purpose: \"Names the governance families capable of enforcement.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.integrity.remediations[]\",\n type: \"remediation messages\",\n purpose: \"Explains how to make an inert or degraded policy effective.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.integrity.configDiagnostics[].{code,kind,severity,path,message}\",\n type: \"configuration diagnostics\",\n purpose: \"Reports inert or conflicting authored governance configuration.\",\n carriage: \"structured-source\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.integrity.roster.{configured,active,inert}\",\n type: \"rule roster counts\",\n purpose: \"Counts configured, active and inert governance rules.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.countsByBaselineState.{baselined,new}\",\n type: \"baseline-state counts\",\n purpose: \"Separates accepted baseline debt from newly introduced findings.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"groups[].{groupId,ruleId,category,severity,packageRoot,filePath}\",\n type: \"finding group metadata\",\n purpose: \"Identifies each grouped rule failure and repository-relative path.\",\n carriage: \"none\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].message\",\n type: \"string\",\n purpose: \"Explains the failure and may quote the offending source literal.\",\n carriage: \"source-literal\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].normalizedOffense.kind\",\n type: \"normalized-offense category\",\n purpose: \"Names the kind of source offense represented by the group.\",\n carriage: \"derived\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].normalizedOffense.raw\",\n type: \"normalized source offense\",\n purpose: \"Carries the exact offending source substring.\",\n carriage: \"source-literal\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].normalizedOffense.canonical\",\n type: \"normalized source offense\",\n purpose: \"Carries the derived canonical representation of the offense.\",\n carriage: \"derived\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].occurrences[].occurrenceId\",\n type: \"stable occurrence identifier\",\n purpose: \"Identifies one occurrence within a finding group.\",\n carriage: \"derived\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].occurrences[].location.{file,line,column,endLine,endColumn}\",\n type: \"repository-relative location\",\n purpose: \"Places each occurrence at its exact file/line/column range.\",\n carriage: \"none\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].occurrences[].area.{areaId,areaName,criticality,owners[],matchedGlob}\",\n type: \"area identifiers, owners and criticality\",\n purpose: \"Carries the configured product-area classification for the file.\",\n carriage: \"structured-source\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].occurrences[].evidence[].factId\",\n type: \"fact identifier\",\n purpose: \"Links the occurrence to the extracted fact supporting it.\",\n carriage: \"derived\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].occurrences[].evidence[].fact.kind\",\n type: \"fact discriminator\",\n purpose: \"Names the extracted rule-fact shape.\",\n carriage: \"none\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].occurrences[].evidence[].fact.location.{file,line,column,endLine,endColumn}\",\n type: \"repository-relative location\",\n purpose: \"Locates the source-backed fact used as evidence.\",\n carriage: \"none\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].occurrences[].evidence[].fact.{ruleSpecificField}\",\n type: \"extensible rule-specific fact fields\",\n purpose:\n \"Carries rule-specific parsed facts; fields may include selectors, properties and source values.\",\n carriage: \"structured-source\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].suggestedReplacement.{kind,from,to,certainty,reason}\",\n type: \"deterministic replacement\",\n purpose: \"Carries the deterministic replacement the CLI can apply.\",\n carriage: \"derived\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].suggestedReplacement.edit.{file,start,end,replacement}\",\n type: \"deterministic edit range\",\n purpose: \"Locates and describes the exact edit the CLI can apply.\",\n carriage: \"derived\",\n topLevelField: \"groups\",\n },\n {\n path: \"suppressions[].{id,kind,file,line,column,code,expiresOn,attachedLine,attachedTo,directive}\",\n type: \"directive identity, location and attachment metadata\",\n purpose: \"Reports matched in-source governance directives.\",\n carriage: \"none\",\n topLevelField: \"suppressions\",\n },\n {\n path: \"suppressions[].reason\",\n type: \"authored directive reason\",\n purpose: \"Carries the repository-authored reason for the suppression.\",\n carriage: \"source-literal\",\n topLevelField: \"suppressions\",\n },\n {\n path: \"bypassEvents[].{code,file,line}\",\n type: \"rule code and source location\",\n purpose: \"Records directives that actually bypassed a finding in this run.\",\n carriage: \"none\",\n topLevelField: \"bypassEvents\",\n },\n {\n path: \"bypassEvents[].reason\",\n type: \"authored directive reason\",\n purpose: \"Carries the repository-authored reason for the bypass.\",\n carriage: \"source-literal\",\n topLevelField: \"bypassEvents\",\n },\n {\n path: \"bypassEvents[].area.{areaId,areaName,criticality,matchedGlob}\",\n type: \"configured product-area metadata\",\n purpose: \"Classifies the bypass by its configured product area.\",\n carriage: \"structured-source\",\n topLevelField: \"bypassEvents\",\n },\n {\n path: \"hookEvents[].{eventId,kind,ruleId,code,file,mode,agent,timestamp,reasonClass}\",\n type: \"bounded hook decision receipts\",\n purpose: \"Reports deny, downgrade, suppression and fail-open decisions.\",\n carriage: \"none\",\n topLevelField: \"hookEvents\",\n },\n {\n path: \"packageVocabularies[].{source,packageName,status,manifestPath,digest,commit}\",\n type: \"compiled canonical-package vocabulary records\",\n purpose: \"Publishes package vocabulary proposed by authoritative local discovery.\",\n carriage: \"structured-source\",\n topLevelField: \"packageVocabularies\",\n },\n {\n path: \"packageVocabularies[].roots[].{name,members[]}\",\n type: \"compiled component roots and members\",\n purpose: \"Publishes the canonical component vocabulary discovered from the package.\",\n carriage: \"structured-source\",\n topLevelField: \"packageVocabularies\",\n },\n {\n path: \"adoption.{metricVersion,adoptedUsages,ownableUsages}\",\n type: \"versioned component-identity usage counts\",\n purpose: \"Records the exact numerator and denominator used for adoption history.\",\n carriage: \"derived\",\n topLevelField: \"adoption\",\n },\n {\n path: \"adoption.shadows[].{componentKey,displayName,canonicalTarget,usageCount}\",\n type: \"bounded component-identity summaries\",\n purpose:\n \"Explains which shadow components are moving the adoption curve without uploading source.\",\n carriage: \"derived\",\n topLevelField: \"adoption\",\n },\n {\n path: \"health.{metricVersion,checkedSites,violatingSites}\",\n type: \"versioned contract-site counts\",\n purpose:\n \"Records how many sites contract-scope rules inspected and how many distinct sites carried a finding.\",\n carriage: \"derived\",\n topLevelField: \"health\",\n },\n {\n path: \"health.populations.{componentUsages,tokenReferences}\",\n type: \"per-population site counts\",\n purpose: \"Names the measured populations behind the checked-site denominator.\",\n carriage: \"derived\",\n topLevelField: \"health\",\n },\n {\n path: \"topology.areaImpact[].{areaId,areaName,beforeOpen,afterOpen,introduced,persistent,resolved}\",\n type: \"area identifiers and before/after counts\",\n purpose: \"Reports bounded product-area impact totals.\",\n carriage: \"derived\",\n topLevelField: \"topology\",\n },\n {\n path: \"contractHash\",\n type: \"64-character FCID\",\n purpose: \"Pins the exact compiled contract enforced by the run.\",\n carriage: \"derived\",\n topLevelField: \"contractHash\",\n },\n {\n path: \"source\",\n type: '\"ci\"',\n purpose: \"Identifies the report producer.\",\n carriage: \"none\",\n topLevelField: \"source\",\n },\n {\n path: \"gateRung\",\n type: '\"ci\" | \"cli\"',\n purpose: \"Identifies the enforcement rung that produced the verdict.\",\n carriage: \"none\",\n topLevelField: \"gateRung\",\n },\n {\n path: \"diffOnly\",\n type: \"boolean\",\n purpose: \"States whether the scan was restricted to changed files.\",\n carriage: \"none\",\n topLevelField: \"diffOnly\",\n },\n {\n path: \"failOnWarnings\",\n type: \"boolean\",\n purpose: \"States whether warnings were gating for this run.\",\n carriage: \"none\",\n topLevelField: \"failOnWarnings\",\n },\n] as const satisfies readonly GovernanceTelemetryField[];\n\nexport const GOVERNANCE_TELEMETRY_SOURCE_DISCLOSURE =\n \"The report carries source text in named fields: offending literals, messages that may quote them, structured rule facts, authored suppression and bypass reasons, and compiled package vocabulary. It never uploads whole files, whole source lines or function bodies.\";\n"],"mappings":";AAsBO,IAAM,wCAAwC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,IAAM,8BAA8B;AAAA,EACzC;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAA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;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SACE;AAAA,IACF,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AACF;AAEO,IAAM,yCACX;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/governance-telemetry.ts"],"sourcesContent":["/**\n * Public disclosure contract for `fragments-governance-report:v1`.\n *\n * Brace groups enumerate closed sibling fields without hiding additions behind\n * `*`. The three named placeholder fields are the only intentionally open\n * records: configured ignore reasons, configured categories, and rule-specific\n * evidence facts.\n */\nexport type GovernanceTelemetryCarriage =\n | \"none\"\n | \"derived\"\n | \"source-literal\"\n | \"structured-source\";\n\nexport interface GovernanceTelemetryField {\n path: string;\n type: string;\n purpose: string;\n carriage: GovernanceTelemetryCarriage;\n topLevelField: GovernanceTelemetryTopLevelField;\n}\n\nexport const GOVERNANCE_TELEMETRY_TOP_LEVEL_FIELDS = [\n \"contractHash\",\n \"schemaVersion\",\n \"generatedAt\",\n \"root\",\n \"hook\",\n \"git\",\n \"summary\",\n \"groups\",\n \"suppressions\",\n \"bypassEvents\",\n \"hookEvents\",\n \"packageVocabularies\",\n \"adoption\",\n \"health\",\n \"topology\",\n \"source\",\n \"gateRung\",\n \"diffOnly\",\n \"failOnWarnings\",\n] as const;\n\nexport type GovernanceTelemetryTopLevelField =\n (typeof GOVERNANCE_TELEMETRY_TOP_LEVEL_FIELDS)[number];\n\nexport const GOVERNANCE_TELEMETRY_FIELDS = [\n {\n path: \"schemaVersion\",\n type: '\"fragments-governance-report:v1\"',\n purpose: \"Pins the accepted wire shape and compatibility policy.\",\n carriage: \"none\",\n topLevelField: \"schemaVersion\",\n },\n {\n path: \"generatedAt\",\n type: \"ISO-8601 string\",\n purpose: \"Records when the CLI produced the report.\",\n carriage: \"none\",\n topLevelField: \"generatedAt\",\n },\n {\n path: \"root.{workspaceRoot,packageRoot,packageName}\",\n type: \"string fields\",\n purpose: \"Identifies the scanned workspace and package roots.\",\n carriage: \"none\",\n topLevelField: \"root\",\n },\n {\n path: \"hook.{installedAt,mode,agents[]}\",\n type: \"installation metadata\",\n purpose: \"Describes the local hook installation that produced evidence.\",\n carriage: \"none\",\n topLevelField: \"hook\",\n },\n {\n path: \"git.{baseRef,headSha,branch,repoFullName,pullRequestNumber}\",\n type: \"Git and provider identifiers\",\n purpose: \"Attaches results to the correct repository, commit and pull request.\",\n carriage: \"none\",\n topLevelField: \"git\",\n },\n {\n path: \"summary.{filesScanned,rulesActive,presetsLoaded[],groupCount,occurrenceCount,ignoredCount,classnamesScanned,classnamesDynamic,classnamesResolved,totalFindings,errorCount,warnCount,infoCount,passed}\",\n type: \"counts, verdict and active preset names\",\n purpose: \"Reports scan volume and result totals without finding rows.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.ignoredByReason.{reason}\",\n type: \"configured reason name → count\",\n purpose: \"Counts ignored findings by the reason configured by the repository.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.countsBySeverity.{error,warn,info}\",\n type: \"severity counts\",\n purpose: \"Counts findings in each fixed severity bucket.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.countsByCategory.{category}\",\n type: \"configured category name → count\",\n purpose: \"Counts findings by the rule categories present in the scan.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.integrity.{status,declared,fatalForCi,blockingCapable,summary}\",\n type: \"governance-integrity verdict\",\n purpose: \"Explains whether the resolved policy is capable of enforcement.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.integrity.families[].{id,armed,reason,remediation}\",\n type: \"integrity-family status\",\n purpose: \"Explains the enforcement readiness of each governance family.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.integrity.families[].rules[]\",\n type: \"rule identifiers\",\n purpose: \"Names the active rules contributing to an integrity family.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.integrity.armed[]\",\n type: \"integrity-family identifiers\",\n purpose: \"Names the governance families capable of enforcement.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.integrity.remediations[]\",\n type: \"remediation messages\",\n purpose: \"Explains how to make an inert or degraded policy effective.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.integrity.configDiagnostics[].{code,kind,severity,path,message}\",\n type: \"configuration diagnostics\",\n purpose: \"Reports inert or conflicting authored governance configuration.\",\n carriage: \"structured-source\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.integrity.roster.{configured,active,inert}\",\n type: \"rule roster counts\",\n purpose: \"Counts configured, active and inert governance rules.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"summary.countsByBaselineState.{baselined,new}\",\n type: \"baseline-state counts\",\n purpose: \"Separates accepted baseline debt from newly introduced findings.\",\n carriage: \"derived\",\n topLevelField: \"summary\",\n },\n {\n path: \"groups[].{groupId,ruleId,category,severity,packageRoot,filePath}\",\n type: \"finding group metadata\",\n purpose: \"Identifies each grouped rule failure and repository-relative path.\",\n carriage: \"none\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].message\",\n type: \"string\",\n purpose: \"Explains the failure and may quote the offending source literal.\",\n carriage: \"source-literal\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].normalizedOffense.kind\",\n type: \"normalized-offense category\",\n purpose: \"Names the kind of source offense represented by the group.\",\n carriage: \"derived\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].normalizedOffense.raw\",\n type: \"normalized source offense\",\n purpose: \"Carries the exact offending source substring.\",\n carriage: \"source-literal\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].normalizedOffense.canonical\",\n type: \"normalized source offense\",\n purpose: \"Carries the derived canonical representation of the offense.\",\n carriage: \"derived\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].occurrences[].occurrenceId\",\n type: \"stable occurrence identifier\",\n purpose: \"Identifies one occurrence within a finding group.\",\n carriage: \"derived\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].occurrences[].location.{file,line,column,endLine,endColumn}\",\n type: \"repository-relative location\",\n purpose: \"Places each occurrence at its exact file/line/column range.\",\n carriage: \"none\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].occurrences[].area.{areaId,areaName,criticality,owners[],matchedGlob}\",\n type: \"area identifiers, owners and criticality\",\n purpose: \"Carries the configured product-area classification for the file.\",\n carriage: \"structured-source\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].occurrences[].evidence[].factId\",\n type: \"fact identifier\",\n purpose: \"Links the occurrence to the extracted fact supporting it.\",\n carriage: \"derived\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].occurrences[].evidence[].fact.kind\",\n type: \"fact discriminator\",\n purpose: \"Names the extracted rule-fact shape.\",\n carriage: \"none\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].occurrences[].evidence[].fact.location.{file,line,column,endLine,endColumn}\",\n type: \"repository-relative location\",\n purpose: \"Locates the source-backed fact used as evidence.\",\n carriage: \"none\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].occurrences[].evidence[].fact.{ruleSpecificField}\",\n type: \"extensible rule-specific fact fields\",\n purpose:\n \"Carries rule-specific parsed facts; fields may include selectors, properties and source values.\",\n carriage: \"structured-source\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].suggestedReplacement.{kind,from,to,certainty,reason}\",\n type: \"deterministic replacement\",\n purpose: \"Carries the deterministic replacement the CLI can apply.\",\n carriage: \"derived\",\n topLevelField: \"groups\",\n },\n {\n path: \"groups[].suggestedReplacement.edit.{file,start,end,replacement}\",\n type: \"deterministic edit range\",\n purpose: \"Locates and describes the exact edit the CLI can apply.\",\n carriage: \"derived\",\n topLevelField: \"groups\",\n },\n {\n path: \"suppressions[].{id,kind,file,line,column,code,expiresOn,attachedLine,attachedTo,directive}\",\n type: \"directive identity, location and attachment metadata\",\n purpose: \"Reports matched in-source governance directives.\",\n carriage: \"none\",\n topLevelField: \"suppressions\",\n },\n {\n path: \"suppressions[].reason\",\n type: \"authored directive reason\",\n purpose: \"Carries the repository-authored reason for the suppression.\",\n carriage: \"source-literal\",\n topLevelField: \"suppressions\",\n },\n {\n path: \"bypassEvents[].{code,file,line}\",\n type: \"rule code and source location\",\n purpose: \"Records directives that actually bypassed a finding in this run.\",\n carriage: \"none\",\n topLevelField: \"bypassEvents\",\n },\n {\n path: \"bypassEvents[].reason\",\n type: \"authored directive reason\",\n purpose: \"Carries the repository-authored reason for the bypass.\",\n carriage: \"source-literal\",\n topLevelField: \"bypassEvents\",\n },\n {\n path: \"bypassEvents[].area.{areaId,areaName,criticality,matchedGlob}\",\n type: \"configured product-area metadata\",\n purpose: \"Classifies the bypass by its configured product area.\",\n carriage: \"structured-source\",\n topLevelField: \"bypassEvents\",\n },\n {\n path: \"hookEvents[].{eventId,kind,ruleId,code,file,mode,agent,timestamp,reasonClass}\",\n type: \"bounded hook decision receipts\",\n purpose: \"Reports deny, downgrade, suppression and fail-open decisions.\",\n carriage: \"none\",\n topLevelField: \"hookEvents\",\n },\n {\n path: \"packageVocabularies[].{source,packageName,status,manifestPath,digest,commit}\",\n type: \"compiled canonical-package vocabulary records\",\n purpose: \"Publishes package vocabulary proposed by authoritative local discovery.\",\n carriage: \"structured-source\",\n topLevelField: \"packageVocabularies\",\n },\n {\n path: \"packageVocabularies[].roots[].{name,members[]}\",\n type: \"compiled component roots and members\",\n purpose: \"Publishes the canonical component vocabulary discovered from the package.\",\n carriage: \"structured-source\",\n topLevelField: \"packageVocabularies\",\n },\n {\n path: \"adoption.{metricVersion,adoptedUsages,ownableUsages}\",\n type: \"versioned component-identity usage counts\",\n purpose: \"Records the exact numerator and denominator used for adoption history.\",\n carriage: \"derived\",\n topLevelField: \"adoption\",\n },\n {\n path: \"adoption.adopted[].{componentKey,displayName,canonicalTarget,usageCount}\",\n type: \"bounded adopted component-identity summaries\",\n purpose:\n \"Explains which canonical components account for current adopted call sites without uploading source.\",\n carriage: \"derived\",\n topLevelField: \"adoption\",\n },\n {\n path: \"adoption.shadows[].{componentKey,displayName,canonicalTarget,usageCount}\",\n type: \"bounded component-identity summaries\",\n purpose:\n \"Explains which shadow components are moving the adoption curve without uploading source.\",\n carriage: \"derived\",\n topLevelField: \"adoption\",\n },\n {\n path: \"health.{metricVersion,checkedSites,violatingSites}\",\n type: \"versioned contract-site counts\",\n purpose:\n \"Records how many sites contract-scope rules inspected and how many distinct sites carried a finding.\",\n carriage: \"derived\",\n topLevelField: \"health\",\n },\n {\n path: \"health.populations.{componentUsages,tokenReferences}\",\n type: \"per-population site counts\",\n purpose: \"Names the measured populations behind the checked-site denominator.\",\n carriage: \"derived\",\n topLevelField: \"health\",\n },\n {\n path: \"topology.areaImpact[].{areaId,areaName,beforeOpen,afterOpen,introduced,persistent,resolved}\",\n type: \"area identifiers and before/after counts\",\n purpose: \"Reports bounded product-area impact totals.\",\n carriage: \"derived\",\n topLevelField: \"topology\",\n },\n {\n path: \"contractHash\",\n type: \"64-character FCID\",\n purpose: \"Pins the exact compiled contract enforced by the run.\",\n carriage: \"derived\",\n topLevelField: \"contractHash\",\n },\n {\n path: \"source\",\n type: '\"ci\"',\n purpose: \"Identifies the report producer.\",\n carriage: \"none\",\n topLevelField: \"source\",\n },\n {\n path: \"gateRung\",\n type: '\"ci\" | \"cli\"',\n purpose: \"Identifies the enforcement rung that produced the verdict.\",\n carriage: \"none\",\n topLevelField: \"gateRung\",\n },\n {\n path: \"diffOnly\",\n type: \"boolean\",\n purpose: \"States whether the scan was restricted to changed files.\",\n carriage: \"none\",\n topLevelField: \"diffOnly\",\n },\n {\n path: \"failOnWarnings\",\n type: \"boolean\",\n purpose: \"States whether warnings were gating for this run.\",\n carriage: \"none\",\n topLevelField: \"failOnWarnings\",\n },\n] as const satisfies readonly GovernanceTelemetryField[];\n\nexport const GOVERNANCE_TELEMETRY_SOURCE_DISCLOSURE =\n \"The report carries source text in named fields: offending literals, messages that may quote them, structured rule facts, authored suppression and bypass reasons, and compiled package vocabulary. It never uploads whole files, whole source lines or function bodies.\";\n"],"mappings":";AAsBO,IAAM,wCAAwC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,IAAM,8BAA8B;AAAA,EACzC;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,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AS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAe;AAAA,EACjB;AACF;AAEO,IAAM,yCACX;","names":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {
|
|
2
|
+
contractHash
|
|
3
|
+
} from "./chunk-PWIJMOI4.js";
|
|
4
|
+
|
|
5
|
+
// src/contract/manifest.ts
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
var FRAGMENTS_MANIFEST_FILENAME = "fragments.manifest.json";
|
|
8
|
+
var FRAGMENTS_MANIFEST_SCHEMA_VERSION = 1;
|
|
9
|
+
var FRAGMENTS_MANIFEST_TOKEN_RULE = "no-raw-values";
|
|
10
|
+
var fragmentsManifestPrimitiveSchema = z.object({
|
|
11
|
+
name: z.string().min(1),
|
|
12
|
+
members: z.array(z.string()),
|
|
13
|
+
intents: z.array(z.string()),
|
|
14
|
+
props: z.array(z.string()),
|
|
15
|
+
do: z.array(z.string()),
|
|
16
|
+
dont: z.array(z.string()),
|
|
17
|
+
exemplar: z.string().min(1).optional()
|
|
18
|
+
});
|
|
19
|
+
var fragmentsManifestPatternSchema = z.object({
|
|
20
|
+
name: z.string().min(1),
|
|
21
|
+
intent: z.string(),
|
|
22
|
+
primitives: z.array(z.string()),
|
|
23
|
+
shape: z.string(),
|
|
24
|
+
exemplar: z.string().min(1).optional()
|
|
25
|
+
});
|
|
26
|
+
var fragmentsManifestGrammarSchema = z.object({
|
|
27
|
+
rule: z.string().min(1),
|
|
28
|
+
check: z.string().min(1).optional()
|
|
29
|
+
});
|
|
30
|
+
var fragmentsManifestSchema = z.object({
|
|
31
|
+
schemaVersion: z.literal(FRAGMENTS_MANIFEST_SCHEMA_VERSION),
|
|
32
|
+
designSystem: z.object({
|
|
33
|
+
packageName: z.string().min(1),
|
|
34
|
+
importPath: z.string().min(1)
|
|
35
|
+
}),
|
|
36
|
+
tokens: z.object({
|
|
37
|
+
prefix: z.string().min(1),
|
|
38
|
+
rule: z.literal(FRAGMENTS_MANIFEST_TOKEN_RULE)
|
|
39
|
+
}),
|
|
40
|
+
primitives: z.array(fragmentsManifestPrimitiveSchema),
|
|
41
|
+
patterns: z.array(fragmentsManifestPatternSchema),
|
|
42
|
+
grammar: z.array(fragmentsManifestGrammarSchema),
|
|
43
|
+
rules: z.object({
|
|
44
|
+
preset: z.string().min(1),
|
|
45
|
+
off: z.array(z.string())
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
function parseFragmentsManifest(input) {
|
|
49
|
+
return fragmentsManifestSchema.parse(input);
|
|
50
|
+
}
|
|
51
|
+
function fragmentsManifestFcid(manifest) {
|
|
52
|
+
return contractHash(manifest);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
FRAGMENTS_MANIFEST_FILENAME,
|
|
57
|
+
FRAGMENTS_MANIFEST_SCHEMA_VERSION,
|
|
58
|
+
FRAGMENTS_MANIFEST_TOKEN_RULE,
|
|
59
|
+
fragmentsManifestPrimitiveSchema,
|
|
60
|
+
fragmentsManifestPatternSchema,
|
|
61
|
+
fragmentsManifestGrammarSchema,
|
|
62
|
+
fragmentsManifestSchema,
|
|
63
|
+
parseFragmentsManifest,
|
|
64
|
+
fragmentsManifestFcid
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=chunk-7ULGH74M.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/contract/manifest.ts"],"sourcesContent":["/**\n * Design-system manifest v1 — the committed, human-curated vocabulary that\n * every local agent surface reads. FCID is `contractHash(manifest)`.\n */\n\nimport { z } from \"zod\";\n\nimport { contractHash } from \"./hash.js\";\n\nexport const FRAGMENTS_MANIFEST_FILENAME = \"fragments.manifest.json\";\nexport const FRAGMENTS_MANIFEST_SCHEMA_VERSION = 1;\nexport const FRAGMENTS_MANIFEST_TOKEN_RULE = \"no-raw-values\";\n\nexport const fragmentsManifestPrimitiveSchema = z.object({\n name: z.string().min(1),\n members: z.array(z.string()),\n intents: z.array(z.string()),\n props: z.array(z.string()),\n do: z.array(z.string()),\n dont: z.array(z.string()),\n exemplar: z.string().min(1).optional(),\n});\n\nexport const fragmentsManifestPatternSchema = z.object({\n name: z.string().min(1),\n intent: z.string(),\n primitives: z.array(z.string()),\n shape: z.string(),\n exemplar: z.string().min(1).optional(),\n});\n\nexport const fragmentsManifestGrammarSchema = z.object({\n rule: z.string().min(1),\n check: z.string().min(1).optional(),\n});\n\nexport const fragmentsManifestSchema = z.object({\n schemaVersion: z.literal(FRAGMENTS_MANIFEST_SCHEMA_VERSION),\n designSystem: z.object({\n packageName: z.string().min(1),\n importPath: z.string().min(1),\n }),\n tokens: z.object({\n prefix: z.string().min(1),\n rule: z.literal(FRAGMENTS_MANIFEST_TOKEN_RULE),\n }),\n primitives: z.array(fragmentsManifestPrimitiveSchema),\n patterns: z.array(fragmentsManifestPatternSchema),\n grammar: z.array(fragmentsManifestGrammarSchema),\n rules: z.object({\n preset: z.string().min(1),\n off: z.array(z.string()),\n }),\n});\n\nexport type FragmentsManifestPrimitive = z.infer<typeof fragmentsManifestPrimitiveSchema>;\nexport type FragmentsManifestPattern = z.infer<typeof fragmentsManifestPatternSchema>;\nexport type FragmentsManifestGrammar = z.infer<typeof fragmentsManifestGrammarSchema>;\nexport type FragmentsManifest = z.infer<typeof fragmentsManifestSchema>;\n\nexport function parseFragmentsManifest(input: unknown): FragmentsManifest {\n return fragmentsManifestSchema.parse(input);\n}\n\n/** FCID for a parsed manifest: content-address, key-order independent. */\nexport function fragmentsManifestFcid(manifest: FragmentsManifest): string {\n return contractHash(manifest);\n}\n"],"mappings":";;;;;AAKA,SAAS,SAAS;AAIX,IAAM,8BAA8B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EAAE,MAAM,gCAAgC;AAAA,EACpD,UAAU,EAAE,MAAM,8BAA8B;AAAA,EAChD,SAAS,EAAE,MAAM,8BAA8B;AAAA,EAC/C,OAAO,EAAE,OAAO;AAAA,IACd,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,IACxB,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,EACzB,CAAC;AACH,CAAC;AAOM,SAAS,uBAAuB,OAAmC;AACxE,SAAO,wBAAwB,MAAM,KAAK;AAC5C;AAGO,SAAS,sBAAsB,UAAqC;AACzE,SAAO,aAAa,QAAQ;AAC9B;","names":[]}
|
|
@@ -1,173 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
portableRepoPathError
|
|
3
3
|
} from "./chunk-EIYNNS77.js";
|
|
4
|
+
import {
|
|
5
|
+
canonicalPreimage,
|
|
6
|
+
contractHash,
|
|
7
|
+
sha256Hex
|
|
8
|
+
} from "./chunk-PWIJMOI4.js";
|
|
4
9
|
|
|
5
10
|
// src/registry.ts
|
|
6
11
|
import { z } from "zod";
|
|
7
|
-
|
|
8
|
-
// src/contract/hash.ts
|
|
9
|
-
function normalizeNumber(value) {
|
|
10
|
-
if (Number.isNaN(value)) return '"@num:nan"';
|
|
11
|
-
if (value === Infinity) return '"@num:+inf"';
|
|
12
|
-
if (value === -Infinity) return '"@num:-inf"';
|
|
13
|
-
if (Object.is(value, -0)) return "0";
|
|
14
|
-
return JSON.stringify(value);
|
|
15
|
-
}
|
|
16
|
-
function canonicalPreimage(value) {
|
|
17
|
-
if (value === void 0 || value === null) return "null";
|
|
18
|
-
const type = typeof value;
|
|
19
|
-
if (type === "number") return normalizeNumber(value);
|
|
20
|
-
if (type === "string" || type === "boolean") return JSON.stringify(value);
|
|
21
|
-
if (type === "bigint") return JSON.stringify(value.toString());
|
|
22
|
-
if (Array.isArray(value)) {
|
|
23
|
-
return `[${value.map(canonicalPreimage).join(",")}]`;
|
|
24
|
-
}
|
|
25
|
-
if (type !== "object") {
|
|
26
|
-
return "null";
|
|
27
|
-
}
|
|
28
|
-
const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
29
|
-
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalPreimage(v)}`).join(",")}}`;
|
|
30
|
-
}
|
|
31
|
-
var K = new Uint32Array([
|
|
32
|
-
1116352408,
|
|
33
|
-
1899447441,
|
|
34
|
-
3049323471,
|
|
35
|
-
3921009573,
|
|
36
|
-
961987163,
|
|
37
|
-
1508970993,
|
|
38
|
-
2453635748,
|
|
39
|
-
2870763221,
|
|
40
|
-
3624381080,
|
|
41
|
-
310598401,
|
|
42
|
-
607225278,
|
|
43
|
-
1426881987,
|
|
44
|
-
1925078388,
|
|
45
|
-
2162078206,
|
|
46
|
-
2614888103,
|
|
47
|
-
3248222580,
|
|
48
|
-
3835390401,
|
|
49
|
-
4022224774,
|
|
50
|
-
264347078,
|
|
51
|
-
604807628,
|
|
52
|
-
770255983,
|
|
53
|
-
1249150122,
|
|
54
|
-
1555081692,
|
|
55
|
-
1996064986,
|
|
56
|
-
2554220882,
|
|
57
|
-
2821834349,
|
|
58
|
-
2952996808,
|
|
59
|
-
3210313671,
|
|
60
|
-
3336571891,
|
|
61
|
-
3584528711,
|
|
62
|
-
113926993,
|
|
63
|
-
338241895,
|
|
64
|
-
666307205,
|
|
65
|
-
773529912,
|
|
66
|
-
1294757372,
|
|
67
|
-
1396182291,
|
|
68
|
-
1695183700,
|
|
69
|
-
1986661051,
|
|
70
|
-
2177026350,
|
|
71
|
-
2456956037,
|
|
72
|
-
2730485921,
|
|
73
|
-
2820302411,
|
|
74
|
-
3259730800,
|
|
75
|
-
3345764771,
|
|
76
|
-
3516065817,
|
|
77
|
-
3600352804,
|
|
78
|
-
4094571909,
|
|
79
|
-
275423344,
|
|
80
|
-
430227734,
|
|
81
|
-
506948616,
|
|
82
|
-
659060556,
|
|
83
|
-
883997877,
|
|
84
|
-
958139571,
|
|
85
|
-
1322822218,
|
|
86
|
-
1537002063,
|
|
87
|
-
1747873779,
|
|
88
|
-
1955562222,
|
|
89
|
-
2024104815,
|
|
90
|
-
2227730452,
|
|
91
|
-
2361852424,
|
|
92
|
-
2428436474,
|
|
93
|
-
2756734187,
|
|
94
|
-
3204031479,
|
|
95
|
-
3329325298
|
|
96
|
-
]);
|
|
97
|
-
function rotr(value, bits) {
|
|
98
|
-
return (value >>> bits | value << 32 - bits) >>> 0;
|
|
99
|
-
}
|
|
100
|
-
function sha256Hex(message) {
|
|
101
|
-
const bytes = new TextEncoder().encode(message);
|
|
102
|
-
const length = bytes.length;
|
|
103
|
-
const bitLength = length * 8;
|
|
104
|
-
const withMarker = length + 1;
|
|
105
|
-
const zeroPad = (56 - withMarker % 64 + 64) % 64;
|
|
106
|
-
const total = withMarker + zeroPad + 8;
|
|
107
|
-
const buffer = new Uint8Array(total);
|
|
108
|
-
buffer.set(bytes, 0);
|
|
109
|
-
buffer[length] = 128;
|
|
110
|
-
const view = new DataView(buffer.buffer);
|
|
111
|
-
view.setUint32(total - 8, Math.floor(bitLength / 4294967296));
|
|
112
|
-
view.setUint32(total - 4, bitLength >>> 0);
|
|
113
|
-
let h0 = 1779033703;
|
|
114
|
-
let h1 = 3144134277;
|
|
115
|
-
let h2 = 1013904242;
|
|
116
|
-
let h3 = 2773480762;
|
|
117
|
-
let h4 = 1359893119;
|
|
118
|
-
let h5 = 2600822924;
|
|
119
|
-
let h6 = 528734635;
|
|
120
|
-
let h7 = 1541459225;
|
|
121
|
-
const w = new Uint32Array(64);
|
|
122
|
-
for (let chunk = 0; chunk < total; chunk += 64) {
|
|
123
|
-
for (let t = 0; t < 16; t++) w[t] = view.getUint32(chunk + t * 4);
|
|
124
|
-
for (let t = 16; t < 64; t++) {
|
|
125
|
-
const w15 = w[t - 15];
|
|
126
|
-
const w2 = w[t - 2];
|
|
127
|
-
const s0 = rotr(w15, 7) ^ rotr(w15, 18) ^ w15 >>> 3;
|
|
128
|
-
const s1 = rotr(w2, 17) ^ rotr(w2, 19) ^ w2 >>> 10;
|
|
129
|
-
w[t] = w[t - 16] + s0 + w[t - 7] + s1 >>> 0;
|
|
130
|
-
}
|
|
131
|
-
let a = h0;
|
|
132
|
-
let b = h1;
|
|
133
|
-
let c = h2;
|
|
134
|
-
let d = h3;
|
|
135
|
-
let e = h4;
|
|
136
|
-
let f = h5;
|
|
137
|
-
let g = h6;
|
|
138
|
-
let h = h7;
|
|
139
|
-
for (let t = 0; t < 64; t++) {
|
|
140
|
-
const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
141
|
-
const ch = e & f ^ ~e & g;
|
|
142
|
-
const temp1 = h + s1 + ch + K[t] + w[t] >>> 0;
|
|
143
|
-
const s0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
144
|
-
const maj = a & b ^ a & c ^ b & c;
|
|
145
|
-
const temp2 = s0 + maj >>> 0;
|
|
146
|
-
h = g;
|
|
147
|
-
g = f;
|
|
148
|
-
f = e;
|
|
149
|
-
e = d + temp1 >>> 0;
|
|
150
|
-
d = c;
|
|
151
|
-
c = b;
|
|
152
|
-
b = a;
|
|
153
|
-
a = temp1 + temp2 >>> 0;
|
|
154
|
-
}
|
|
155
|
-
h0 = h0 + a >>> 0;
|
|
156
|
-
h1 = h1 + b >>> 0;
|
|
157
|
-
h2 = h2 + c >>> 0;
|
|
158
|
-
h3 = h3 + d >>> 0;
|
|
159
|
-
h4 = h4 + e >>> 0;
|
|
160
|
-
h5 = h5 + f >>> 0;
|
|
161
|
-
h6 = h6 + g >>> 0;
|
|
162
|
-
h7 = h7 + h >>> 0;
|
|
163
|
-
}
|
|
164
|
-
return [h0, h1, h2, h3, h4, h5, h6, h7].map((value) => value.toString(16).padStart(8, "0")).join("");
|
|
165
|
-
}
|
|
166
|
-
function contractHash(body) {
|
|
167
|
-
return sha256Hex(canonicalPreimage(body));
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// src/registry.ts
|
|
171
12
|
var REGISTRY_MANIFEST_SCHEMA_VERSION = "fragments.registry.v1";
|
|
172
13
|
var REGISTRY_ARTIFACT_SCHEMA_VERSION = "fragments.registry-artifact.v1";
|
|
173
14
|
var REGISTRY_INSTALL_RECEIPT_SCHEMA_VERSION = "fragments.registry-lock.v1";
|
|
@@ -289,6 +130,8 @@ var registryManifestBaseSchema = z.object({
|
|
|
289
130
|
generatedAt: z.string().datetime(),
|
|
290
131
|
source: registrySourceSchema,
|
|
291
132
|
packageFiles: z.array(registryFileSchema).default([]),
|
|
133
|
+
/** Files every install writes, whatever the selection: the stylesheet entry and its closure. */
|
|
134
|
+
baseFiles: z.array(registryFileSchema).default([]),
|
|
292
135
|
entrypoints: z.array(registryEntrypointSchema).default([]),
|
|
293
136
|
components: z.record(z.string(), registryComponentSchema),
|
|
294
137
|
dependencies: z.array(registryDependencySchema).default([]),
|
|
@@ -315,6 +158,7 @@ var registryArtifactSchema = z.object({
|
|
|
315
158
|
}
|
|
316
159
|
const manifestFiles = [
|
|
317
160
|
...artifact.manifest.packageFiles,
|
|
161
|
+
...artifact.manifest.baseFiles,
|
|
318
162
|
...artifact.manifest.entrypoints.map((entrypoint) => ({
|
|
319
163
|
path: entrypoint.sourcePath,
|
|
320
164
|
role: "barrel",
|
|
@@ -456,11 +300,176 @@ function registryArtifactDigest(artifact) {
|
|
|
456
300
|
function registryManifestCanonicalPreimage(manifest) {
|
|
457
301
|
return canonicalPreimage(registryHashPayload(manifest));
|
|
458
302
|
}
|
|
303
|
+
var REGISTRY_INDEX_SCHEMA_VERSION = "fragments.registry-index.v2";
|
|
304
|
+
var REGISTRY_SHARD_SCHEMA_VERSION = "fragments.registry-shard.v2";
|
|
305
|
+
var registryShardPathSchema = registryFilePathSchema.superRefine((value, ctx) => {
|
|
306
|
+
if (!value.endsWith(".json")) {
|
|
307
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "Shard path must end with .json" });
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
var registryShardSchema = z.object({
|
|
311
|
+
schemaVersion: z.literal(REGISTRY_SHARD_SCHEMA_VERSION),
|
|
312
|
+
files: z.record(z.string().min(1), registryFileContentSchema)
|
|
313
|
+
}).superRefine((shard, ctx) => {
|
|
314
|
+
for (const [contentRef, file] of Object.entries(shard.files)) {
|
|
315
|
+
if (contentRef !== `sha256:${file.sha256}`) {
|
|
316
|
+
ctx.addIssue({
|
|
317
|
+
code: z.ZodIssueCode.custom,
|
|
318
|
+
path: ["files", contentRef],
|
|
319
|
+
message: `Shard key ${contentRef} does not match content hash of ${file.path}`
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
var registryIndexSchema = z.object({
|
|
325
|
+
schemaVersion: z.literal(REGISTRY_INDEX_SCHEMA_VERSION),
|
|
326
|
+
manifest: registryManifestSchema,
|
|
327
|
+
/** Shard path (relative to the index) → registry file paths whose bodies it carries. */
|
|
328
|
+
shards: z.record(registryShardPathSchema, z.array(registryFilePathSchema).min(1))
|
|
329
|
+
}).superRefine((index, ctx) => {
|
|
330
|
+
const owner = /* @__PURE__ */ new Map();
|
|
331
|
+
for (const [shardPath, paths] of Object.entries(index.shards)) {
|
|
332
|
+
for (const path of paths) {
|
|
333
|
+
const existing = owner.get(path);
|
|
334
|
+
if (existing) {
|
|
335
|
+
ctx.addIssue({
|
|
336
|
+
code: z.ZodIssueCode.custom,
|
|
337
|
+
path: ["shards", shardPath],
|
|
338
|
+
message: `Registry file ${path} is listed in both ${existing} and ${shardPath}`
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
owner.set(path, shardPath);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
for (const path of registryManifestFilePaths(index.manifest)) {
|
|
345
|
+
if (!owner.has(path)) {
|
|
346
|
+
ctx.addIssue({
|
|
347
|
+
code: z.ZodIssueCode.custom,
|
|
348
|
+
path: ["shards"],
|
|
349
|
+
message: `Registry file ${path} is not carried by any shard`
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
var REGISTRY_POINTER_SCHEMA_VERSION = "fragments.registry-pointer.v1";
|
|
355
|
+
var registryPointerSchema = z.object({
|
|
356
|
+
schemaVersion: z.literal(REGISTRY_POINTER_SCHEMA_VERSION),
|
|
357
|
+
registryId: z.string().min(1),
|
|
358
|
+
version: z.string().min(1),
|
|
359
|
+
registryHash: sha256Schema,
|
|
360
|
+
index: registryShardPathSchema,
|
|
361
|
+
generatedAt: z.string().datetime()
|
|
362
|
+
});
|
|
363
|
+
function buildRegistryPointer(index, indexPath) {
|
|
364
|
+
return registryPointerSchema.parse({
|
|
365
|
+
schemaVersion: REGISTRY_POINTER_SCHEMA_VERSION,
|
|
366
|
+
registryId: index.manifest.registryId,
|
|
367
|
+
version: index.manifest.version,
|
|
368
|
+
registryHash: index.manifest.registryHash,
|
|
369
|
+
index: indexPath,
|
|
370
|
+
generatedAt: index.manifest.generatedAt
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
function registryManifestFilePaths(manifest) {
|
|
374
|
+
return [...registryManifestFileMetadata(manifest).keys()].sort(
|
|
375
|
+
(left, right) => left.localeCompare(right)
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
function registryManifestFileMetadata(manifest) {
|
|
379
|
+
const files = /* @__PURE__ */ new Map();
|
|
380
|
+
const add = (file) => {
|
|
381
|
+
if (!files.get(file.path)) files.set(file.path, file);
|
|
382
|
+
};
|
|
383
|
+
manifest.packageFiles.forEach(add);
|
|
384
|
+
manifest.baseFiles.forEach(add);
|
|
385
|
+
for (const component of Object.values(manifest.components)) component.files.forEach(add);
|
|
386
|
+
for (const entrypoint of manifest.entrypoints) {
|
|
387
|
+
if (!files.has(entrypoint.sourcePath)) files.set(entrypoint.sourcePath, null);
|
|
388
|
+
}
|
|
389
|
+
return files;
|
|
390
|
+
}
|
|
391
|
+
function defaultRegistryShardPath(path) {
|
|
392
|
+
const componentMatch = /^src\/components\/([^/]+)\//.exec(path);
|
|
393
|
+
if (componentMatch) return `components/${componentMatch[1]}.json`;
|
|
394
|
+
if (!path.startsWith("src/")) return "shared/package.json";
|
|
395
|
+
const segments = path.slice("src/".length).split("/");
|
|
396
|
+
return segments.length > 1 ? `shared/${segments[0]}.json` : "shared/src.json";
|
|
397
|
+
}
|
|
398
|
+
function shardKeyFor(metadata, sha256) {
|
|
399
|
+
return metadata?.contentRef ?? `sha256:${sha256}`;
|
|
400
|
+
}
|
|
401
|
+
function shardRegistryArtifact(artifact, shardPathFor = defaultRegistryShardPath) {
|
|
402
|
+
const metadata = registryManifestFileMetadata(artifact.manifest);
|
|
403
|
+
const shards = /* @__PURE__ */ new Map();
|
|
404
|
+
const shardPaths = {};
|
|
405
|
+
for (const [path, content] of Object.entries(artifact.files).sort(
|
|
406
|
+
([left], [right]) => left.localeCompare(right)
|
|
407
|
+
)) {
|
|
408
|
+
const shardPath = shardPathFor(path);
|
|
409
|
+
const shard = shards.get(shardPath) ?? {
|
|
410
|
+
schemaVersion: REGISTRY_SHARD_SCHEMA_VERSION,
|
|
411
|
+
files: {}
|
|
412
|
+
};
|
|
413
|
+
shard.files[shardKeyFor(metadata.get(path), content.sha256)] = content;
|
|
414
|
+
shards.set(shardPath, shard);
|
|
415
|
+
(shardPaths[shardPath] ??= []).push(path);
|
|
416
|
+
}
|
|
417
|
+
const index = registryIndexSchema.parse({
|
|
418
|
+
schemaVersion: REGISTRY_INDEX_SCHEMA_VERSION,
|
|
419
|
+
manifest: artifact.manifest,
|
|
420
|
+
shards: shardPaths
|
|
421
|
+
});
|
|
422
|
+
for (const [path, shard] of shards) shards.set(path, registryShardSchema.parse(shard));
|
|
423
|
+
return { index, shards };
|
|
424
|
+
}
|
|
425
|
+
function shardOwnerMap(index) {
|
|
426
|
+
const owner = /* @__PURE__ */ new Map();
|
|
427
|
+
for (const [shardPath, paths] of Object.entries(index.shards)) {
|
|
428
|
+
for (const path of paths) owner.set(path, shardPath);
|
|
429
|
+
}
|
|
430
|
+
return owner;
|
|
431
|
+
}
|
|
432
|
+
function registryShardsForPaths(index, paths) {
|
|
433
|
+
const owner = shardOwnerMap(index);
|
|
434
|
+
const shards = /* @__PURE__ */ new Set();
|
|
435
|
+
for (const path of paths) {
|
|
436
|
+
const shardPath = owner.get(path);
|
|
437
|
+
if (!shardPath) throw new Error(`Registry index has no shard for ${path}`);
|
|
438
|
+
shards.add(shardPath);
|
|
439
|
+
}
|
|
440
|
+
return [...shards].sort((left, right) => left.localeCompare(right));
|
|
441
|
+
}
|
|
442
|
+
function assembleRegistryArtifact(args) {
|
|
443
|
+
const metadata = registryManifestFileMetadata(args.index.manifest);
|
|
444
|
+
const owner = shardOwnerMap(args.index);
|
|
445
|
+
const files = {};
|
|
446
|
+
for (const path of [...new Set(args.paths)].sort((left, right) => left.localeCompare(right))) {
|
|
447
|
+
const shardPath = owner.get(path);
|
|
448
|
+
if (!shardPath) throw new Error(`Registry index has no shard for ${path}`);
|
|
449
|
+
const shard = args.shards.get(shardPath);
|
|
450
|
+
if (!shard) throw new Error(`Registry shard ${shardPath} was not loaded (needed for ${path})`);
|
|
451
|
+
const expected = metadata.get(path) ?? null;
|
|
452
|
+
const content = expected ? shard.files[expected.contentRef] : Object.values(shard.files).find((file) => file.path === path);
|
|
453
|
+
if (!content || content.path !== path) {
|
|
454
|
+
throw new Error(`Registry shard ${shardPath} is missing content for ${path}`);
|
|
455
|
+
}
|
|
456
|
+
const actualSha256 = hashRegistryFileContent(content.content);
|
|
457
|
+
const actualSize = registryFileSize(content.content);
|
|
458
|
+
const expectedSha256 = expected?.sha256 ?? content.sha256;
|
|
459
|
+
const expectedSize = expected?.size ?? content.size;
|
|
460
|
+
if (actualSha256 !== expectedSha256 || actualSize !== expectedSize) {
|
|
461
|
+
throw new Error(`Registry shard ${shardPath} content for ${path} does not match the index`);
|
|
462
|
+
}
|
|
463
|
+
files[path] = content;
|
|
464
|
+
}
|
|
465
|
+
return {
|
|
466
|
+
schemaVersion: REGISTRY_ARTIFACT_SCHEMA_VERSION,
|
|
467
|
+
manifest: args.index.manifest,
|
|
468
|
+
files
|
|
469
|
+
};
|
|
470
|
+
}
|
|
459
471
|
|
|
460
472
|
export {
|
|
461
|
-
canonicalPreimage,
|
|
462
|
-
sha256Hex,
|
|
463
|
-
contractHash,
|
|
464
473
|
REGISTRY_MANIFEST_SCHEMA_VERSION,
|
|
465
474
|
REGISTRY_ARTIFACT_SCHEMA_VERSION,
|
|
466
475
|
REGISTRY_INSTALL_RECEIPT_SCHEMA_VERSION,
|
|
@@ -488,6 +497,19 @@ export {
|
|
|
488
497
|
buildRegistryArtifact,
|
|
489
498
|
assertValidRegistryArtifact,
|
|
490
499
|
registryArtifactDigest,
|
|
491
|
-
registryManifestCanonicalPreimage
|
|
500
|
+
registryManifestCanonicalPreimage,
|
|
501
|
+
REGISTRY_INDEX_SCHEMA_VERSION,
|
|
502
|
+
REGISTRY_SHARD_SCHEMA_VERSION,
|
|
503
|
+
registryShardSchema,
|
|
504
|
+
registryIndexSchema,
|
|
505
|
+
REGISTRY_POINTER_SCHEMA_VERSION,
|
|
506
|
+
registryPointerSchema,
|
|
507
|
+
buildRegistryPointer,
|
|
508
|
+
registryManifestFilePaths,
|
|
509
|
+
registryManifestFileMetadata,
|
|
510
|
+
defaultRegistryShardPath,
|
|
511
|
+
shardRegistryArtifact,
|
|
512
|
+
registryShardsForPaths,
|
|
513
|
+
assembleRegistryArtifact
|
|
492
514
|
};
|
|
493
|
-
//# sourceMappingURL=chunk-
|
|
515
|
+
//# sourceMappingURL=chunk-ML5S6QNU.js.map
|