export type PackageManagerName = "pnpm" | "npm"; export interface ResolvedPackageManager { name: PackageManagerName; /** Absolute path when we can resolve one, otherwise the bare command name. * Spawning the resolved path (not the bare name) is what lets pnpm work * even when its install dir is missing from the process PATH. */ bin: string; } /** * Writes a generated file without exposing a partially-written version to the * Next.js dev server or another watcher pass. */ export declare function writeFileAtomic(filePath: string, content: string | Uint8Array): Promise; /** * Chooses the package manager for the generated app. The app ships a pnpm * workspace, so pnpm is preferred whenever it can be found; npm is the fallback. * An explicit `override` (from `--package-manager` or doccupine.json) always * wins. Auto-detection also trusts `npm_config_user_agent` when pnpm launched * the CLI. */ export declare function resolvePackageManager(override?: string): ResolvedPackageManager; /** * Finds the first free port at or above `startPort`. Scanning stops at the * last valid TCP port rather than recursing past it: `listen(65536)` is a * RangeError, and surfacing that instead of an explanation tells the user * nothing about what to do next. */ export declare function findAvailablePort(startPort: number): Promise; /** * Whether a path names an MDX source document. Case-insensitive so a file * saved as "Guide.MDX" is treated the same everywhere - source discovery, the * watcher's filter, the restart fingerprint, and the llms body reader all * route through here, and a split between them makes a file invisible to * generation while still triggering work. */ export declare function isMdxPath(filePath: string): boolean; export declare function generateSlug(filePath: string): string; export declare function getFullSlug(pageSlug: string, sectionSlug: string): string; export declare function escapeTemplateContent(content: string): string; /** * YAML-only gray-matter that never throws: unsupported tagged engines and * malformed YAML frontmatter are reported as warnings and treated as having no * frontmatter. The broken block is stripped from the body best-effort; an * unterminated block passes through as-is and the generated app's MDX error * panel absorbs it. */ export declare function safeMatter(raw: string, label?: string): { data: { [key: string]: any; }; content: string; }; /** * Renders `value` as a JS string literal using the same quote Prettier would * choose: double by default, switching to single when that needs fewer escapes * (JSON text, for instance, is full of `"`). Backslashes and the chosen quote * are escaped. Lets generated code embed a string in a form Prettier leaves * untouched, so emitted files stay format-stable without running a formatter. */ export declare function toJsStringLiteral(value: string): string;