()
| 1620 | }) |
| 1621 | |
| 1622 | export function getCurrentProjectConfig(): ProjectConfig { |
| 1623 | if (process.env.NODE_ENV === 'test') { |
| 1624 | return TEST_PROJECT_CONFIG_FOR_TESTING |
| 1625 | } |
| 1626 | |
| 1627 | const absolutePath = getProjectPathForConfig() |
| 1628 | const config = getGlobalConfig() |
| 1629 | |
| 1630 | if (!config.projects) { |
| 1631 | return DEFAULT_PROJECT_CONFIG |
| 1632 | } |
| 1633 | |
| 1634 | const projectConfig = config.projects[absolutePath] ?? DEFAULT_PROJECT_CONFIG |
| 1635 | // Not sure how this became a string |
| 1636 | // TODO: Fix upstream |
| 1637 | if (typeof projectConfig.allowedTools === 'string') { |
| 1638 | projectConfig.allowedTools = |
| 1639 | (safeParseJSON(projectConfig.allowedTools) as string[]) ?? [] |
| 1640 | } |
| 1641 | |
| 1642 | return projectConfig |
| 1643 | } |
| 1644 | |
| 1645 | export function saveCurrentProjectConfig( |
| 1646 | updater: (currentConfig: ProjectConfig) => ProjectConfig, |
no test coverage detected