@zuvia-software-solutions/code-mapper 2.3.12 → 2.4.1

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.
@@ -228,7 +228,7 @@ def batch_mode(db_path, dims=256, max_tokens=2048):
228
228
  db.execute("ALTER TABLE embeddings ADD COLUMN textHash TEXT")
229
229
 
230
230
  # Query embeddable nodes — skip test/fixture files (BM25 covers them)
231
- labels = ('Function', 'Class', 'Method', 'Interface')
231
+ labels = ('Function', 'Class', 'Method', 'Interface', 'Const', 'Enum', 'TypeAlias', 'Namespace', 'Module', 'Struct')
232
232
  placeholders = ','.join('?' * len(labels))
233
233
  all_rows = db.execute(
234
234
  f"SELECT id, name, label, filePath, content, startLine, endLine, nameExpanded FROM nodes WHERE label IN ({placeholders})",
@@ -272,7 +272,23 @@ def batch_mode(db_path, dims=256, max_tokens=2048):
272
272
  for row in db.execute(f"SELECT e.sourceId, c.heuristicLabel FROM edges e JOIN nodes c ON c.id = e.targetId WHERE e.sourceId IN ({ph}) AND e.type = 'MEMBER_OF' AND c.label = 'Community' LIMIT {len(chunk_ids)}", chunk_ids):
273
273
  module_map[row[0]] = row[1]
274
274
 
275
- print(json.dumps({"phase": "context", "with_callers": len(caller_map), "with_module": len(module_map)}), flush=True)
275
+ # Batch fetch import names per file
276
+ import_map = {}
277
+ for ci in range(0, len(node_ids), CHUNK):
278
+ chunk_ids = node_ids[ci:ci+CHUNK]
279
+ ph = ','.join('?' * len(chunk_ids))
280
+ # Get unique file paths for these nodes
281
+ file_paths = [r[3] for r in rows if r[0] in set(chunk_ids)]
282
+ unique_files = list(set(file_paths))
283
+ if unique_files:
284
+ fph = ','.join('?' * len(unique_files))
285
+ for row in db.execute(
286
+ f"SELECT DISTINCT n.filePath, tn.name FROM nodes n JOIN edges e ON e.sourceId = n.id AND e.type = 'IMPORTS' JOIN nodes tn ON tn.id = e.targetId WHERE n.filePath IN ({fph}) LIMIT {len(unique_files)*10}",
287
+ unique_files
288
+ ):
289
+ import_map.setdefault(row[0], []).append(row[1])
290
+
291
+ print(json.dumps({"phase": "context", "with_callers": len(caller_map), "with_module": len(module_map), "with_imports": len(import_map)}), flush=True)
276
292
 
277
293
  # Get existing text hashes for skip detection
278
294
  existing_hashes = {}
@@ -367,13 +383,24 @@ def batch_mode(db_path, dims=256, max_tokens=2048):
367
383
  if comment:
368
384
  parts.append(comment)
369
385
 
386
+ # Directory context
387
+ dir_parts = filePath.rsplit('/', 2)
388
+ dir_context = '/'.join(dir_parts[:-1])[-40:] if '/' in filePath else ''
389
+
370
390
  # File + module location
371
391
  loc = f"File: {file_name}"
392
+ if dir_context:
393
+ loc += f" in {dir_context}"
372
394
  module = module_map.get(nid, "")
373
395
  if module:
374
396
  loc += f" | Module: {module}"
375
397
  parts.append(loc)
376
398
 
399
+ # Import context
400
+ file_imports = import_map.get(filePath, [])[:5]
401
+ if file_imports:
402
+ parts.append(f"Imports: {', '.join(file_imports)}")
403
+
377
404
  # Graph context
378
405
  callers = caller_map.get(nid, [])[:5]
379
406
  callees = callee_map.get(nid, [])[:5]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuvia-software-solutions/code-mapper",
3
- "version": "2.3.12",
3
+ "version": "2.4.1",
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",