/** * ZodDescriptionExtractor — Automatic Prompt Extraction from Zod .describe() * * Walks a Zod schema's AST and collects `.describe()` annotations from * every field. These descriptions are injected as system rules via * Context Tree-Shaking, eliminating the need for manual `systemRules` * when the Zod schema already carries domain-specific constraints. * * This ensures documentation never drifts from the actual data shape: * the single source of truth is the Zod `.describe()` annotation. * * @example * ```typescript * const schema = z.object({ * amount_cents: z.number().describe('CRITICAL: in CENTS. Divide by 100.'), * status: z.enum(['paid', 'pending']).describe('Always display with emoji'), * }); * * extractZodDescriptions(schema); * // → ['amount_cents: CRITICAL: in CENTS. Divide by 100.', * // 'status: Always display with emoji'] * ``` * * @module */ import { type ZodType } from 'zod'; /** * Extract `.describe()` annotations from a Zod schema's fields. * * Walks the top-level `z.object()` shape and retrieves the description * string from each field (after unwrapping wrappers like `z.optional()`, * `z.nullable()`, `z.default()`, etc.). * * Returns an array of human-readable `"fieldName: description"` strings, * ready to be injected as system rules. * * @param schema - A Zod schema (typically z.object, but safely handles non-objects) * @returns Array of `"fieldName: description"` strings (empty if no descriptions found) * * @example * ```typescript * const schema = z.object({ * amount_cents: z.number().describe('CRITICAL: value is in CENTS. Divide by 100.'), * currency: z.string(), // No .describe() → skipped * status: z.enum(['paid', 'pending']).describe('Show with emoji'), * }); * * extractZodDescriptions(schema); * // → ['amount_cents: CRITICAL: value is in CENTS. Divide by 100.', * // 'status: Show with emoji'] * ``` */ export declare function extractZodDescriptions(schema: ZodType): string[]; //# sourceMappingURL=ZodDescriptionExtractor.d.ts.map