Config file discovery. Resolves where config files live for a project, walking up from the working directory to the worktree root plus the global config directory, and reads individual config files tolerantly.
Members
(static, constant) directories
Effect that resolves the deduplicated list of config directories to consult: the global config dir, any .closedcode dirs found between directory and the worktree root (unless project config is disabled) plus one in the home dir, and an explicit override directory when configured.
(static, constant) files
Effect that finds <name>.jsonc/<name>.json config files by walking up from a directory to the worktree root, returned outermost-first (root before nested).
Methods
(static) fileInDirectory(dir, name) → {Array.<string>}
Build the candidate .json and .jsonc paths for a config file in a directory.
| Name | Type | Description |
|---|---|---|
dir | string | The directory to look in. |
name | string | The config file base name (without extension). |
The [<dir>/<name>.json, <dir>/<name>.jsonc] candidate paths.
- Type:
- Array.<string>
(static) readFile(filepath) → {Promise.<(string|undefined)>}
Read a config file, returning undefined for missing files and throwing JsonError for other failures.
| Name | Type | Description |
|---|---|---|
filepath | string | Absolute path to the config file. |
When the file exists but cannot be read.
- Type
- JsonError
The file contents, or undefined when the file does not exist.
- Type:
- Promise.<(string|undefined)>