/** * Error templates and formatting utilities. * Extracted from exceptions.ts for max-lines compliance. * * IMPORTANT: This file must NOT import from exceptions.ts to avoid circular * dependencies. It duplicates ErrorCategory values as string literals. */ type CategoryString = "CONFIGURATION" | "VALIDATION" | "RUNTIME" | "EXTERNAL" | "INTERNAL"; export interface ErrorTemplateContext { [key: string]: string | number | boolean | undefined | null; } export interface ErrorTemplate { pattern: string; category: CategoryString; defaultNextSteps?: string[]; defaultSuggestions?: string[]; } export declare const ERROR_TEMPLATES: { readonly MISSING_REQUIRED_FLAG: { readonly pattern: "Missing required flag: {{flag}}"; readonly category: "VALIDATION"; readonly defaultNextSteps: ["Add the missing flag to your command", "Run with --help to see all available options"]; }; readonly INVALID_FLAG_VALUE: { readonly pattern: "Invalid value for {{flag}}: {{value}}. Expected {{expected}}"; readonly category: "VALIDATION"; readonly defaultNextSteps: ["Check the expected format for this flag", "Run with --help for usage information"]; }; readonly FILE_NOT_FOUND: { readonly pattern: "File not found: {{path}}"; readonly category: "CONFIGURATION"; readonly defaultNextSteps: ["Verify the file path is correct", "Check that the file exists and is readable"]; }; readonly PROCESS_NOT_FOUND: { readonly pattern: "Process entry file not found: {{path}}"; readonly category: "CONFIGURATION"; readonly defaultNextSteps: ["Ensure the path is correct and points to a valid JS/TS module", "Check that the file has been compiled if using TypeScript"]; }; readonly EXPORT_NOT_FOUND: { readonly pattern: "Process module {{path}} does not export '{{exportName}}'"; readonly category: "CONFIGURATION"; readonly defaultNextSteps: ["Check available exports in your module", "Use --entry {{path}}#default for default export"]; readonly defaultSuggestions: ["Did you mean to use a different export name?"]; }; readonly EFFECT_NOT_FOUND: { readonly pattern: "Effect {{effectId}} not found at {{runDir}}"; readonly category: "VALIDATION"; readonly defaultNextSteps: ["Verify the effect ID is correct", "Run task:list to see available effects"]; }; readonly EFFECT_WRONG_STATUS: { readonly pattern: "Effect {{effectId}} is not {{expectedStatus}} (current status={{actualStatus}})"; readonly category: "VALIDATION"; readonly defaultNextSteps: ["Check the current effect status with task:show", "Ensure you're operating on the correct effect"]; }; readonly RUN_NOT_FOUND: { readonly pattern: "Run directory not found: {{runDir}}"; readonly category: "CONFIGURATION"; readonly defaultNextSteps: ["Verify the run directory path", "Ensure the run has been created with run:create"]; }; readonly JSON_PARSE_ERROR: { readonly pattern: "Failed to parse {{file}} as JSON: {{error}}"; readonly category: "VALIDATION"; readonly defaultNextSteps: ["Check that the file contains valid JSON", "Validate JSON syntax with a linter"]; }; readonly MISSING_PROCESS_CONTEXT: { readonly pattern: "No active process context found on the current async call stack"; readonly category: "RUNTIME"; readonly defaultNextSteps: ["Ensure you are calling this from within a babysitter process function", "Check that async context is properly maintained"]; }; readonly INVOCATION_COLLISION: { readonly pattern: "Invocation key {{invocationKey}} is already in use within this run"; readonly category: "RUNTIME"; readonly defaultNextSteps: ["Ensure unique invocation keys for each task invocation", "Check for duplicate task calls in your process"]; }; }; export type ErrorTemplateKey = keyof typeof ERROR_TEMPLATES; export declare function interpolateTemplate(pattern: string, context: ErrorTemplateContext): string; export declare function createErrorMessage(templateKey: ErrorTemplateKey, context: ErrorTemplateContext): string; export interface FormatErrorOptions { colors?: boolean; includeStack?: boolean; prefix?: string; } export declare function formatErrorWithContext(error: Error, options?: FormatErrorOptions): string; export declare function formatNextSteps(nextSteps: string[], options?: { prefix?: string; colors?: boolean; }): string; export interface StructuredError { name: string; message: string; category: string; categoryDescription: string; suggestions: string[]; nextSteps: string[]; details?: Record; stack?: string; } export declare function toStructuredError(error: Error, includeStack?: boolean): StructuredError; export {}; //# sourceMappingURL=errorTemplates.d.ts.map