/** * Shared human-readable diagnostics for non-interactive `wp-typia` CLI flows. */ export interface CliDiagnosticMessage { code: CliDiagnosticCode; command: string; data?: Record; detailLines: string[]; summary: string; } export declare const CLI_DIAGNOSTIC_CODES: { readonly COMMAND_EXECUTION: 'command-execution'; readonly CONFIGURATION_MISSING: 'configuration-missing'; readonly DEPENDENCIES_NOT_INSTALLED: 'dependencies-not-installed'; readonly DOCTOR_CHECK_FAILED: 'doctor-check-failed'; readonly GENERATED_ARTIFACT_DRIFT: 'generated-artifact-drift'; readonly INVALID_ARGUMENT: 'invalid-argument'; readonly INVALID_COMMAND: 'invalid-command'; readonly MISSING_ARGUMENT: 'missing-argument'; readonly MISSING_BUILD_ARTIFACT: 'missing-build-artifact'; readonly OUTSIDE_PROJECT_ROOT: 'outside-project-root'; readonly TEMPLATE_SOURCE_TIMEOUT: 'template-source-timeout'; readonly TEMPLATE_SOURCE_TOO_LARGE: 'template-source-too-large'; readonly UNKNOWN_TEMPLATE: 'unknown-template'; readonly UNSUPPORTED_COMMAND: 'unsupported-command'; }; export type CliDiagnosticCode = (typeof CLI_DIAGNOSTIC_CODES)[keyof typeof CLI_DIAGNOSTIC_CODES]; /** * Human-readable guidance attached to one stable CLI diagnostic code. */ export interface CliDiagnosticCodeMetadata { /** Why this diagnostic code is emitted. */ cause: string; /** The recommended recovery path for users and automation. */ recovery: string; } /** * Stable cause and recovery metadata for every supported CLI diagnostic code. */ export declare const CLI_DIAGNOSTIC_CODE_METADATA: { "command-execution": { cause: string; recovery: string; }; "configuration-missing": { cause: string; recovery: string; }; "dependencies-not-installed": { cause: string; recovery: string; }; "doctor-check-failed": { cause: string; recovery: string; }; "generated-artifact-drift": { cause: string; recovery: string; }; "invalid-argument": { cause: string; recovery: string; }; "invalid-command": { cause: string; recovery: string; }; "missing-argument": { cause: string; recovery: string; }; "missing-build-artifact": { cause: string; recovery: string; }; "outside-project-root": { cause: string; recovery: string; }; "template-source-timeout": { cause: string; recovery: string; }; "template-source-too-large": { cause: string; recovery: string; }; "unknown-template": { cause: string; recovery: string; }; "unsupported-command": { cause: string; recovery: string; }; }; export type CliDiagnosticCodeError = Error & { code: TCode; }; type DoctorCheckLike = { code?: string; detail: string; label: string; status: 'pass' | 'fail' | 'warn'; }; /** * Structured CLI failure carrying a stable summary/detail layout. */ export declare class CliDiagnosticError extends Error { readonly code: CliDiagnosticCode; readonly command: string; readonly data?: Record; readonly detailLines: string[]; readonly summary: string; constructor(message: CliDiagnosticMessage, options?: ErrorOptions); } /** * Narrow an unknown error to the shared CLI diagnostic error shape. */ export declare function isCliDiagnosticError(error: unknown): error is CliDiagnosticError; /** * Look up cause and recovery guidance for a stable CLI diagnostic code. */ export declare function getCliDiagnosticCodeMetadata(code: CliDiagnosticCode): CliDiagnosticCodeMetadata; /** * Tag a user-facing CLI throw site with a stable diagnostic code. * * Prefer this helper, or `createCliCommandError({ code })`, for new known CLI * failures. `inferCliDiagnosticCode()` remains only a compatibility fallback * for legacy or untyped errors. */ export declare function createCliDiagnosticCodeError(code: TCode, message: string, options?: ErrorOptions): CliDiagnosticCodeError; /** * Build a shared diagnostic error for one CLI command failure. */ export declare function createCliCommandError(options: { command: string; code?: CliDiagnosticCode; data?: Record; detailLines?: string[]; error?: unknown; summary?: string; }): CliDiagnosticError; /** * Render a CLI diagnostic block. Non-diagnostic errors fall back to their * plain message so existing non-command failures keep working. */ export declare function formatCliDiagnosticError(error: unknown): string; export declare function serializeCliDiagnosticError(error: unknown): { code: CliDiagnosticCode; command?: string; data?: Record; detailLines?: string[]; kind: 'command-execution'; message: string; name: string; summary?: string; tag: 'CommandExecutionError'; }; /** * Format one human-readable doctor check row. */ export declare function formatDoctorCheckLine(check: DoctorCheckLike): string; /** * Return the failing doctor checks from one doctor run. */ export declare function getFailingDoctorChecks(checks: readonly TCheck[]): TCheck[]; /** * Format the final doctor summary row. */ export declare function formatDoctorSummaryLine(checks: readonly DoctorCheckLike[], options?: { exitFailureChecks?: readonly DoctorCheckLike[]; }): string; /** * Build detail lines for doctor failures so the non-interactive formatter can * restate the failed checks after the streaming rows. */ export declare function getDoctorFailureDetailLines(checks: readonly DoctorCheckLike[]): string[]; export {};