/** * Preset parser — validates *.preset.yaml content against the PresetManifestSchema. * * Also performs structural validation beyond what zod alone covers: * - Unique item IDs within the preset * - Cycle detection for nested preset refs (max depth 3) * - Cross-item refs (#item-id) resolve to declared items * * @docLink packages/library/concepts#preset-parsing */ import { type PresetManifest } from "@skaile/workspaces/types/manifests"; /** * Result of parsing and validating a preset manifest. * * When `ok` is false, `errors` contains human-readable messages. * `preset` may still be set on partial success (structural errors after Zod passes). * * @docLink packages/library/concepts#preset-parsing */ export interface ParseResult { /** Whether the preset passed all validation checks. */ ok: boolean; /** The validated preset manifest (set even on structural errors after Zod passes). */ preset?: PresetManifest; /** Validation error messages. */ errors: string[]; } /** * Parse and validate a preset manifest object. * * @param data - Raw parsed YAML content (from `yaml` or similar). * @returns ParseResult with validated preset or error messages. * @docLink packages/library/concepts#preset-parsing */ export declare function parsePreset(data: unknown): ParseResult; /** * Parse preset from a raw YAML string. * * @param yamlContent - Raw YAML string content of a `*.preset.yaml` file. * @returns ParseResult — includes a YAML parse error in `errors` if the string is malformed. * @docLink packages/library/concepts#preset-parsing */ export declare function parsePresetYaml(yamlContent: string): ParseResult; /** * Detect nested preset refs within a preset's items. * * A ref is classified as a nested preset if it appears in `knownPresetRefs`. * Refs starting with `library://` or `#` are always skipped. * * @param preset - Validated preset manifest. * @param knownPresetRefs - Optional set of refs known to be presets. * @returns Array of refs that are nested presets. * @docLink packages/library/concepts#preset-parsing */ export declare function detectNestedPresetRefs(preset: PresetManifest, knownPresetRefs?: Set): string[]; /** * Validate nesting depth. Max depth is 3. * * @param presetRef - The ref of the preset being validated. * @param currentDepth - Current nesting depth (0 = top-level). * @returns Error message string if depth exceeded, undefined otherwise. * @docLink packages/library/concepts#preset-parsing */ export declare function validateNestingDepth(presetRef: string, currentDepth: number): string | undefined; //# sourceMappingURL=parse.d.ts.map