/** * Prompt Loading Utility * * Loads prompt templates with precedence chain support: * 1. LEX_PROMPTS_DIR (explicit environment override) * 2. ./.smartergpt/prompts/ (organization workspace, preferred) * 3. ./prompts/ (legacy location) * 4. Package canon/prompts/ (built-in fallback, read-only) */ import { PromptTemplate, PromptMetadata } from "./types.js"; /** * Load prompt template with precedence chain * * @param promptName - Name of the prompt file (e.g., "idea.md", "create-project.md") * @returns Prompt content as string * @throws Error if prompt file cannot be found in any location * * Precedence chain: * 1. LEX_PROMPTS_DIR (explicit environment override) * 2. ./.smartergpt/prompts/ (organization workspace, preferred) * 3. ./prompts/ (legacy location) * 4. canon/prompts/ (package built-in, read-only fallback) * * @example * ```typescript * const ideaPrompt = loadPrompt('idea.md'); * console.log(ideaPrompt); // Prompt template content * ``` * * @example With environment variable override * ```typescript * process.env.LEX_PROMPTS_DIR = '/custom/prompts'; * const prompt = loadPrompt('idea.md'); // Loads from /custom/prompts/idea.md * ``` * * @example Workspace override (create .smartergpt/prompts/idea.md to override canon) * ```typescript * // If .smartergpt/prompts/idea.md exists, it takes precedence over canon * const prompt = loadPrompt('idea.md'); * ``` */ export declare function loadPrompt(promptName: string): string; /** * Get the path where a prompt would be loaded from (without loading it) * * @param promptName - Name of the prompt file * @returns Resolved path or null if not found * * @example * ```typescript * const path = getPromptPath('idea.md'); * console.log(path); // '/workspace/.smartergpt/prompts/idea.md' * ``` */ export declare function getPromptPath(promptName: string): string | null; /** * List all available prompts across all precedence levels * * @returns Array of unique prompt names (deduplicated) * * @example * ```typescript * const prompts = listPrompts(); * console.log(prompts); // ['idea.md', 'create-project.md', ...] * ``` */ export declare function listPrompts(): string[]; /** * Load a prompt template with metadata * * @param promptName - Name of the prompt file (e.g., "conflict-resolution.md") * @returns PromptTemplate with content, metadata, and content hash * @throws RenderError if prompt file is invalid or not found * * @example * ```typescript * const template = await loadPromptTemplate('conflict-resolution.md'); * console.log(template.id, template.metadata.title); * ``` */ export declare function loadPromptTemplate(promptName: string): PromptTemplate; /** * List all available prompt templates with metadata * * @returns Array of prompt metadata (deduplicated by id) * * @example * ```typescript * const templates = listPromptTemplates(); * templates.forEach(meta => console.log(meta.id, meta.title)); * ``` */ export declare function listPromptTemplates(): PromptMetadata[];