export interface PackageJson { dependencies?: Record; devDependencies?: Record; scripts?: Record; /** Corepack-standard PM declaration: `"pnpm@9.15.0"`, `"yarn@4.0.0"`, etc. */ packageManager?: string; } export type PackageManager = "npm" | "pnpm" | "yarn"; export interface DetectedStack { language: "typescript"; hasVitest: boolean; hasPlaywright: boolean; /** * Consumer's package manager. Drives the workflow templates' install * step (`npm ci` vs `pnpm install --frozen-lockfile` vs `yarn install * --immutable`) and test invocation prefix. Detected from * `package.json#packageManager` (corepack convention) → lockfile * presence (`pnpm-lock.yaml`, `yarn.lock`, `package-lock.json`) → * defaults to npm. */ packageManager: PackageManager; } /** Minimal filesystem reader so planning is pure. */ export interface FileReader { exists(path: string): boolean; read(path: string): string; } export interface PlanOptions { /** Consumer project root (where package.json lives). */ cwd: string; /** CODEOWNERS handle/team (e.g., "@aminazar"). */ owner: string; /** Overwrite existing files (default: skip-if-exists). */ force: boolean; /** Version of the CLI invoking init; drives the CI workflow pin. */ cliVersion?: string; } export type FileAction = { kind: "create"; path: string; contents: string; } | { kind: "skip-exists"; path: string; reason: string; } | { kind: "overwrite"; path: string; contents: string; } | { kind: "append"; path: string; contents: string; existingContents: string; } | { kind: "conflict"; path: string; reason: string; }; export interface Plan { detected: DetectedStack; actions: FileAction[]; warnings: string[]; } export declare function detectStack(pkg: PackageJson, reader?: FileReader): DetectedStack; /** * Detect the consumer's package manager. Priority order: * * 1. `package.json#packageManager` field (corepack standard; * authoritative when present, since corepack will use whatever * this declares) * 2. Lockfile presence (most reliable on existing repos) * 3. Default to npm * * Filed as slowcook#25 — every pnpm consumer hit this on the first * run when init's npm-only templates failed at `npm ci`. */ export declare function detectPackageManager(pkg: PackageJson, reader?: FileReader): PackageManager; export declare class InitError extends Error { constructor(message: string); } export declare function buildPlan(reader: FileReader, options: PlanOptions): Plan; //# sourceMappingURL=plan.d.ts.map