import { OutfitterError } from "@outfitter/contracts"; import { Result } from "@outfitter/contracts"; /** Options passed to a codemod's transform function. */ interface CodemodOptions { readonly dryRun: boolean; readonly targetDir: string; } /** Result returned by a codemod's transform function. */ interface CodemodResult { readonly changedFiles: readonly string[]; readonly errors: readonly string[]; readonly skippedFiles: readonly string[]; } /** A discovered codemod with resolved paths. */ interface DiscoveredCodemod { /** Absolute path to the codemod file. */ readonly absolutePath: string; /** Path relative to the codemods directory. */ readonly relativePath: string; } /** * Find the codemods directory, checking known locations. * * Searches: * 1. Relative to the target cwd * 2. Walking up parent directories from cwd (monorepo root detection) * 3. Relative to the outfitter binary itself (development mode) */ declare function findCodemodsDir(cwd: string, binaryDir?: string): string | null; /** * Discover codemods referenced in migration docs for a package version range. * * Scans migration doc frontmatter for `codemod` references in the `changes` * array, resolves them to absolute paths in the codemods directory, and * deduplicates. */ declare function discoverCodemods(migrationsDir: string, codemodsDir: string, shortName: string, fromVersion: string, toVersion: string): DiscoveredCodemod[]; /** * Run a single codemod by importing and executing its `transform` function. * * @param codemodPath - Absolute path to the codemod module * @param targetDir - Root directory the codemod should operate on * @param dryRun - When `true`, the codemod previews changes without writing * @returns Codemod result with changed/skipped files, or an error */ declare function runCodemod(codemodPath: string, targetDir: string, dryRun: boolean): Promise>; export { runCodemod, findCodemodsDir, discoverCodemods, DiscoveredCodemod, CodemodResult, CodemodOptions };