MCPcopy Create free account
hub / github.com/freecodexyz/free-code / removeProjectHistory

Function removeProjectHistory

src/utils/config.ts:986–1009  ·  view source on GitHub ↗

* Removes history field from projects (migrated to history.jsonl) * @internal

(
  projects: Record<string, ProjectConfig> | undefined,
)

Source from the content-addressed store, hash-verified

984 * @internal
985 */
986function 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)
1012const CONFIG_FRESHNESS_POLL_MS = 1000

Callers 1

saveGlobalConfigFunction · 0.85

Calls 1

entriesMethod · 0.80

Tested by

no test coverage detected