import { GeneratorCallback, Tree } from '@nx/devkit'; /** * Interface for file transformation results with renaming support * This is a common pattern for migrations that transform files and potentially rename them * Nx doesn't provide this pattern, so we create our own reusable interface */ export interface ActionTransformResult { transformed: boolean; newContent: string; shouldRename?: boolean; newFileName?: string; } /** * Target Nx version for the "update to Nx 23" family of migrations/generators. * Shared by the `update-nx-23` workspace migration and the `migrate-nx-23` bot-app generator * so the two stay in lockstep. */ export declare const NX_23_VERSION = "23.1.0"; /** * Bumps `nx` / `@nx/*` dependency versions to Nx 23 in the given package.json. * Idempotent: leaves already-23.x versions untouched. * @returns true if the file was modified */ export declare function updateNxDependencies(tree: Tree, packageJsonPath: string): boolean; /** * Finds the package.json paths for the workspace root plus every project tagged * `botonic:bot-app`. */ export declare function getBotonicPackageJsonPaths(tree: Tree): string[]; /** * Update Botonic dependencies to a specific version across the workspace or specific project * @param tree - The file system tree * @param targetVersion - The target version for Botonic dependencies * @param projectPath - Optional project path, if not provided updates workspace root * @returns GeneratorCallback for the dependency update task */ export declare function updateBotonicDependencies(tree: Tree, targetVersion: string, projectPath: string): void; /** * Get the current @botonic/core version from a project's package.json */ export declare function getCurrentBotonicCoreVersion(tree: Tree, projectPath: string): string | null; /** * Get the target migration version from migrations.json */ export declare function getMigrationTargetVersion(tree: Tree, migrationName: string): string | null; export declare function findBotApps(tree: Tree): string[]; export interface ProjectSelectionOptions { projects?: string[]; skipPrompt?: boolean; } export interface ProjectChoice { name: string; message: string; hint?: string; } /** * Interface for migration-specific project processing functions */ export interface ProjectProcessor { (tree: Tree, projectPath: string, targetBotonicVersion: string): Promise<{ transformed: boolean; filesChanged: number; }>; } /** * Configuration object for runBotonicMigration function */ export interface BotonicMigrationConfig { /** The file system tree */ tree: Tree; /** Project selection options (projects array, skipPrompt flag) */ options: ProjectSelectionOptions; /** Migration key used in migrations.json (e.g., 'modernize-bot-actions') */ migrationKey: string; /** Human-readable migration name for logging */ migrationName: string; /** Function to process each project */ processProject: ProjectProcessor; /** Function to generate success messages */ getSuccessMessage: (targetVersion: string) => string[]; /** Optional: Skip dependency updates (defaults to false) */ skipDependencyUpdates?: boolean; /** Optional: Custom success message title (defaults to "Migration completed!") */ successTitle?: string; /** Optional: Additional steps to show in the summary */ additionalSteps?: string[]; } /** * Helper function to create a BotonicMigrationConfig object with type safety */ export declare function createBotonicMigrationConfig(config: BotonicMigrationConfig): BotonicMigrationConfig; /** * Helper function to create a simple project processor for file-based migrations */ export declare function createFileProcessor(fileProcessors: Array<{ filePath: (projectPath: string) => string; shouldProcess: (tree: Tree, filePath: string) => boolean; processFile: (tree: Tree, filePath: string, content: string, targetVersion: string) => { transformed: boolean; newContent?: string; logMessage?: string; }; }>): ProjectProcessor; /** * Common migration wrapper that handles the standard migration pattern: * 1. Project selection * 2. Version resolution * 3. Project processing with dependency updates * 4. Summary and task execution */ export declare function runBotonicMigration(config: BotonicMigrationConfig): Promise; /** * Reusable function to select bot projects for migration with interactive prompts * @param tree - The file system tree * @param options - Project selection options (projects array, skipPrompt flag) * @param migrationName - Name of the migration (for logging) * @param migrationKey - Key used in migrations.json (e.g., 'modernize-bot-actions') * @returns Array of selected project paths */ export declare function selectBotProjectsForMigration(tree: Tree, options: ProjectSelectionOptions, migrationName: string, migrationKey?: string): Promise; /** * Reads the nx-plugin's own version from its package.json. * Pass __dirname (or MODULE_DIR) from the calling file so the path resolves * correctly regardless of where in the source tree the caller lives. * * Walks up from moduleDir looking for the `@botonic/nx-plugin` package.json * rather than assuming a fixed depth — callers can live at different nesting * levels (e.g. `src/generators//` vs `src/generators/bot-app-migrations//`). */ export declare function getPluginVersion(moduleDir: string): string;