@zuvia-software-solutions/code-mapper 2.3.10 → 2.3.11
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.
- package/dist/cli/analyze.js +13 -9
- package/package.json +1 -1
package/dist/cli/analyze.js
CHANGED
|
@@ -291,6 +291,7 @@ export const analyzeCommand = async (inputPath, options) => {
|
|
|
291
291
|
}
|
|
292
292
|
// Phase 4: Embeddings (90-98%)
|
|
293
293
|
const stats = getStats(db);
|
|
294
|
+
let embeddingFailed = false;
|
|
294
295
|
if (options?.embeddings) {
|
|
295
296
|
recordPhase('embeddings');
|
|
296
297
|
updateBar(90, 'Generating embeddings...');
|
|
@@ -301,7 +302,7 @@ export const analyzeCommand = async (inputPath, options) => {
|
|
|
301
302
|
const { spawn: spawnChild } = await import('child_process');
|
|
302
303
|
const { fileURLToPath } = await import('url');
|
|
303
304
|
const mlxScript = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'models', 'mlx-embedder.py');
|
|
304
|
-
await new Promise((resolve
|
|
305
|
+
await new Promise((resolve) => {
|
|
305
306
|
// Use spawn (not execFile) — no internal buffer limit, streams only.
|
|
306
307
|
// execFile buffers all stdout in memory which causes OOM/kill on large codebases.
|
|
307
308
|
const proc = spawnChild('python3', [mlxScript, 'batch', dbPath, '--dims', '256', '--max-tokens', '2048'], {
|
|
@@ -310,21 +311,23 @@ export const analyzeCommand = async (inputPath, options) => {
|
|
|
310
311
|
let stderrBuf = '';
|
|
311
312
|
proc.stderr?.on('data', (chunk) => {
|
|
312
313
|
stderrBuf += chunk.toString();
|
|
313
|
-
// Keep only last 10KB of stderr for error reporting
|
|
314
314
|
if (stderrBuf.length > 10240)
|
|
315
315
|
stderrBuf = stderrBuf.slice(-10240);
|
|
316
316
|
});
|
|
317
317
|
proc.on('close', (code) => {
|
|
318
318
|
if (code !== 0) {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
319
|
+
// Non-fatal: index is already saved, just embeddings failed
|
|
320
|
+
console.error(`\n Warning: Embedding failed (exit code ${code}). Index saved without embeddings.`);
|
|
321
|
+
if (stderrBuf.trim())
|
|
322
|
+
console.error(` ${stderrBuf.trim().split('\n').slice(-3).join('\n ')}`);
|
|
323
|
+
embeddingFailed = true;
|
|
324
324
|
}
|
|
325
|
+
resolve();
|
|
325
326
|
});
|
|
326
327
|
proc.on('error', (err) => {
|
|
327
|
-
|
|
328
|
+
console.error(`\n Warning: Embedding failed: ${err.message}. Index saved without embeddings.`);
|
|
329
|
+
embeddingFailed = true;
|
|
330
|
+
resolve();
|
|
328
331
|
});
|
|
329
332
|
// Stream progress from Python's JSON lines on stdout
|
|
330
333
|
let lineBuf = '';
|
|
@@ -422,7 +425,8 @@ export const analyzeCommand = async (inputPath, options) => {
|
|
|
422
425
|
process.stdout.write('\x1b[2K');
|
|
423
426
|
// Summary
|
|
424
427
|
const embeddingsCached = cachedEmbeddings.length > 0;
|
|
425
|
-
|
|
428
|
+
const embeddingNote = embeddingFailed ? ' [embeddings failed — re-run with --embeddings]' : embeddingsCached ? ` [${cachedEmbeddings.length} embeddings cached]` : '';
|
|
429
|
+
console.log(`\n Repository indexed successfully (${totalTime}s)${embeddingNote}\n`);
|
|
426
430
|
console.log(` ${stats.nodes.toLocaleString()} nodes | ${stats.edges.toLocaleString()} edges | ${pipelineResult.communityResult?.stats.totalCommunities || 0} clusters | ${pipelineResult.processResult?.stats.totalProcesses || 0} flows`);
|
|
427
431
|
// Resource usage
|
|
428
432
|
const cpuEnd = process.cpuUsage(cpuStart);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuvia-software-solutions/code-mapper",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.11",
|
|
4
4
|
"description": "Graph-powered code intelligence for AI agents. Index any codebase, query via MCP or CLI.",
|
|
5
5
|
"author": "Abhigyan Patwari",
|
|
6
6
|
"license": "PolyForm-Noncommercial-1.0.0",
|