()
| 1668 | }) |
| 1669 | |
| 1670 | export function getCurrentProjectConfig(): ProjectConfig { |
| 1671 | if (process.env.NODE_ENV === 'test') { |
| 1672 | return TEST_PROJECT_CONFIG_FOR_TESTING |
| 1673 | } |
| 1674 | |
| 1675 | const absolutePath = getProjectPathForConfig() |
| 1676 | const config = getGlobalConfig() |
| 1677 | |
| 1678 | if (!config.projects) { |
| 1679 | return DEFAULT_PROJECT_CONFIG |
| 1680 | } |
| 1681 | |
| 1682 | const projectConfig = config.projects[absolutePath] ?? DEFAULT_PROJECT_CONFIG |
| 1683 | // Not sure how this became a string |
| 1684 | // TODO: Fix upstream |
| 1685 | if (typeof projectConfig.allowedTools === 'string') { |
| 1686 | projectConfig.allowedTools = |
| 1687 | (safeParseJSON(projectConfig.allowedTools) as string[]) ?? [] |
| 1688 | } |
| 1689 | |
| 1690 | return projectConfig |
| 1691 | } |
| 1692 | |
| 1693 | export function saveCurrentProjectConfig( |
| 1694 | updater: (currentConfig: ProjectConfig) => ProjectConfig, |
no test coverage detected