import type { MetaData } from "@metaobjectsdev/metadata"; import type { MetaobjectsGenConfig } from "./metaobjects-config.js"; import { type WriteResult, type MergeStrategy, type BaselineMode } from "./overwrite-policy.js"; export interface RunGenOpts { config: MetaobjectsGenConfig; metadata: MetaData; /** Optional whitelist of entity names. */ entityFilter?: string[]; /** Overwrite strategy passed to decideAndWrite. Defaults to "overwrite". */ mergeStrategy?: MergeStrategy; /** Project root (used to derive the .gen-state/ snapshot directory and to * key snapshots by project-relative output path). When omitted, falls back * to process.cwd(). */ projectRoot?: string; /** Override the snapshot directory location. Defaults to * `/.metaobjects/.gen-state/`. */ genStateDir?: string; /** First-time-on-existing-file behavior. Defaults to "default" (write-if- * different). "fresh" → overwrite and re-baseline (the `--baseline=fresh` * CLI flag). */ baseline?: BaselineMode; /** * Preview only — render and report, touching NOTHING on disk (no output files, * no `.gen-state/` snapshot). Backs `meta gen --dry-run`. * * Until 0.21.x the flag existed only in the CLI's *display* object and was never * passed here, so `--dry-run` wrote every file exactly like a real run — while the * website, `meta init`'s next-steps and the CLI help all called it "preview without * writing". A fresh adopter found it by deleting a generated file, running * `--dry-run`, and watching it reappear. */ dryRun?: boolean; /** * Output scope — an object is generated only when this predicate returns true * for its fully-qualified name (`obj.resolutionKey()`, `::`). * Intersects with `entityFilter`: both must pass. Absent ⇒ every object is * in scope (byte-identical to a project with no `scope` declared). * * The collection metadata always loads in FULL regardless of this predicate — * scope filters OUTPUT, never input (design §4.3). So an in-scope object may * reference an out-of-scope one (an FK target, a relationship `@objectRef`, a * projection's base) and resolve perfectly at load time, while the code * emitted FOR the in-scope object still imports/names a symbol that was never * generated. This is left silent by design, not auto-widened: the adopter * declared the scope precisely because something else (another consumer, * another codegen run) owns those objects, and the reference is real. Warning * on it correctly would require walking every reference kind (identity.reference, * every relationship.* @objectRef, projection extends bases, field.object * @objectRef) FQN-resolved against the SAME scope — genuinely new machinery, * not a fit for the existing `warnings: string[]` channel at this seam. If an * adopter hits it, the failure is a plain compiler error in the generated * code (an unresolved import) — loud, at build time, not silent at runtime. * * Deliberately a PLAIN PREDICATE, not the `include`/`exclude` pattern strings * `@metaobjectsdev/sdk`'s `scope.ts` compiles. `codegen-ts` must not depend on * `@metaobjectsdev/sdk` — the dependency runs the other way (`cli` depends on * both) — so it cannot import `matchesScope`/`CompiledScope` itself. The * design's "package patterns, never a predicate function" rule (§4.3 of the * metadata-source-resolution design doc) governs CONFIG SURFACES that must * port identically to a `pom.xml` / `metaobjects.config.yaml` in every * language port; it says nothing about internal plumbing between two * TypeScript packages in this one repo. Do not "fix" this into a config * shape — `cli`'s `gen`/`verify` commands are the only callers, and a * `Collection` already exposes exactly this predicate as `inScope`, which * they pass straight through. */ scope?: (fqn: string) => boolean; } export interface RunGenResult { files: WriteResult[]; warnings: string[]; /** Subset of `files` with status "conflict" — surfaced separately so the * CLI can print the end-of-run summary. */ conflicts: WriteResult[]; } export declare function runGen(opts: RunGenOpts): Promise; //# sourceMappingURL=runner.d.ts.map