()
| 1340 | let configReadingAllowed = false |
| 1341 | |
| 1342 | export function enableConfigs(): void { |
| 1343 | if (configReadingAllowed) { |
| 1344 | // Ensure this is idempotent |
| 1345 | return |
| 1346 | } |
| 1347 | |
| 1348 | const startTime = Date.now() |
| 1349 | logForDiagnosticsNoPII('info', 'enable_configs_started') |
| 1350 | |
| 1351 | // Any reads to configuration before this flag is set show an console warning |
| 1352 | // to prevent us from adding config reading during module initialization |
| 1353 | configReadingAllowed = true |
| 1354 | // We only check the global config because currently all the configs share a file |
| 1355 | getConfig( |
| 1356 | getGlobalClaudeFile(), |
| 1357 | createDefaultGlobalConfig, |
| 1358 | true /* throw on invalid */, |
| 1359 | ) |
| 1360 | |
| 1361 | logForDiagnosticsNoPII('info', 'enable_configs_completed', { |
| 1362 | duration_ms: Date.now() - startTime, |
| 1363 | }) |
| 1364 | } |
| 1365 | |
| 1366 | /** |
| 1367 | * Returns the directory where config backup files are stored. |
no test coverage detected