export type ManifestModule = { slug: string; kind: "core" | "module" | "plugin"; dependsOn: string[]; files: string[]; seams: string[]; replaces: Array<{ target: string; with: string; }>; deps: Array<{ name: string; version?: string; dev?: boolean; }>; devDeps: Array<{ name: string; version?: string; }>; env: Array<{ name: string; required: boolean; example?: string; docs?: string; }>; tests: string[]; docs: string[]; flag?: string; knownDeviations?: string[]; }; export type ScaffoldManifest = { schema: "cartwright-scaffold-manifest-v1"; codemodTargets: string[]; modules: ManifestModule[]; profiles: Array<{ name: string; description: string; modules: string[]; aliases: string[]; }>; /** * Dev-only scripts a `site` materialization deletes, declared BY THE ENGINE * (scaffold/site-pruned-scripts.ts). Optional: a template ref older than the * engine release that introduced it has no such field, and those refs fall * back to the constant below. */ sitePrunedScripts?: string[]; }; export declare function loadScaffoldManifest(targetDir: string): ScaffoldManifest | null; /** * Profile (or alias) + `--with` extras → transitive module set. `core` is * always seeded (the manifest's contract: a profile is "core + modules"). */ export declare function resolveProfileModules(manifest: ScaffoldManifest, profileNameOrAlias: string, withModules?: readonly string[]): { profileName: string; included: Set; }; export type MaterializationPlan = { /** Files/dirs to delete (excluded modules' claims, seam targets exempt). */ deletePaths: string[]; /** Static seam variants to copy over their targets (unprovided seams). */ seamCopies: Array<{ from: string; to: string; }>; /** Every `*.static.*` seam-variant file to remove after copying. */ staticCleanup: string[]; /** Design-pack slugs to de-register from designs/index.ts + options.ts. */ excludedDesignSlugs: string[]; /** Plugin slugs to de-register from plugins/registry.ts. */ excludedPluginSlugs: string[]; }; export declare function computeMaterializationPlan(manifest: ScaffoldManifest, included: ReadonlySet): MaterializationPlan; /** * Parse `import { } from "./";` lines from * designs/index.ts — the codemods need the export name per slug, and parsing * the template's own source means newly added packs never drift a hardcoded * table. */ export declare function parseDesignIndexExports(src: string): Map; /** Same for `import { } from ".//manifest";` in plugins/registry.ts. */ export declare function parsePluginRegistryExports(src: string): Map; /** * Dependencies that exist ONLY for excluded-module code in a `site` * materialization. Curated v1 list (module `deps` inventories are a B4 * fill-in); the release scaffold-gate's site leg (install → typecheck → * build → boot) is the proof that the remaining tree never imports these. */ export declare const SITE_PRUNED_DEPENDENCIES: readonly string[]; export declare const SITE_PRUNED_DEV_DEPENDENCIES: readonly string[]; /** * Drop every script whose command runs a file the profile removed. * * `SITE_PRUNED_SCRIPT_KEYS` is a hand-kept list of KEYS, and it drifted: a real * `create-cartwright@2.9.4 --profile site` scaffold shipped five scripts whose * targets are in `removedPaths` — `admin:create` (→ scripts/admin-reset.ts), * `capture:gallery`, `dev:screenshot`, `capture:locales` and `verify:design`, * the last of which DESIGN.md tells the owner to run. Running any of them says * "Cannot find module". Deriving the answer from the materialised tree closes * the class instead of adding five more names to the list. */ export declare function pruneDeadScriptReferences(src: string, fileExists: (relativePath: string) => boolean): { src: string; dropped: string[]; }; export declare function rewritePackageJsonForSite(src: string): { src: string; missing: string[]; }; /** * The engine tsconfig includes every .ts file, so every surviving file must typecheck. The * engine's test-suite and db-coupled scripts assume the full tree — module- * travelling tests are a B4 fill-in (`tests` inventories are empty today), * so a site materialization prunes the zones wholesale, keeping only the * pure generators that still compile against the site tree. */ export declare const SITE_PRUNED_ZONES: readonly string[]; /** * FALLBACK ONLY — the engine owns this list. * * It used to be the truth, hand-mirrored against the engine's own copy in * `scripts/site-profile-audit.ts`, with nothing checking that the two agreed. * A script added to one and not the other means either the audit asserts a * pruning that never happens, or the CLI ships a scaffold with a script it * cannot run — which is how `scripts/capture-locales.mjs` (it imports * Playwright, which the site profile prunes) reached CI. * * The engine now publishes `sitePrunedScripts` in `scaffold/manifest.json`. * Prefer `sitePrunedScriptsFor(manifest)`; this list only serves template refs * cut before that field existed. */ export declare const SITE_PRUNED_SCRIPTS_FALLBACK: readonly string[]; /** * The engine's list when the template ref carries one, the frozen fallback * otherwise. Reading it from the manifest is what stops the two repositories * from drifting: the engine declares what it prunes, the CLI obeys. */ export declare function sitePrunedScriptsFor(manifest: ScaffoldManifest | null | undefined): readonly string[]; export type MaterializerReport = { profileName: string; modules: string[]; removedPaths: string[]; seamCopies: number; designsDeregistered: string[]; pluginsDeregistered: string[]; warnings: string[]; }; /** * Run the full materialization against a downloaded template directory. * Fail-soft on template drift (missing paths are warnings, never fatal) — * the scaffold-gate proves the result functionally. */ export declare function applyMaterializer(targetDir: string, profileNameOrAlias: string, opts?: { withModules?: readonly string[]; }): MaterializerReport;