/** * Authoring types for inline component migrations. * * A migration is authored ONCE, inline in the source component's `*.stories.tsx` via * `mutateMeta(meta, { migration })`. Storybook renders it for humans and the @corva/ui MCP * server extracts it for AI agents — the story is the single source of truth. * * These are the canonical migration types: the MCP server's `MigrationSpec` / `PropMapping` * (mcp-server/src/data-extractors/migrations-extractor/migrations-extractor.ts) are type-only * aliases of them, so the two sides cannot drift. `source` is NOT authored here — the extractor * derives it from the component name. `sourceImportPath` is also derived from the story's location * (`src/components/**` → `@corva/ui/components`, `src/componentsV2/**` → `@corva/ui/componentsV2`) * and only needs to be set inline to override that default (e.g. a deep import path). * * IMPORTANT: author migrations with inline literals only (no imported constants, enum refs or * spreads). The MCP extractor reads them from the story's AST and cannot resolve references. */ /** * Import root for legacy components under `src/components` — the default source location and the * fallback when a spec doesn't set `sourceImportPath`. */ export declare const COMPONENTS_IMPORT_PATH = "@corva/ui/components"; /** * Import root for the current component generation under `src/componentsV2`, where migration * targets live — including same-folder successors that use the `Next` naming convention. */ export declare const COMPONENTS_V2_IMPORT_PATH = "@corva/ui/componentsV2"; /** * Default `targetImportPath` for a migration whose spec doesn't override it. Points at the current * target generation; repoint this (and the discovery config) when a newer generation supersedes it. */ export declare const DEFAULT_TARGET_IMPORT_PATH = "@corva/ui/componentsV2"; /** * How confidently a single prop change can be applied automatically. * - automatic: safe to apply without human review — a true drop-in `rename` or boolean negation only. * - supervised: applied best-effort but a human must verify (e.g. a `renameValue` — a consumer may pass * a value the map doesn't cover — or a newly-required prop). * - assisted: structural / lossy change — apply what is safe and always leave a TODO. * * Per-kind tier floors: `restructure` is always `assisted`; `renameValue` and `addRequiredProp` are never * `automatic` (floor `supervised`); only a true drop-in `rename` / `invertBoolean` earns `automatic`. */ export type MigrationTier = 'automatic' | 'supervised' | 'assisted'; /** A single declarative transform from a source prop to its target form. */ export type StoryPropMapping = { kind: 'rename'; tier: MigrationTier; from: string; to: string; note?: string; } | { kind: 'renameValue'; tier: MigrationTier; from: string; to?: string; valueMap: Record; note?: string; } | { kind: 'invertBoolean'; tier: MigrationTier; from: string; to: string; note?: string; } | { kind: 'removeProp'; tier: MigrationTier; from: string; reason: string; } | { kind: 'addRequiredProp'; tier: MigrationTier; name: string; bestEffortValue: string; note: string; } | { kind: 'restructure'; tier: MigrationTier; from?: string; summary: string; guidance: string; }; /** Numeric severity of each tier — used to pick the coarsest tier of a mapping list. */ export declare const MIGRATION_TIER_RANK: Record; /** The coarsest (most hands-on) tier across a migration's prop mappings. */ export declare const computeOverallMigrationTier: (mappings: StoryPropMapping[]) => MigrationTier; /** * Canonical human-readable markdown for a single prop mapping — rendered by both the Storybook * MigrationBlock and the MCP `get_migration_guide` tool, so the two surfaces cannot drift. * This module must stay dependency-free: the MCP server imports it at runtime. */ export declare const describePropMapping: (mapping: StoryPropMapping) => string; /** * Inline migration spec authored on a source component's story (`source` / `sourceImportPath` * are derived by the extractor and must not be repeated here). */ export type StoryMigration = { /** Replacement component name, e.g. 'Button' or 'AutocompleteNext'. */ target: string; /** * Override the location-derived source import path. Only needed when the source is NOT the * location barrel — e.g. a deep import like '@corva/ui/components/Typography'. */ sourceImportPath?: string; /** Override only when the source's default export name differs from `source`. */ sourceDefaultName?: string; /** Defaults to `DEFAULT_TARGET_IMPORT_PATH` (`@corva/ui/componentsV2`). */ targetImportPath?: string; /** Curated, human-readable migration notes (rich text). */ notes?: string; /** Declarative prop transforms. */ propMappings?: StoryPropMapping[]; }; //# sourceMappingURL=migration.d.ts.map