()
| 1600 | }) |
| 1601 | |
| 1602 | export function getCurrentProjectConfig(): ProjectConfig { |
| 1603 | if (process.env.NODE_ENV === 'test') { |
| 1604 | return TEST_PROJECT_CONFIG_FOR_TESTING |
| 1605 | } |
| 1606 | |
| 1607 | const absolutePath = getProjectPathForConfig() |
| 1608 | const config = getGlobalConfig() |
| 1609 | |
| 1610 | if (!config.projects) { |
| 1611 | return DEFAULT_PROJECT_CONFIG |
| 1612 | } |
| 1613 | |
| 1614 | const projectConfig = config.projects[absolutePath] ?? DEFAULT_PROJECT_CONFIG |
| 1615 | // Not sure how this became a string |
| 1616 | // TODO: Fix upstream |
| 1617 | if (typeof projectConfig.allowedTools === 'string') { |
| 1618 | projectConfig.allowedTools = |
| 1619 | (safeParseJSON(projectConfig.allowedTools) as string[]) ?? [] |
| 1620 | } |
| 1621 | |
| 1622 | return projectConfig |
| 1623 | } |
| 1624 | |
| 1625 | export function saveCurrentProjectConfig( |
| 1626 | updater: (currentConfig: ProjectConfig) => ProjectConfig, |
no test coverage detected