MCPcopy Index your code
hub / github.com/codeaashu/claude-code / removeProjectHistory

Function removeProjectHistory

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

964 * @internal
965 */
966function 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)
992const CONFIG_FRESHNESS_POLL_MS = 1000

Callers 1

saveGlobalConfigFunction · 0.85

Calls 1

entriesMethod · 0.80

Tested by

no test coverage detected