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