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

Function declarationNames

graph-ui/src/traces/bug-paths.ts:405–445  ·  view source on GitHub ↗
(
    index: BugPathIndex,
    project: string,
    filePaths: readonly string[],
)

Source from the content-addressed store, hash-verified

403 * asked about it.
404 */
405export async function declarationNames(
406 index: BugPathIndex,
407 project: string,
408 filePaths: readonly string[],
409): Promise<Map<string, { qualifiedName?: string; line?: number }>> {
410 const found = new Map<string, { qualifiedName?: string; line?: number }>();
411 const files = [...new Set(filePaths.filter((path) => path.length > 0))].sort(compareText);
412 if (files.length === 0) {
413 return found;
414 }
415 for (const label of CALLABLE_LABELS) {
416 const query = declarationsInFiles(label, files);
417 if (query === undefined) {
418 continue;
419 }
420 let rows: Record<string, string>[];
421 try {
422 rows = await index.queryRows(project, query);
423 } catch {
424 continue;
425 }
426 for (const row of rows) {
427 const name = row[COLUMNS.declarations[0]] ?? '';
428 const filePath = row[COLUMNS.declarations[2]] ?? '';
429 if (name.length === 0) {
430 continue;
431 }
432 const key = nodeKey({ name, filePath });
433 if (found.has(key)) {
434 continue;
435 }
436 const qualifiedName = row[COLUMNS.declarations[1]] ?? '';
437 const line = toOptionalNumber(row[COLUMNS.declarations[3]]);
438 found.set(key, {
439 ...(qualifiedName.length > 0 ? { qualifiedName } : {}),
440 ...(line === undefined ? {} : { line }),
441 });
442 }
443 }
444 return found;
445}
446
447/**
448 * Whether the index records one named call.

Callers 1

bugPathsFunction · 0.85

Calls 4

declarationsInFilesFunction · 0.90
toOptionalNumberFunction · 0.90
nodeKeyFunction · 0.85
queryRowsMethod · 0.65

Tested by

no test coverage detected