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

Function syncEdit

__tests__/sync-object-members.test.ts:90–100  ·  view source on GitHub ↗

Index `before`, write `after` over it, sync; return the graph and what a full index of `after` holds.

(before: Files, after: Files)

Source from the content-addressed store, hash-verified

88
89/** Index `before`, write `after` over it, sync; return the graph and what a full index of `after` holds. */
90async function syncEdit(before: Files, after: Files): Promise<{ root: string; graph: CodeGraph; full: string[] }> {
91 const root = tempRoot();
92 write(root, before);
93 const graph = await index(root);
94 write(root, after);
95 await graph.sync();
96 const fullRoot = tempRoot();
97 write(fullRoot, { ...before, ...after });
98 const full = stateOf(fullRoot, await index(fullRoot));
99 return { root, graph, full };
100}
101
102const LIB = (members: string): string =>
103 `function foo() { return 1; }\nfunction bar() { return 2; }\nexport function baz() { return 3; }\nexport const __testing = { ${members} };\n`;

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