MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / syncEdit

Function syncEdit

__tests__/sync-memo-lifetime.test.ts:72–81  ·  view source on GitHub ↗

Index `before`, write `after` over it, sync on the same object; the state, and a full index's of the final tree.

(before: Files, after: Files)

Source from the content-addressed store, hash-verified

70
71/** Index `before`, write `after` over it, sync on the same object; the state, and a full index's of the final tree. */
72async function syncEdit(before: Files, after: Files): Promise<{ state: string[]; full: string[] }> {
73 const root = tempRoot();
74 write(root, before);
75 const graph = await index(root);
76 write(root, after);
77 await graph.sync();
78 const fullRoot = tempRoot();
79 write(fullRoot, { ...before, ...after });
80 return { state: stateOf(root, graph), full: stateOf(fullRoot, await index(fullRoot)) };
81}
82
83const held = (state: string[], text: string): string[] => state.filter((line) => line.includes(text));
84

Callers 1

Calls 5

tempRootFunction · 0.70
writeFunction · 0.70
indexFunction · 0.70
stateOfFunction · 0.70
syncMethod · 0.45

Tested by

no test coverage detected