import type { InstallerEventEmitter } from '../events.js'; export type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun'; /** * The `create-next-app` major we pin to. Matches `authkit-nextjs/examples/next` * (Next 16). A major float (`@16`) keeps the pinned flag set stable while still * receiving patch/minor updates. Re-pin when AuthKit bumps its supported Next major. * `@latest` is intentionally avoided — it would reintroduce the flag-drift * non-determinism this deterministic step exists to prevent. */ export declare const CREATE_NEXT_APP_VERSION = "16"; /** * Files that may be present in a directory we still consider "scaffoldable empty". * * INVARIANT: this MUST stay a subset of create-next-app's own `validFiles` * (verified against the v{@link CREATE_NEXT_APP_VERSION} tag). If ours is * stricter, we simply scaffold less often (safe). If ours were looser, * create-next-app would accept our offer and then refuse mid-run. * * We omit `docs` and `mkdocs.yml` from the upstream list on purpose — their * presence usually signals real project content, so we err toward NOT scaffolding. * We also omit `README.md`/`.vscode`: they are NOT in create-next-app's list, so a * directory containing them is left to the normal (non-scaffold) install path. */ export declare const SAFE_EMPTY_FILES: ReadonlySet; /** * True iff `dir` is empty or contains only {@link SAFE_EMPTY_FILES} entries. * * Because no project manifest (`package.json`, `go.mod`, `Gemfile`, etc.) appears * in {@link SAFE_EMPTY_FILES}, the presence of any manifest makes this return * false — i.e. an existing project always takes the normal install path. */ export declare function isScaffoldableEmptyDir(dir: string): Promise; /** * Resolve the package manager for the scaffolded app. * * Precedence: validated `--pm` override > `npm_config_user_agent` parse > `npm`. * An empty directory has no lockfile, so lockfile-based detection does not apply; * we read the runner from the user agent instead (e.g. `pnpm dlx` → `pnpm`). */ export declare function resolvePackageManager(opts: { pm?: string; userAgent?: string; }): PackageManager; /** * The pinned `create-next-app` flag set. Kept pure so a unit test can assert the * exact array — flag drift across a pinned major is the primary failure mode. * * v1 scaffolds Next.js only. Multi-framework scaffolding (e.g. a Vite React app * via its own `create-*` tool) is a tracked follow-up, not implemented. * * App Router + TypeScript + ESLint + Tailwind + `src/` + `@/*` alias, installed * with the resolved package manager. `--yes` accepts all remaining defaults * (including the major's Turbopack default) and prevents interactive hangs. */ export declare function buildCreateNextAppArgs(pm: PackageManager): string[]; /** * Spawn `create-next-app@ .` in `installDir` via the resolved package * manager's runner, streaming output as `scaffold:progress` events. Resolves on * exit 0; rejects on non-zero exit or spawn error so the state machine can route * to its error state. */ export declare function runCreateNextApp(opts: { installDir: string; packageManager: PackageManager; emitter: InstallerEventEmitter; }): Promise;