export type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';
export interface PackageManagerCommands {
    /** Install command (e.g., 'npm install') */
    install: string;
    /** Run a script (e.g., 'npm run build' for script 'build') */
    run: (script: string) => string;
    /** Execute command in workspace (e.g., 'npm exec --workspace=frontend -- astro build') */
    workspaceExec: (workspace: string, command: string) => string;
    /** Run a script in a workspace (e.g., 'npm run build --workspace=frontend') */
    workspaceRun: (workspace: string, script: string) => string;
    /** Execute a binary (e.g., 'npx wrangler') */
    exec: (command: string) => string;
}
/**
 * Find lock file in directory or parent directories
 * @returns Lock file name and path, or null if not found
 */
export declare function findLockFile(directory: string): Promise<{
    name: string;
    packageManager: PackageManager;
    path: string;
} | null>;
/**
 * Detect package manager from lock file in directory tree
 * @returns Detected package manager, defaults to 'npm' if no lock file found
 */
export declare function detectPackageManager(directory: string): Promise<PackageManager>;
/**
 * Get command templates for a package manager
 */
export declare function getPackageManagerCommands(pm: PackageManager): PackageManagerCommands;
/**
 * Detect package manager and get its commands
 */
export declare function getPackageManager(directory: string): Promise<{
    commands: PackageManagerCommands;
    lockFile: {
        name: string;
        path: string;
    } | null;
    name: PackageManager;
}>;
/**
 * Transform an npm command to the equivalent for the detected package manager
 * Handles common patterns:
 * - 'npm run X' -> 'yarn run X' / 'pnpm run X' / 'bun run X'
 * - 'npm run X --workspace=Y' -> 'yarn workspace Y run X' / 'pnpm --filter Y run X' / 'bun run --filter Y X'
 * - 'npm exec --workspace=X -- Y' -> equivalent workspace command
 * - 'npx X' -> 'yarn dlx X' / 'pnpm dlx X' / 'bunx X'
 */
export declare function transformCommand(command: string, pm: PackageManager): string;
/**
 * Transform npm create commands to the equivalent for another package manager.
 * Handles 'npm create X@version -- args' -> 'pm create X@version args'
 * Also transforms --use-npm to --use-{pm} for CLIs that support it (e.g., Next.js)
 * For yarn, removes @latest suffix since yarn classic (v1) may not handle it properly.
 *
 * @example
 * transformCreateCommand('npm create cloudflare@latest -- frontend --framework=hono', 'bun')
 * // Returns: 'bun create cloudflare@latest frontend --framework=hono'
 *
 * @example
 * transformCreateCommand('npm create cloudflare@latest -- frontend --framework=next --use-npm', 'pnpm')
 * // Returns: 'pnpm create cloudflare@latest frontend --framework=next --use-pnpm'
 *
 * @example
 * transformCreateCommand('npm create cloudflare@latest -- frontend --framework=astro', 'yarn')
 * // Returns: 'yarn create cloudflare -- frontend --framework=astro'
 */
export declare function transformCreateCommand(command: string, pm: PackageManager): string;
/**
 * Get spawn arguments for executing a package binary.
 * Returns the program and any prefix args needed before the command args.
 * Useful for node's spawn() which needs program and args separately.
 *
 * Uses npx for most package managers (universally available via Node.js).
 * Uses bunx for bun projects (performance benefit from Bun runtime).
 *
 * @example
 * const { program, prefixArgs } = getExecSpawnArgs('npm');
 * spawn(program, [...prefixArgs, 'wrangler', 'dev', '--port=3000']);
 */
export declare function getExecSpawnArgs(pm: PackageManager): {
    prefixArgs: string[];
    program: string;
};
