import { PropDefinition, FactId, Fact, ComponentId, FactLocation, TailwindClassFact, ThemeDeclarationFact, TailwindResolvedValue, FactIndex, TailwindTokenResolvedFact, Finding, SuppressionDirectiveFact, GovernedFragmentDefinition, ResolvedGovernedFragmentDefinition, GovernanceConfig, FragmentsConfig, ConformInput, DesignSystemContext, ConformResult } from '@fragments-sdk/core';
import * as t from '@babel/types';
import ts from 'typescript';

/**
 * ComponentExtractor — persistent LanguageService-based prop extraction.
 *
 * Replaces auto-props.ts with:
 * - Persistent ts.LanguageService (not throwaway ts.createProgram())
 * - Incremental invalidation via projectVersion
 * - Compound component (Object.assign) sub-component prop extraction
 * - Full type serialization to PropMeta format
 *
 * Zero additional dependencies — uses raw TypeScript APIs.
 */
interface ComponentExtractor {
    /** Extract metadata for a single component by export name */
    extract(filePath: string, exportName?: string): ComponentMeta | null;
    /** Extract all exported components found in a file */
    extractAll(filePath: string): ComponentMeta[];
    /** Notify extractor that a file changed (incremental) */
    invalidate(filePath: string): void;
    /** Clean up resources */
    dispose(): void;
}
interface ComponentMeta {
    name: string;
    filePath: string;
    description: string;
    props: Record<string, PropMeta>;
    composition: CompositionMeta | null;
    exports: string[];
    dependencies: string[];
}
interface PropMeta {
    name: string;
    type: string;
    typeKind: PropTypeKind;
    values?: string[];
    default?: string;
    description?: string;
    required: boolean;
    source: 'local' | 'inherited';
}
type PropTypeKind = 'string' | 'number' | 'boolean' | 'enum' | 'function' | 'node' | 'element' | 'object' | 'array' | 'union' | 'custom';
interface CompositionMeta {
    pattern: 'compound' | 'controlled' | 'simple';
    parts: PartMeta[];
    required: string[];
}
interface PartMeta {
    name: string;
    props: Record<string, PropMeta>;
}
declare function createComponentExtractor(tsconfigPath?: string): ComponentExtractor;

interface AutoDetectedPropDefinition {
    type: PropDefinition["type"];
    description: string;
    required: boolean;
    default?: unknown;
    values?: readonly string[];
}
interface AutoPropsExtractionResult {
    props: Record<string, AutoDetectedPropDefinition>;
    warnings: string[];
    resolved: boolean;
}
/**
 * Resolve a component source file from the fragment file path + component import path.
 * Supports relative imports like ".", "./Button", "../components/Button".
 */
declare function resolveComponentSourcePath(fragmentFileAbsolutePath: string, componentImportPath: string | null): string | null;
/**
 * Extract custom component props from a source file.
 * Custom props are identified as props whose declarations originate from the component's source file.
 */
declare function extractCustomPropsFromComponentFile(componentFilePath: string, exportName: string): AutoPropsExtractionResult;

/**
 * Token Resolver — resolves unresolved SCSS token values using actual sass compilation.
 *
 * The regex-based resolver in token-parser.ts cannot handle SCSS module namespaces,
 * functions (color.scale, math.div), or map lookups. This module provides a fallback
 * that compiles the actual SCSS sources to extract computed CSS custom property values.
 *
 * Used at build time only — no runtime sass dependency in the MCP server.
 */
/**
 * Resolve unresolved SCSS token values by compiling the project's token SCSS.
 *
 * Generates a temporary SCSS string that imports the project's _variables.scss
 * and includes the fui-css-variables mixin, then compiles it with sass to extract
 * the actual computed values for all CSS custom properties.
 *
 * @param unresolvedTokens - Tokens with values containing #{} or $ that need resolution
 * @param tokensDir - Absolute path to the directory containing _variables.scss
 * @returns Map of token name → resolved CSS value (only for tokens that were unresolved)
 */
declare function resolveTokensWithSass(unresolvedTokens: Array<{
    name: string;
    value: string;
}>, tokensDir: string): Promise<Map<string, string>>;

/**
 * packages/extract/src/token-source/types.ts — public type surface.
 * Exports: RepoTreeEntry, ParsedToken, HardcodedFinding, DuplicateFinding,
 *   TokenExtractionProgress, TokenExtractionResult, TokenTier,
 *   TokenProvenanceConfig.
 * See ./INDEX.md for split rationale.
 */
interface RepoTreeEntry {
    path: string;
    type: 'blob' | 'tree';
    size?: number;
}
/**
 * Classification tier for a parsed token.
 *
 * - **canonical**: Public API of the design system — the tokens consumers
 *   are expected to use. Identified by matching the detected prefix and/or
 *   living in a primary token source file.
 * - **extended**: Build intermediates, consumer overrides, or tokens from
 *   secondary sources. Real values, but not the headline count.
 * - **unknown**: Insufficient signal to classify. Treated as canonical in
 *   display when no provenance config is available.
 */
type TokenTier = 'canonical' | 'extended' | 'unknown';
/**
 * Optional provenance hints passed into extraction. When absent the
 * classifier assigns 'unknown' to every token (backward compatible —
 * same behavior as before tiers existed).
 */
interface TokenProvenanceConfig {
    primarySources?: string[];
    allSources?: string[];
    prefix?: string;
    appPaths?: string[];
}
interface ParsedToken {
    name: string;
    value: string;
    category: string;
    file: string;
    line: number;
    tier: TokenTier;
    identityKey: string;
}
interface HardcodedFinding {
    file: string;
    line: number;
    property: string;
    hardcodedValue: string;
    suggestedToken: string;
    suggestedTokenValue: string;
    category: string;
    fingerprint: string;
}
interface TokenExtractionProgress {
    phase: 'tokens' | 'hardcoded';
    filesProcessed: number;
    totalFiles: number;
    tokensFound: number;
    hardcodedFound: number;
}
interface DuplicateFinding {
    value: string;
    tokenNames: string[];
    files: string[];
    category: string;
    fingerprint: string;
}
interface TokenExtractionResult {
    tokenPayload: string;
    tokenCount: number;
    /** Count of tokens classified as canonical (equals tokenCount when no provenance config). */
    canonicalCount: number;
    tokenFileCount: number;
    hardcodedFindings: HardcodedFinding[];
    duplicateFindings: DuplicateFinding[];
    /** Raw parsed tokens for downstream detection/aggregation. */
    parsedTokens: ParsedToken[];
}

/**
 * packages/extract/src/token-source/classify.ts — token provenance classification
 * and identity-based deduplication.
 *
 * Assigns a tier (canonical / extended / unknown) to each ParsedToken based on
 * framework-agnostic signals: file path, detected prefix, and known app paths.
 * Then collapses tokens that represent the same logical design decision across
 * different syntactic forms ($var, --var, dtcg.path) into a single entry.
 */

/**
 * Compute a format-agnostic identity key for a token.
 *
 * `$fui-space-1`, `--fui-space-1`, and DTCG path `spacing.fui.space.1` all
 * refer to the same logical token. The identity key normalizes away the
 * syntax so deduplication can collapse them.
 */
declare function computeIdentityKey(name: string): string;
/**
 * Assign `tier` to every token in the array (mutates in place).
 * When `config` is undefined or empty, all tokens stay 'unknown'.
 */
declare function classifyTokenTiers(tokens: ParsedToken[], config?: TokenProvenanceConfig): void;
/**
 * Collapse tokens that represent the same logical design decision.
 *
 * When `$fui-space-1` (SCSS) and `--fui-space-1` (CSS) both exist, keep
 * the one with the higher tier, breaking ties by format preference
 * (CSS var > SCSS > DTCG path) since that's the runtime-facing form.
 */
declare function deduplicateByIdentity(tokens: ParsedToken[]): ParsedToken[];

/**
 * packages/extract/src/token-source/categorize.ts — shared category + color helpers.
 * Exports: inferCategory, isColorValue, normalizeColorValue.
 * Used by parse.ts, detect-hardcoded.ts, and index.ts.
 */
declare function isColorValue(value: string): boolean;
declare function inferCategory(name: string, value?: string): string;
declare function normalizeColorValue(value: string): string;

/**
 * packages/extract/src/token-source/serialize.ts — DTCG JSON payload builder.
 * Exports: buildDTCGPayload.
 * Groups parsed tokens by category then nests by dash-separated name segments.
 */

declare function buildDTCGPayload(tokens: ParsedToken[]): string;

/**
 * Source-backed design-token extraction.
 *
 * Pipeline shape: parse token sources → classify/dedupe → detect hardcoded
 * values → serialize code-token payload.
 */

type TokenScanProfile = "full" | "onboarding";
interface TokenFileStore {
    getText(path: string): Promise<string | null>;
}
interface ExtractSourceTokensArgs {
    tree: RepoTreeEntry[];
    fileStore: TokenFileStore;
    provenance?: TokenProvenanceConfig;
    scanProfile?: TokenScanProfile;
    /**
     * Tokens already parsed by a prior scan (typically an onboarding run we
     * are extending into a full run). These are merged into the local token
     * lookup so duplicate detection and hardcoded value detection see the
     * union, without re-fetching the source files.
     */
    priorParsedTokens?: ParsedToken[];
    /**
     * Token file paths covered by the parent scan. Files already in this
     * set are skipped during token I/O so the full follow-up only fetches
     * the marginal set (e.g. files 41..100 when onboarding covered 0..40).
     */
    priorTokenFilePaths?: ReadonlySet<string>;
    onProgress?: (progress: TokenExtractionProgress) => void;
    /**
     * Streaming callback. Emits batches of findings as they are produced:
     * duplicate-token findings once just after the token phase, and
     * hardcoded-value findings per CONCURRENCY-style-file batch. Callers
     * use this to update dashboards in near-real-time instead of waiting
     * for the whole scan to finish.
     */
    onIncrementalFindings?: (event: {
        hardcoded?: HardcodedFinding[];
        duplicate?: DuplicateFinding[];
    }) => void | Promise<void>;
}
declare function rankStylePathForExtraction(path: string): number;
declare function extractSourceTokens(args: ExtractSourceTokensArgs): Promise<TokenExtractionResult>;
/**
 * Post-process previously extracted tokens with provenance classification.
 *
 * Use this when provenance info becomes available after initial extraction
 * (e.g. after codebase detection runs). Returns a new DTCG payload string
 * and updated counts.
 */
declare function refineTokenPayload(parsedTokens: ParsedToken[], provenance: TokenProvenanceConfig): {
    tokenPayload: string;
    tokenCount: number;
    canonicalCount: number;
};

/**
 * Walks JSX `className` (or `class`) attributes and emits `classname_literal`
 * / `classname_dynamic` facts. Pure; never throws on user-input shapes —
 * parser surprises degrade to a `classname_dynamic` fact with a snippet so
 * the scan never aborts mid-file.
 *
 * Invoked from the JSX usage extractor (see `../usage/jsx.ts`) so the AST
 * is walked exactly once per file.
 */

/** Recognized callees: HELPER_ORIGINS keys plus `cva` (always opaque). */
declare const DEFAULT_RECOGNIZED_CLASS_HELPERS: readonly [...string[], "cva"];
interface ExtractClassnamesOptions {
    /**
     * Identifier names recognized as className-helper callees (e.g. `clsx`,
     * `cn`). Supplying this option *replaces* the default list — it is not
     * merged with the defaults.
     */
    recognizedClassHelpers?: readonly string[];
}
/**
 * Resolve a same-file identifier to the expression it is `const`-bound to, when
 * that binding is constant and statically initialized. Supplied by the JSX
 * walker (which has the Babel scope) so a className built from a hoisted const —
 * `const tone = cond ? 'bg-[#abcdef]' : 'bg-brand'; <div className={\`p ${tone}\`}/>`
 * — is folded and graded instead of being written off as fully dynamic (BUG 5).
 */
type BindingResolver = (name: string) => t.Expression | undefined;
/**
 * Resolve the recognized-helper set once per file so the per-attribute hot
 * path doesn't reallocate. Returns the cached default set when the override
 * is absent.
 */
declare function resolveRecognizedHelpers(override: readonly string[] | undefined): ReadonlySet<string>;
/**
 * Extract className facts from a JSX attribute. The caller supplies the
 * parent element's `usage_node` identity so the facts join back to the
 * existing usage graph without re-walking.
 */
declare function extractClassnameFactsFromAttribute(input: {
    attr: t.JSXAttribute;
    file: string;
    nodeId: FactId;
    recognizedHelpers?: ReadonlySet<string>;
    resolveBinding?: BindingResolver;
}): Fact[];
/**
 * Emit a single `classname_dynamic { reason: 'spread' }` fact for an element
 * whose only opportunity to set className is via a spread attribute.
 */
declare function extractClassnameSpreadFact(input: {
    spread: t.JSXSpreadAttribute;
    file: string;
    nodeId: FactId;
}): Fact[];

/**
 * JSX/TSX usage extractor — turns one source file into `usage_*` facts.
 *
 * The extractor is a pure function over (source, filePath). It produces:
 *
 *   - `usage_node`            for each JSX element
 *   - `usage_component`       for elements imported from a non-relative source
 *   - `usage_prop_resolved`   for each JSX attribute or structural child prop
 *   - `usage_inline_style`    for each property in `style={{...}}`
 *   - `usage_text_child`      for each JSXText/string child
 *
 * Locations point at the offending value (e.g., the `<Button` opening, the
 * `padding` property key, the literal `"secondary"`), not just the file. The
 * extractor never resolves modules from disk — it only walks imports declared
 * at the top of the file.
 */

interface ComponentImportResolution {
    filePath: string;
    elementName: string;
    local: string;
    imported: string;
    source: string;
    namespace?: boolean;
}
interface ExtractJsxFactsOptions {
    resolveComponentId?: (resolution: ComponentImportResolution) => ComponentId | null | undefined;
    /**
     * Identifier names recognized as className-helper callees (e.g. `clsx`,
     * `cn`). Supplying this option *replaces* the default list — it is not
     * merged with the defaults.
     */
    recognizedClassHelpers?: ExtractClassnamesOptions["recognizedClassHelpers"];
}
declare function extractJsxFacts(source: string, filePath: string, options?: ExtractJsxFactsOptions): Fact[];

/**
 * CSS/SCSS declaration extractor — turns one source file into
 * `style_declaration` facts.
 *
 * Pure function over (source, filePath). Walks the source as a small character
 * machine that tracks selector depth, handles nested `&.primary`-style SCSS
 * selectors, ignores `// line` and `/* block * /` comments, and emits one fact
 * per CSS declaration. Identity (file + selector + declarationPath + property)
 * is stable when other lines move; locations point at the property name.
 *
 * SCSS variables, mixins, includes, and `@`-rule directives are intentionally
 * skipped — only real CSS declarations become facts. That keeps Phase 5 rules
 * simple and avoids leaking SCSS-only constructs (`$foo: red;`) into the fact
 * IR as if they were declarations.
 */

declare function extractScssFacts(source: string, filePath: string): Fact[];

interface ParseClassInput {
    raw: string;
    file: string;
    nodeId: FactId;
    originPath: string;
    location: FactLocation;
    tailwindPrefix?: string;
}
declare function parseClass(input: ParseClassInput): TailwindClassFact;

interface TailwindDefaultsSnapshot {
    version: string;
    color?: Record<string, string>;
    spacing?: Record<string, string>;
    radius?: Record<string, string>;
    shadow?: Record<string, string>;
    "font-family"?: Record<string, string>;
    "font-size"?: Record<string, string>;
    duration?: Record<string, string>;
}

interface ThemeIndexEntry {
    value: string;
    inline: boolean;
}
type ThemeIndex = ReadonlyMap<string, ThemeIndexEntry>;
declare function buildThemeIndex(declarations: readonly ThemeDeclarationFact[]): ThemeIndex;
declare function resolveTailwindTokenFacts(ix: FactIndex, defaults?: TailwindDefaultsSnapshot): TailwindTokenResolvedFact[];
declare function resolveTailwindToken(input: {
    utility: string;
    token: string;
    themeIndex: ThemeIndex;
    defaults?: TailwindDefaultsSnapshot;
}): TailwindResolvedValue;

type ObservedPropKind = "static" | "dynamic" | "spread" | "jsx" | "boolean" | "null";
interface ObservedProp {
    name: string;
    kind: ObservedPropKind;
    value?: string | number | boolean | null;
    location?: FactLocation;
}
interface ObservedInlineStyle {
    property: string;
    valueKind: "static" | "number" | "css-variable";
    value: string;
}
interface ComponentCallSite {
    componentId: ComponentId;
    element: string;
    filePath: string;
    line: number;
    column: number;
    nodePath: string;
    props: ObservedProp[];
    inlineStyles: ObservedInlineStyle[];
    textChildren: string[];
}
interface ComponentUsageSummary {
    componentId: ComponentId;
    callSiteCount: number;
    importingFileCount: number;
    propCounts: Record<string, number>;
    staticValueCounts: Record<string, Record<string, number>>;
    dynamicPropCounts: Record<string, number>;
    spreadCount: number;
}
interface ComponentUsageAnalysis {
    callSites: ComponentCallSite[];
    summaries: ComponentUsageSummary[];
}

declare function aggregateComponentUsage(facts: readonly Fact[]): ComponentUsageAnalysis;

/**
 * Pure types for Storybook CSF parsing.
 *
 * These describe the shape extracted from a story file's *content* — no
 * filesystem concepts. The CLI's migrate tool layers fs-backed types
 * (ConversionResult, MigrationReport, MigrateOptions) on top of these.
 */
/** Parsed Storybook story metadata (the default export). */
interface ParsedMeta {
    /** Full title path (e.g., "Components/Forms/Input"). */
    title: string;
    /** Component name (inferred from title or component ref). */
    componentName: string;
    /** Component import path. */
    componentImport?: string;
    /** Whether the component uses a default import (export default). */
    isDefaultImport?: boolean;
    /** Tags from the story. */
    tags?: string[];
    /** Description from parameters.docs. */
    description?: string;
}
/** Parsed argType definition. */
interface ParsedArgType {
    /** Storybook control type. */
    control?: string;
    /** Options for select/radio controls. */
    options?: string[];
    /** Prop description. */
    description?: string;
    /** Default value. */
    defaultValue?: unknown;
    /** TypeScript type (if available). */
    type?: string;
    /** Whether the prop is required. */
    required?: boolean;
}
/** Parsed individual story. */
interface ParsedStory {
    /** Story name (export name). */
    name: string;
    /** Args passed to the component. */
    args: Record<string, unknown>;
    /** Story description. */
    description?: string;
    /** Whether story has a custom render function. */
    hasCustomRender?: boolean;
    /** Raw render code if extractable. */
    renderCode?: string;
}
/** Complete parsed story file. */
interface ParsedStoryFile {
    /** Original file path (informational only — never read by the parser). */
    filePath: string;
    /** Parsed metadata. */
    meta: ParsedMeta;
    /** Parsed argTypes. */
    argTypes: Record<string, ParsedArgType>;
    /** Parsed stories. */
    stories: ParsedStory[];
    /** Parse warnings. */
    warnings: string[];
    /** Confidence score (0-1) — how reliable the extraction was. */
    confidence: number;
}
type StoryFactsRung = "full" | "partial" | "presence-only" | "skipped";
interface StoryComponentImport {
    specifier: string;
    name: string;
}
interface StoryFactsStory {
    ref: string;
    name: string;
    args?: Record<string, unknown>;
}
interface StoryFactsDiagnostic {
    level: "warning" | "error";
    message: string;
}
/**
 * Locked Storybook parse seam used by downstream contract ingestion.
 *
 * This shape is additive-only after brief 02: stories are evidence for an
 * existing component identity, never a component identity by themselves.
 */
interface StoryFacts {
    file: string;
    title?: string;
    componentImport?: StoryComponentImport;
    tags: string[];
    metaArgs: Record<string, unknown>;
    argTypes: Record<string, ParsedArgType>;
    stories: StoryFactsStory[];
    rung: StoryFactsRung;
    diagnostics: StoryFactsDiagnostic[];
    autodocsDescription?: string;
}
/** Detected Storybook configuration. */
interface StorybookConfig {
    /** Path to .storybook/main.* */
    configPath: string;
    /** Story glob patterns from config. */
    storyPatterns: string[];
    /** Detected framework (react, vue, etc.). */
    framework?: string;
    /** Detected builder (vite, webpack). */
    builder?: string;
    /** Whether config was successfully parsed. */
    valid: boolean;
    /** Parse errors if any. */
    errors?: string[];
}

type Framework = "react" | "vue" | "svelte" | "angular" | "solid" | "preact" | "lit";
type DefinitionKind = "function" | "class" | "sfc" | "directive" | "wrapper";
type StyleSystem = "tailwind" | "cssModules" | "styledComponents" | "cssInJs" | "plainCss" | "sass" | "unknown";
type ControlledFlag = boolean | "mixed" | "unknown";
type PropSchemaConfidence = "exact" | "partial" | "unknown";
interface ImportRecord {
    moduleSpecifier: string;
    resolvedPackage?: string;
    importedNames: ReadonlyArray<{
        imported: string;
        local: string;
    }>;
}
interface ExportRecord {
    exportedAs: string;
    isPrimary: boolean;
    localName?: string;
    isDefault?: boolean;
    fromBarrel?: boolean;
}
interface RootElementFact {
    tag: string;
    attrs: Record<string, string | true>;
    loc: FactLocation;
    inputType?: string;
    conditionalGuard?: string;
}
interface PropFact {
    name: string;
    typeText: string;
    loc: FactLocation;
    optional: boolean;
    hasDefault: boolean;
    defaultValueText?: string;
    jsdoc?: string;
    isUnion: boolean;
    unionMembers?: ReadonlyArray<string>;
    schemaConfidence?: PropSchemaConfidence;
}
interface EventFact {
    name: string;
    payloadTypeText?: string;
}
interface SlotFact {
    name: string;
    scoped: boolean;
}
interface CallSiteSample {
    filePath: string;
    jsxText: string;
    framework: Framework;
}
interface StoryEvidence {
    source: "storybook";
    title?: string;
    componentImport: StoryComponentImport;
    storyCount: number;
    storyRefs: ReadonlyArray<string>;
    storyNames: ReadonlyArray<string>;
    storyFilePaths: ReadonlyArray<string>;
    tags: ReadonlyArray<string>;
    metaArgs: Record<string, unknown>;
    stories: ReadonlyArray<StoryFactsStory>;
    autodocsDescription?: string;
}
interface UniversalComponentFact {
    id: string;
    filePath: string;
    componentName: string;
    framework: Framework;
    sourceCommit: string;
    capturedAt: string;
    adapterVersion: string;
    definitionKind: DefinitionKind;
    wrappedBy: ReadonlyArray<string>;
    imports: ReadonlyArray<ImportRecord>;
    exports: ReadonlyArray<ExportRecord>;
    exportedFromBarrel: boolean;
    rootElements: ReadonlyArray<RootElementFact>;
    rootElementsTruncated: boolean;
    ariaRoles: ReadonlyArray<string>;
    ariaAttributes: Record<string, string | true>;
    props: ReadonlyArray<PropFact>;
    events: ReadonlyArray<EventFact>;
    slots: ReadonlyArray<SlotFact>;
    hasInternalState: boolean;
    hasEffects: boolean;
    isControlled: ControlledFlag;
    compoundChildren: ReadonlyArray<string>;
    styleSystem: StyleSystem;
    classNamesUsed: ReadonlyArray<string>;
    jsdocDescription?: string;
    fileHeaderComment?: string;
    callSites?: ReadonlyArray<CallSiteSample>;
    importCount?: number;
    storyEvidence?: ReadonlyArray<StoryEvidence>;
}

interface PrebuiltFragment {
    componentId: ComponentId;
    fragment: GovernedFragmentDefinition | ResolvedGovernedFragmentDefinition;
}
interface ScanFacts {
    governConfig?: GovernanceConfig;
    components?: readonly PrebuiltFragment[];
    tokens?: readonly Fact[];
    resolveComponentId?: (resolution: ComponentImportResolution) => ComponentId | null | undefined;
    recognizedClassHelpers?: readonly string[];
}
interface ScanFile {
    absPath: string;
    relPath: string;
    content: string;
}
interface ClassnameSummary {
    classnamesScanned: number;
    classnamesDynamic: number;
    classnamesResolved: number;
}
interface CompilerScanResult {
    findings: Finding[];
    suppressedFindings: Array<{
        finding: Finding;
        directive: SuppressionDirectiveFact;
    }>;
    suppressions: SuppressionDirectiveFact[];
    filesScanned: string[];
    sourceByFile: ReadonlyMap<string, string>;
    exitCode: 0 | 1;
    failOnWarnings: boolean;
    policy: GovernancePolicyMetadata;
    classnames: ClassnameSummary;
}
interface GovernancePolicyMetadata {
    rulesActive: number;
    presetsLoaded: string[];
}
interface RunForFileOptions {
    absPath: string;
    content: string;
    rootDir: string;
    policy?: GovernanceConfig;
    facts?: Omit<ScanFacts, "governConfig">;
}
declare function runForFile(options: RunForFileOptions): Finding[];
declare function scanWithFacts(input: {
    facts: ScanFacts;
    files: readonly ScanFile[];
}): CompilerScanResult;

type ScanSourceKind = "local" | "github" | "memory" | "fixture";
interface ScanSource {
    kind: ScanSourceKind;
    root: string;
    ref?: string;
    readFile(path: string): Promise<string | null>;
}
interface ScanSourceFile {
    relPath: string;
    absPath?: string;
    size?: number;
}
interface ScanSourceWithFactsInput {
    source: ScanSource;
    facts: ScanFacts;
    files: readonly ScanSourceFile[];
}
type ScanSourceWithFactsResult = CompilerScanResult;

interface ReactComponentAdoptionIdentityInput {
    componentName: string;
    filePath: string;
}
interface ReactComponentAdoptionIdentity {
    componentKey: string;
    componentId: ComponentId;
}
interface AnalyzeReactComponentAdoptionInput {
    source: ScanSource;
    files: readonly ScanSourceFile[];
    ucfs: readonly UniversalComponentFact[];
    onProgress?(progress: {
        filesProcessed: number;
        totalFiles: number;
    }): void;
    createIdentity(input: ReactComponentAdoptionIdentityInput): ReactComponentAdoptionIdentity;
}
interface ReactComponentAdoptionDefinition {
    componentName: string;
    componentKey: string;
    componentId: ComponentId;
    filePath: string;
    exportNames: string[];
    publicExports: number;
    localNames: string[];
}
interface ReactComponentAdoptionRef {
    componentName: string;
    displayName: string;
    filePath: string;
    componentKey: string;
}
interface ReactComponentAdoptionTopImporter {
    filePath: string;
    line: number;
    kind: "jsx";
    confidence: "confirmed";
}
interface ReactComponentAdoptionCallSite {
    filePath: string;
    line: number;
    column: number;
    props: Array<{
        name: string;
        kind: ObservedPropKind;
        value?: string;
    }>;
}
interface ReactComponentAdoptionPropUsage {
    name: string;
    total: number;
    dynamic: number;
    spread: number;
    staticValues: Array<{
        value: string;
        count: number;
    }>;
}
interface ReactComponentAdoptionComponent {
    componentName: string;
    componentKey: string;
    componentId: ComponentId;
    filePath: string;
    totalImporters: number;
    totalCallSites: number;
    topImporters: ReactComponentAdoptionTopImporter[];
    callSites: ReactComponentAdoptionCallSite[];
    propUsage: ReactComponentAdoptionPropUsage[];
    usedBy: ReactComponentAdoptionRef[];
    uses: ReactComponentAdoptionRef[];
    publicExports: number;
    confidence: "confirmed" | "likely" | "review";
    reviewReasons: string[];
    candidateForReview: boolean;
}
interface ReactComponentAdoptionUnresolvedImport {
    filePath: string;
    line: number;
    column: number;
    elementName: string;
    local: string;
    imported: string;
    source: string;
    reason: "unresolved";
}
interface ReactComponentAdoptionAnalysis {
    definitions: ReactComponentAdoptionDefinition[];
    components: ReactComponentAdoptionComponent[];
    callSites: ComponentCallSite[];
    unresolvedImports: ReactComponentAdoptionUnresolvedImport[];
}

declare function analyzeReactComponentAdoption(args: AnalyzeReactComponentAdoptionInput): Promise<ReactComponentAdoptionAnalysis>;

declare function ucfId(filePath: string, componentName: string, framework: Framework, sourceCommit: string): string;

interface ParseSuppressionDirectivesInput {
    filePath: string;
    source: string;
}
declare function parseSuppressionDirectives(input: ParseSuppressionDirectivesInput): SuppressionDirectiveFact[];

interface InlineSource {
    filePath: string;
    source: string;
}
interface ExtractUcfsForReactOptions {
    /** Absolute file paths to extract from. */
    sourceFiles?: string[];
    /** In-memory virtual files (for tests). */
    inlineSources?: InlineSource[];
    /** Path to tsconfig.json (optional). */
    tsconfig?: string;
    /** Pre-resolved compiler options for non-filesystem sources. */
    compilerOptions?: ts.CompilerOptions;
    /** 40-char SHA. Caller-provided. */
    sourceCommit: string;
    /** Defaults to '0.1.0'. */
    adapterVersion?: string;
    /** Repo root for relative filePath; defaults to process.cwd(). */
    cwd?: string;
}
declare function extractUcfsForReact(opts: ExtractUcfsForReactOptions): UniversalComponentFact[];
interface ExtractUcfsForReactStreamingOptions extends ExtractUcfsForReactOptions {
    /**
     * Yield to the event loop every N files so a host heartbeat (and any other
     * pending timers) can fire while the type-checker grinds through a large
     * repo. Defaults to 25. The per-file type-check is the bulk of the cost;
     * program construction itself stays atomic.
     */
    yieldEveryNFiles?: number;
    /** Reports extraction progress as facts accumulate. */
    onProgress?: (progress: {
        filesProcessed: number;
        totalFiles: number;
        componentsFound: number;
    }) => void;
}
/**
 * Async, cooperatively-scheduled twin of `extractUcfsForReact`. Produces
 * identical facts for identical input — the only difference is it periodically
 * yields the event loop (and reports progress) so a long extraction over a
 * large repo can't block a host's liveness heartbeat. Used by the cloud repo
 * scanner; the synchronous `extractUcfsForReact` is unchanged for CLI/LSP/etc.
 */
declare function extractUcfsForReactStreaming(opts: ExtractUcfsForReactStreamingOptions): Promise<UniversalComponentFact[]>;

interface SfcInlineSource {
    filePath: string;
    source: string;
}
interface ExtractUcfsForSfcOptions {
    sources: readonly SfcInlineSource[];
    sourceCommit: string;
    adapterVersion?: string;
}
declare function extractUcfsForSfc(opts: ExtractUcfsForSfcOptions): UniversalComponentFact[];

declare function scanSourceWithFacts(input: ScanSourceWithFactsInput): Promise<ScanSourceWithFactsResult>;

declare function createLocalScanSource(rootDir: string): ScanSource;

declare function createMemoryScanSource(files: Record<string, string>, options?: {
    root?: string;
    kind?: "memory" | "fixture";
    ref?: string;
}): ScanSource;

interface SourceComponentAlias {
    componentId: ComponentId;
    exportName?: string;
    modulePath?: string;
    source?: string;
    fromFilePath?: string;
}
interface CreateSourceComponentResolverOptions {
    source: ScanSource;
    files: readonly ScanSourceFile[];
    aliases: readonly SourceComponentAlias[];
    tsconfigPath?: string;
}
declare function createSourceBackedComponentResolver(options: CreateSourceComponentResolverOptions): Promise<(resolution: ComponentImportResolution) => ComponentId | null | undefined>;

interface ExtractReactUcfsFromSourceInput {
    source: ScanSource;
    files: readonly ScanSourceFile[];
    sourceCommit: string;
    adapterVersion?: string;
    tsconfigPath?: string;
    /**
     * Fired after each batch of source files is read so long-running scans
     * over large repos surface progress (and don't look stalled). Reads run
     * concurrently in batches of READ_CONCURRENCY rather than one-at-a-time.
     */
    onProgress?: (progress: {
        filesProcessed: number;
        totalFiles: number;
    }) => void;
}
type ReactUcfSourceDiagnosticCode = "missing_file" | "invalid_path" | "unsupported_file" | "invalid_tsconfig" | "typescript_syntax" | "no_component_exports" | "prop_metadata_partial";
interface ReactUcfSourceDiagnostic {
    code: ReactUcfSourceDiagnosticCode;
    severity: "info" | "warn";
    message: string;
    filePath?: string;
}
interface ExtractReactUcfsFromSourceResult {
    ucfs: UniversalComponentFact[];
    diagnostics: ReactUcfSourceDiagnostic[];
}
declare function extractReactUcfsFromSource(input: ExtractReactUcfsFromSourceInput): Promise<UniversalComponentFact[]>;
declare function extractReactUcfsFromSourceWithDiagnostics(input: ExtractReactUcfsFromSourceInput): Promise<ExtractReactUcfsFromSourceResult>;

interface ExtractSfcUcfsFromSourceInput {
    source: ScanSource;
    files: readonly ScanSourceFile[];
    sourceCommit: string;
    adapterVersion?: string;
}
type SfcUcfSourceDiagnosticCode = "missing_file" | "invalid_path" | "unsupported_file";
interface SfcUcfSourceDiagnostic {
    code: SfcUcfSourceDiagnosticCode;
    severity: "info" | "warn";
    message: string;
    filePath?: string;
}
interface ExtractSfcUcfsFromSourceResult {
    ucfs: UniversalComponentFact[];
    diagnostics: SfcUcfSourceDiagnostic[];
}
declare function extractSfcUcfsFromSource(input: ExtractSfcUcfsFromSourceInput): Promise<UniversalComponentFact[]>;
declare function extractSfcUcfsFromSourceWithDiagnostics(input: ExtractSfcUcfsFromSourceInput): Promise<ExtractSfcUcfsFromSourceResult>;
type SfcFramework = Extract<Framework, "vue" | "svelte">;

interface QuickComponentCandidateProgress {
    filesProcessed: number;
    totalFiles: number;
    componentsFound: number;
}
interface ExtractQuickComponentCandidatesInput {
    source: ScanSource;
    files: readonly ScanSourceFile[];
    sourceCommit: string;
    adapterVersion: string;
    onProgress?: (progress: QuickComponentCandidateProgress) => void;
}
interface ExtractQuickComponentCandidatesResult {
    ucfs: UniversalComponentFact[];
    filesProcessed: number;
}
declare function extractQuickComponentCandidatesFromSource(args: ExtractQuickComponentCandidatesInput): Promise<ExtractQuickComponentCandidatesResult>;

type GovernancePresetName = "universal" | "fragments" | "tailwind";
type FragmentsScanConfig = Pick<FragmentsConfig, "components" | "exclude" | "include" | "recognizedClassHelpers" | "tokens" | "topology"> & {
    govern?: GovernanceConfig;
};
interface LoadFragmentsConfigOptions {
    rootDir: string;
    configPath?: string;
}
interface LoadFragmentsConfigResult {
    config: FragmentsScanConfig | null;
    configPath: string | null;
    configDir: string;
}
interface ResolveGovernancePolicyOptions {
    preset?: GovernancePresetName;
    fallback?: GovernanceConfig;
}
interface ResolvedGovernancePolicy {
    policy: GovernanceConfig | undefined;
    source: "config" | "preset" | "fallback" | "none";
    presetsLoaded: string[];
}
interface LoadGovernancePolicyOptions extends LoadFragmentsConfigOptions, ResolveGovernancePolicyOptions {
}
interface LoadedGovernancePolicy extends ResolvedGovernancePolicy {
    configPath: string | null;
    configDir: string;
}
declare const FRAGMENTS_CONFIG_FILENAMES: readonly ["fragments.config.ts", "fragments.config.tsx", "fragments.config.mts", "fragments.config.cts", "fragments.config.js", "fragments.config.jsx", "fragments.config.mjs", "fragments.config.cjs", "fragments.config.json", "segments.config.ts", "segments.config.js"];
declare function findFragmentsConfigFile(rootDir: string, configPath?: string): string | null;
declare function loadFragmentsConfig(options: LoadFragmentsConfigOptions): Promise<LoadFragmentsConfigResult>;
declare function loadGovernancePolicy(options: LoadGovernancePolicyOptions): Promise<LoadedGovernancePolicy>;
declare function resolveGovernancePolicy(configGovern: GovernanceConfig | undefined, options?: ResolveGovernancePolicyOptions): ResolvedGovernancePolicy;
declare function shouldApplyConfigPresets(govern: GovernanceConfig | undefined): boolean;
declare function normalizePresetNames(presets: readonly string[]): string[];
declare function resolveGovernancePresetName(raw: string): GovernancePresetName | null;
declare function mergeGovernanceConfigs(...configs: Array<GovernanceConfig | undefined>): GovernanceConfig | undefined;
declare function governancePresetConfig(name: GovernancePresetName): GovernanceConfig;

interface ApplyFixesInput {
    filePath: string;
    source: string;
    findings: readonly Finding[];
}
interface SkippedFix {
    finding: Finding;
    reason: string;
}
interface ApplyFixesResult {
    /** New source with all applicable fixes spliced in. */
    source: string;
    /** Findings whose fix was successfully spliced. */
    applied: Finding[];
    /** Findings whose fix could not be applied (with the reason). */
    skipped: SkippedFix[];
}
interface ResolvedFixEdit {
    start: number;
    end: number;
    replacement: string;
    finding: Finding;
}
interface ResolveFixEditsInput {
    filePath: string;
    source: string;
    findings: readonly Finding[];
}
interface ResolveFixEditsResult {
    edits: ResolvedFixEdit[];
    skipped: SkippedFix[];
}
declare function applyFixes(input: ApplyFixesInput): ApplyFixesResult;
declare function resolveFixEdits(input: ResolveFixEditsInput): ResolveFixEditsResult;

/**
 * The one conform engine. Given a code snippet (JSX/TSX inline styles or
 * CSS/SCSS) and a `DesignSystemContext`, it runs the shared fact-IR rule engine
 * (`styles/no-raw-color`, `styles/no-raw-dimensions`) and rewrites hardcoded
 * colors and dimensions that EXACTLY match a token with a known CSS variable to
 * `var(--token)`. It also applies confirmed component mappings from the tenant
 * catalog (`components/prefer-library`) using range-precise JSX edits.
 * Everything else is surfaced as a suggestion — nothing is guessed into the
 * conformed output.
 *
 * Cloud (hosted MCP + autofix), CLI, and the standalone MCP all call this with
 * a context built from their own data source, so results are identical
 * everywhere.
 *
 * Scope today: color + dimension (spacing/radius) tokenization. a11y and
 * component/import swaps are layered on in later slices.
 */

declare function conformSnippet(input: ConformInput, context: DesignSystemContext): ConformResult;

/**
 * Storybook CSF Parser (pure).
 *
 * Parses Storybook Component Story Format (CSF) file *content* and extracts
 * structured data (component name, import path, argTypes, stories/variants).
 * No filesystem access — callers supply the file content as a string, so this
 * runs identically in the CLI (local fs), the Cloud scan (GitHub API content),
 * and the browser. Supports CSF 2.0 and 3.0.
 */

/**
 * Parse story content into structured data.
 */
declare function parseStoryContent(content: string, filePath: string): ParsedStoryFile;
/** Parse story content into the locked StoryFacts IR. */
declare function parseStoryFacts(content: string, filePath: string): StoryFacts;
/**
 * Calculate confidence score based on parsing quality.
 * Higher score = more reliable extraction.
 */
declare function calculateConfidence(meta: ParsedMeta, argTypes: Record<string, ParsedArgType>, stories: ParsedStory[], warnings: string[]): number;
/**
 * Extract top-level const declarations that can be used for spread resolution.
 * Looks for patterns like: const defaultArgs = { ... }
 * Returns a map of variable name -> parsed object value.
 */
declare function extractConstDeclarations(content: string): Map<string, Record<string, unknown>>;
/**
 * Simple args parser that doesn't do spread resolution.
 * Used for extracting const declarations to avoid infinite recursion.
 */
declare function parseArgsSimple(content: string): Record<string, unknown>;
/**
 * Parse the default export (meta) from a story file.
 */
declare function parseMeta(content: string, filePath: string, warnings: string[]): ParsedMeta;
/**
 * Parse argTypes from the meta export.
 */
declare function parseArgTypes(content: string, warnings: string[]): Record<string, ParsedArgType>;
/**
 * Parse the content of a single argType definition.
 */
declare function parseArgTypeContent(content: string, _warnings: string[]): ParsedArgType;
/**
 * Parse individual story exports.
 *
 * Supports both CSF 2.0 and CSF 3.0 formats:
 * - CSF 3.0: export const Story = { args: {...} }
 * - CSF 2.0: export const Story = Template.bind({}) + Story.args = {...}
 */
declare function parseStories(content: string, componentName: string, warnings: string[], constDeclarations: Map<string, Record<string, unknown>>): ParsedStory[];
/**
 * Extract the content inside StoryName.args = { ... } using proper brace matching.
 */
declare function extractArgsContent(content: string, storyName: string): string | null;
/**
 * Find matching brace in content string, respecting strings and nesting.
 */
declare function findMatchingBraceInContent(content: string, startIndex: number, openChar: string, closeChar: string): number;
/**
 * Check if a template has custom rendering logic beyond simple args spreading.
 *
 * Simple templates look like: (args) => <Component {...args} />
 * Custom templates have hooks, state, or complex logic.
 */
declare function isCustomTemplate(content: string, templateName: string): boolean;
/**
 * Parse a single story's content.
 */
declare function parseStoryContent2(name: string, content: string, _componentName: string, _warnings: string[], constDeclarations: Map<string, Record<string, unknown>>): ParsedStory | null;
/**
 * Parse args object content into a Record.
 *
 * Handles nested objects, arrays, and various value types.
 * Uses brace/bracket matching to correctly split at top-level commas.
 *
 * @param content - The string content inside the args object
 * @param constDeclarations - Optional map of const variable names to their parsed values,
 *                           used to resolve spread syntax like ...defaultArgs
 */
declare function parseArgs(content: string, constDeclarations?: Map<string, Record<string, unknown>>): Record<string, unknown>;
/**
 * Split a string at top-level commas, respecting nested braces/brackets/parens.
 */
declare function splitAtTopLevelCommas(content: string): string[];
/**
 * Resolve JavaScript escape sequences in a string.
 * Converts \n, \t, \\, \", \', etc. to their actual characters.
 */
declare function resolveEscapeSequences(str: string): string;
/**
 * Try to parse and resolve string concatenation.
 * Returns the joined string if the value is string concatenation, null otherwise.
 *
 * Examples:
 *   "text1" + "text2" -> "text1text2"
 *   'text1' + 'text2' -> "text1text2"
 */
declare function tryParseStringConcatenation(value: string): string | null;
/**
 * Parse a single arg value, handling nested structures.
 *
 * @param value - The string value to parse
 * @param constDeclarations - Optional map of const variable names to their parsed values
 */
declare function parseArgValue(value: string, constDeclarations?: Map<string, Record<string, unknown>>): unknown;
/**
 * Find the index of the matching closing brace/bracket.
 * Returns the index of the closing char, or -1 if not found.
 */
declare function findMatchingBrace(content: string, startIndex: number, openChar: string, closeChar: string): number;
/**
 * Convert PascalCase to Title Case with spaces.
 */
declare function storyNameToTitle(name: string): string;
/**
 * Extract category from Storybook title path.
 */
declare function extractCategory(title: string): string;
declare const __testing: {
    parseMeta: typeof parseMeta;
    parseArgTypes: typeof parseArgTypes;
    parseArgTypeContent: typeof parseArgTypeContent;
    parseStories: typeof parseStories;
    parseStoryContent2: typeof parseStoryContent2;
    parseArgs: typeof parseArgs;
    parseArgsSimple: typeof parseArgsSimple;
    parseArgValue: typeof parseArgValue;
    extractConstDeclarations: typeof extractConstDeclarations;
    extractArgsContent: typeof extractArgsContent;
    findMatchingBrace: typeof findMatchingBrace;
    findMatchingBraceInContent: typeof findMatchingBraceInContent;
    splitAtTopLevelCommas: typeof splitAtTopLevelCommas;
    resolveEscapeSequences: typeof resolveEscapeSequences;
    tryParseStringConcatenation: typeof tryParseStringConcatenation;
    isCustomTemplate: typeof isCustomTemplate;
    calculateConfidence: typeof calculateConfidence;
};

/**
 * Pure parsing of a Storybook config file's *content* (.storybook/main.*).
 *
 * Extracts story glob patterns, framework, and builder without touching the
 * filesystem — the CLI reads the file and hands content here; the Cloud scan
 * fetches it via the GitHub API and does the same.
 */

/** Default story patterns when a config declares none. */
declare const DEFAULT_STORY_PATTERNS: string[];
/** Common Storybook config file names, in order of preference. */
declare const STORYBOOK_CONFIG_FILENAMES: string[];
/**
 * Parse Storybook config content into structured config.
 *
 * @param content - The raw text of `.storybook/main.*`.
 * @param configPath - Where the content came from (informational).
 */
declare function parseStorybookConfigContent(content: string, configPath: string): StorybookConfig;

/**
 * Pure path predicates for identifying Storybook story files from a flat list
 * of repo paths. Used by the Cloud scan, which has a file tree from the GitHub
 * API rather than a globbable local filesystem.
 */
/**
 * True when `path` is a Storybook story file we should parse (and not a test
 * variant living under an ignored directory).
 */
declare function isStoryFilePath(path: string): boolean;
/** The component basename a story file describes (e.g. `Button.stories.tsx` -> `Button`). */
declare function storyFileBasename(path: string): string | null;

/** A single enumerated variant axis documented for a component. */
interface StorybookVariant {
    /** The prop name (e.g. "variant", "size"). */
    prop: string;
    /** The enumerated options (e.g. ["primary", "secondary"]). */
    options: string[];
    /** The Storybook control type, when known (e.g. "select", "radio"). */
    control?: string;
}
/** A concrete documented story state: its export name + the args it renders with. */
interface StorybookStory {
    name: string;
    args: Record<string, unknown>;
}
/** Distilled facts for one component documented by a Storybook. */
interface StorybookComponentFacts {
    /** Component name as documented (the story's `component` ref or title leaf). */
    componentName: string;
    /** The import specifier used by the story (e.g. "@acme/ui" or "."). */
    importSpecifier?: string;
    /**
     * Whether `importSpecifier` is a bare package import (not relative/absolute).
     * A package import is directly usable as a documented public import path.
     */
    importIsPackage: boolean;
    /** Full story title path (e.g. "Forms/Button"). */
    title?: string;
    /** Atomic-design / folder tier derived from the title. */
    category: string;
    /** Tags declared on the story meta (e.g. ["autodocs", "canonical"]). */
    tags: string[];
    /** Component description from autodocs metadata, when statically present. */
    description?: string;
    /** Enumerated variant axes (argTypes whose options are listed). */
    variants: StorybookVariant[];
    /** All prop names documented via argTypes (superset of variant props). */
    documentedProps: string[];
    /** Number of story exports. */
    storyCount: number;
    /** Story export names. */
    storyNames: string[];
    /** Concrete per-story states (export name + parsed args) — the CSF seed. */
    stories: StorybookStory[];
    /** Highest extraction confidence across the merged story files (0-1). */
    confidence: number;
    /** Story file paths that document this component (usually one). */
    storyFilePaths: string[];
}
/** Storybook configuration facts, if a config file was supplied. */
interface StorybookConfigFacts {
    detected: boolean;
    configPath?: string;
    framework?: string;
    builder?: string;
    storyPatterns: string[];
}
/** The full result of discovering a Storybook across a set of files. */
interface StorybookDiscovery {
    /** One entry per documented component, sorted by name. */
    components: StorybookComponentFacts[];
    /** Configuration facts (framework/builder/globs). */
    config: StorybookConfigFacts;
    /** Number of story files that parsed. */
    storyFileCount: number;
    /** Non-fatal warnings (e.g. a story file that failed to parse). */
    warnings: string[];
}
interface DiscoverStorybookInput {
    /** Candidate files (may be the whole repo tree or pre-filtered stories). */
    files: ReadonlyArray<{
        path: string;
        content: string;
    }>;
    /** The `.storybook/main.*` config content, if found. */
    configContent?: string;
    /** The `.storybook/main.*` path, used for reporting. */
    configPath?: string;
}
/** Distill a Storybook from a set of files into per-component facts. */
declare function discoverStorybook(input: DiscoverStorybookInput): StorybookDiscovery;

interface UnresolvedStoryEvidence {
    file: string;
    importSpecifier: string;
    importName: string;
    reason: "external-import" | "component-not-found";
}
interface MergeStoryFactsIntoUcfsResult {
    ucfs: UniversalComponentFact[];
    unresolved: UnresolvedStoryEvidence[];
}
declare function mergeStoryFactsIntoUcfs(args: {
    ucfs: readonly UniversalComponentFact[];
    stories: readonly StoryFacts[];
}): MergeStoryFactsIntoUcfsResult;

interface StorybookSeededVariant {
    name: string;
    provenance: "storybook";
}
interface StorybookUsageExample {
    code: string;
    provenance: "storybook";
}
interface StorybookEnrichmentSeed {
    description?: string;
    variants: StorybookSeededVariant[];
    usageExamples: StorybookUsageExample[];
}
interface StorybookSeedProvenance {
    description?: "storybook" | "human" | "ai";
    variants?: "storybook" | "human" | "ai";
    usageExamples?: "storybook" | "human" | "ai";
}
interface StorybookSeedableEnrichment {
    description?: string;
    variants?: StorybookSeededVariant[];
    usageExamples?: StorybookUsageExample[];
    dos?: readonly string[];
    provenance?: StorybookSeedProvenance;
}
interface ApplyStorybookEnrichmentSeedResult {
    enrichment: StorybookSeedableEnrichment;
    changed: boolean;
}
declare function projectStoryEvidenceToEnrichmentSeed(args: {
    componentName: string;
    storyEvidence: readonly StoryEvidence[];
}): StorybookEnrichmentSeed;
declare function applyStorybookEnrichmentSeed(args: {
    existing: StorybookSeedableEnrichment;
    seed: StorybookEnrichmentSeed;
}): ApplyStorybookEnrichmentSeedResult;

export { type AnalyzeReactComponentAdoptionInput, type ApplyFixesInput, type ApplyFixesResult, type ApplyStorybookEnrichmentSeedResult, type AutoDetectedPropDefinition, type AutoPropsExtractionResult, type CallSiteSample, type ClassnameSummary, type CompilerScanResult, type ComponentCallSite, type ComponentExtractor, type ComponentImportResolution, type ComponentMeta, type ComponentUsageAnalysis, type ComponentUsageSummary, type CompositionMeta, type ControlledFlag, type CreateSourceComponentResolverOptions, DEFAULT_RECOGNIZED_CLASS_HELPERS, DEFAULT_STORY_PATTERNS, type DefinitionKind, type DiscoverStorybookInput, type DuplicateFinding, type EventFact, type ExportRecord, type ExtractClassnamesOptions, type ExtractJsxFactsOptions, type ExtractQuickComponentCandidatesInput, type ExtractQuickComponentCandidatesResult, type ExtractReactUcfsFromSourceInput, type ExtractReactUcfsFromSourceResult, type ExtractSfcUcfsFromSourceInput, type ExtractSfcUcfsFromSourceResult, type ExtractSourceTokensArgs, type ExtractUcfsForReactOptions, type ExtractUcfsForReactStreamingOptions, type ExtractUcfsForSfcOptions, FRAGMENTS_CONFIG_FILENAMES, type FragmentsScanConfig, type Framework, type GovernancePolicyMetadata, type GovernancePresetName, type HardcodedFinding, type ImportRecord, type InlineSource, type LoadFragmentsConfigOptions, type LoadFragmentsConfigResult, type LoadGovernancePolicyOptions, type LoadedGovernancePolicy, type MergeStoryFactsIntoUcfsResult, type ObservedInlineStyle, type ObservedProp, type ObservedPropKind, type ParseClassInput, type ParsedArgType, type ParsedMeta, type ParsedStory, type ParsedStoryFile, type ParsedToken, type PartMeta, type PrebuiltFragment, type PropFact, type PropMeta, type PropTypeKind, type QuickComponentCandidateProgress, type ReactComponentAdoptionAnalysis, type ReactComponentAdoptionCallSite, type ReactComponentAdoptionComponent, type ReactComponentAdoptionDefinition, type ReactComponentAdoptionIdentity, type ReactComponentAdoptionIdentityInput, type ReactComponentAdoptionPropUsage, type ReactComponentAdoptionRef, type ReactComponentAdoptionTopImporter, type ReactComponentAdoptionUnresolvedImport, type ReactUcfSourceDiagnostic, type ReactUcfSourceDiagnosticCode, type RepoTreeEntry, type ResolveFixEditsInput, type ResolveFixEditsResult, type ResolveGovernancePolicyOptions, type ResolvedFixEdit, type ResolvedGovernancePolicy, type RootElementFact, type RunForFileOptions, STORYBOOK_CONFIG_FILENAMES, type ScanFacts, type ScanFile, type ScanSource, type ScanSourceFile, type ScanSourceKind, type ScanSourceWithFactsInput, type ScanSourceWithFactsResult, type SfcFramework, type SfcInlineSource, type SfcUcfSourceDiagnostic, type SfcUcfSourceDiagnosticCode, type SkippedFix, type SlotFact, type SourceComponentAlias, type StoryComponentImport, type StoryEvidence, type StoryFacts, type StoryFactsDiagnostic, type StoryFactsRung, type StoryFactsStory, type StorybookComponentFacts, type StorybookConfig, type StorybookConfigFacts, type StorybookDiscovery, type StorybookEnrichmentSeed, type StorybookSeedProvenance, type StorybookSeedableEnrichment, type StorybookSeededVariant, type StorybookUsageExample, type StorybookVariant, type StyleSystem, type ThemeIndex, type TokenExtractionProgress, type TokenExtractionResult, type TokenFileStore, type TokenProvenanceConfig, type TokenTier, type UniversalComponentFact, type UnresolvedStoryEvidence, aggregateComponentUsage, analyzeReactComponentAdoption, applyFixes, applyStorybookEnrichmentSeed, buildDTCGPayload, buildThemeIndex, classifyTokenTiers, computeIdentityKey, conformSnippet, createComponentExtractor, createLocalScanSource, createMemoryScanSource, createSourceBackedComponentResolver, deduplicateByIdentity, discoverStorybook, extractCategory, extractClassnameFactsFromAttribute, extractClassnameSpreadFact, extractCustomPropsFromComponentFile, extractJsxFacts, extractQuickComponentCandidatesFromSource, extractReactUcfsFromSource, extractReactUcfsFromSourceWithDiagnostics, extractScssFacts, extractSfcUcfsFromSource, extractSfcUcfsFromSourceWithDiagnostics, extractSourceTokens, extractUcfsForReact, extractUcfsForReactStreaming, extractUcfsForSfc, findFragmentsConfigFile, governancePresetConfig, inferCategory, isColorValue, isStoryFilePath, loadFragmentsConfig, loadGovernancePolicy, mergeGovernanceConfigs, mergeStoryFactsIntoUcfs, normalizeColorValue, normalizePresetNames, parseClass, parseStoryContent, parseStoryFacts, parseStorybookConfigContent, parseSuppressionDirectives, projectStoryEvidenceToEnrichmentSeed, rankStylePathForExtraction, refineTokenPayload, resolveComponentSourcePath, resolveFixEdits, resolveGovernancePolicy, resolveGovernancePresetName, resolveRecognizedHelpers, resolveTailwindToken, resolveTailwindTokenFacts, resolveTokensWithSass, runForFile, scanSourceWithFacts, scanWithFacts, shouldApplyConfigPresets, storyFileBasename, storyNameToTitle, __testing as storybookParserTesting, ucfId };
