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