export type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun'; /** The `--npm` / `--yarn` / `--pnpm` / `--bun` flags every command accepts. */ export interface PackageManagerFlags { npm?: boolean; yarn?: boolean; pnpm?: boolean; bun?: boolean; } export interface PackageManagerChoice { manager: PackageManager; /** `flag` when the user asked for it, `detected` when we inferred it. */ source: 'flag' | 'detected'; } /** * Which package manager to install with. * * Precedence, in order: * * 1. An explicit flag. * 2. `packageManager` in the project's `components.json`. * 3. How this process was launched — `npx`, `pnpm dlx`, `bunx`. Usually the * only signal available to `init`, where the project does not exist yet. * 4. The project's own lockfile or `packageManager` field. This is what the * hand-rolled detection never looked at, so `bna-ui add` inside a pnpm * project could install with npm and leave a stray package-lock.json. * 5. npm. * * Reports *how* it decided rather than logging, because the scaffold commands * announce a detected manager while `add` stays quiet. */ export declare function resolvePackageManager(flags: PackageManagerFlags, cwd?: string, /** From `components.json`. Loses to a flag, beats every detected signal. */ configured?: PackageManager): Promise; export declare function getInstallCommand(packageManager: PackageManager): string; /** * The environment an install subprocess runs in. * * Yarn 2+ turns `enableImmutableInstalls` on whenever `CI` is set, and an * immutable install refuses to create or modify a lockfile. But a project * `init` has just scaffolded has no lockfile at all — the very install being * refused is the one that would write it — so `bna-ui init --yarn` failed with * YN0028 on every CI runner and inside every container, and `bna-ui add`'s * `yarn add` hit the same guard for the same reason. * * Only yarn is touched: npm, pnpm and bun all create a missing lockfile without * complaint, and nothing here should be quietly relaxing a user's `--frozen` * intent for a manager that never had a problem. */ export declare function installEnv(packageManager: PackageManager): typeof process.env | undefined; export declare function getRunCommand(packageManager: PackageManager, script: string): string; export declare function installDependencies(projectPath: string, packageManager: PackageManager): Promise; export declare function validatePackageManager(pm: string): pm is PackageManager;