/** * `slowcook init mock` — scaffold the consumer's mock/ directory. * * Writes the consumer-side shell of the singular mock app: package.json * (depending on @slowcook-ai/mock-runtime + next + react), Dockerfile, * tsconfig, next.config.js, postcss.config.mjs, layout.tsx, page.tsx, * scenario-registry.ts, globals.css (copied from src/app/globals.css if * present), .gitignore, README.md. * * Refuses to overwrite existing files unless --force. * * After running this once, the consumer commits + pushes; vibe runs * after (slowcook 0.16-α.3+) populate `mock/scenarios/` + extend * `mock/src/lib/scenario-registry.ts`. */ interface MockInitArgs { cwd: string; force: boolean; dryRun: boolean; /** Pinned version of @slowcook-ai/mock-runtime to depend on. */ runtimeVersion: string; } interface FileToWrite { path: string; contents: string; /** When true and file exists, write only on --force. */ skipIfExists?: boolean; /** When set, only write if no existing globals.css to copy from. */ fallbackOnly?: boolean; } export declare function parseMockInitArgs(argv: string[], runtimeVersion: string): MockInitArgs; export declare function planMockFiles(args: MockInitArgs): FileToWrite[]; export declare function initMock(argv: string[], cliVersion: string): Promise; /** * Detect the consumer's package manager from lockfile presence. * Pure: takes an `exists` predicate so it can be unit-tested without IO. */ export declare function detectPackageManager(cwd: string, exists: (p: string) => boolean): "pnpm" | "npm" | "yarn" | "unknown"; /** * Detect whether `mock` is already declared in the consumer's * pnpm-workspace.yaml `packages` list. Pure parser — handles the * common YAML shapes: flow array (`packages: [mock]`) + block list * (`packages:\n - mock`). Returns true on any literal "mock" entry. */ export declare function isMockInPnpmWorkspace(yamlContent: string): boolean; /** * Result of ensurePnpmWorkspace — what the cli did (if anything) so the * caller can print accurate "Next steps" text. */ export type EnsureWorkspaceResult = { kind: "added-to-existing"; path: string; } | { kind: "already-listed"; path: string; } | { kind: "created"; path: string; } | { kind: "not-pnpm"; pkgManager: "npm" | "yarn" | "unknown"; }; /** * Make sure `mock` is a pnpm-workspace member when the consumer is on * pnpm. Three paths: * - pnpm-workspace.yaml exists + lists "mock" → already-listed * - pnpm-workspace.yaml exists + missing "mock" → added-to-existing * - pnpm-lock.yaml present + no workspace.yaml → created (block-list shape) * - npm/yarn/unknown (no pnpm signal) → not-pnpm * * We DON'T auto-migrate npm/yarn consumers — that requires re-resolving * the lockfile and is too invasive for an `init mock` step. Caller * prints a one-line recommendation in that case. * * Conservative writes: when adding to an existing block-list workspace, * we append a new `- mock` line preserving prior content; we never * rewrite the whole file. */ export declare function ensurePnpmWorkspace(cwd: string): EnsureWorkspaceResult; /** * Patch the consumer's tsconfig.json so `mock` is in the `exclude` * array. Idempotent — returns false when nothing changed. * * tsconfig.json may legitimately contain trailing commas + comments * (TypeScript's parser tolerates both). We use a conservative regex * approach: find the existing `"exclude": [...]` line + append `"mock"` * if it isn't already there. If no `exclude` field exists, leave the * file alone (consumer can add it themselves; we don't want to risk * malforming a file with comments). */ export declare function ensureMockInTsconfigExclude(tsconfigPath: string): boolean; /** * The mock-runtime package versions track slowcook's overall release * cadence. Until 0.16 final cuts we hardcode the latest known version * here. After 0.16 the cli's package.json could carry a peer-pin field. */ export declare function mockRuntimeVersionFor(_cliVersion: string): string; export {}; //# sourceMappingURL=mock.d.ts.map