/**
* Parse a pack generator body into an executable form.
*
* Two shapes (docs/superpowers/specs/2026-07-14-pack-generators-design.md):
*
* - **single** — one primitive ``. Simplest case
* (a licence plate via one regex).
* - **composed** — one or more local `` declarations
* (compound allowed) plus one `` output template that combines
* them, e.g. a Spanish full name from name/surname lists:
*
*
*
*
*
* ${{F1}} ${{L1}}
*
* The body reuses TDC's own parser, so it is identical to the config DSL.
* Local sequences are materialised over `count` by the same engine, so
* exact percentages / shuffle / determinism transfer for free.
*
* Safety (phase 2): generators may reference DATA lists and use primitive
* generators only. `template` references to other GENERATORS are rejected
* (they would risk cycles — deferred to a later phase with cycle
* detection). Because a data list is a leaf, no cycle is possible here.
*/
import type { OpenCloseElementContext } from '../generated/TDCParser.js';
import type { GenSpec, SequenceSpec } from '../sequence/types.js';
/** Generator types allowed as a self-contained primitive body. */
export declare const PRIMITIVE_GENERATOR_TYPES: readonly string[];
export type GeneratorBody = {
readonly kind: 'single';
readonly gen: GenSpec;
} | {
readonly kind: 'composed';
readonly sequences: readonly SequenceSpec[];
readonly output: string;
/**
* Optional `` predicate for reject-and-retry (migration spec §4.2):
* a row whose predicate is false has its base sequences redrawn (bounded)
* before output. Absent for generators that never reject.
*/
readonly validate?: OpenCloseElementContext;
/**
* Interpolation pattern for the `` output template, e.g. `${{%}}`
* (the default) or a custom delimiter like `<<%>>`. Lets a generator emit
* literal `${{…}}`/`{{…}}` content (GitHub Actions, Vue, Handlebars…)
* without it clashing with TDC's own interpolation. Set via the pack
* file's `inject:` header; isolated per generator (never inherits the
* consuming config's inject).
*/
readonly inject: string;
};
export interface ParsedGenerator {
readonly body: GeneratorBody;
/** Dotted addresses this generator references via `template` gens. */
readonly references: readonly string[];
/**
* True when the body declares a share — a `` or a `percent=` on a
* ``. Such a generator is only correct across a WHOLE column: the quota is
* apportioned over the row count, so running it a row at a time hands every row
* to the largest share. The streaming engines resolve per row, so a config that
* uses this pack must run on the in-memory engine — see `resolveRenderEngine`.
*/
readonly needsWholeColumn: boolean;
}
export interface GeneratorParseResult {
readonly generator?: ParsedGenerator;
readonly error?: string;
}
export declare function parseGeneratorSpec(body: string, inject?: string): GeneratorParseResult;
//# sourceMappingURL=generator.d.ts.map