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