MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / graphFiles

Function graphFiles

graph-ui/tools/smoke-w4d.mjs:220–245  ·  view source on GitHub ↗

Den Graph-Baum rekursiv abfragen, so wie die Oberflaeche es tut.

(port, path = '', seen = new Set(), files = new Set(), dirs = new Set())

Source from the content-addressed store, hash-verified

218
219/** Den Graph-Baum rekursiv abfragen, so wie die Oberflaeche es tut. */
220async function graphFiles(port, path = '', seen = new Set(), files = new Set(), dirs = new Set()) {
221 if (seen.has(path)) {
222 return { files, dirs };
223 }
224 seen.add(path);
225 const query = new URLSearchParams({ project: PROJECT });
226 if (path.length > 0) {
227 query.set('path', path);
228 }
229 const response = await fetch(`http://127.0.0.1:${port}/api/tree?${query.toString()}`, {
230 headers: { Accept: 'application/json' },
231 });
232 const body = await response.json();
233 for (const child of Array.isArray(body?.children) ? body.children : []) {
234 if (typeof child?.path !== 'string' || child.path === '{}' || child.path.length === 0) {
235 continue;
236 }
237 if (child.kind === 'dir') {
238 dirs.add(child.path);
239 await graphFiles(port, child.path, seen, files, dirs);
240 } else if (!dirs.has(child.path)) {
241 files.add(child.path);
242 }
243 }
244 return { files, dirs };
245}
246
247/** Alle Scope-Seiten holen, bis der Server keine mehr meldet. */
248async function allScopeEntries(port) {

Callers 1

mainFunction · 0.85

Calls 1

jsonMethod · 0.65

Tested by

no test coverage detected