/** * Dry-run JSON file generators for the three CLEO runtime state files. * * Returns the content that `cleo init` WOULD write on the target machine, * capturing machine-local state (projectRoot, hostname, timestamps) without * touching the filesystem. * * Used by T354's A/B regenerate-and-compare engine (ADR-038 §10): the "A" * side of the comparison is always what a fresh init would produce locally. * * @task T352 * @epic T311 * @why ADR-038 §10 — A/B regenerate-and-compare needs the "A" side: what the * JSON files would look like if freshly initialized on the target machine. * Captures machine-local state (projectRoot, hostname, timestamps). * @what Pure dry-run versions of the cleo init JSON file generators. * * DRIFT WARNING: These generators mirror the logic inside: * - packages/core/src/scaffold.ts :: createDefaultConfig() (config.json) * - packages/core/src/scaffold.ts :: ensureProjectInfo() (project-info.json) * - packages/core/src/store/project-detect.ts :: detectProjectType() (project-context.json) * * If any of those functions change the shape or defaults of their generated * files, this module MUST be updated to match. There is no runtime link — the * similarity is maintained manually. */ import { type ProjectContext } from './project-detect.js'; /** * The result of a dry-run file generator. * * @typeParam T - The shape of the generated file content. Defaults to * `Record` when the exact shape is not statically known. * * @task T352 * @epic T311 */ export interface RegeneratedFile> { /** The filename that `cleo init` would write. */ filename: 'config.json' | 'project-info.json' | 'project-context.json'; /** The parsed content that would be written to disk. */ content: T; } /** * Returns the `config.json` content that `cleo init` would write for * `projectRoot` on the current machine. * * PURE — no disk writes. Reads package.json only to detect the contributor * project fingerprint (same as `ensureConfig` in scaffold.ts). * * Mirrors: `packages/core/src/scaffold.ts :: ensureConfig()` and * `packages/core/src/scaffold.ts :: createDefaultConfig()`. * * DRIFT: if `createDefaultConfig()` adds new keys, regenerateConfigJson must * be updated to reflect the same structure. The coupling is intentional but * manual — see the TSDoc on this file. * * @param projectRoot - Absolute or relative path to the project root. * @returns A `RegeneratedFile` whose `content` matches a freshly written * `config.json`. */ export declare function regenerateConfigJson(projectRoot: string): RegeneratedFile; /** * Returns the `project-info.json` content that `cleo init` would write for * `projectRoot` on the current machine. * * Captures machine-local fields: * - `projectHash` — SHA-256 of the resolved absolute path (first 12 chars) * - `projectId` — fresh UUID (volatile; each call produces a new value) * - `lastUpdated` — current ISO timestamp (volatile) * - `cleoVersion` — read from `@cleocode/core/package.json` at runtime * - `schemas.*` — schema version strings from bundled JSON schema files * * PURE — no disk writes. * * Mirrors: `packages/core/src/scaffold.ts :: ensureProjectInfo()`. * * DRIFT: if `ensureProjectInfo` adds, removes, or renames fields in the * written JSON, update this function to match. * * @param projectRoot - Absolute or relative path to the project root. * @returns A `RegeneratedFile` whose `content` matches a freshly written * `project-info.json`. */ export declare function regenerateProjectInfoJson(projectRoot: string): RegeneratedFile; /** * Returns the `project-context.json` content that `cleo init` would write for * `projectRoot` on the current machine. * * Runs full project-type detection by inspecting the project directory: * testing framework, build command, primary language, monorepo topology, * file-naming conventions, and LLM hints. DOES NOT spawn child processes. * * PURE — no disk writes. * * Mirrors: `packages/core/src/scaffold.ts :: ensureProjectContext()` and * `packages/core/src/store/project-detect.ts :: detectProjectType()`. * * DRIFT: if `detectProjectType()` changes its output shape, the downstream * A/B compare engine (T354) will still work because it compares fields by * name — but regenerateProjectContextJson may produce unexpected keys or * miss new ones until updated. * * @param projectRoot - Absolute or relative path to the project root. * @returns A `RegeneratedFile` whose `content` matches a freshly written * `project-context.json`. */ export declare function regenerateProjectContextJson(projectRoot: string): RegeneratedFile; /** * Convenience wrapper that returns all three regenerated files in one call. * * Each generator runs independently; volatile fields in `project-info.json` * (`projectId`, `lastUpdated`) will differ from a separate call to * `regenerateProjectInfoJson`. * * @param projectRoot - Absolute or relative path to the project root. * @returns Object containing all three `RegeneratedFile` results. * * @task T352 * @epic T311 */ export declare function regenerateAllJson(projectRoot: string): { config: RegeneratedFile; projectInfo: RegeneratedFile; projectContext: RegeneratedFile; }; //# sourceMappingURL=regenerators.d.ts.map