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

Method indexFiles

src/extraction/index.ts:2722–2764  ·  view source on GitHub ↗

* Index specific files

(filePaths: string[])

Source from the content-addressed store, hash-verified

2720 * Index specific files
2721 */
2722 async indexFiles(filePaths: string[]): Promise<IndexResult> {
2723 const startTime = Date.now();
2724 const errors: ExtractionError[] = [];
2725 let filesIndexed = 0;
2726 let filesSkipped = 0;
2727 let filesErrored = 0;
2728 let totalNodes = 0;
2729 let totalEdges = 0;
2730
2731 for (const filePath of filePaths) {
2732 const result = await this.indexFile(filePath);
2733
2734 if (result.errors.length > 0) {
2735 errors.push(...result.errors);
2736 }
2737
2738 if (result.nodes.length > 0) {
2739 filesIndexed++;
2740 totalNodes += result.nodes.length;
2741 totalEdges += result.edges.length;
2742 } else if (result.errors.some((e) => e.severity === 'error')) {
2743 filesErrored++;
2744 } else {
2745 const tracked = this.queries.getFileByPath(filePath);
2746 if (tracked && isFileLevelOnlyLanguage(tracked.language)) {
2747 filesIndexed++;
2748 } else {
2749 filesSkipped++;
2750 }
2751 }
2752 }
2753
2754 return {
2755 success: filesIndexed > 0 || errors.filter((e) => e.severity === 'error').length === 0,
2756 filesIndexed,
2757 filesSkipped,
2758 filesErrored,
2759 nodesCreated: totalNodes,
2760 edgesCreated: totalEdges,
2761 errors,
2762 durationMs: Date.now() - startTime,
2763 };
2764 }
2765
2766 /**
2767 * Index a single file

Callers

nothing calls this directly

Calls 4

indexFileMethod · 0.95
isFileLevelOnlyLanguageFunction · 0.90
pushMethod · 0.80
getFileByPathMethod · 0.80

Tested by

no test coverage detected