/** * @fileoverview Package manager connector for npm/pnpm operations. */ import { type ExecResult } from '../platform.js'; /** Supported package managers */ export type PackageManager = 'npm' | 'pnpm'; /** Options for PackageManagerConnector */ export interface PackageManagerConnectorOptions { /** Enable debug logging of commands */ debug?: boolean; /** Working directory for commands */ cwd?: string; } /** * Connector for package manager operations (npm/pnpm). * * Package and script names are validated before anything runs. An invalid name returns an * ExecResult with `errorCode: SPAWN_FAILED` and the reason in `stderr`. * * @example * ```typescript * const pm = new PackageManagerConnector('pnpm', { debug: true }); * * // Install all dependencies * await pm.install(); * * // Install a specific package * await pm.install('lodash'); * * // Install as dev dependency * await pm.install('vitest', true); * * // Run a script * const result = await pm.run('build'); * ``` */ export declare class PackageManagerConnector { private pm; private options?; constructor(pm?: PackageManager, options?: PackageManagerConnectorOptions); /** * Install dependencies. * * @param pkg - Optional package name to install * @param dev - If true, install as dev dependency * @returns ExecResult from the install command */ install(pkg?: string, dev?: boolean): Promise; /** * Run a package.json script. * * @param script - Script name from package.json * @returns ExecResult from the run command */ run(script: string): Promise; /** * Add a package to dependencies. * * @param pkg - Package name (with optional version) * @param dev - If true, add as dev dependency * @returns ExecResult from the add command */ add(pkg: string, dev?: boolean): Promise; /** * Remove a package from dependencies. * * @param pkg - Package name to remove * @returns ExecResult from the remove command */ remove(pkg: string): Promise; /** * Check if a command succeeded. * * @param result - ExecResult to check * @returns true if the command succeeded */ isSuccess(result: ExecResult): boolean; /** * Execute a package manager command. */ private execPm; } //# sourceMappingURL=package-manager.d.ts.map