* A config file must parse to a plain object to be mergeable. A YAML file that * is syntactically valid but collapses to a scalar (`42`, `just a string`) or a * top-level array (`- a\n- b`) would otherwise be handed to deepMerge, whose * "type mismatch → override wins" rule replaces the ENTIRE co
(parsed: unknown)
| 75 | * We reject those here instead of clobbering. |
| 76 | */ |
| 77 | function isMergeableConfig(parsed: unknown): parsed is Partial<QodexConfig> { |
| 78 | return typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed); |
| 79 | } |
| 80 | |
| 81 | export async function loadConfig(cwd: string = process.cwd()): Promise<QodexConfig> { |
| 82 | await ensureQodexHome(); |