export type PackageManager = "pnpm" | "npm"; export interface PMCommands { /** The binary name ("pnpm" | "npm"). */ name: PackageManager; /** Install all dependencies — e.g. `pnpm install` / `npm install`. */ install: string[]; /** Run a script — e.g. `pnpm run dev` / `npm run dev`. */ run: (script: string) => string[]; /** Execute a local bin — e.g. `pnpm exec rebase ...` / `npx rebase ...`. */ exec: (bin: string, args: string[]) => string[]; /** Query the registry — e.g. `pnpm view version` / `npm view version`. */ view: (pkg: string, field: string) => string[]; /** Run all workspace scripts — e.g. `pnpm -r run build` / `npm run build --workspaces`. */ runAll: (script: string) => string[]; /** Run a script in a specific workspace — e.g. `pnpm --filter "*-backend" start` / `npm run start -w backend`. */ runWorkspace: (workspace: string, script: string) => string[]; /** Execute a one-off package — e.g. `pnpm dlx skills ...` / `npx -y skills ...`. */ dlx: (pkg: string, args: string[]) => string[]; /** The workspace dependency protocol: `"workspace:*"` for pnpm, `"*"` for npm. */ workspaceProtocol: string; } /** * Decide availability from a `spawnSync` outcome. * * Split out from the spawn itself so the decision is testable without starting * a process — which is what made the old test load-sensitive and occasionally * red for reasons that had nothing to do with the code under test. * * The three outcomes are distinguishable, and the old code conflated two of * them by asking only `status === 0`: * * not installed status null, signal null, error.code ENOENT * timed out status null, signal SIGTERM, error.code ETIMEDOUT * broken install status non-zero, no error */ export declare function pnpmAvailabilityFromProbe(res: { status: number | null; signal?: NodeJS.Signals | null; error?: { code?: string; } | Error; }): boolean; /** * Whether pnpm is runnable on this machine. * * Used to decide whether a fresh project can be scaffolded with pnpm. Kept * cheap and non-interactive (bounded timeout, output discarded) so it never * hangs detection if a corepack shim misbehaves, and memoised so that repeated * detection in one CLI run costs one process rather than one per call. */ export declare function isPnpmAvailable(): boolean; /** Forget the memoised probe. For tests; nothing in a CLI run needs it. */ export declare function resetPnpmAvailabilityCache(): void; /** * Detect the package manager for a Rebase project. * * Rebase recommends pnpm, so detection prefers it. Crucially, *how the CLI was * invoked* (`npx` vs `pnpm dlx`, i.e. `npm_config_user_agent`) is deliberately * ignored: running `npx @rebasepro/cli init` says nothing about how the user * wants to manage the project they're creating, and letting it pin the scaffold * to npm is what made every `npx`-invoked project an npm project. * * Detection order: * 1. An existing lock file — an explicit choice we always respect * (`pnpm-lock.yaml` wins over `package-lock.json` when both are present). * 2. pnpm, whenever it is installed. * 3. npm, only as a fallback when pnpm is genuinely unavailable. */ export declare function detectPackageManager(targetDir?: string): PackageManager; /** Build the command helpers for a given package manager. */ export declare function getPMCommands(pm: PackageManager): PMCommands;