IF Commons GitHub

physical/config-load

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0009-repoctl-config FR-002

How the host finds and loads a repository's configuration (commons repoctl 0009-repoctl-config FR-002): --config FILE, else the first repoctl.config.ts from the working folder up to the root of the Git checkout; the file is imported (it runs on Bun and on Node 26 as it is), its default export, or its export config, is read by parseConfig, and every way it can fail is a typed problem with its code. The repository's root is the folder of the file.

import { findConfigFile } from "@intellectual-frontiers/repoctl/physical";
findConfigFile("/nowhere/at/all", undefined); // undefined

Source: commons/repoctl/src/physical/config-load.ts

1 of 10 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

physical.ConfigProblemtypeno test imports it
type ConfigProblem = { readonly code: "E-CONFIG-MISSING" | "E-CONFIG-LOAD" | "E-CONFIG-INVALID"; readonly message: string };

Why a configuration could not be had.

physical.findConfigFilefunctionno test imports it
function findConfigFile(from: string, explicit: string | undefined): string | undefined

The configuration's file: the one --config names, else the first repoctl.config.ts from a folder up to the root of the checkout (the first folder that holds .git, which is searched too).

physical.loadConfigFilefunctionno test imports it
function loadConfigFile(file: string): Promise<Result<{ readonly root: string; readonly config: Config; }, ConfigProblem>>

Loads a configuration file: its root (the folder it is in) and the configuration, or the problem.

physical.bareConfigfunctionno test imports it
function bareConfig(): Config

The configuration of no repository: no generator, no check, no optional verb. What a host holds where the file is missing, so that help and doctor still run.

physical.describedConfigfunctionno test imports it
function describedConfig(): Config

The configuration of an imagined repository that has every optional verb, which is what a documentation lens describes: the program is described with all of its verbs.

loadConfigFilefunction
function loadConfigFile(file: string): Promise<Result<{ readonly root: string; readonly config: Config; }, ConfigProblem>>

Loads a configuration file: its root (the folder it is in) and the configuration, or the problem.

Imported by 12 tests of the run (12 passed, 0 failed): the library's results

findConfigFilefunctionno test imports it
function findConfigFile(from: string, explicit: string | undefined): string | undefined

The configuration's file: the one --config names, else the first repoctl.config.ts from a folder up to the root of the checkout (the first folder that holds .git, which is searched too).

ConfigProblemtypeno test imports it
type ConfigProblem = { readonly code: "E-CONFIG-MISSING" | "E-CONFIG-LOAD" | "E-CONFIG-INVALID"; readonly message: string };

Why a configuration could not be had.

bareConfigfunctionno test imports it
function bareConfig(): Config

The configuration of no repository: no generator, no check, no optional verb. What a host holds where the file is missing, so that help and doctor still run.

describedConfigfunctionno test imports it
function describedConfig(): Config

The configuration of an imagined repository that has every optional verb, which is what a documentation lens describes: the program is described with all of its verbs.

Titles, headings, exports, tables, columns and requirements. Esc closes.