/** * Typed failures for configuration loading, plus the combinators that turn an * Effect `ConfigError` into a message a user can act on. * * A `ConfigError` says what the schema wanted; it does not say what the user * should type to fix it. `ConfigRemedyError` carries that fix, so a CLI can * print `paths.main_clone: not set` followed by the exact edit to make. */ import { type Config, ConfigProvider, Effect } from "effect"; declare const TomlParseError_base: new = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & { readonly _tag: "TomlParseError"; } & Readonly; /** The TOML text could not be parsed. `line` and `column` come from the parser. */ export declare class TomlParseError extends TomlParseError_base<{ /** Where the text came from: a file path, or a label such as `""`. */ readonly source: string; readonly cause: unknown; readonly line?: number; readonly column?: number; }> { get message(): string; } declare const ConfigFileNotFoundError_base: new = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & { readonly _tag: "ConfigFileNotFoundError"; } & Readonly; /** The config file does not exist. Distinct from a read failure or a parse failure. */ export declare class ConfigFileNotFoundError extends ConfigFileNotFoundError_base<{ readonly path: string; }> { get message(): string; } declare const ConfigRemedyError_base: new = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & { readonly _tag: "ConfigRemedyError"; } & Readonly; /** * A configuration problem paired with the fix for it. `message` reads * * ```text * paths.main_clone: not set * set paths.main_clone in ~/.config/wt/config.toml * ``` */ export declare class ConfigRemedyError extends ConfigRemedyError_base<{ /** The dotted key the user would edit, for example `paths.main_clone`. */ readonly key: string; /** What is wrong, for example `not set` or `Expected a finite number`. */ readonly problem: string; /** A copy-pasteable fix, for example `set paths.main_clone in ~/.config/wt/config.toml`. */ readonly remedy: string; readonly cause?: unknown; }> { get message(): string; } /** Options for {@link withRemedy}. Only `remedy` is required. */ export interface RemedyOptions { /** The fix to print under the problem. */ readonly remedy: string; /** The key to name. Defaults to the path the failing config actually read. */ readonly key?: string; /** The provider path to probe for presence. Defaults to the failing path, then `key.split(".")`. */ readonly path?: ConfigProvider.Path; /** Overrides the derived problem text. */ readonly problem?: string; } /** * The provider path a `ConfigError` was raised for, or `undefined` when the * failure was the source itself rather than a value. */ export declare function configErrorPath(error: Config.ConfigError): ConfigProvider.Path | undefined; /** * One short line describing a `ConfigError`, without the `SchemaError(...)` * wrapper or the trailing `at [...]` location. */ export declare function configErrorProblem(error: Config.ConfigError): string; /** * Turns a failing `Config` into a `ConfigRemedyError` that names the key, says * whether it is missing or invalid, and prints the fix. The original * `ConfigError` is kept as `cause`. * * ```ts * const mainClone = withRemedy(Config.string("main_clone").pipe(Config.nested("paths")), { * remedy: "set paths.main_clone in ~/.config/wt/config.toml", * }); * ``` */ export declare function withRemedy(self: Config.Config, options: RemedyOptions): Effect.Effect; /** * {@link withRemedy} for the common case: the key is the one the config itself * read, and a missing value reads `not set`. */ export declare function required(self: Config.Config, remedy: string): Effect.Effect; /** * Joins several remedy errors into one block, so a loader can report every * problem at once instead of one per run. * * ```text * wt: invalid config at ~/.config/wt/config.toml * - paths.main_clone: not set * set paths.main_clone in ~/.config/wt/config.toml * ``` */ export declare function renderConfigErrors(errors: Iterable, options?: { readonly header?: string; }): string; export {};