code-graph-context 2.12.6 → 2.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,15 +28,23 @@ export class LocalEmbeddingsService {
28
28
  const totalBatches = Math.ceil(texts.length / safeBatchSize);
29
29
  for (let i = 0; i < texts.length; i += safeBatchSize) {
30
30
  const batch = texts.slice(i, i + safeBatchSize);
31
- const batchIndex = Math.floor(i / batchSize) + 1;
31
+ const batchIndex = Math.floor(i / safeBatchSize) + 1;
32
+ console.error(`[embedding] Batch ${batchIndex}/${totalBatches} (${batch.length} texts)`);
32
33
  await debugLog('Embedding batch progress', {
33
34
  provider: 'local',
34
35
  batchIndex,
35
36
  totalBatches,
36
37
  batchSize: batch.length,
37
38
  });
38
- const batchResults = await sidecar.embed(batch);
39
- results.push(...batchResults);
39
+ try {
40
+ const batchResults = await sidecar.embed(batch);
41
+ results.push(...batchResults);
42
+ }
43
+ catch (error) {
44
+ const msg = error instanceof Error ? error.message : String(error);
45
+ console.error(`[embedding] Batch ${batchIndex}/${totalBatches} FAILED: ${msg}`);
46
+ throw error;
47
+ }
40
48
  }
41
49
  return results;
42
50
  }
@@ -132,11 +132,16 @@ export class GraphGeneratorHandler {
132
132
  // Batch embed all texts that need it
133
133
  if (nodesNeedingEmbedding.length > 0) {
134
134
  const texts = nodesNeedingEmbedding.map((n) => n.text);
135
+ const totalBatches = Math.ceil(texts.length / EMBEDDING_BATCH_CONFIG.maxBatchSize);
136
+ console.error(`[embedding] Starting ${texts.length} texts in ${totalBatches} batches (batch_size=${EMBEDDING_BATCH_CONFIG.maxBatchSize})`);
135
137
  try {
136
138
  const embeddings = await this.embeddingsService.embedTextsInBatches(texts, EMBEDDING_BATCH_CONFIG.maxBatchSize);
137
139
  // Map embeddings back to their nodes
140
+ let embeddedCount = 0;
138
141
  nodesNeedingEmbedding.forEach((item, i) => {
139
142
  const embedding = embeddings[i];
143
+ if (embedding)
144
+ embeddedCount++;
140
145
  nodeResults[item.index] = {
141
146
  ...item.node,
142
147
  labels: embedding ? [...item.node.labels, GraphGeneratorHandler.EMBEDDED_LABEL] : item.node.labels,
@@ -146,15 +151,17 @@ export class GraphGeneratorHandler {
146
151
  },
147
152
  };
148
153
  });
154
+ console.error(`[embedding] Done: ${embeddedCount}/${texts.length} nodes embedded`);
149
155
  await debugLog('Batch embedding completed', {
150
156
  totalNodes: nodes.length,
151
- nodesEmbedded: nodesNeedingEmbedding.length,
152
- batchesUsed: Math.ceil(texts.length / EMBEDDING_BATCH_CONFIG.maxBatchSize),
157
+ nodesEmbedded: embeddedCount,
158
+ batchesUsed: totalBatches,
153
159
  });
154
160
  }
155
161
  catch (error) {
156
- // DON'T silently continue - propagate the error so user knows what's wrong
157
- await debugLog('Embedding failed', { error: error instanceof Error ? error.message : String(error) });
162
+ const msg = error instanceof Error ? error.message : String(error);
163
+ console.error(`[embedding] FAILED: ${msg}`);
164
+ await debugLog('Embedding failed', { error: msg });
158
165
  throw error;
159
166
  }
160
167
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-graph-context",
3
- "version": "2.12.6",
3
+ "version": "2.12.7",
4
4
  "description": "MCP server that builds code graphs to provide rich context to LLMs",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/drewdrewH/code-graph-context#readme",