* Removes history field from projects (migrated to history.jsonl) * @internal
( projects: Record<string, ProjectConfig> | undefined, )
| 984 | * @internal |
| 985 | */ |
| 986 | function removeProjectHistory( |
| 987 | projects: Record<string, ProjectConfig> | undefined, |
| 988 | ): Record<string, ProjectConfig> | undefined { |
| 989 | if (!projects) { |
| 990 | return projects |
| 991 | } |
| 992 | |
| 993 | const cleanedProjects: Record<string, ProjectConfig> = {} |
| 994 | let needsCleaning = false |
| 995 | |
| 996 | for (const [path, projectConfig] of Object.entries(projects)) { |
| 997 | // history is removed from the type but may exist in old configs |
| 998 | const legacy = projectConfig as ProjectConfig & { history?: unknown } |
| 999 | if (legacy.history !== undefined) { |
| 1000 | needsCleaning = true |
| 1001 | const { history, ...cleanedConfig } = legacy |
| 1002 | cleanedProjects[path] = cleanedConfig |
| 1003 | } else { |
| 1004 | cleanedProjects[path] = projectConfig |
| 1005 | } |
| 1006 | } |
| 1007 | |
| 1008 | return needsCleaning ? cleanedProjects : projects |
| 1009 | } |
| 1010 | |
| 1011 | // fs.watchFile poll interval for detecting writes from other instances (ms) |
| 1012 | const CONFIG_FRESHNESS_POLL_MS = 1000 |
no test coverage detected