* Removes history field from projects (migrated to history.jsonl) * @internal
( projects: Record<string, ProjectConfig> | undefined, )
| 972 | * @internal |
| 973 | */ |
| 974 | function removeProjectHistory( |
| 975 | projects: Record<string, ProjectConfig> | undefined, |
| 976 | ): Record<string, ProjectConfig> | undefined { |
| 977 | if (!projects) { |
| 978 | return projects |
| 979 | } |
| 980 | |
| 981 | const cleanedProjects: Record<string, ProjectConfig> = {} |
| 982 | let needsCleaning = false |
| 983 | |
| 984 | for (const [path, projectConfig] of Object.entries(projects)) { |
| 985 | // history is removed from the type but may exist in old configs |
| 986 | const legacy = projectConfig as ProjectConfig & { history?: unknown } |
| 987 | if (legacy.history !== undefined) { |
| 988 | needsCleaning = true |
| 989 | const { history, ...cleanedConfig } = legacy |
| 990 | cleanedProjects[path] = cleanedConfig |
| 991 | } else { |
| 992 | cleanedProjects[path] = projectConfig |
| 993 | } |
| 994 | } |
| 995 | |
| 996 | return needsCleaning ? cleanedProjects : projects |
| 997 | } |
| 998 | |
| 999 | // fs.watchFile poll interval for detecting writes from other instances (ms) |
| 1000 | const CONFIG_FRESHNESS_POLL_MS = 1000 |
no test coverage detected