/**
 * @fragments-sdk/extract
 *
 * Shared component extraction, props analysis, and token resolution.
 * Single source of truth — consumed by @fragments-sdk/cli and @fragments-sdk/compiler.
 */

export {
  createComponentExtractor,
  type ComponentExtractor,
  type ComponentMeta,
  type PropMeta,
  type PropTypeKind,
  type CompositionMeta,
  type PartMeta,
} from "./component-extractor.js";

export {
  extractCustomPropsFromComponentFile,
  resolveComponentSourcePath,
  type AutoDetectedPropDefinition,
  type AutoPropsExtractionResult,
} from "./auto-props.js";

export { resolveTokensWithSass } from "./token-resolver.js";

export {
  buildDTCGPayload,
  classifyTokenTiers,
  computeIdentityKey,
  deduplicateByIdentity,
  extractSourceTokens,
  inferCategory,
  isColorValue,
  normalizeColorValue,
  rankStylePathForExtraction,
  refineTokenPayload,
  type DuplicateFinding,
  type ExtractSourceTokensArgs,
  type HardcodedFinding,
  type ParsedToken,
  type RepoTreeEntry,
  type TokenExtractionProgress,
  type TokenExtractionResult,
  type TokenFileStore,
  type TokenProvenanceConfig,
  type TokenTier,
} from "./token-source/index.js";

export {
  extractJsxFacts,
  type ComponentImportResolution,
  type ExtractJsxFactsOptions,
} from "./usage/jsx.js";
export { extractScssFacts } from "./usage/scss.js";

export {
  DEFAULT_RECOGNIZED_CLASS_HELPERS,
  extractClassnameFactsFromAttribute,
  extractClassnameSpreadFact,
  parseClass,
  buildThemeIndex,
  resolveTailwindToken,
  resolveTailwindTokenFacts,
  resolveRecognizedHelpers,
  type ExtractClassnamesOptions,
  type ParseClassInput,
  type ThemeIndex,
} from "./tailwind/index.js";

export { aggregateComponentUsage } from "./usage/aggregate.js";
export {
  analyzeReactComponentAdoption,
  type AnalyzeReactComponentAdoptionInput,
  type ReactComponentAdoptionAnalysis,
  type ReactComponentAdoptionCallSite,
  type ReactComponentAdoptionComponent,
  type ReactComponentAdoptionDefinition,
  type ReactComponentAdoptionIdentity,
  type ReactComponentAdoptionIdentityInput,
  type ReactComponentAdoptionPropUsage,
  type ReactComponentAdoptionRef,
  type ReactComponentAdoptionTopImporter,
  type ReactComponentAdoptionUnresolvedImport,
} from "./usage/component-adoption.js";
export type {
  ComponentCallSite,
  ComponentUsageAnalysis,
  ComponentUsageSummary,
  ObservedInlineStyle,
  ObservedProp,
  ObservedPropKind,
} from "./usage/types.js";

export {
  extractUcfsForReact,
  extractUcfsForReactStreaming,
  extractUcfsForSfc,
  parseSuppressionDirectives,
  ucfId,
  type CallSiteSample,
  type ControlledFlag,
  type DefinitionKind,
  type EventFact,
  type ExportRecord,
  type ExtractUcfsForReactOptions,
  type ExtractUcfsForReactStreamingOptions,
  type ExtractUcfsForSfcOptions,
  type Framework,
  type ImportRecord,
  type InlineSource,
  type PropFact,
  type RootElementFact,
  type SfcInlineSource,
  type SlotFact,
  type StoryEvidence,
  type StyleSystem,
  type UniversalComponentFact,
} from "./ucf/index.js";

export {
  scanSourceWithFacts,
  createLocalScanSource,
  createMemoryScanSource,
  createSourceBackedComponentResolver,
  extractReactUcfsFromSource,
  extractReactUcfsFromSourceWithDiagnostics,
  extractQuickComponentCandidatesFromSource,
  extractSfcUcfsFromSource,
  extractSfcUcfsFromSourceWithDiagnostics,
  type CreateSourceComponentResolverOptions,
  type ExtractReactUcfsFromSourceInput,
  type ExtractReactUcfsFromSourceResult,
  type ExtractQuickComponentCandidatesInput,
  type ExtractQuickComponentCandidatesResult,
  type ExtractSfcUcfsFromSourceInput,
  type ExtractSfcUcfsFromSourceResult,
  type QuickComponentCandidateProgress,
  type ReactUcfSourceDiagnostic,
  type ReactUcfSourceDiagnosticCode,
  type ScanSource,
  type ScanSourceFile,
  type ScanSourceKind,
  type ScanSourceWithFactsInput,
  type ScanSourceWithFactsResult,
  type SfcFramework,
  type SfcUcfSourceDiagnostic,
  type SfcUcfSourceDiagnosticCode,
  type SourceComponentAlias,
} from "./source/index.js";

export {
  runForFile,
  scanWithFacts,
  type ClassnameSummary,
  type CompilerScanResult,
  type GovernancePolicyMetadata,
  type PrebuiltFragment,
  type RunForFileOptions,
  type ScanFacts,
  type ScanFile,
} from "./typestyle/check.js";

export {
  FRAGMENTS_CONFIG_FILENAMES,
  findFragmentsConfigFile,
  governancePresetConfig,
  loadFragmentsConfig,
  loadGovernancePolicy,
  mergeGovernanceConfigs,
  normalizePresetNames,
  resolveGovernancePolicy,
  resolveGovernancePresetName,
  shouldApplyConfigPresets,
  type FragmentsScanConfig,
  type GovernancePresetName,
  type LoadedGovernancePolicy,
  type LoadFragmentsConfigOptions,
  type LoadFragmentsConfigResult,
  type LoadGovernancePolicyOptions,
  type ResolveGovernancePolicyOptions,
  type ResolvedGovernancePolicy,
} from "./typestyle/policy.js";

export {
  applyFixes,
  resolveFixEdits,
  type ApplyFixesInput,
  type ApplyFixesResult,
  type ResolveFixEditsInput,
  type ResolveFixEditsResult,
  type ResolvedFixEdit,
  type SkippedFix,
} from "./typestyle/apply-fixes.js";

// The shared conform engine (used by cloud MCP + autofix, CLI, standalone MCP).
export { conformSnippet } from "./conform/engine.js";

// Pure Storybook CSF parsing (used by the CLI migrate tool + Cloud repo scan).
export {
  parseStoryContent,
  parseStoryFacts,
  parseStorybookConfigContent,
  storyNameToTitle,
  extractCategory,
  isStoryFilePath,
  storyFileBasename,
  discoverStorybook,
  mergeStoryFactsIntoUcfs,
  applyStorybookEnrichmentSeed,
  projectStoryEvidenceToEnrichmentSeed,
  DEFAULT_STORY_PATTERNS,
  STORYBOOK_CONFIG_FILENAMES,
  __testing as storybookParserTesting,
  type ParsedMeta,
  type ParsedArgType,
  type ParsedStory,
  type ParsedStoryFile,
  type StoryComponentImport,
  type StorybookConfig,
  type StoryFacts,
  type StoryFactsDiagnostic,
  type StoryFactsRung,
  type StoryFactsStory,
  type DiscoverStorybookInput,
  type StorybookComponentFacts,
  type StorybookConfigFacts,
  type StorybookDiscovery,
  type StorybookVariant,
  type MergeStoryFactsIntoUcfsResult,
  type UnresolvedStoryEvidence,
  type ApplyStorybookEnrichmentSeedResult,
  type StorybookEnrichmentSeed,
  type StorybookSeedableEnrichment,
  type StorybookSeededVariant,
  type StorybookSeedProvenance,
  type StorybookUsageExample,
} from "./storybook/index.js";
