/** * Browser-safe exports for @fragments-sdk/cli/core * For Node.js-only APIs (config, discovery, loader), import from '@fragments-sdk/cli' directly. */ // Brand and default constants export { BRAND, DEFAULTS } from "./constants.js"; export type { Brand, Defaults } from "./constants.js"; // Conform engine contract (shared across extract engine, mcp tool, surfaces) export type { ConformChange, ConformComponentMapping, ConformConfidence, ConformCoverage, ConformInput, ConformLocation, ConformPropMapping, ConformResult, ConformSuggestion, ConformToken, ConformUnresolved, DesignSystemContext, } from "./conform.js"; // Prove-compliant loop (Contract Mode Phase 2): the pure validate-fix-validate // primitive behind `contract.prove`. Framework-agnostic — takes a conform // callback + optional sampler, returns a 3-valued verdict. export { PROVE_DEFAULT_MAX_PASSES, PROVE_MAX_PASSES, clampMaxPasses, emptyConformResult, proveCompliant, proveIssueCount, resolveProveVerdict, } from "./conform-prove.js"; export type { ProveCallbacks, ProveLoopResult, ProveOptions, ProvePass, ProvePassSampling, ProveResidual, ProveSample, ProveSamplerArgs, ProveVerdict, } from "./conform-prove.js"; // Shared TypeStyle severity helpers export { SEVERITIES, SEVERITY_RANK, SEVERITY_WEIGHTS, compareSeverity, maxSeverity, severityLevel, severitySchema, sortBySeverity, } from "./severity.js"; export type { Severity, SeverityLevel } from "./severity.js"; // Canonical TypeStyle schemas export { agentFormatSchema, factEvidenceSchema, factLocationSchema, findingFixSchema, findingReplaceClassTokenFixSchema, findingReplaceComponentFixSchema, findingReplaceImportFixSchema, findingReplacePropValueFixSchema, findingReplaceStyleValueFixSchema, findingSchema, fixSchema, governanceVerdictMetadataSchema, governanceVerdictSchema, normalizeFinding, normalizeSeverity, normalizeViolation, suppressionDirectiveSchema, validatorResultSchema, violationSchema, } from "./schemas/index.js"; export type { AgentFormat, Fix, Finding as CanonicalFinding, GovernanceVerdict as CanonicalGovernanceVerdict, GovernanceVerdictMetadata, SuppressionDirective, ValidatorResult, Violation, } from "./schemas/index.js"; // FUI code registry export { CODES, EXPLAIN_URL_BASE, bridgeSourceViolation, bridgeSourceViolations, byCode, byRuleId, explainUrlForCode, } from "./codes/index.js"; export type { BridgeViolationInput, CodeCategory, CodeLifecycle, FuiCode, Severity as FuiSeverity, } from "./codes/index.js"; export { buildAgentFormat, type BuildAgentFormatInput } from "./agent-format.js"; export { isPortableRepoPath, normalizeConfigPath, portableRepoPathError, resolveConfiguredAppPath, tokenIncludesFromConfig, topologyBase, } from "./config-paths.js"; // Types export type { FragmentComponent, ComponentRef, FragmentMeta, FragmentUsage, PropType, PropDefinition, ControlType, RelationshipType, ComponentRelation, VariantLoader, PlayFunction, PlayFunctionContext, FragmentVariant, FragmentDefinition, FragmentsConfig, SnippetPolicyConfig, RegistryOptions, CompiledFragment, CompiledFragmentsFile, ObservedComponentUsage, ObservedUsageProp, BlockDefinition, CompiledBlock, RecipeDefinition, // @deprecated - use BlockDefinition CompiledRecipe, // @deprecated - use CompiledBlock // Contract and provenance types FragmentContract, FragmentGenerated, // AI metadata type AIMetadata, // v2 types (alongside v1, non-breaking) FragmentGuidance, FragmentExample, CompositionMetadata, FragmentProvenance, FragmentDefinitionV2, // Screenshot types ScreenshotConfig, ServiceConfig, Viewport, Theme, Screenshot, ScreenshotMetadata, DiffResult, BoundingBox, BaselineInfo, Manifest, VerifyRequest, VerifyResult, // Figma property mapping types FigmaPropMapping, FigmaStringMapping, FigmaBooleanMapping, FigmaEnumMapping, FigmaInstanceMapping, FigmaChildrenMapping, FigmaTextContentMapping, // Storybook filter configuration StorybookFilterConfig, // Token configuration AppConfig, DesignSystemConfig, RepoRelativePath, TokenConfig, TokenSourceConfig, TokenSourceFormat, // Theme and snapshot configuration ThemeSeeds, SnapshotConfig, // Compiled token types CompiledTokenEntry, CompiledTokenData, } from "./types.js"; // Performance presets export { resolvePerformanceConfig, classifyComplexity, formatBytes, budgetBar, PRESET_NAMES, } from "./performance-presets.js"; export type { PerformanceBudgets, PerformanceConfig, ComplexityTier, PerformanceData as PerfData, PerformanceSummary as PerfSummary, } from "./performance-presets.js"; // Token types export type { TokenCategory, DesignToken, TokenRegistry, TokenRegistryMeta, EnhancedStyleDiffItem, TokenFix, TokenParseResult, TokenParseError, TokenMatchRequest, TokenMatchResult, TokenUsageSummary, } from "./token-types.js"; // Bundle contracts for Cloud setup bundles export { bundleSchemaVersionSchema, bundleTargetSchema, bundleArtifactMetadataSchema, bundleManifestComponentEntrySchema, bundleManifestSchema, bundleComponentShardSchema, bundleTokenFileSchema, } from "./bundle.js"; export type { BundleSchemaVersion, BundleTarget, BundleArtifactMetadata, BundleManifestComponentEntry, BundleManifest, BundleComponentShard, BundleTokenFile, } from "./bundle.js"; // Fragments Registry Protocol contracts export { REGISTRY_ARTIFACT_SCHEMA_VERSION, REGISTRY_INSTALL_RECEIPT_SCHEMA_VERSION, REGISTRY_MANIFEST_SCHEMA_VERSION, assertValidRegistryArtifact, buildRegistryArtifact, buildRegistryFile, computeRegistryHash, finalizeRegistryManifest, hashRegistryFileContent, registryArtifactDigest, registryArtifactSchema, registryComponentExportSchema, registryComponentSchema, registryDependencySchema, registryDependencyTypeSchema, registryEntrypointSchema, registryFileContentSchema, registryFileRoleSchema, registryFileSchema, registryFileSize, registryInstallProfileSchema, registryInstallReceiptComponentSchema, registryInstallReceiptFileSchema, registryInstallReceiptSchema, registryManifestCanonicalPreimage, registryManifestDraftSchema, registryManifestSchema, registrySourceSchema, } from "./registry.js"; export type { RegistryArtifact, RegistryArtifactInput, RegistryComponent, RegistryComponentExport, RegistryDependency, RegistryDependencyType, RegistryEntrypoint, RegistryFile, RegistryFileContent, RegistryFileInput, RegistryFileRole, RegistryInstallProfile, RegistryInstallReceipt, RegistryInstallReceiptComponent, RegistryInstallReceiptFile, RegistryManifest, RegistryManifestDraft, RegistrySource, } from "./registry.js"; export { assertPortableRegistryPath, buildRegistryInstallPlan, buildRegistryInstallReceipt, collectRegistryInstallDependencies, normalizeRegistryRepoPath, selectedRegistryComponentNames, sourceToRegistryTargetPath, } from "./registry-install-plan.js"; export type { BuildRegistryInstallPlanInput, RegistryInstallPlan, RegistryWritePlan, } from "./registry-install-plan.js"; // MCP snapshot contracts export { mcpSnapshotSchemaVersionSchema, mcpSourceTypeSchema, mcpCapabilitySchema, mcpPerformanceImportSchema, mcpPerformanceDataSchema, mcpPerformanceSummarySchema, mcpComponentPropSchema, mcpComponentExampleSchema, mcpComponentRelationSchema, mcpCompoundChildSchema, mcpGuidancePatternSchema, mcpComponentGuidanceSchema, mcpComponentMetadataSchema, mcpComponentSchema, mcpBlockSchema, mcpTokenSchema, mcpTokenDataSchema, mcpSnapshotMetadataSchema, mcpSnapshotSchema, } from "./mcp-snapshot.js"; export type { McpSnapshotSchemaVersion, McpSourceType, McpCapability, McpPerformanceImport, McpPerformanceData, McpPerformanceSummary, McpComponentProp, McpComponentExample, McpComponentRelation, McpCompoundChild, McpGuidancePattern, McpComponentGuidance, McpComponentMetadata, McpComponent, McpBlock, McpToken, McpTokenData, McpSnapshotMetadata, McpSnapshot, } from "./mcp-snapshot.js"; // Style comparison engine (canonical — viewer and CLI re-export from here) export { compareStyleValue, compareStyles, compareStylesWithTokens, normalizeStyleValue, compareColors, compareNumericValues, formatTokenSummary, getComplianceBadge, DEFAULT_STYLE_PROPERTIES, DEFAULT_ENHANCED_STYLE_PROPERTIES, } from "./style-comparison.js"; export type { NormalizedToken, NormalizedStyleMap, StyleComparisonOptions, StyleDiffItem, StyleComparisonResult, TokenLookup, EnhancedStyleComparisonResult, } from "./style-comparison.js"; // Schema validation (Zod is browser-safe) export { fragmentMetaSchema, fragmentUsageSchema, propDefinitionSchema, componentRelationSchema, fragmentVariantSchema, fragmentDefinitionSchema, fragmentsConfigSchema, figmaPropMappingSchema, // Contract and provenance schemas fragmentContractSchema, fragmentGeneratedSchema, fragmentBanSchema, blockDefinitionSchema, recipeDefinitionSchema, // @deprecated - use blockDefinitionSchema // AI metadata schema aiMetadataSchema, // v2 schemas compositionMetadataSchema, fragmentProvenanceSchema, fragmentDefinitionV2Schema, governedFragmentDefinitionSchema, } from "./schema.js"; // Main API export { defineConfig } from "./config.js"; export { defineFragment, compileFragment, normalizeToV1, defineBlock, compileBlock, defineRecipe, compileRecipe, } from "./defineFragment.js"; export type { InferProps } from "./defineFragment.js"; // Governance authoring DSL export { componentGovernanceRecordSchema, componentGovernanceRecordsSchema, g, globalGovernanceRecordSchema, globalJsxGovernanceRecordSchema, globalStyleGovernanceRecordSchema, governanceConfigSchema, governanceSeveritySchema, normalizeGovernanceConfig, scaleGovernanceRecordSchema, } from "./governance.js"; export type { AccessibilityGovernanceBuilder, CanonicalSource, ComponentGovernanceBuilder, ComponentGovernanceRecord, GlobalGovernanceRecord, GlobalJsxGovernanceRecord, GlobalStyleGovernanceRecord, GovernanceConfig, GovernancePropValue, GovernanceSeverity, GovernedFragmentDefinition, PropGovernanceBuilder, PropGovernanceOptions, PropKey, ResolvedGovernedFragmentDefinition, ScaleGovernanceRecord, } from "./governance.js"; // Story adapter (runtime conversion of Storybook modules) export { storyModuleToFragment, setPreviewConfig, getPreviewConfig, // Re-export @storybook/csf utilities toId, storyNameFromExport, isExportStory, } from "./storyAdapter.js"; export type { StoryModule, StoryMeta, Story, StoryArgType, StoryContext, Decorator, Loader, PreviewConfig, CSF2Story, } from "./storyAdapter.js"; // Storybook adapter filtering export { checkStoryExclusion, detectSubComponentPaths, isForceIncluded, isConfigExcluded, } from "./storyFilters.js"; export type { ExclusionReason, ExclusionResult, CheckStoryExclusionOpts } from "./storyFilters.js"; // Context generation for AI agents export { generateContext } from "./context.js"; export type { ContextOptions, ContextResult } from "./context.js"; // Figma property mapping DSL export { figma, isFigmaPropMapping, resolveFigmaMapping } from "./figma.js"; // Fragment JSON types (for .fragment.json files) export type { Fragment, FragmentFigma, FragmentUsage as FragmentJsonUsage, FragmentDoNotItem, FragmentPattern, FragmentAccessibility, FragmentRelated, FragmentMeta as FragmentJsonMeta, FragmentIndex, FragmentRegistry, RegistryComponentEntry, RegistryPropEntry, FragmentContextOptions, } from "./fragment-types.js"; // Token parsing and token-domain helpers export { calculateDeltaE, colorSimilarity, containsTailwindV4Theme, familyDistance, hexToRgb, inferTokenCategory, inferTokenGroup, isColorLike, nearestByDeltaE, normalizeColor, normalizeTokenGroupComment, normalizeTokenValue, parseColor, parseColorToRgb, parseCssTokens, parseDesignTokenContent, parseDtcgTokens, parseRgb, parseScssTokens, parseScssVariables, parseTailwindV4Theme, parseTokenFile, parseTokens, resolveDesignTokenValue, resolveTokenValue, rgbToHex, } from "./tokens/index.js"; export type { DeltaEMatch, DesignTokenParseOptions, NearestByDeltaEOptions, ParsedToken, ParseTokensOptions, RGB, RGBA, ThemeParserResult, TokenFormat, TokenParseOutput, } from "./tokens/index.js"; // DTCG token format export { parseDTCGFile, isDTCGFile } from "./dtcg-parser.js"; export type { DTCGTokenFile, DTCGToken, DTCGGroup, DTCGTokenType, DTCGColorValue, DTCGDimensionValue, ResolvedDTCGToken, } from "./dtcg.js"; export { dtcgTokenFileSchema } from "./dtcg.js"; // Component contracts (framework-agnostic) export { parseComponentContract, isContractFile } from "./contract-parser.js"; export type { CompiledContractOutput } from "./contract-parser.js"; export type { ComponentContract } from "./component-contract.js"; export { componentContractSchema } from "./component-contract.js"; // DTCG output generators export { generateCSSCustomProperties, generateSCSSVariables, generateTailwindConfig, generateFigmaVariables, } from "./dtcg-generators.js"; export type { CSSGeneratorOptions, SCSSGeneratorOptions, FigmaVariable, FigmaVariableCollection, } from "./dtcg-generators.js"; // Composition analysis export { analyzeComposition } from "./composition.js"; export type { CompositionAnalysis, CompositionWarning, CompositionSuggestion, CompositionGuideline, } from "./composition.js"; // Shared preview runtime export { executeVariantLoaders, resolvePreviewRuntimeState, usePreviewVariantRuntime, PreviewVariantRuntime, } from "./preview-runtime.js"; export type { PreviewVariantLike, PreviewRuntimeState, PreviewRuntimeOptions, } from "./preview-runtime.js"; // Component discovery export { discoverComponents, isReactComponent } from "./component-discovery.js"; export type { DiscoverComponentsOptions } from "./component-discovery.js"; // Phase 5 rules (governance compiler refactor) export { RULES, runRules, makeFinding, ruleComponentsUnknownProp, ruleComponentsForbiddenPropValue, ruleComponentsPreferLibrary, rulePropsInvalidValue, ruleJsxPreferredImportPath, ruleJsxPreferredComponent, ruleStylesNoRawColor, ruleStylesNoRawDimensions, ruleStylesNoRawSpacing, ruleStylesNoRawTypography, ruleThemeNoThemeCoupledLiteral, ruleTailwindArbitraryColor, ruleTailwindArbitrarySpacing, ruleTailwindForbiddenPalette, ruleTailwindOffScaleSpacingToken, ruleTailwindRawColorViaToken, ruleTailwindUnknownClass, ruleTokensRequireDualFallback, ruleA11yRequiredAccessibleName, } from "./rules/index.js"; export { nearestSignedScaleValue } from "./rules/utils.js"; export { buildSpacingTokenLookup, resolveSpacingValue, type CheckedSpacingValue, type SpacingResolutionScale, type SpacingTokenLookup, } from "./rules/spacing-resolution.js"; export type { Rule, RuleFn, Finding, FindingFix, FindingReplaceComponentFix, FindingReplaceImportFix, FindingReplacePropValueFix, FindingReplaceStyleValueFix, FindingReplaceClassTokenFix, } from "./rules/index.js"; // Composition config contract (region-scoped governance, brief 04) — shared // across the policy boundary: rule guard, cloud policy validation, fragment // authoring sugar. export { compositionPatternSchema, compositionAuthoringEntrySchema, isCompositionPattern, lowerCompositionContract, } from "./rules/index.js"; export type { CompositionPattern, CompositionRegionSelector, CompositionChildSelector, CompositionConstraint, CompositionAuthoringEntry, } from "./rules/index.js"; // Rule taxonomy SSOT (contract-findings brief 02): tier map + customer/fragments // presets, consumed by the cloud policy composer + UI rules editor. export { RULE_TIER, FRAGMENTS_INTERNAL_RULE_IDS, tierFor, isContractTierRule, contractTierRuleIds, hygieneTierRuleIds, vocabularyRank, compareByVocabularyRank, customerDefaultRuleStates, fragmentsPresetRuleStates, } from "./rules/index.js"; export type { RuleTier, PresetRuleState } from "./rules/index.js"; // Blocking deny-set (Contract Mode Phase 0): shared "may this finding hard-deny // a write" criteria — single-sourced for the CLI hook + the emit gate. export { BLOCKING_RULE_ALLOWLIST, gatesCi, isDenyEligible } from "./rules/index.js"; // Governance integrity — armed-vs-declared verdict over a fully-resolved policy. // Encodes "enabled ≠ armed": a rule with no vocabulary enforces nothing. export { evaluateGovernanceIntegrity, hasEffectiveComponentVocabulary, isEffectiveCanonicalSource, } from "./governance-integrity.js"; export type { GovernanceIntegrityFamily, GovernanceIntegrityFamilyId, GovernanceIntegrityInput, GovernanceIntegrityStatus, GovernanceIntegrityVerdict, } from "./governance-integrity.js"; // Fact IR + index (Phase 3 of the governance compiler refactor) export { componentId, asComponentId, factId, hash64Hex, canonicalJson, FactIndex, matchesGlob, makeComponentMetadataFact, makeComponentCapabilityFact, makeCanonicalCandidateFact, makeCanonicalMappingFact, makeCanonicalReplacementFact, makePropMetadataFact, makePropValueAvoidedFact, makePropValueForbiddenFact, makeA11yNameRequiredFact, makeScaleFact, makeScaleValueFact, makeStructuralConfidenceFact, makeStyleRawColorForbiddenFact, makeStylePropertyScaleFact, makeStyleFontSizeScaleFact, makeStyleCssVarsMustBeDefinedFact, makeContractTokenFact, makeJsxUnknownPropsForbiddenFact, makeJsxInlineStyleForbiddenRawFact, makeJsxImportPathPreferredFact, makeJsxComponentPreferredFact, makeTokenDefinitionFact, makeTailwindPaletteAllowFact, makeTailwindPaletteDenyFact, makeTailwindUnknownClassEnabledFact, makeUsageNodeFact, makeUsageComponentFact, makeUsageImportFact, makeUsagePropResolvedFact, makeUsageInlineStyleFact, makeUsageTextChildFact, makeStyleDeclarationFact, makeStyleUnsupportedFact, makeClassNameLiteralFact, makeClassNameDynamicFact, makeTailwindClassFact, makeThemeDeclarationFact, makeTailwindTokenResolvedFact, compileGlobalGovernanceFacts, compileComponentFacts, } from "./facts/index.js"; export { canonicalPreimage, AGENT_CONTEXT_RELATIVE_PATH, CATALOG_FIXTURE_A_FCID, catalogFixtureA, catalogFixtureAContractPayload, catalogFixtureATokensDtcg, CONTRACT_DOMAINS, CONTRACT_PREIMAGE_SCHEMA, contractComponentsFromFragments, contractHash, contractPolicyFromGovernanceConfig, diffContractDomains, formatStampHeader, formatStampPin, formatStampVersionHash, parseContractStamp, projectContractPreimage, serializeContractStamp, sha256Hex, } from "./contract/index.js"; export type { CanonicalMappingStatus, ContractCanonicalMappingInput, ContractCatalogInput, ContractComponentInput, ContractDomain, ContractPolicyInput, ContractPreimage, ContractPropMappingInput, ContractStampPin, ContractStampRecord, ContractTokenInput, ContractWaiverInput, } from "./contract/index.js"; export { governanceConfigWithLocalCanonical, localCanonicalContractMappings, } from "./local-canonical.js"; export type { InspectConfig, LocalCanonicalDeclaration, LocalCanonicalResolveRule, } from "./local-canonical.js"; export { RAW_HTML_ADVISORY_TAGS, RAW_HTML_CANONICAL_TAGS, RAW_HTML_INPUT_TYPE_CANONICALS, RAW_HTML_ROLE_CANONICALS, isEnforceableHtmlEquivalent, isRawHtmlAdvisoryTier, resolveCanonicalForAriaRole, resolveCanonicalForRawHtml, type RawHtmlCanonicalMatch, type RawHtmlPrecisionTier, } from "./raw-html-canonical.js"; export type { ComponentId, FactId, Fact, FactKind, FactOfKind, FactLocation, FactEvidence, CanonicalCandidateFact, CanonicalMappingFact, CanonicalReplacementFact, ComponentLevelFact, PolicyFact, UsageFact, ComponentMetadataFact, ComponentCapabilityFact, PropMetadataFact, PropValueAvoidedFact, PropValueForbiddenFact, A11yNameRequiredFact, ScaleFact, ScaleValueFact, StructuralConfidenceFact, StyleRawColorForbiddenFact, StylePropertyScaleFact, StyleFontSizeScaleFact, StyleCssVarsMustBeDefinedFact, JsxUnknownPropsForbiddenFact, JsxInlineStyleForbiddenRawFact, JsxImportPathPreferredFact, JsxComponentPreferredFact, TokenDefinitionFact, TailwindPaletteAllowFact, TailwindPaletteDenyFact, TailwindUnknownClassEnabledFact, UsageNodeFact, UsageComponentFact, UsageImportFact, UsagePropResolvedFact, UsageInlineStyleFact, UsageTextChildFact, StyleDeclarationFact, StyleUnsupportedFact, UnsupportedStyleReason, ClassNameLiteralFact, ClassNameDynamicFact, ClassNameFact, ClassNameOrigin, ClassNameDynamicReason, TailwindClassFact, TailwindModifier, TailwindModifierKind, TailwindValue, ThemeDeclarationFact, TailwindResolvedKind, TailwindResolutionSource, TailwindResolvedValue, TailwindTokenResolvedFact, SuppressionDirectiveFact, ComponentFactInput, } from "./facts/index.js"; // Topology — map file paths to product areas (area-scoped governance). // Also available at the `@fragments-sdk/core/topology` subpath. export { resolveArea } from "./topology/index.js"; export type { Area, AreaCriticality, AreaMatch, Topology } from "./topology/index.js";