/** * Prompt Template Renderer * * Provides deterministic, strict rendering of prompt templates with: * - Token expansion: {{today}}, {{now}}, {{repo_root}}, etc. * - Variable substitution: {{variable}} * - Conditionals: {{#if condition}}...{{else}}...{{/if}} * - Loops: {{#each items}}...{{/each}} * - HTML escaping by default * - Raw output: {{{raw}}} * - Strict mode: throws on unknown variables */ import { RenderContext, RenderOptions, ValidationResult, PromptTemplate, RenderedPrompt } from "./types.js"; /** * Validate that all required variables are present in context */ export declare function validateContext(template: string, context: RenderContext): ValidationResult; /** * Render a prompt template with variable substitution and control structures * * @param template - Template string with {{}} syntax * @param context - Variables to substitute * @param options - Rendering options (strict mode, escaping) * @returns Rendered string * * @example * ```typescript * const result = renderPrompt("Hello {{name}}!", { name: "World" }); * // => "Hello World!" * ``` * * @example Conditionals * ```typescript * const result = renderPrompt( * "{{#if hasError}}Error: {{error}}{{/if}}", * { hasError: true, error: "Not found" } * ); * // => "Error: Not found" * ``` * * @example Loops * ```typescript * const result = renderPrompt( * "{{#each items}}{{this}}, {{/each}}", * { items: ["a", "b", "c"] } * ); * // => "a, b, c, " * ``` * * @example Token Expansion * ```typescript * const result = renderPrompt( * "Created on {{today}} at {{branch}}", * {} * ); * // => "Created on 2025-11-23 at main" * ``` */ export declare function renderPrompt(template: string, context: RenderContext, options?: RenderOptions): string; /** * Render a prompt template with full metadata and hashing */ export declare function renderPromptTemplate(template: PromptTemplate, context: RenderContext, options?: RenderOptions): RenderedPrompt; /** * Compute content hash for a template */ export declare function computeContentHash(content: string): string;