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

Function removeProjectHistory

src/utils/config.ts:1040–1063  ·  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

1038 * @internal
1039 */
1040function removeProjectHistory(
1041 projects: Record<string, ProjectConfig> | undefined,
1042): Record<string, ProjectConfig> | undefined {
1043 if (!projects) {
1044 return projects
1045 }
1046
1047 const cleanedProjects: Record<string, ProjectConfig> = {}
1048 let needsCleaning = false
1049
1050 for (const [path, projectConfig] of Object.entries(projects)) {
1051 // history is removed from the type but may exist in old configs
1052 const legacy = projectConfig as ProjectConfig & { history?: unknown }
1053 if (legacy.history !== undefined) {
1054 needsCleaning = true
1055 const { history, ...cleanedConfig } = legacy
1056 cleanedProjects[path] = cleanedConfig
1057 } else {
1058 cleanedProjects[path] = projectConfig
1059 }
1060 }
1061
1062 return needsCleaning ? cleanedProjects : projects
1063}
1064
1065// fs.watchFile poll interval for detecting writes from other instances (ms)
1066const CONFIG_FRESHNESS_POLL_MS = 1000

Callers 1

saveGlobalConfigFunction · 0.85

Calls 1

entriesMethod · 0.80

Tested by

no test coverage detected