import { VersionConflict } from "./outfitter-109s75x0.js"; import { MigrationChange } from "./outfitter-y37yfehn.js"; import { OutputMode as OutputMode3 } from "@outfitter/cli/types"; import { OutfitterError as OutfitterError2 } from "@outfitter/contracts"; import { Result } from "@outfitter/contracts"; import { OutputMode } from "@outfitter/cli/types"; /** Options controlling how upgrade results are rendered. */ interface PrintUpgradeResultsOptions { readonly all?: boolean; readonly cwd?: string; readonly dryRun?: boolean; readonly guide?: boolean; readonly mode?: OutputMode; } /** * Format and output upgrade results. * * @param result - Upgrade scan/apply result to render * @param options - Display options (output mode, guide, dry-run hints) */ declare function printUpgradeResults(result: UpgradeResult, options?: PrintUpgradeResultsOptions): Promise; import { OutputMode as OutputMode2 } from "@outfitter/cli/types"; import { OutfitterError } from "@outfitter/contracts"; /** Terminal disposition of an upgrade run (written into the report). */ type UpgradeReportStatus = "dry_run" | "no_updates" | "cancelled" | "skipped_non_interactive" | "applied" | "failed"; /** Snapshot of effective flags for this upgrade run. */ interface UpgradeReportFlags { readonly all: boolean; readonly dryRun: boolean; readonly interactive: boolean; readonly noCodemods: boolean; readonly outputMode: OutputMode2 | null; readonly yes: boolean; } /** Machine-readable upgrade report written to `.outfitter/reports/upgrade.json`. */ interface UpgradeReport { readonly $schema: "https://outfitter.dev/reports/upgrade/v1"; readonly applied: boolean; readonly checkedAt: string; readonly codemods?: CodemodSummary; readonly conflicts?: readonly VersionConflict[]; readonly cwd: string; readonly error?: { readonly message: string; readonly category: string; readonly context?: Record; }; readonly excluded: { readonly breaking: readonly string[]; }; readonly finishedAt: string; readonly flags: UpgradeReportFlags; readonly packages: readonly PackageVersionInfo[]; readonly startedAt: string; readonly status: UpgradeReportStatus; readonly summary: { readonly total: number; readonly available: number; readonly breaking: number; readonly applied: number; }; readonly unknownPackages?: readonly string[]; readonly workspaceRoot: string | null; } /** Contextual metadata passed alongside the result when writing a report. */ interface WriteUpgradeReportMeta { readonly error?: OutfitterError; readonly options: UpgradeOptions; readonly startedAt: Date; readonly status: UpgradeReportStatus; readonly workspaceRoot: string | null; } /** * Best-effort report writer. * * Report I/O failures should not change the primary command result. */ declare function writeUpgradeReportSafely(cwd: string, result: UpgradeResult, meta: WriteUpgradeReportMeta): void; /** Input options for `runUpgrade`. */ interface UpgradeOptions { /** Include breaking changes in the upgrade */ readonly all?: boolean; /** Working directory (defaults to cwd) */ readonly cwd: string; /** Preview only — no mutations, no prompt */ readonly dryRun?: boolean; /** Show migration guide */ readonly guide?: boolean; /** Filter to specific package names (scan + guides) */ readonly guidePackages?: readonly string[]; /** Whether interactive prompts are enabled (false in CI) */ readonly interactive?: boolean; /** Skip automatic codemod execution during upgrade */ readonly noCodemods?: boolean; /** Output mode */ readonly outputMode?: OutputMode3; /** Auto-confirm without prompting */ readonly yes?: boolean; } /** Version metadata for a single installed @outfitter/* package. */ interface PackageVersionInfo { /** Whether the update contains breaking changes (major bump) */ readonly breaking: boolean; /** Currently installed version */ readonly current: string; /** Latest available version from npm (null if query failed) */ readonly latest: string | null; /** Full package name */ readonly name: string; /** Whether an update is available */ readonly updateAvailable: boolean; } /** Summary of codemods executed during --apply. */ interface CodemodSummary { /** Total files changed across all codemods */ readonly changedFiles: readonly string[]; /** Number of codemods executed */ readonly codemodCount: number; /** Errors encountered during codemod execution */ readonly errors: readonly string[]; } /** Complete output of a single upgrade run. */ interface UpgradeResult { /** Whether mutations were made (--apply was used and changes were written) */ readonly applied: boolean; /** Package names that were updated in package.json */ readonly appliedPackages: string[]; /** Codemod execution summary (populated when --apply runs codemods) */ readonly codemods?: CodemodSummary; /** Version conflicts found across workspace manifests */ readonly conflicts?: readonly VersionConflict[]; /** Structured migration guides (populated when --guide is used) */ readonly guides?: readonly MigrationGuide[]; /** Whether any update is a breaking change */ readonly hasBreaking: boolean; /** Package version info */ readonly packages: PackageVersionInfo[]; /** Package names skipped because they contain breaking changes */ readonly skippedBreaking: string[]; /** Total packages checked */ readonly total: number; /** Package names that were requested but not found in the workspace */ readonly unknownPackages?: readonly string[]; /** Number of packages with updates available */ readonly updatesAvailable: number; } /** * Run the upgrade command — detect installed versions and query npm for latest. * * Default flow: scan → classify → prompt → apply. * `--dry-run` returns a report without mutation. * `--all` includes breaking changes. * `--yes` or `--non-interactive` bypasses the prompt. */ declare function runUpgrade(options: UpgradeOptions): Promise>; type GuidePackageVersionInfo = PackageVersionInfo; /** Structured migration guide for a single package upgrade. */ interface MigrationGuide { /** Whether this is a breaking change */ readonly breaking: boolean; /** Structured changes from migration frontmatter, if available */ readonly changes?: readonly MigrationChange[]; /** Currently installed version */ readonly fromVersion: string; /** The @outfitter/* package name */ readonly packageName: string; /** Migration step strings (empty if no guide exists) */ readonly steps: readonly string[]; /** Latest available version */ readonly toVersion: string; } /** * Build structured migration guides for packages with available updates. * * For each package with an update, produces a `MigrationGuide` with steps * extracted from migration docs (if a migrations directory is available). * Packages without updates or without a resolved latest version are skipped. */ declare function buildMigrationGuides(packages: readonly GuidePackageVersionInfo[], migrationsDir: string | null): MigrationGuide[]; export { MigrationGuide, buildMigrationGuides, PrintUpgradeResultsOptions, printUpgradeResults, UpgradeOptions, PackageVersionInfo, CodemodSummary, UpgradeResult, runUpgrade, UpgradeReportStatus, UpgradeReportFlags, UpgradeReport, WriteUpgradeReportMeta, writeUpgradeReportSafely };