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