@gaunt-sloth/core 2.0.0-alpha.3 → 2.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/defaults.d.ts +84 -0
- package/dist/config/defaults.js +97 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/loader.d.ts +88 -0
- package/dist/config/loader.js +604 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +471 -0
- package/dist/config/schema.js +301 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/shell-policy.d.ts +212 -0
- package/dist/config/shell-policy.js +142 -0
- package/dist/config/shell-policy.js.map +1 -0
- package/dist/config/types.d.ts +453 -0
- package/dist/config/types.js +12 -0
- package/dist/config/types.js.map +1 -0
- package/dist/config.d.ts +18 -821
- package/dist/config.js +15 -657
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/constants.js.map +1 -1
- package/dist/core/GthAbstractAgent.js +9 -1
- package/dist/core/GthAbstractAgent.js.map +1 -1
- package/dist/core/types.d.ts +7 -0
- package/dist/utils/fileUtils.d.ts +4 -1
- package/dist/utils/fileUtils.js +19 -10
- package/dist/utils/fileUtils.js.map +1 -1
- package/dist/utils/systemUtils.d.ts +31 -0
- package/dist/utils/systemUtils.js +38 -0
- package/dist/utils/systemUtils.js.map +1 -1
- package/package.json +8 -5
- package/schema/gsloth-config.schema.json +1548 -0
|
@@ -0,0 +1,604 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Configuration discovery + the layered load/merge pipeline (global + project layers,
|
|
4
|
+
* format fall-through JSON → JS → MJS, schema validation, deep-merge with defaults).
|
|
5
|
+
* Extracted from the former `config.ts` god-file; behaviour is unchanged.
|
|
6
|
+
*/
|
|
7
|
+
import { GSLOTH_DIR, GSLOTH_SETTINGS_DIR, USER_PROJECT_CONFIG_JS, USER_PROJECT_CONFIG_JSON, USER_PROJECT_CONFIG_MJS, USER_PROJECT_CONFIG_TS, } from '#src/constants.js';
|
|
8
|
+
import { StatusLevel } from '#src/core/types.js';
|
|
9
|
+
import { displayDebug, displayError, displayInfo, displayWarning, setConsoleLevel, } from '#src/utils/consoleUtils.js';
|
|
10
|
+
import { findUnknownTopLevelKeys, formatConfigValidationError, preMapDeprecatedConfigNames, rawGthConfigSchema, } from '#src/config/schema.js';
|
|
11
|
+
import { getGslothConfigReadPath, importExternalFile } from '#src/utils/fileUtils.js';
|
|
12
|
+
import { getGlobalGslothConfigReadPath } from '#src/utils/globalConfigUtils.js';
|
|
13
|
+
import { error, exit, getCurrentWorkDir, isTTY, setProjectDir, setUseColour, } from '#src/utils/systemUtils.js';
|
|
14
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
15
|
+
import { homedir } from 'node:os';
|
|
16
|
+
import { dirname, resolve } from 'node:path';
|
|
17
|
+
import { DEFAULT_CONFIG } from '#src/config/defaults.js';
|
|
18
|
+
/**
|
|
19
|
+
* Validate (and normalize) a freshly loaded raw config layer (global or project)
|
|
20
|
+
* against {@link rawGthConfigSchema}, the single source of truth for the on-disk
|
|
21
|
+
* config shape.
|
|
22
|
+
*
|
|
23
|
+
* Steps, in order:
|
|
24
|
+
* 1. B3 pre-map: map deprecated key names one-way to their canonical names (root +
|
|
25
|
+
* per-command) via {@link preMapDeprecatedConfigNames}, emitting a deprecation
|
|
26
|
+
* `displayWarning` for each occurrence. This runs FIRST so renamed keys are not
|
|
27
|
+
* later mistaken for unknown keys.
|
|
28
|
+
* 2. Unknown top-level keys: warn (do NOT fail) so likely typos are surfaced while
|
|
29
|
+
* forward-compatible / extension keys still pass through untouched.
|
|
30
|
+
* 3. Schema parse: on a genuine type mismatch on a known field, emit a friendly,
|
|
31
|
+
* path-scoped error and exit (matching the loader's existing invalid-config
|
|
32
|
+
* behaviour). Validation is shape-only — the loose schema preserves unknown keys,
|
|
33
|
+
* so the original `raw` (pre-mapped) is returned unchanged on success.
|
|
34
|
+
*
|
|
35
|
+
* @param raw The freshly loaded config layer (mutated in place by the pre-map).
|
|
36
|
+
* @param sourceLabel Human-readable source name for messages (e.g. the filename).
|
|
37
|
+
*/
|
|
38
|
+
function validateRawConfigLayer(raw, sourceLabel) {
|
|
39
|
+
const { config, warnings } = preMapDeprecatedConfigNames(raw);
|
|
40
|
+
for (const warning of warnings) {
|
|
41
|
+
displayWarning(warning);
|
|
42
|
+
}
|
|
43
|
+
const unknownKeys = findUnknownTopLevelKeys(config);
|
|
44
|
+
if (unknownKeys.length > 0) {
|
|
45
|
+
displayWarning(`Unknown top-level config ${unknownKeys.length === 1 ? 'key' : 'keys'} in ${sourceLabel}: ` +
|
|
46
|
+
`${unknownKeys.join(', ')}. ${unknownKeys.length === 1 ? 'It is' : 'They are'} kept as-is ` +
|
|
47
|
+
'but ignored by Gaunt Sloth; check for typos.');
|
|
48
|
+
}
|
|
49
|
+
const result = rawGthConfigSchema.safeParse(config);
|
|
50
|
+
if (!result.success) {
|
|
51
|
+
displayError(`Invalid configuration in ${sourceLabel}:\n${formatConfigValidationError(result.error)}`);
|
|
52
|
+
exit(1);
|
|
53
|
+
}
|
|
54
|
+
return config;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Project config file lookup order, highest precedence first. JSON wins, then the
|
|
58
|
+
* `configure()`-style module formats (JS → MJS → TS). Used to pick THE config within a dir.
|
|
59
|
+
*/
|
|
60
|
+
const PROJECT_CONFIG_FORMATS = [
|
|
61
|
+
USER_PROJECT_CONFIG_JSON,
|
|
62
|
+
USER_PROJECT_CONFIG_JS,
|
|
63
|
+
USER_PROJECT_CONFIG_MJS,
|
|
64
|
+
USER_PROJECT_CONFIG_TS,
|
|
65
|
+
];
|
|
66
|
+
/**
|
|
67
|
+
* Dir-aware version of {@link getGslothConfigReadPath} for ancestor dirs during the up-tree
|
|
68
|
+
* walk. Mirrors its `.gsloth/.gsloth-settings[/<profile>]/<filename>` resolution but against an
|
|
69
|
+
* explicit `dir` instead of the cwd, falling back to `<dir>/<filename>`. Implemented with
|
|
70
|
+
* `node:path`/`node:fs` directly (no `fileUtils` round-trip) so the cwd level can keep
|
|
71
|
+
* delegating to the original cwd-bound resolver.
|
|
72
|
+
*/
|
|
73
|
+
function resolveProjectConfigPathInDir(dir, filename, identityProfileRaw) {
|
|
74
|
+
const identityProfile = identityProfileRaw?.trim();
|
|
75
|
+
const gslothDirPath = resolve(dir, GSLOTH_DIR);
|
|
76
|
+
if (existsSync(gslothDirPath)) {
|
|
77
|
+
const gslothSettingsPath = resolve(gslothDirPath, GSLOTH_SETTINGS_DIR);
|
|
78
|
+
const configPath = identityProfile
|
|
79
|
+
? resolve(gslothSettingsPath, identityProfile, filename)
|
|
80
|
+
: resolve(gslothSettingsPath, filename);
|
|
81
|
+
if (existsSync(configPath)) {
|
|
82
|
+
return configPath;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return resolve(dir, filename);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Resolve where a config `filename` would live for the given base dir, composing with
|
|
89
|
+
* `identityProfile`. The cwd level delegates to the existing cwd-bound
|
|
90
|
+
* {@link getGslothConfigReadPath} (preserving its behaviour and test seams); ancestor dirs use
|
|
91
|
+
* {@link resolveProjectConfigPathInDir}.
|
|
92
|
+
*/
|
|
93
|
+
function resolveConfigPath(baseDir, filename, identityProfile) {
|
|
94
|
+
return baseDir === getCurrentWorkDir()
|
|
95
|
+
? getGslothConfigReadPath(filename, identityProfile)
|
|
96
|
+
: resolveProjectConfigPathInDir(baseDir, filename, identityProfile);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Find THE project config by walking up from cwd toward a stop boundary, returning the FIRST
|
|
100
|
+
* match (first-match-win: nearest dir, then format precedence within that dir — NOT a merged
|
|
101
|
+
* stack). Detection ({@link hasProjectConfig}/{@link hasAnyConfig}) and loading ({@link initConfig})
|
|
102
|
+
* both go through this, so they can never disagree.
|
|
103
|
+
*
|
|
104
|
+
* Stop boundary — the dir is SEARCHED, then ascent stops at: a dir containing `.git` (the git
|
|
105
|
+
* root), the user's home dir, or the filesystem root — whichever comes first. So a config IN the
|
|
106
|
+
* git root (or home) is found; a config ABOVE it is not.
|
|
107
|
+
*
|
|
108
|
+
* A `customConfigPath` override wins outright (no walking).
|
|
109
|
+
*
|
|
110
|
+
* @returns the matched `{ dir, path }`, or `undefined` when no project config exists within the
|
|
111
|
+
* boundary.
|
|
112
|
+
*/
|
|
113
|
+
export function findProjectConfigPath(commandLineConfigOverrides) {
|
|
114
|
+
if (commandLineConfigOverrides.customConfigPath) {
|
|
115
|
+
return existsSync(commandLineConfigOverrides.customConfigPath)
|
|
116
|
+
? {
|
|
117
|
+
dir: dirname(commandLineConfigOverrides.customConfigPath),
|
|
118
|
+
path: commandLineConfigOverrides.customConfigPath,
|
|
119
|
+
}
|
|
120
|
+
: undefined;
|
|
121
|
+
}
|
|
122
|
+
const home = homedir();
|
|
123
|
+
let dir = getCurrentWorkDir();
|
|
124
|
+
// Walk up: search each dir, then stop at the boundary (git root / home / fs root).
|
|
125
|
+
for (;;) {
|
|
126
|
+
for (const filename of PROJECT_CONFIG_FORMATS) {
|
|
127
|
+
const candidate = resolveConfigPath(dir, filename, commandLineConfigOverrides.identityProfile);
|
|
128
|
+
if (existsSync(candidate)) {
|
|
129
|
+
return { dir, path: candidate };
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const parent = dirname(dir);
|
|
133
|
+
if (existsSync(resolve(dir, '.git')) || dir === home || parent === dir) {
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
dir = parent;
|
|
137
|
+
}
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Loads the global gsloth config (if present) from the global `~/.gsloth` folder.
|
|
142
|
+
*
|
|
143
|
+
* Precedence support: the returned raw config is intended to act as the BASE that the
|
|
144
|
+
* project config (and CLI overrides) merge on top of, so any value here is the lowest
|
|
145
|
+
* user-controlled layer (still above {@link DEFAULT_CONFIG}).
|
|
146
|
+
*
|
|
147
|
+
* Lookup order within the global folder, first match wins:
|
|
148
|
+
* `.gsloth.config.json` -> `.gsloth.config.js` -> `.gsloth.config.mjs`
|
|
149
|
+
*
|
|
150
|
+
* Absence of every variant is a no-op: returns `undefined` so behaviour is unchanged.
|
|
151
|
+
*
|
|
152
|
+
* NOTE: secrets (API keys) may live in this file; this function must never log its
|
|
153
|
+
* contents. Only non-sensitive diagnostics (the resolved path / parse failure) are emitted.
|
|
154
|
+
*
|
|
155
|
+
* @returns The raw global config object, or `undefined` when no global config exists.
|
|
156
|
+
*/
|
|
157
|
+
export async function loadGlobalRawConfig() {
|
|
158
|
+
// JSON first (the must-have format).
|
|
159
|
+
const jsonPath = getGlobalGslothConfigReadPath(USER_PROJECT_CONFIG_JSON);
|
|
160
|
+
if (existsSync(jsonPath)) {
|
|
161
|
+
try {
|
|
162
|
+
const parsed = JSON.parse(readFileSync(jsonPath, 'utf8'));
|
|
163
|
+
return validateRawConfigLayer(parsed, `${USER_PROJECT_CONFIG_JSON} (global)`);
|
|
164
|
+
}
|
|
165
|
+
catch (e) {
|
|
166
|
+
displayDebug(e instanceof Error ? e : String(e));
|
|
167
|
+
displayWarning(`Failed to read global config from ${jsonPath}, ignoring it.`);
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Then JS / MJS variants (dynamic import of a `configure()` module).
|
|
172
|
+
for (const filename of [USER_PROJECT_CONFIG_JS, USER_PROJECT_CONFIG_MJS]) {
|
|
173
|
+
const modulePath = getGlobalGslothConfigReadPath(filename);
|
|
174
|
+
if (existsSync(modulePath)) {
|
|
175
|
+
try {
|
|
176
|
+
const imported = await importExternalFile(modulePath);
|
|
177
|
+
const configured = await imported.configure();
|
|
178
|
+
return validateRawConfigLayer(configured, `${filename} (global)`);
|
|
179
|
+
}
|
|
180
|
+
catch (e) {
|
|
181
|
+
displayDebug(e instanceof Error ? e : String(e));
|
|
182
|
+
displayWarning(`Failed to read global config from ${modulePath}, ignoring it.`);
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return undefined;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Deep-merges a loaded global raw config UNDER the given project raw config, so the
|
|
191
|
+
* project config wins on conflicting keys. When no global config exists this is a no-op
|
|
192
|
+
* and the original project config is returned unchanged.
|
|
193
|
+
*/
|
|
194
|
+
async function applyGlobalConfigBase(projectRawConfig) {
|
|
195
|
+
const globalRawConfig = await loadGlobalRawConfig();
|
|
196
|
+
if (!globalRawConfig) {
|
|
197
|
+
return projectRawConfig;
|
|
198
|
+
}
|
|
199
|
+
return deepMerge(globalRawConfig, projectRawConfig);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* ORDERING INVARIANT (GS2-11): detection ({@link hasProjectConfig}/{@link hasAnyConfig}) MUST run
|
|
203
|
+
* before {@link initConfig} in a given process. Both resolve cwd-level candidates via
|
|
204
|
+
* `getGslothConfigReadPath`, which reads `getProjectDir()`; {@link initConfig} clears `projectDir`
|
|
205
|
+
* at the start of its run, so detection stays cwd-correct as long as it precedes initConfig (it
|
|
206
|
+
* does: startSession calls hasAnyConfig before any initConfig, and the ACP/agent path calls
|
|
207
|
+
* initConfig directly without detection). Calling detection AFTER an initConfig with a changed cwd
|
|
208
|
+
* in a long-lived process would read a stale projectDir (currently unreachable). If that call
|
|
209
|
+
* order is ever introduced, decouple discovery's cwd-branch from `getProjectDir()`.
|
|
210
|
+
*/
|
|
211
|
+
/**
|
|
212
|
+
* Returns true when a project-level config file (json/js/mjs) exists for the given
|
|
213
|
+
* overrides. Honours `customConfigPath` and the active identity profile so the check
|
|
214
|
+
* matches exactly what {@link initConfig} would attempt to load.
|
|
215
|
+
*
|
|
216
|
+
* This is the project half of CFG-10's "is any config present?" detection; the global
|
|
217
|
+
* half is {@link loadGlobalRawConfig} (used by {@link hasAnyConfig}).
|
|
218
|
+
*/
|
|
219
|
+
export function hasProjectConfig(commandLineConfigOverrides) {
|
|
220
|
+
return findProjectConfigPath(commandLineConfigOverrides) !== undefined;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* CFG-10 — true when ANY usable configuration is present, either a project config file
|
|
224
|
+
* (json/js/mjs) or a standalone global config (`~/.gsloth/.gsloth.config.*`). When this
|
|
225
|
+
* returns false the caller should run the first-run dialog instead of erroring.
|
|
226
|
+
*
|
|
227
|
+
* Reuses CFG-8's project + global detection so the two paths can never disagree.
|
|
228
|
+
*/
|
|
229
|
+
export async function hasAnyConfig(commandLineConfigOverrides) {
|
|
230
|
+
if (hasProjectConfig(commandLineConfigOverrides)) {
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
return (await loadGlobalRawConfig()) !== undefined;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Initialize configuration by loading from available config files
|
|
237
|
+
* @returns The loaded GthConfig
|
|
238
|
+
*/
|
|
239
|
+
export async function initConfig(commandLineConfigOverrides) {
|
|
240
|
+
if (commandLineConfigOverrides.customConfigPath &&
|
|
241
|
+
!existsSync(commandLineConfigOverrides.customConfigPath)) {
|
|
242
|
+
throw new Error(`Provided manual config "${commandLineConfigOverrides.customConfigPath}" does not exist`);
|
|
243
|
+
}
|
|
244
|
+
// Clear the project root BEFORE discovery. Discovery and detection must resolve against cwd,
|
|
245
|
+
// and the up-tree walk itself goes through getGslothConfigReadPath -> getProjectDir(); clearing
|
|
246
|
+
// first guarantees getProjectDir() falls back to cwd during the walk, even on a SECOND initConfig
|
|
247
|
+
// call in a long-lived process (ACP server) or across tests where a stale projectDir would
|
|
248
|
+
// otherwise poison the walk and miss the real config.
|
|
249
|
+
setProjectDir(undefined);
|
|
250
|
+
// Discover the project config location: a customConfigPath wins outright, otherwise walk up
|
|
251
|
+
// from cwd to the stop boundary (see findProjectConfigPath). Detection and loading share this
|
|
252
|
+
// resolver, and the discovered dir becomes the base for the per-format cascade below.
|
|
253
|
+
const discovered = findProjectConfigPath(commandLineConfigOverrides);
|
|
254
|
+
const baseDir = discovered?.dir ?? getCurrentWorkDir();
|
|
255
|
+
// Set the project root for post-config, project-relative artifact resolution (guidelines,
|
|
256
|
+
// prompts, .gsloth-settings, outputs). up-tree and --config both set it here; a global-only /
|
|
257
|
+
// no-config run leaves it undefined so those artifacts stay cwd-bound (see getProjectDir).
|
|
258
|
+
// Safe for the in-function load below: when discovered.dir === cwd getProjectDir() is unchanged,
|
|
259
|
+
// and when it is an ancestor resolveConfigPath takes its explicit-dir branch (never getProjectDir).
|
|
260
|
+
setProjectDir(discovered?.dir);
|
|
261
|
+
const jsonConfigPath = commandLineConfigOverrides.customConfigPath ??
|
|
262
|
+
resolveConfigPath(baseDir, USER_PROJECT_CONFIG_JSON, commandLineConfigOverrides.identityProfile);
|
|
263
|
+
// CFG-8 — when no project config file of any format exists (anywhere up-tree), fall back to a
|
|
264
|
+
// standalone global config (loaded alone) before erroring. Project config still takes
|
|
265
|
+
// precedence: this branch only runs when there is no project file to apply the global under.
|
|
266
|
+
if (!discovered) {
|
|
267
|
+
const globalRawConfig = await loadGlobalRawConfig();
|
|
268
|
+
if (globalRawConfig) {
|
|
269
|
+
if (globalRawConfig.llm &&
|
|
270
|
+
typeof globalRawConfig.llm === 'object' &&
|
|
271
|
+
'type' in globalRawConfig.llm) {
|
|
272
|
+
// Route the global config through the same path the project JSON uses.
|
|
273
|
+
return await tryJsonConfig(globalRawConfig, commandLineConfigOverrides);
|
|
274
|
+
}
|
|
275
|
+
displayError('Global configuration found but it is not in valid format. Should at least define llm.type');
|
|
276
|
+
exit(1);
|
|
277
|
+
// Unreachable past exit(1) in production; keeps TS happy and prevents test exit.
|
|
278
|
+
throw new Error('Unexpected error occurred.');
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
// Try loading the JSON config file first
|
|
282
|
+
if (jsonConfigPath.endsWith('.json') && existsSync(jsonConfigPath)) {
|
|
283
|
+
try {
|
|
284
|
+
// Validate the project config layer against the Zod schema (single source of
|
|
285
|
+
// truth): pre-map deprecated names, warn on unknown top-level keys, and fail
|
|
286
|
+
// with a friendly, path-scoped message on a genuine type mismatch.
|
|
287
|
+
const projectJsonConfig = validateRawConfigLayer(JSON.parse(readFileSync(jsonConfigPath, 'utf8')), USER_PROJECT_CONFIG_JSON);
|
|
288
|
+
// Apply global config as the base layer (project config wins on conflicts).
|
|
289
|
+
const jsonConfig = (await applyGlobalConfigBase(projectJsonConfig));
|
|
290
|
+
// If the config has an LLM with a type, create the appropriate LLM instance
|
|
291
|
+
if (jsonConfig.llm && typeof jsonConfig.llm === 'object' && 'type' in jsonConfig.llm) {
|
|
292
|
+
return await tryJsonConfig(jsonConfig, commandLineConfigOverrides);
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
error(`${jsonConfigPath} is not in valid format. Should at least define llm.type`);
|
|
296
|
+
exit(1);
|
|
297
|
+
// noinspection ExceptionCaughtLocallyJS
|
|
298
|
+
// This throw is unreachable due to exit(1) above, but satisfies TS type analysis and prevents tests from exiting
|
|
299
|
+
// noinspection ExceptionCaughtLocallyJS
|
|
300
|
+
throw new Error('Unexpected error occurred.');
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
catch (e) {
|
|
304
|
+
displayDebug(e instanceof Error ? e : String(e));
|
|
305
|
+
displayError(`Failed to read config from ${USER_PROJECT_CONFIG_JSON}, will try other formats.`);
|
|
306
|
+
// Continue to try other formats
|
|
307
|
+
return await tryModuleConfig('js', commandLineConfigOverrides, baseDir);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
// JSON config not found, try JS
|
|
312
|
+
return tryModuleConfig('js', commandLineConfigOverrides, baseDir);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Module-format fall-through order (lowest precedence among project formats; JSON is tried
|
|
317
|
+
* first by {@link initConfig}). `.ts` (B2b) is last, loaded via jiti by `importExternalFile`.
|
|
318
|
+
*/
|
|
319
|
+
const MODULE_CONFIG_FORMATS = ['js', 'mjs', 'ts'];
|
|
320
|
+
const MODULE_CONFIG_FILENAME = {
|
|
321
|
+
js: USER_PROJECT_CONFIG_JS,
|
|
322
|
+
mjs: USER_PROJECT_CONFIG_MJS,
|
|
323
|
+
ts: USER_PROJECT_CONFIG_TS,
|
|
324
|
+
};
|
|
325
|
+
const MODULE_CONFIG_EXT = {
|
|
326
|
+
js: '.js',
|
|
327
|
+
mjs: '.mjs',
|
|
328
|
+
ts: '.ts',
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
* Try loading a `configure()`-style module config (JS → MJS → TS), preserving the format
|
|
332
|
+
* fall-through: a missing/failed format falls through to the next in {@link MODULE_CONFIG_FORMATS};
|
|
333
|
+
* exhausting the chain is the terminal "no usable config" error. Collapses the formerly-duplicated
|
|
334
|
+
* `tryJsConfig`/`tryMjsConfig` helpers into one format-parameterized loader.
|
|
335
|
+
*
|
|
336
|
+
* NOTE: the terminal "No configuration file found" message intentionally advertises only
|
|
337
|
+
* json/js/mjs (the historical, asserted wording) — `.ts` is a quiet lowest-precedence fallback.
|
|
338
|
+
*/
|
|
339
|
+
async function tryModuleConfig(format, commandLineConfigOverrides, baseDir) {
|
|
340
|
+
const filename = MODULE_CONFIG_FILENAME[format];
|
|
341
|
+
const ext = MODULE_CONFIG_EXT[format];
|
|
342
|
+
const nextFormat = MODULE_CONFIG_FORMATS[MODULE_CONFIG_FORMATS.indexOf(format) + 1];
|
|
343
|
+
const configPath = commandLineConfigOverrides.customConfigPath ??
|
|
344
|
+
resolveConfigPath(baseDir, filename, commandLineConfigOverrides.identityProfile);
|
|
345
|
+
if (configPath.endsWith(ext) && existsSync(configPath)) {
|
|
346
|
+
try {
|
|
347
|
+
const i = await importExternalFile(configPath);
|
|
348
|
+
const customConfig = validateRawConfigLayer((await i.configure()), filename);
|
|
349
|
+
const mergedWithGlobal = await applyGlobalConfigBase(customConfig);
|
|
350
|
+
return await mergeConfig(mergedWithGlobal, commandLineConfigOverrides);
|
|
351
|
+
}
|
|
352
|
+
catch (e) {
|
|
353
|
+
displayDebug(e instanceof Error ? e : String(e));
|
|
354
|
+
if (nextFormat) {
|
|
355
|
+
displayError(`Failed to read config from ${filename}, will try other formats.`);
|
|
356
|
+
// Continue to try other formats
|
|
357
|
+
return await tryModuleConfig(nextFormat, commandLineConfigOverrides, baseDir);
|
|
358
|
+
}
|
|
359
|
+
displayError(`Failed to read config from ${filename}.`);
|
|
360
|
+
displayError(`No valid configuration found. Please create a valid configuration file.`);
|
|
361
|
+
exit(1);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
else if (nextFormat) {
|
|
365
|
+
// This format not found, try the next one
|
|
366
|
+
return await tryModuleConfig(nextFormat, commandLineConfigOverrides, baseDir);
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
// No config files found
|
|
370
|
+
displayError('No configuration file found. Please create one of: ' +
|
|
371
|
+
`${USER_PROJECT_CONFIG_JSON}, ${USER_PROJECT_CONFIG_JS}, or ${USER_PROJECT_CONFIG_MJS} ` +
|
|
372
|
+
'in your project directory.');
|
|
373
|
+
exit(1);
|
|
374
|
+
}
|
|
375
|
+
// This throw is unreachable due to exit(1) above, but satisfies TS type analysis and prevents tests from exiting
|
|
376
|
+
throw new Error('Unexpected error occurred.');
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Process JSON LLM config by creating the appropriate LLM instance
|
|
380
|
+
* @param jsonConfig - The parsed JSON config
|
|
381
|
+
* @param commandLineConfigOverrides - command line config overrides
|
|
382
|
+
* @returns Promise<GthConfig>
|
|
383
|
+
*/
|
|
384
|
+
export async function tryJsonConfig(jsonConfig, commandLineConfigOverrides) {
|
|
385
|
+
try {
|
|
386
|
+
if (jsonConfig.llm && typeof jsonConfig.llm === 'object') {
|
|
387
|
+
// Get the type of LLM (e.g. 'vertexai', 'anthropic') - this should exist
|
|
388
|
+
const llmType = jsonConfig.llm.type;
|
|
389
|
+
if (!llmType) {
|
|
390
|
+
displayError('LLM type not specified in config.');
|
|
391
|
+
exit(1);
|
|
392
|
+
}
|
|
393
|
+
// Get the configuration for the specific LLM type
|
|
394
|
+
const llmConfig = jsonConfig.llm;
|
|
395
|
+
if (commandLineConfigOverrides.verbose) {
|
|
396
|
+
// Necessary to avoid https://github.com/langchain-ai/langchainjs/issues/8705
|
|
397
|
+
llmConfig.verbose = commandLineConfigOverrides.verbose;
|
|
398
|
+
}
|
|
399
|
+
// Import the appropriate config module
|
|
400
|
+
const configModule = await import(`#src/providers/${llmType}.js`);
|
|
401
|
+
if (configModule.processJsonConfig) {
|
|
402
|
+
const llm = (await configModule.processJsonConfig(llmConfig));
|
|
403
|
+
const mergedConfig = mergeRawConfig(jsonConfig, llm, commandLineConfigOverrides);
|
|
404
|
+
if (configModule.postProcessJsonConfig) {
|
|
405
|
+
return await configModule.postProcessJsonConfig(mergedConfig);
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
return await mergedConfig;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
displayWarning(`Config module for ${llmType} does not have processJsonConfig function.`);
|
|
413
|
+
exit(1);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
displayError('No LLM configuration found in config.');
|
|
418
|
+
exit(1);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
catch (e) {
|
|
422
|
+
if (e instanceof Error && e.message.includes('Cannot find module')) {
|
|
423
|
+
displayError(`LLM type '${jsonConfig.llm.type}' not supported.`);
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
displayError(`Error processing LLM config: ${e instanceof Error ? e.message : String(e)}`);
|
|
427
|
+
}
|
|
428
|
+
exit(1);
|
|
429
|
+
}
|
|
430
|
+
// This throw is unreachable due to exit(1) above, but satisfies TS type analysis and prevents tests from exiting
|
|
431
|
+
throw new Error('Unexpected error occurred.');
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Config array fields whose values ADD UP across merge layers (global → project): the
|
|
435
|
+
* merged result is both layers concatenated (target/lower-precedence first) and de-duplicated
|
|
436
|
+
* by value, instead of the higher-precedence layer replacing the lower. Keyed by dotted path
|
|
437
|
+
* from the config root.
|
|
438
|
+
*
|
|
439
|
+
* CONSERVATIVE BY DESIGN — only genuinely-cumulative lists are additive. Everything else keeps
|
|
440
|
+
* REPLACE semantics, because those express "this is THE set" and silently unioning them across
|
|
441
|
+
* global + project would surprise users.
|
|
442
|
+
*
|
|
443
|
+
* | array field | policy | rationale |
|
|
444
|
+
* | -------------------- | -------- | ---------------------------------------------------- |
|
|
445
|
+
* | `allowDirs` | ADDITIVE | extra sandbox roots accumulate across layers |
|
|
446
|
+
* | `aiignore.patterns` | ADDITIVE | ignore patterns accumulate across layers |
|
|
447
|
+
* | `allowedTools` | replace | the explicit allow-list IS the set |
|
|
448
|
+
* | `builtInTools` | replace | the explicit tool selection IS the set |
|
|
449
|
+
* | `tools` | replace | live tool instances; union would be surprising |
|
|
450
|
+
* | `middleware` | replace | ordered pipeline; union would reorder/duplicate |
|
|
451
|
+
* | `binaryFormats` | replace | the declared format policy IS the set |
|
|
452
|
+
* | (every other array) | replace | default; preserves historical behaviour |
|
|
453
|
+
*
|
|
454
|
+
* NOTE: the additive fields only live at the config ROOT, so only the
|
|
455
|
+
* `applyGlobalConfigBase(global, project)` merge can trigger them; the per-command
|
|
456
|
+
* `deepMerge` calls start at command scope and never reach these paths.
|
|
457
|
+
*
|
|
458
|
+
* NAMESPACE CAVEAT: these keys are config-ROOT-relative, but the per-command
|
|
459
|
+
* `deepMerge(DEFAULT_CONFIG.commands.X, …)` calls also start at `path === ''`. No command
|
|
460
|
+
* default carries `allowDirs`/`aiignore`, so there is no collision today — but do NOT add a
|
|
461
|
+
* key here that could also appear as a per-command field, or it would silently become additive
|
|
462
|
+
* inside command merges too.
|
|
463
|
+
*/
|
|
464
|
+
const ADDITIVE_ARRAY_FIELDS = new Set(['allowDirs', 'aiignore.patterns']);
|
|
465
|
+
/**
|
|
466
|
+
* Deep merge two objects, with source overriding target properties.
|
|
467
|
+
* Objects are merged recursively. Arrays REPLACE by default; arrays at an
|
|
468
|
+
* {@link ADDITIVE_ARRAY_FIELDS} path are concatenated (target-first) then de-duplicated by
|
|
469
|
+
* value. Every other non-plain-object value is replaced by the source value.
|
|
470
|
+
* @param target - The target object with default values (lower-precedence layer)
|
|
471
|
+
* @param source - The source object with user overrides (higher-precedence layer)
|
|
472
|
+
* @param path - Dotted path from the config root, used to look up the array merge policy.
|
|
473
|
+
*/
|
|
474
|
+
function deepMerge(target, source, path = '') {
|
|
475
|
+
if (!source)
|
|
476
|
+
return target;
|
|
477
|
+
if (!target)
|
|
478
|
+
return source;
|
|
479
|
+
const result = { ...target };
|
|
480
|
+
for (const key in source) {
|
|
481
|
+
const sourceValue = source[key];
|
|
482
|
+
const targetValue = target[key];
|
|
483
|
+
const fieldPath = path ? `${path}.${key}` : key;
|
|
484
|
+
if (sourceValue &&
|
|
485
|
+
typeof sourceValue === 'object' &&
|
|
486
|
+
!Array.isArray(sourceValue) &&
|
|
487
|
+
targetValue &&
|
|
488
|
+
typeof targetValue === 'object' &&
|
|
489
|
+
!Array.isArray(targetValue)) {
|
|
490
|
+
// Recursively merge nested objects
|
|
491
|
+
result[key] = deepMerge(targetValue, sourceValue, fieldPath);
|
|
492
|
+
}
|
|
493
|
+
else if (Array.isArray(sourceValue) &&
|
|
494
|
+
Array.isArray(targetValue) &&
|
|
495
|
+
ADDITIVE_ARRAY_FIELDS.has(fieldPath)) {
|
|
496
|
+
// Additive list: concat both layers (target/lower-precedence first), de-dupe by value.
|
|
497
|
+
result[key] = [...new Set([...targetValue, ...sourceValue])];
|
|
498
|
+
}
|
|
499
|
+
else if (sourceValue !== undefined) {
|
|
500
|
+
// Override with source value if it exists (arrays REPLACE by default)
|
|
501
|
+
result[key] = sourceValue;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
return result;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Resolve a fully-merged {@link GthConfig} from a partial config + CLI overrides WITHOUT
|
|
508
|
+
* any global side effects (a pure transform). It deep-merges defaults, applies CLI overrides,
|
|
509
|
+
* resolves the numeric `consoleLevel` (warning + defaulting to INFO on an invalid value), and
|
|
510
|
+
* computes `canInterruptInferenceWithEsc`. The process-global setters (`setUseColour` /
|
|
511
|
+
* `setConsoleLevel`) are applied separately by {@link mergeConfig}, so this function can be
|
|
512
|
+
* reasoned about and reused without touching global state.
|
|
513
|
+
*/
|
|
514
|
+
export function resolveConfig(partialConfig, commandLineConfigOverrides) {
|
|
515
|
+
const config = partialConfig;
|
|
516
|
+
// Deep merge command configs while preserving defaults
|
|
517
|
+
// Type complexity from DEFAULT_CONFIG.commands 'as const' requires any cast for deep merge result
|
|
518
|
+
const mergedCommands = {
|
|
519
|
+
pr: deepMerge(DEFAULT_CONFIG.commands.pr, config?.commands?.pr), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
520
|
+
review: deepMerge(DEFAULT_CONFIG.commands.review, config?.commands?.review), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
521
|
+
code: deepMerge(DEFAULT_CONFIG.commands.code, config?.commands?.code), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
522
|
+
exec: deepMerge(DEFAULT_CONFIG.commands.exec, config?.commands?.exec), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
523
|
+
ask: deepMerge(DEFAULT_CONFIG.commands.ask, config?.commands?.ask), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
524
|
+
chat: deepMerge(DEFAULT_CONFIG.commands.chat, config?.commands?.chat), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
525
|
+
api: deepMerge(DEFAULT_CONFIG.commands.api, config?.commands?.api), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
526
|
+
};
|
|
527
|
+
const mergedConfig = {
|
|
528
|
+
...DEFAULT_CONFIG,
|
|
529
|
+
...config,
|
|
530
|
+
commands: mergedCommands,
|
|
531
|
+
};
|
|
532
|
+
if (commandLineConfigOverrides.identityProfile !== undefined) {
|
|
533
|
+
displayInfo(`Activating profile: ${commandLineConfigOverrides.identityProfile}`);
|
|
534
|
+
mergedConfig.identityProfile = commandLineConfigOverrides.identityProfile.trim();
|
|
535
|
+
}
|
|
536
|
+
if (commandLineConfigOverrides.verbose !== undefined) {
|
|
537
|
+
mergedConfig.llm.verbose = commandLineConfigOverrides.verbose;
|
|
538
|
+
}
|
|
539
|
+
if (commandLineConfigOverrides.writeOutputToFile !== undefined) {
|
|
540
|
+
mergedConfig.writeOutputToFile = commandLineConfigOverrides.writeOutputToFile;
|
|
541
|
+
}
|
|
542
|
+
// Resolve console logging level (value only; the global setter is applied in mergeConfig).
|
|
543
|
+
if (mergedConfig.consoleLevel !== undefined) {
|
|
544
|
+
const resolvedConsoleLevel = resolveConsoleLevel(mergedConfig.consoleLevel);
|
|
545
|
+
if (resolvedConsoleLevel !== undefined) {
|
|
546
|
+
mergedConfig.consoleLevel = resolvedConsoleLevel;
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
displayWarning(`Invalid consoleLevel "${String(mergedConfig.consoleLevel)}", using default ${StatusLevel.INFO}.`);
|
|
550
|
+
mergedConfig.consoleLevel = StatusLevel.INFO;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
mergedConfig.canInterruptInferenceWithEsc = mergedConfig.canInterruptInferenceWithEsc && isTTY();
|
|
554
|
+
return mergedConfig;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Merge config with default config, then apply the resolved colour + console-level settings
|
|
558
|
+
* to the process globals. Thin wrapper over the pure {@link resolveConfig}; kept `async` with
|
|
559
|
+
* the same signature so every existing caller (`mergeRawConfig`, `tryJsConfig`, `tryMjsConfig`)
|
|
560
|
+
* behaves identically — the two `set*` calls are the only global mutations in the merge path.
|
|
561
|
+
*/
|
|
562
|
+
async function mergeConfig(partialConfig, commandLineConfigOverrides) {
|
|
563
|
+
const mergedConfig = resolveConfig(partialConfig, commandLineConfigOverrides);
|
|
564
|
+
// Set the useColour value in systemUtils.
|
|
565
|
+
setUseColour(mergedConfig.useColour);
|
|
566
|
+
// Set console logging level.
|
|
567
|
+
if (mergedConfig.consoleLevel !== undefined) {
|
|
568
|
+
setConsoleLevel(mergedConfig.consoleLevel);
|
|
569
|
+
}
|
|
570
|
+
return mergedConfig;
|
|
571
|
+
}
|
|
572
|
+
const CONSOLE_LEVELS_BY_NAME = {
|
|
573
|
+
debug: StatusLevel.DEBUG,
|
|
574
|
+
info: StatusLevel.INFO,
|
|
575
|
+
display: StatusLevel.DISPLAY,
|
|
576
|
+
success: StatusLevel.SUCCESS,
|
|
577
|
+
warning: StatusLevel.WARNING,
|
|
578
|
+
error: StatusLevel.ERROR,
|
|
579
|
+
stream: StatusLevel.STREAM,
|
|
580
|
+
};
|
|
581
|
+
function resolveConsoleLevel(level) {
|
|
582
|
+
if (typeof level === 'number') {
|
|
583
|
+
return StatusLevel[level] !== undefined ? level : undefined;
|
|
584
|
+
}
|
|
585
|
+
if (typeof level === 'string') {
|
|
586
|
+
const normalized = level.trim().toLowerCase();
|
|
587
|
+
if (normalized in CONSOLE_LEVELS_BY_NAME) {
|
|
588
|
+
return CONSOLE_LEVELS_BY_NAME[normalized];
|
|
589
|
+
}
|
|
590
|
+
const enumValue = StatusLevel[level];
|
|
591
|
+
if (typeof enumValue === 'number') {
|
|
592
|
+
return enumValue;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
return undefined;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Merge raw with default config
|
|
599
|
+
*/
|
|
600
|
+
async function mergeRawConfig(config, llm, commandLineConfigOverrides) {
|
|
601
|
+
const modelDisplayName = config.llm?.model;
|
|
602
|
+
return await mergeConfig({ ...config, llm, modelDisplayName }, commandLineConfigOverrides);
|
|
603
|
+
}
|
|
604
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,cAAc,EACd,eAAe,GAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EACL,KAAK,EACL,IAAI,EACJ,iBAAiB,EACjB,KAAK,EACL,aAAa,EACb,YAAY,GACb,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AASzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,sBAAsB,CAAoC,GAAM,EAAE,WAAmB;IAC5F,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,2BAA2B,CAAC,GAAG,CAAC,CAAC;IAC9D,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,cAAc,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM,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