MCPcopy
hub / github.com/codeaashu/claude-code / syncTeamMemory

Function syncTeamMemory

src/services/teamMemorySync/index.ts:1153–1191  ·  view source on GitHub ↗
(state: SyncState)

Source from the content-addressed store, hash-verified

1151 * Push uses conflict resolution (retries on 412) via pushTeamMemory.
1152 */
1153export async function syncTeamMemory(state: SyncState): Promise<{
1154 success: boolean
1155 filesPulled: number
1156 filesPushed: number
1157 error?: string
1158}> {
1159 // 1. Pull remote → local (skip ETag cache for full sync)
1160 const pullResult = await pullTeamMemory(state, { skipEtagCache: true })
1161 if (!pullResult.success) {
1162 return {
1163 success: false,
1164 filesPulled: 0,
1165 filesPushed: 0,
1166 error: pullResult.error,
1167 }
1168 }
1169
1170 // 2. Push local → remote (with conflict resolution)
1171 const pushResult = await pushTeamMemory(state)
1172 if (!pushResult.success) {
1173 return {
1174 success: false,
1175 filesPulled: pullResult.filesWritten,
1176 filesPushed: 0,
1177 error: pushResult.error,
1178 }
1179 }
1180
1181 logForDebugging(
1182 `team-memory-sync: synced (pulled ${pullResult.filesWritten}, pushed ${pushResult.filesUploaded})`,
1183 { level: 'info' },
1184 )
1185
1186 return {
1187 success: true,
1188 filesPulled: pullResult.filesWritten,
1189 filesPushed: pushResult.filesUploaded,
1190 }
1191}
1192
1193// ─── Telemetry helpers ───────────────────────────────────────
1194

Callers

nothing calls this directly

Calls 3

pullTeamMemoryFunction · 0.85
pushTeamMemoryFunction · 0.85
logForDebuggingFunction · 0.85

Tested by

no test coverage detected