import type { TerminalError } from '../types/errors.js'; /** Structured scaffold error. */ export interface ScaffoldError { code: string; message: string; exitCode: number; recovery?: string; context?: Record; } /** Non-fatal warning (never causes non-zero exit). */ export interface ScaffoldWarning { code: string; message: string; context?: Record; } export declare function configMissing(configPath: string): ScaffoldError; export declare function configEmpty(configPath: string): ScaffoldError; export declare function configParseError(configPath: string, detail: string): ScaffoldError; export declare function configNotObject(configPath: string): ScaffoldError; export declare function configUnknownField(field: string, configPath: string): ScaffoldWarning; export declare function fieldMissing(field: string, file: string): ScaffoldError; export declare function fieldWrongType(field: string, expected: string, actual: string, file: string): ScaffoldError; export declare function fieldEmptyValue(field: string, file: string): ScaffoldError; export declare function fieldInvalidDepth(value: unknown, file: string): ScaffoldError; export declare function fieldInvalidMethodology(value: string, suggestion: string | null, file: string): ScaffoldError; export declare function frontmatterMissing(file: string): ScaffoldError; export declare function frontmatterUnclosed(file: string): ScaffoldError; export declare function frontmatterYamlError(file: string, detail: string): ScaffoldError; export declare function frontmatterNameInvalid(name: string, file: string): ScaffoldError; export declare function frontmatterUnknownField(field: string, file: string): ScaffoldWarning; export declare function stateSchemaVersion(expected: number | readonly number[], actual: number, file: string): ScaffoldError; export declare function stateMissing(file: string): ScaffoldError; export declare function stateParseError(file: string, detail: string): ScaffoldError; export declare function psmAlreadyInProgress(step: string, current: string): ScaffoldError; export declare function lockHeld(holder: string, pid: number, command: string): ScaffoldError; export declare function lockWriteFailed(file: string, detail: string): ScaffoldError; export declare function lockStaleCleared(holder: string, pid: number): ScaffoldWarning; export declare function decisionParseError(file: string, line: number, detail: string): ScaffoldError; export declare function presetMissing(presetName: string, file: string): ScaffoldError; export declare function presetParseError(file: string, detail: string): ScaffoldError; export declare function presetInvalidStep(step: string, preset: string): ScaffoldError; export declare function presetMissingStep(step: string, preset: string): ScaffoldWarning; export declare function presetUnmetDependency(step: string, dependency: string, preset: string): ScaffoldWarning; export declare function overlayMissing(name: string, path: string): ScaffoldError; export declare function overlayParseError(path: string, detail: string): ScaffoldError; export declare function overlayMalformedEntry(step: string, field: string, file: string): ScaffoldWarning; export declare function overlayMalformedSection(section: string, file: string): ScaffoldWarning; export declare function overlayMalformedAppendItem(step: string, index: number, file: string): ScaffoldWarning; export declare function overlayCrossReadsNotAllowed(file: string): ScaffoldWarning; /** * Converts any thrown value into a well-formed ScaffoldError. * - Already-shaped ScaffoldError objects are returned unchanged (strict duck-type check). * - Error instances have their message extracted; stack included in context. * - String/null/undefined/other throws are wrapped with the fallback code. */ /** * Widen a ScaffoldError into a TerminalError, supplying a fallback recovery. * * Fields are copied by name rather than spread. asScaffoldError passes through * anything shaped like a ScaffoldError, and an Error subclass carrying * code/exitCode satisfies that shape — but Error.prototype.message is * NON-ENUMERABLE, so `{ ...e }` silently drops it and the envelope ships * `message: undefined`. Reading properties by name works for plain objects and * Error instances alike. * * Lives here, next to asScaffoldError, because every terminal site needs it: * an earlier revision defined it privately in adopt.ts and init.ts kept its * own spread-based copy, which reintroduced exactly this bug one file away * from the comment warning about it. */ export declare function withRecovery(e: ScaffoldError, fallback: string): TerminalError; export declare function asScaffoldError(err: unknown, fallbackCode: string, fallbackExit: number): ScaffoldError; //# sourceMappingURL=errors.d.ts.map