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

Function syncEdit

__tests__/sync-barrel-retarget.test.ts:84–94  ·  view source on GitHub ↗

Index `before`, write `after` over it, sync (scoped to `paths` when given); return the graph and a full index of the final tree.

(before: Files, after: Files, paths?: string[])

Source from the content-addressed store, hash-verified

82
83/** Index `before`, write `after` over it, sync (scoped to `paths` when given); return the graph and a full index of the final tree. */
84async function syncEdit(before: Files, after: Files, paths?: string[]): Promise<{ root: string; graph: CodeGraph; full: string[] }> {
85 const root = tempRoot();
86 write(root, before);
87 const graph = await index(root);
88 expect(fooCalledBy(graph)).toEqual(['src/a.ts::foo']);
89 write(root, after);
90 await graph.sync(paths ? { paths } : {});
91 const fullRoot = tempRoot();
92 write(fullRoot, { ...before, ...after });
93 return { root, graph, full: stateOf(fullRoot, await index(fullRoot)) };
94}
95
96const BEFORE: Files = {
97 'package.json': JSON.stringify({ name: 'app' }),

Callers 1

Calls 6

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

Tested by

no test coverage detected