/** * `tdcv2.config.json` — where the data lives, written down instead of guessed. * * TDC used to probe for its pack directory (`bundledPacksDir()` trying one * layout then another) and take `--data-path` afresh on every invocation. That * guessing is what produced the `npm pack` race and the "wrong path" fragility. * A config file replaces it: paths are stated once and resolved deterministically. * * Resolution is a cascade, highest priority last (so a later level OVERRIDES an * earlier one for the same pack address, which is how a downloaded or project * pack shadows the bundled one): * * bundled < global (~/.config/tdcv2) < project (tdcv2.config.json) < --flag * * `dataPaths` ACCUMULATE across levels (every root is searched); scalar settings * like `locale` take the value from the highest level that sets one. Paths in a * config file are relative to that file's own directory, the way tsconfig's are. * * Pure and parameterised (cwd/home/env passed in) so it is testable without * touching the real filesystem layout. */ export declare const PROJECT_CONFIG_NAME = "tdcv2.config.json"; export interface ResolvedConfig { /** * Data roots in LOW→HIGH priority order (the caller prepends the bundled * root, which is lowest of all). Absolute paths. */ readonly dataPaths: readonly string[]; /** Default locale — the highest level that set one wins. Undefined if none. */ readonly locale: string | undefined; /** * Where `pack add` downloads bundles. Every bundle unpacks into this ONE * folder, at its address path (`/ru/…`, `/countries/usa/…`), * which `pack add` registers in `dataPaths` once — not once per bundle. It is * not a scan root on its own account: it is scanned because that entry says * so, the same as any other data path. The highest level that sets one wins. */ readonly packStore: string | undefined; /** * The config file that set the winning `packStore` — the file `pack add` * edits to register the store. Undefined if no packStore. */ readonly packStoreSource: string | undefined; /** Config files that contributed, low→high, for diagnostics. */ readonly sources: readonly string[]; } export declare class ConfigError extends Error { readonly name = "ConfigError"; } export interface LoadConfigOptions { /** Where the run started. Relative `--data-path` flags resolve against this. */ readonly cwd: string; /** * Where the upward search for `tdcv2.config.json` begins. Defaults to `cwd`. * * These are the same directory for `pack` and `init`, which act on wherever * they were run, and DIFFERENT whenever a config file is named: a `.tdc` file * belongs to the project it sits in, not to the shell that happened to invoke * it. Searching from the shell made `tdcv2 sub/users.tdc` from one directory * up quietly miss the project's packs and fall back to the bundled English — * a run that succeeds and produces the wrong data. Java and Python have * always searched from the file; this is what makes the four agree. */ readonly searchFrom?: string | undefined; /** `--data-path` values from the command line (highest priority). */ readonly flagDataPaths?: readonly string[] | undefined; /** `--locale` from the command line (highest priority). */ readonly flagLocale?: string | undefined; /** Overrides for testing; default to the real home/platform/env. */ readonly home?: string | undefined; readonly platform?: NodeJS.Platform | undefined; readonly env?: NodeJS.ProcessEnv | undefined; } /** * The global (per-user) config path: `%APPDATA%\tdcv2\config.json` on Windows, * else `$XDG_CONFIG_HOME/tdcv2/config.json` or `~/.config/tdcv2/config.json`. */ export declare function globalConfigPath(opts?: LoadConfigOptions): string; /** * Walk up from `cwd` to the filesystem root looking for the nearest * `tdcv2.config.json`. Returns its absolute path, or undefined if none. */ export declare function findProjectConfig(cwd: string): string | undefined; /** * Resolve the effective configuration by cascading global → project → flags. * `dataPaths` accumulate low→high; `locale` takes the highest level that sets * one. The bundled pack root is NOT included here — the caller prepends it as * the lowest priority. */ export declare function loadConfig(opts: LoadConfigOptions): ResolvedConfig; //# sourceMappingURL=config.d.ts.map