MCPcopy Create free account
hub / github.com/IAmUnbounded/devctx / syncBranchContext

Function syncBranchContext

devctx/src/core/context.ts:87–100  ·  view source on GitHub ↗
(branch: string)

Source from the content-addressed store, hash-verified

85 * Merges local entries with whatever is on disk (which may have been updated by git pull).
86 */
87export async function syncBranchContext(branch: string): Promise<ContextEntry[]> {
88 const dir = await getDevCtxDir();
89 const branchFile = path.join(dir, "branches", `${branch.replace(/\//g, "__")}.json`);
90
91 if (!fs.existsSync(branchFile)) return [];
92
93 const diskEntries: ContextEntry[] = JSON.parse(fs.readFileSync(branchFile, "utf-8"));
94
95 // Deduplicate (in case of merge conflicts resolved by git)
96 const deduped = mergeContexts([], diskEntries);
97 fs.writeFileSync(branchFile, JSON.stringify(deduped, null, 2));
98
99 return deduped;
100}
101

Callers

nothing calls this directly

Calls 2

getDevCtxDirFunction · 0.85
mergeContextsFunction · 0.85

Tested by

no test coverage detected