export type CheckStatus = "ok" | "warn" | "fail" | "skip"; export type CheckResult = { id: string; label: string; status: CheckStatus; detail: string; }; /** Shape of .cartwright/release.json (all fields optional — forward-compat). */ export type ReleaseMarker = { engine?: string; channel?: string; ref?: string; version?: string; commit?: string; releasedAt?: string; }; /** Shape of .cartwright/profile.json. */ export type ProfileMarker = { profile?: string; generatedBy?: string; keptDesigns?: string[]; excludedPaths?: string[]; prunedDependencies?: string[]; }; /** Injectable command runner so tests never spawn real processes. */ export type SpawnRunner = (cmd: string, args: string[], cwd: string) => { status: number | null; error?: boolean; timedOut?: boolean; }; /** Hard cap per spawned command — db:verify boots Prisma, so give it room. */ export declare const SPAWN_TIMEOUT_MS = 60000; /** Check 1 — the three files that make a directory a Cartwright project root. */ export declare function checkSentinels(present: { brandConfig: boolean; schema: boolean; pkg: boolean; }): CheckResult; /** Tolerant parse of a release/profile marker file. Null on garbage. */ export declare function parseJsonObject(raw: string): T | null; /** Check 2 — the .cartwright/release.json engine-version marker. */ export declare function checkReleaseMarker(raw: string | null): { result: CheckResult; marker: ReleaseMarker | null; }; /** True when a vX.Y.Z tag carries a pre-release/build suffix (-rc.1, +sha…). */ export declare function hasPrereleaseSuffix(v: string): boolean; /** * Compare two vX.Y.Z-ish strings numerically on the X.Y.Z base (pre-release * suffixes are ignored here — checkUpToDate flags them separately). Returns * -1 if a < b, 0 if equal, 1 if a > b, null when either doesn't look like a * semver tag. */ export declare function compareSemverish(a: string, b: string): -1 | 0 | 1 | null; /** * Check 3 — engine version vs the latest template tag THIS CLI build knows * (DEFAULT_REF). Explicitly no network — an older CLI knows an older latest. */ export declare function checkUpToDate(markerVersion: string | null | undefined, latestKnown: string): CheckResult; /** Check 4 — the .cartwright/profile.json scaffold-profile marker. */ export declare function checkProfile(raw: string | null): CheckResult; /** Check 5 — Node major version (engine's package.json says >= 22). */ export declare function checkNode(nodeVersion: string): CheckResult; /** * Shallow .env parse — enough for a diagnostic, no dotenv dep. Handles * `KEY=value`, `export KEY=value`, surrounding single/double quotes, inline * ` # comments` after the value (a `#` INSIDE quotes is preserved), full-line * comments and blank lines. Unquoted values keep any `=` after the first. * Known limitation: multiline quoted values are NOT supported (each line is * parsed independently) — out of scope for this diagnostic. */ export declare function parseEnvFile(content: string): Record; /** The env keys the doctor cares about (boot requirements). */ export declare const ENV_KEYS: readonly ["AUTH_SECRET", "DATABASE_URL", "TURSO_DATABASE_URL", "TURSO_AUTH_TOKEN"]; /** * Merge the env sources with the app's ACTUAL runtime precedence (Next.js * load order): process.env > .env.local > .env. Settings inherited from the * shell/CI/container must count — otherwise a perfectly bootable project * would report a false FAIL. Only the keys the doctor checks are overlaid * from process.env (it carries hundreds of unrelated vars). */ export declare function mergeEnvSources(input: { dotEnv: Record; dotEnvLocal: Record; processEnv: Record; }): Record; /** True when an AUTH_SECRET value is empty or an obvious placeholder. */ export declare function isPlaceholderSecret(value: string | undefined): boolean; /** Check 6 — env preflight (mirrors the engine's boot requirements). */ export declare function checkEnv(input: { envLocalExists: boolean; env: Record; }): CheckResult; /** True when package.json declares a db:verify script. */ export declare function hasDbVerifyScript(pkgRaw: string | null): boolean; /** Check 7 — migration-baseline drift via the project's own db:verify gate. */ export declare function checkDbVerify(input: { hasScript: boolean; pnpmOnPath: boolean; cwd: string; run: SpawnRunner; }): CheckResult; /** * Run every check against a project directory. Pure apart from fs reads and * the injectable command runner — tests point it at a mkdtemp scaffold with a * stub runner. Short-circuits after the sentinel check when the directory is * not a Cartwright project. */ export declare function collectChecks(cwd: string, deps?: { run?: SpawnRunner; nodeVersion?: string; processEnv?: Record; }): { checks: CheckResult[]; ok: boolean; }; export declare function runDoctor(args: string[]): Promise;