grepmax 0.26.32 → 0.26.33

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.
Files changed (50) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/commands/context.js +12 -8
  3. package/dist/commands/doctor.js +7 -9
  4. package/dist/commands/droid.js +2 -1
  5. package/dist/commands/extract.js +8 -11
  6. package/dist/commands/impact.js +5 -8
  7. package/dist/commands/mcp.js +38 -41
  8. package/dist/commands/peek.js +6 -9
  9. package/dist/commands/search-output.js +10 -11
  10. package/dist/commands/search-run.js +5 -4
  11. package/dist/commands/search-skeletons.js +2 -1
  12. package/dist/commands/search.js +5 -4
  13. package/dist/commands/serve.js +2 -1
  14. package/dist/commands/similar.js +7 -6
  15. package/dist/commands/skeleton.js +17 -22
  16. package/dist/commands/test-find.js +5 -8
  17. package/dist/config.js +6 -5
  18. package/dist/eval-oss.js +4 -3
  19. package/dist/eval-tokens.js +4 -4
  20. package/dist/eval.js +2 -5
  21. package/dist/index.js +4 -3
  22. package/dist/lib/daemon/daemon.js +36 -29
  23. package/dist/lib/daemon/graph-handler.js +2 -1
  24. package/dist/lib/daemon/mlx-server-manager.js +10 -9
  25. package/dist/lib/daemon/rows-handler.js +11 -13
  26. package/dist/lib/daemon/search-handler.js +6 -5
  27. package/dist/lib/daemon/vector-handler.js +2 -1
  28. package/dist/lib/daemon/watcher-manager.js +4 -2
  29. package/dist/lib/graph/graph-builder.js +4 -10
  30. package/dist/lib/graph/graph-traversal.js +0 -0
  31. package/dist/lib/index/batch-processor.js +13 -12
  32. package/dist/lib/index/chunker.js +22 -23
  33. package/dist/lib/index/syncer.js +2 -2
  34. package/dist/lib/llm/investigate.js +5 -4
  35. package/dist/lib/llm/review.js +2 -1
  36. package/dist/lib/llm/tools.js +6 -5
  37. package/dist/lib/output/agent-search-formatter.js +3 -2
  38. package/dist/lib/output/compact-results.js +16 -12
  39. package/dist/lib/search/searcher.js +11 -13
  40. package/dist/lib/setup/model-loader.js +1 -1
  41. package/dist/lib/skeleton/body-fields.js +2 -1
  42. package/dist/lib/skeleton/skeletonizer.js +8 -7
  43. package/dist/lib/store/vector-db.js +6 -5
  44. package/dist/lib/utils/formatter.js +5 -4
  45. package/dist/lib/utils/stale-hint.js +4 -3
  46. package/dist/lib/utils/store-access.js +2 -1
  47. package/dist/lib/workers/embeddings/granite.js +2 -1
  48. package/dist/lib/workers/pool.js +14 -10
  49. package/package.json +2 -3
  50. package/plugins/grepmax/.claude-plugin/plugin.json +1 -1
@@ -192,11 +192,8 @@ class GraphBuilder {
192
192
  // first row when no candidate shares the center's file or family.
193
193
  const selfRow = rows.find((r) => { var _a; return String((_a = r.path) !== null && _a !== void 0 ? _a : "") === centerFile; });
194
194
  const familyRow = centerFamily
195
- ? rows.find((r) => {
196
- var _a;
197
- return (0, languages_1.languageFamilyForPath)(String((_a = r.path) !== null && _a !== void 0 ? _a : "")) ===
198
- centerFamily;
199
- })
195
+ ? rows.find((r) => { var _a; return (0, languages_1.languageFamilyForPath)(String((_a = r.path) !== null && _a !== void 0 ? _a : "")) ===
196
+ centerFamily; })
200
197
  : undefined;
201
198
  calleeNodes.push(this.mapRowToNode(((_a = selfRow !== null && selfRow !== void 0 ? selfRow : familyRow) !== null && _a !== void 0 ? _a : rows[0]), name, "center"));
202
199
  }
@@ -371,11 +368,8 @@ class GraphBuilder {
371
368
  return null;
372
369
  let r = rows[0];
373
370
  if (anchorFamily) {
374
- const match = rows.find((row) => {
375
- var _a;
376
- return (0, languages_1.languageFamilyForPath)(String((_a = row.path) !== null && _a !== void 0 ? _a : "")) ===
377
- anchorFamily;
378
- });
371
+ const match = rows.find((row) => { var _a; return (0, languages_1.languageFamilyForPath)(String((_a = row.path) !== null && _a !== void 0 ? _a : "")) ===
372
+ anchorFamily; });
379
373
  if (match)
380
374
  r = match;
381
375
  }
Binary file
@@ -94,8 +94,7 @@ class ProjectBatchProcessor {
94
94
  this.onTerminalFailure = opts.onTerminalFailure;
95
95
  this.onPathSuccess = opts.onPathSuccess;
96
96
  this.runOperation = opts.runOperation;
97
- this.filePolicy =
98
- (_b = opts.filePolicy) !== null && _b !== void 0 ? _b : new file_policy_1.ProjectFilePolicy(opts.projectRoot);
97
+ this.filePolicy = (_b = opts.filePolicy) !== null && _b !== void 0 ? _b : new file_policy_1.ProjectFilePolicy(opts.projectRoot);
99
98
  this.wtag = `watch:${path.basename(opts.projectRoot)}`;
100
99
  this.concurrency = Math.max(1, Math.floor((_c = opts.concurrency) !== null && _c !== void 0 ? _c : DEFAULT_BATCH_CONCURRENCY));
101
100
  const taskTimeoutMs = (() => {
@@ -232,7 +231,8 @@ class ProjectBatchProcessor {
232
231
  }
233
232
  processBatch(operationSignal) {
234
233
  return __awaiter(this, void 0, void 0, function* () {
235
- var _a, _b, _c, _d, _e, _f;
234
+ var _a, _b, _c, _d;
235
+ var _e, _f;
236
236
  if (this.closed || this.processing || this.pending.size === 0)
237
237
  return;
238
238
  const diskPressure = this.vectorDb.checkDiskPressure();
@@ -244,7 +244,7 @@ class ProjectBatchProcessor {
244
244
  const now = Date.now();
245
245
  let taken = 0;
246
246
  for (const [absPath, event] of this.pending) {
247
- if (((_a = this.retryAt.get(absPath)) !== null && _a !== void 0 ? _a : 0) > now)
247
+ if (((_e = this.retryAt.get(absPath)) !== null && _e !== void 0 ? _e : 0) > now)
248
248
  continue;
249
249
  batch.set(absPath, event);
250
250
  const forceGeneration = this.forcedReprocess.get(absPath);
@@ -291,17 +291,18 @@ class ProjectBatchProcessor {
291
291
  const completed = new Set();
292
292
  const retryFailures = new Set();
293
293
  const requeuePath = (absPath, event, failed) => {
294
- var _a, _b;
294
+ var _a;
295
+ var _b;
295
296
  if (this.pending.has(absPath))
296
297
  return;
297
298
  if (failed) {
298
- const retry = (0, watcher_batch_1.computePathRetry)((_a = this.retryCount.get(absPath)) !== null && _a !== void 0 ? _a : 0, MAX_RETRIES, DEBOUNCE_MS);
299
+ const retry = (0, watcher_batch_1.computePathRetry)((_b = this.retryCount.get(absPath)) !== null && _b !== void 0 ? _b : 0, MAX_RETRIES, DEBOUNCE_MS);
299
300
  if (!retry.retry) {
300
301
  (0, logger_1.log)(this.wtag, `Dropped ${path.basename(absPath)} after ${MAX_RETRIES} retries`);
301
302
  this.retryCount.delete(absPath);
302
303
  this.retryAt.delete(absPath);
303
304
  this.terminalFailures.add(absPath);
304
- (_b = this.onTerminalFailure) === null || _b === void 0 ? void 0 : _b.call(this, absPath);
305
+ (_a = this.onTerminalFailure) === null || _a === void 0 ? void 0 : _a.call(this, absPath);
305
306
  return;
306
307
  }
307
308
  this.retryCount.set(absPath, retry.failures);
@@ -519,7 +520,7 @@ class ProjectBatchProcessor {
519
520
  }
520
521
  const duration = Date.now() - start;
521
522
  if (reindexed > 0) {
522
- (_b = this.onReindex) === null || _b === void 0 ? void 0 : _b.call(this, reindexed, duration);
523
+ (_a = this.onReindex) === null || _a === void 0 ? void 0 : _a.call(this, reindexed, duration);
523
524
  }
524
525
  this.recentBatches.push({ files: batch.size, reindexed });
525
526
  if (this.recentBatches.length > ProjectBatchProcessor.RECENT_BATCH_WINDOW) {
@@ -536,7 +537,7 @@ class ProjectBatchProcessor {
536
537
  this.retryCount.delete(absPath);
537
538
  this.retryAt.delete(absPath);
538
539
  this.terminalFailures.delete(absPath);
539
- (_c = this.onPathSuccess) === null || _c === void 0 ? void 0 : _c.call(this, absPath);
540
+ (_b = this.onPathSuccess) === null || _b === void 0 ? void 0 : _b.call(this, absPath);
540
541
  }
541
542
  // Trigger compaction if fragments are accumulating
542
543
  if (reindexed > 0 && diskPressure !== "critical") {
@@ -593,12 +594,12 @@ class ProjectBatchProcessor {
593
594
  continue;
594
595
  if (this.pending.has(absPath))
595
596
  continue;
596
- const retry = (0, watcher_batch_1.computePathRetry)((_d = this.retryCount.get(absPath)) !== null && _d !== void 0 ? _d : 0, MAX_RETRIES, DEBOUNCE_MS);
597
+ const retry = (0, watcher_batch_1.computePathRetry)((_f = this.retryCount.get(absPath)) !== null && _f !== void 0 ? _f : 0, MAX_RETRIES, DEBOUNCE_MS);
597
598
  if (!retry.retry) {
598
599
  this.retryCount.delete(absPath);
599
600
  this.retryAt.delete(absPath);
600
601
  this.terminalFailures.add(absPath);
601
- (_e = this.onTerminalFailure) === null || _e === void 0 ? void 0 : _e.call(this, absPath);
602
+ (_c = this.onTerminalFailure) === null || _c === void 0 ? void 0 : _c.call(this, absPath);
602
603
  dropped++;
603
604
  droppedPaths.push(absPath);
604
605
  continue;
@@ -644,7 +645,7 @@ class ProjectBatchProcessor {
644
645
  }
645
646
  }
646
647
  if (!this.closed)
647
- (_f = this.onBatchSettled) === null || _f === void 0 ? void 0 : _f.call(this);
648
+ (_d = this.onBatchSettled) === null || _d === void 0 ? void 0 : _d.call(this);
648
649
  }
649
650
  });
650
651
  }
@@ -623,12 +623,9 @@ class TreeSitterChunker {
623
623
  "property_identifier",
624
624
  "field_identifier", // Go
625
625
  ]);
626
- const isLeafId = (n) => {
627
- var _a, _b;
628
- return !!n &&
629
- LEAF_ID_TYPES.has(n.type) &&
630
- ((_b = (_a = n.namedChildren) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 0;
631
- };
626
+ const isLeafId = (n) => { var _a; var _b; return !!n &&
627
+ LEAF_ID_TYPES.has(n.type) &&
628
+ ((_b = (_a = n.namedChildren) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 0; };
632
629
  const firstNamed = (n) => { var _a, _b; return (_b = ((_a = n.namedChildren) !== null && _a !== void 0 ? _a : [])[0]) !== null && _b !== void 0 ? _b : null; };
633
630
  // Resolve the type name out of an instantiation node (`new Foo`,
634
631
  // `Foo{}`, `new Foo()`), preferring an explicit `type` field and
@@ -693,7 +690,8 @@ class TreeSitterChunker {
693
690
  // in `Literal["x"]`) fall out via the kind + Capitalized gates.
694
691
  const TYPE_NAME_LEAF_TYPES = new Set(["identifier", "name"]);
695
692
  const harvestTypeLeaves = (node) => {
696
- var _a, _b, _c;
693
+ var _a;
694
+ var _b, _c;
697
695
  if (!node)
698
696
  return;
699
697
  if (((_b = (_a = node.namedChildren) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 0) {
@@ -708,7 +706,8 @@ class TreeSitterChunker {
708
706
  harvestTypeLeaves(c);
709
707
  };
710
708
  const extractRefs = (n) => {
711
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
709
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
710
+ var _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
712
711
  // Handle JS/TS (call_expression), Python (call), Lua (function_call)
713
712
  if (n.type === "call_expression" ||
714
713
  n.type === "call" ||
@@ -749,14 +748,14 @@ class TreeSitterChunker {
749
748
  else {
750
749
  // Swift/Kotlin: call_expression has no "function" field;
751
750
  // the callable is a positional child
752
- const firstChild = ((_a = n.namedChildren) !== null && _a !== void 0 ? _a : [])[0];
751
+ const firstChild = ((_l = n.namedChildren) !== null && _l !== void 0 ? _l : [])[0];
753
752
  if (firstChild) {
754
753
  let funcName = firstChild.text;
755
754
  let isMemberCall = false;
756
755
  if (firstChild.type === "navigation_expression") {
757
- const suffix = ((_b = firstChild.namedChildren) !== null && _b !== void 0 ? _b : []).find((c) => c.type === "navigation_suffix");
756
+ const suffix = ((_m = firstChild.namedChildren) !== null && _m !== void 0 ? _m : []).find((c) => c.type === "navigation_suffix");
758
757
  const methodId = suffix
759
- ? ((_c = suffix.namedChildren) !== null && _c !== void 0 ? _c : []).find((c) => c.type === "simple_identifier")
758
+ ? ((_o = suffix.namedChildren) !== null && _o !== void 0 ? _o : []).find((c) => c.type === "simple_identifier")
760
759
  : null;
761
760
  if (methodId) {
762
761
  funcName = methodId.text;
@@ -772,13 +771,13 @@ class TreeSitterChunker {
772
771
  // JSX elements: <Component /> or <Component>
773
772
  if (n.type === "jsx_self_closing_element" ||
774
773
  n.type === "jsx_opening_element") {
775
- const nameChild = ((_d = n.namedChildren) !== null && _d !== void 0 ? _d : []).find((c) => c.type === "identifier" ||
774
+ const nameChild = ((_p = n.namedChildren) !== null && _p !== void 0 ? _p : []).find((c) => c.type === "identifier" ||
776
775
  c.type === "member_expression" ||
777
776
  c.type === "nested_identifier");
778
777
  if (nameChild) {
779
778
  // Only capture PascalCase components (skip HTML tags like div, span)
780
779
  const name = nameChild.type === "member_expression"
781
- ? ((_g = (_f = (_e = nameChild.childForFieldName) === null || _e === void 0 ? void 0 : _e.call(nameChild, "property")) === null || _f === void 0 ? void 0 : _f.text) !== null && _g !== void 0 ? _g : nameChild.text)
780
+ ? ((_q = (_b = (_a = nameChild.childForFieldName) === null || _a === void 0 ? void 0 : _a.call(nameChild, "property")) === null || _b === void 0 ? void 0 : _b.text) !== null && _q !== void 0 ? _q : nameChild.text)
782
781
  : nameChild.text;
783
782
  if (name && /^[A-Z]/.test(name)) {
784
783
  referencedSymbols.push(name);
@@ -822,7 +821,7 @@ class TreeSitterChunker {
822
821
  }
823
822
  else if (n.type === "is_pattern_expression") {
824
823
  // C# — `x is BeyondError`: the type sits in a constant_pattern.
825
- const cp = ((_h = n.namedChildren) !== null && _h !== void 0 ? _h : []).find((c) => c.type === "constant_pattern");
824
+ const cp = ((_r = n.namedChildren) !== null && _r !== void 0 ? _r : []).find((c) => c.type === "constant_pattern");
826
825
  const id = cp ? firstNamed(cp) : null;
827
826
  if (isLeafId(id) && id && /^[A-Z]/.test(id.text))
828
827
  addRef(id.text);
@@ -854,7 +853,7 @@ class TreeSitterChunker {
854
853
  // type_identifier and are already covered. Reduce `extends ns.Base`
855
854
  // to `Base`; skip type arguments (Shape 4 handles those).
856
855
  if (n.type === "extends_clause") {
857
- for (const c of (_j = n.namedChildren) !== null && _j !== void 0 ? _j : []) {
856
+ for (const c of (_s = n.namedChildren) !== null && _s !== void 0 ? _s : []) {
858
857
  if (c.type === "type_arguments")
859
858
  continue;
860
859
  const sup = simpleRefName(c);
@@ -876,16 +875,16 @@ class TreeSitterChunker {
876
875
  // `x: Foo`, `-> Bar`, `v: Baz = …`, and `class C(Base)` bases.
877
876
  if (n.type === "typed_parameter" ||
878
877
  n.type === "typed_default_parameter") {
879
- harvestTypeLeaves((_l = (_k = n.childForFieldName) === null || _k === void 0 ? void 0 : _k.call(n, "type")) !== null && _l !== void 0 ? _l : null);
878
+ harvestTypeLeaves((_t = (_c = n.childForFieldName) === null || _c === void 0 ? void 0 : _c.call(n, "type")) !== null && _t !== void 0 ? _t : null);
880
879
  }
881
880
  else if (n.type === "function_definition") {
882
- harvestTypeLeaves((_o = (_m = n.childForFieldName) === null || _m === void 0 ? void 0 : _m.call(n, "return_type")) !== null && _o !== void 0 ? _o : null);
881
+ harvestTypeLeaves((_u = (_d = n.childForFieldName) === null || _d === void 0 ? void 0 : _d.call(n, "return_type")) !== null && _u !== void 0 ? _u : null);
883
882
  }
884
883
  else if (n.type === "assignment") {
885
- harvestTypeLeaves((_q = (_p = n.childForFieldName) === null || _p === void 0 ? void 0 : _p.call(n, "type")) !== null && _q !== void 0 ? _q : null);
884
+ harvestTypeLeaves((_v = (_e = n.childForFieldName) === null || _e === void 0 ? void 0 : _e.call(n, "type")) !== null && _v !== void 0 ? _v : null);
886
885
  }
887
886
  else if (n.type === "class_definition") {
888
- harvestTypeLeaves((_s = (_r = n.childForFieldName) === null || _r === void 0 ? void 0 : _r.call(n, "superclasses")) !== null && _s !== void 0 ? _s : null);
887
+ harvestTypeLeaves((_w = (_f = n.childForFieldName) === null || _f === void 0 ? void 0 : _f.call(n, "superclasses")) !== null && _w !== void 0 ? _w : null);
889
888
  }
890
889
  }
891
890
  else if (lang === "c_sharp") {
@@ -894,10 +893,10 @@ class TreeSitterChunker {
894
893
  if (n.type === "parameter" ||
895
894
  n.type === "property_declaration" ||
896
895
  n.type === "variable_declaration") {
897
- harvestTypeLeaves((_u = (_t = n.childForFieldName) === null || _t === void 0 ? void 0 : _t.call(n, "type")) !== null && _u !== void 0 ? _u : null);
896
+ harvestTypeLeaves((_x = (_g = n.childForFieldName) === null || _g === void 0 ? void 0 : _g.call(n, "type")) !== null && _x !== void 0 ? _x : null);
898
897
  }
899
898
  else if (n.type === "method_declaration") {
900
- harvestTypeLeaves((_w = (_v = n.childForFieldName) === null || _v === void 0 ? void 0 : _v.call(n, "returns")) !== null && _w !== void 0 ? _w : null);
899
+ harvestTypeLeaves((_y = (_h = n.childForFieldName) === null || _h === void 0 ? void 0 : _h.call(n, "returns")) !== null && _y !== void 0 ? _y : null);
901
900
  }
902
901
  else if (n.type === "base_list") {
903
902
  harvestTypeLeaves(n);
@@ -909,11 +908,11 @@ class TreeSitterChunker {
909
908
  // (`return_type`), and the extends / implements clauses.
910
909
  if (n.type === "simple_parameter" ||
911
910
  n.type === "property_declaration") {
912
- harvestTypeLeaves((_y = (_x = n.childForFieldName) === null || _x === void 0 ? void 0 : _x.call(n, "type")) !== null && _y !== void 0 ? _y : null);
911
+ harvestTypeLeaves((_z = (_j = n.childForFieldName) === null || _j === void 0 ? void 0 : _j.call(n, "type")) !== null && _z !== void 0 ? _z : null);
913
912
  }
914
913
  else if (n.type === "function_definition" ||
915
914
  n.type === "method_declaration") {
916
- harvestTypeLeaves((_0 = (_z = n.childForFieldName) === null || _z === void 0 ? void 0 : _z.call(n, "return_type")) !== null && _0 !== void 0 ? _0 : null);
915
+ harvestTypeLeaves((_0 = (_k = n.childForFieldName) === null || _k === void 0 ? void 0 : _k.call(n, "return_type")) !== null && _0 !== void 0 ? _0 : null);
917
916
  }
918
917
  else if (n.type === "base_clause" ||
919
918
  n.type === "class_interface_clause") {
@@ -701,8 +701,8 @@ function initialSync(options) {
701
701
  }
702
702
  // Only close resources we own (not injected by daemon)
703
703
  if (!injected) {
704
- yield (metaCache === null || metaCache === void 0 ? void 0 : metaCache.close());
705
- yield (ownedVectorDb === null || ownedVectorDb === void 0 ? void 0 : ownedVectorDb.close());
704
+ yield metaCache === null || metaCache === void 0 ? void 0 : metaCache.close();
705
+ yield ownedVectorDb === null || ownedVectorDb === void 0 ? void 0 : ownedVectorDb.close();
706
706
  }
707
707
  }
708
708
  });
@@ -94,9 +94,10 @@ function finalizeAnswer(content, modelName) {
94
94
  }
95
95
  function investigate(opts) {
96
96
  return __awaiter(this, void 0, void 0, function* () {
97
- var _a, _b, _c;
97
+ var _a, _b;
98
+ var _c;
98
99
  const { question, projectRoot, verbose = false } = opts;
99
- const maxRounds = (_a = opts.maxRounds) !== null && _a !== void 0 ? _a : prompts_1.MAX_ROUNDS;
100
+ const maxRounds = (_c = opts.maxRounds) !== null && _c !== void 0 ? _c : prompts_1.MAX_ROUNDS;
100
101
  const config = (0, config_1.getLlmConfig)();
101
102
  const modelName = path.basename(config.model, path.extname(config.model));
102
103
  const client = new openai_1.default({
@@ -140,7 +141,7 @@ function investigate(opts) {
140
141
  tool_choice: "auto",
141
142
  temperature: 0,
142
143
  });
143
- if (!((_b = response.choices) === null || _b === void 0 ? void 0 : _b.length)) {
144
+ if (!((_a = response.choices) === null || _a === void 0 ? void 0 : _a.length)) {
144
145
  throw new Error("LLM returned empty response");
145
146
  }
146
147
  const message = response.choices[0].message;
@@ -235,7 +236,7 @@ function investigate(opts) {
235
236
  messages,
236
237
  temperature: 0,
237
238
  });
238
- if (!((_c = response.choices) === null || _c === void 0 ? void 0 : _c.length)) {
239
+ if (!((_b = response.choices) === null || _b === void 0 ? void 0 : _b.length)) {
239
240
  throw new Error("LLM returned empty response");
240
241
  }
241
242
  const answer = finalizeAnswer(response.choices[0].message.content, modelName);
@@ -59,7 +59,8 @@ const report_1 = require("./report");
59
59
  const tools_1 = require("./tools");
60
60
  function reviewCommit(opts) {
61
61
  return __awaiter(this, void 0, void 0, function* () {
62
- var _a, _b, _c, _d;
62
+ var _a, _b, _c;
63
+ var _d;
63
64
  const { commitRef, projectRoot, verbose = false } = opts;
64
65
  const wallStart = Date.now();
65
66
  // 1. Extract diff
@@ -180,15 +180,16 @@ function executeSearch(args, ctx) {
180
180
  if (!resp.data || resp.data.length === 0)
181
181
  return "(no results)";
182
182
  const lines = resp.data.map((r) => {
183
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
184
- const absPath = String((_c = (_b = (_a = r.metadata) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : r.path) !== null && _c !== void 0 ? _c : "");
183
+ var _a, _b;
184
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l;
185
+ const absPath = String((_d = (_c = (_a = r.metadata) === null || _a === void 0 ? void 0 : _a.path) !== null && _c !== void 0 ? _c : r.path) !== null && _d !== void 0 ? _d : "");
185
186
  const rp = rel(absPath, ctx.projectRoot);
186
- const defs = (0, arrow_1.toArr)((_d = r.definedSymbols) !== null && _d !== void 0 ? _d : r.defined_symbols);
187
+ const defs = (0, arrow_1.toArr)((_e = r.definedSymbols) !== null && _e !== void 0 ? _e : r.defined_symbols);
187
188
  const sym = defs[0] || "(anonymous)";
188
- const role = String((_e = r.role) !== null && _e !== void 0 ? _e : "IMPL")
189
+ const role = String((_f = r.role) !== null && _f !== void 0 ? _f : "IMPL")
189
190
  .slice(0, 4)
190
191
  .toUpperCase();
191
- const startLine = (_j = (_h = (_f = r.startLine) !== null && _f !== void 0 ? _f : (_g = r.generated_metadata) === null || _g === void 0 ? void 0 : _g.start_line) !== null && _h !== void 0 ? _h : r.start_line) !== null && _j !== void 0 ? _j : 0;
192
+ const startLine = (_j = (_h = (_g = r.startLine) !== null && _g !== void 0 ? _g : (_b = r.generated_metadata) === null || _b === void 0 ? void 0 : _b.start_line) !== null && _h !== void 0 ? _h : r.start_line) !== null && _j !== void 0 ? _j : 0;
192
193
  const hint = String((_l = (_k = r.text) !== null && _k !== void 0 ? _k : r.content) !== null && _l !== void 0 ? _l : "")
193
194
  .split("\n")[0]
194
195
  .slice(0, 100);
@@ -40,8 +40,9 @@ function chunkPath(chunk) {
40
40
  return String(chunk.path || (metadata === null || metadata === void 0 ? void 0 : metadata.path) || "");
41
41
  }
42
42
  function chunkStartLine(chunk) {
43
- var _a, _b, _c, _d;
44
- return Math.max(1, Number((_d = (_b = (_a = chunk.startLine) !== null && _a !== void 0 ? _a : chunk.start_line) !== null && _b !== void 0 ? _b : (_c = chunk.generated_metadata) === null || _c === void 0 ? void 0 : _c.start_line) !== null && _d !== void 0 ? _d : 0) + 1);
43
+ var _a;
44
+ var _b, _c, _d;
45
+ return Math.max(1, Number((_d = (_c = (_b = chunk.startLine) !== null && _b !== void 0 ? _b : chunk.start_line) !== null && _c !== void 0 ? _c : (_a = chunk.generated_metadata) === null || _a === void 0 ? void 0 : _a.start_line) !== null && _d !== void 0 ? _d : 0) + 1);
45
46
  }
46
47
  function definedSymbols(chunk) {
47
48
  var _a;
@@ -40,7 +40,8 @@ exports.resultCountHeader = resultCountHeader;
40
40
  const path = __importStar(require("node:path"));
41
41
  function toTextResults(data) {
42
42
  return data.map((r) => {
43
- var _a, _b, _c, _d, _e, _f;
43
+ var _a, _b, _c, _d, _e;
44
+ var _f;
44
45
  const rawPath = typeof ((_a = r.metadata) === null || _a === void 0 ? void 0 : _a.path) === "string"
45
46
  ? r.metadata.path
46
47
  : "Unknown path";
@@ -49,23 +50,24 @@ function toTextResults(data) {
49
50
  : 0;
50
51
  const end = typeof ((_c = r.generated_metadata) === null || _c === void 0 ? void 0 : _c.end_line) === "number"
51
52
  ? r.generated_metadata.end_line
52
- : start + Math.max(0, ((_e = (_d = r.generated_metadata) === null || _d === void 0 ? void 0 : _d.num_lines) !== null && _e !== void 0 ? _e : 1) - 1);
53
+ : start + Math.max(0, ((_f = (_d = r.generated_metadata) === null || _d === void 0 ? void 0 : _d.num_lines) !== null && _f !== void 0 ? _f : 1) - 1);
53
54
  return {
54
55
  path: rawPath,
55
56
  score: r.score,
56
57
  content: r.text || "",
57
- chunk_type: (_f = r.generated_metadata) === null || _f === void 0 ? void 0 : _f.type,
58
+ chunk_type: (_e = r.generated_metadata) === null || _e === void 0 ? void 0 : _e.type,
58
59
  start_line: start,
59
60
  end_line: end,
60
61
  };
61
62
  });
62
63
  }
63
64
  function getPreviewText(chunk) {
64
- var _a, _b, _c, _d, _e;
65
+ var _a, _b;
66
+ var _c, _d, _e;
65
67
  const maxLen = 140;
66
- const lines = (_b = (_a = chunk.text) === null || _a === void 0 ? void 0 : _a.split("\n").map((l) => l.trim()).filter(Boolean)) !== null && _b !== void 0 ? _b : [];
67
- let preview = (_c = lines[0]) !== null && _c !== void 0 ? _c : "";
68
- if (!preview && ((_d = chunk.defined_symbols) === null || _d === void 0 ? void 0 : _d.length)) {
68
+ const lines = (_c = (_a = chunk.text) === null || _a === void 0 ? void 0 : _a.split("\n").map((l) => l.trim()).filter(Boolean)) !== null && _c !== void 0 ? _c : [];
69
+ let preview = (_d = lines[0]) !== null && _d !== void 0 ? _d : "";
70
+ if (!preview && ((_b = chunk.defined_symbols) === null || _b === void 0 ? void 0 : _b.length)) {
69
71
  preview = (_e = chunk.defined_symbols[0]) !== null && _e !== void 0 ? _e : "";
70
72
  }
71
73
  if (preview.length > maxLen) {
@@ -75,7 +77,8 @@ function getPreviewText(chunk) {
75
77
  }
76
78
  function toCompactHits(data) {
77
79
  return data.map((chunk) => {
78
- var _a, _b, _c, _d, _e, _f;
80
+ var _a, _b, _c, _d, _e;
81
+ var _f;
79
82
  const rawPath = typeof ((_a = chunk.metadata) === null || _a === void 0 ? void 0 : _a.path) === "string"
80
83
  ? chunk.metadata.path
81
84
  : "Unknown path";
@@ -84,7 +87,7 @@ function toCompactHits(data) {
84
87
  : 0;
85
88
  const end = typeof ((_c = chunk.generated_metadata) === null || _c === void 0 ? void 0 : _c.end_line) === "number"
86
89
  ? chunk.generated_metadata.end_line
87
- : start + Math.max(0, ((_e = (_d = chunk.generated_metadata) === null || _d === void 0 ? void 0 : _d.num_lines) !== null && _e !== void 0 ? _e : 1) - 1);
90
+ : start + Math.max(0, ((_f = (_d = chunk.generated_metadata) === null || _d === void 0 ? void 0 : _d.num_lines) !== null && _f !== void 0 ? _f : 1) - 1);
88
91
  return {
89
92
  path: rawPath,
90
93
  range: `${start + 1}-${end + 1}`,
@@ -97,7 +100,7 @@ function toCompactHits(data) {
97
100
  ? chunk.defined_symbols.slice(0, 3)
98
101
  : typeof chunk.defined_symbols === "string"
99
102
  ? [chunk.defined_symbols]
100
- : typeof ((_f = chunk.defined_symbols) === null || _f === void 0 ? void 0 : _f.toArray) === "function"
103
+ : typeof ((_e = chunk.defined_symbols) === null || _e === void 0 ? void 0 : _e.toArray) === "function"
101
104
  ? chunk.defined_symbols.toArray().slice(0, 3)
102
105
  : [],
103
106
  preview: getPreviewText(chunk),
@@ -232,10 +235,11 @@ function formatCompactTable(hits, projectRoot, query, opts) {
232
235
  return formatCompactPretty(hits, projectRoot, query, termWidth, true);
233
236
  }
234
237
  function resultCountHeader(results, maxCount) {
235
- var _a, _b, _c;
238
+ var _a;
239
+ var _b, _c;
236
240
  const files = new Set();
237
241
  for (const r of results) {
238
- const p = (_c = (_a = r.path) !== null && _a !== void 0 ? _a : (_b = r.metadata) === null || _b === void 0 ? void 0 : _b.path) !== null && _c !== void 0 ? _c : "";
242
+ const p = (_c = (_b = r.path) !== null && _b !== void 0 ? _b : (_a = r.metadata) === null || _a === void 0 ? void 0 : _a.path) !== null && _c !== void 0 ? _c : "";
239
243
  if (p)
240
244
  files.add(p);
241
245
  }
@@ -268,12 +268,13 @@ class Searcher {
268
268
  };
269
269
  }
270
270
  applyStructureBoost(record, score, intent) {
271
- var _a, _b, _c, _d;
271
+ var _a;
272
+ var _b, _c, _d;
272
273
  let adjusted = score;
273
274
  // Item 6: Anchors are recall helpers, not rank contenders
274
275
  if (record.is_anchor) {
275
276
  // Minimal penalty to break ties
276
- const anchorPenalty = Number.parseFloat((_a = process.env.GMAX_ANCHOR_PENALTY) !== null && _a !== void 0 ? _a : "") || 0.99;
277
+ const anchorPenalty = Number.parseFloat((_b = process.env.GMAX_ANCHOR_PENALTY) !== null && _b !== void 0 ? _b : "") || 0.99;
277
278
  adjusted *= anchorPenalty;
278
279
  }
279
280
  else {
@@ -301,7 +302,7 @@ class Searcher {
301
302
  boostFactor *= 1.1;
302
303
  }
303
304
  // --- Complexity/Orchestration Boost (User Requested) ---
304
- const refs = ((_b = record.referenced_symbols) === null || _b === void 0 ? void 0 : _b.length) || 0;
305
+ const refs = ((_a = record.referenced_symbols) === null || _a === void 0 ? void 0 : _a.length) || 0;
305
306
  if (refs > 5) {
306
307
  // Small boost for non-trivial functions
307
308
  boostFactor *= 1.1;
@@ -757,16 +758,13 @@ class Searcher {
757
758
  if (doRerank && rerankCandidates.length > 0) {
758
759
  const scores = yield pool.rerank({
759
760
  query: queryMatrixRaw,
760
- docs: rerankCandidates.map((doc) => {
761
- var _a;
762
- return ({
763
- colbert: (_a = doc.colbert) !== null && _a !== void 0 ? _a : [],
764
- scale: typeof doc.colbert_scale === "number" ? doc.colbert_scale : 1,
765
- token_ids: Array.isArray(doc.doc_token_ids)
766
- ? doc.doc_token_ids
767
- : undefined,
768
- });
769
- }),
761
+ docs: rerankCandidates.map((doc) => { var _a; return ({
762
+ colbert: (_a = doc.colbert) !== null && _a !== void 0 ? _a : [],
763
+ scale: typeof doc.colbert_scale === "number" ? doc.colbert_scale : 1,
764
+ token_ids: Array.isArray(doc.doc_token_ids)
765
+ ? doc.doc_token_ids
766
+ : undefined,
767
+ }); }),
770
768
  colbertDim,
771
769
  }, signal);
772
770
  for (const [idx, doc] of rerankCandidates.entries()) {
@@ -67,7 +67,7 @@ function downloadModels() {
67
67
  const runningTs = path.extname(__filename) === ".ts";
68
68
  const isDev = (runningTs && hasTsWorker) || (hasTsWorker && !hasJsWorker);
69
69
  const workerPath = isDev ? tsWorkerPath : jsWorkerPath;
70
- const execArgv = isDev ? ["-r", "ts-node/register"] : [];
70
+ const execArgv = isDev ? ["--import", require.resolve("tsx")] : [];
71
71
  const worker = new node_worker_threads_1.Worker(workerPath, { execArgv });
72
72
  worker.on("message", (msg) => {
73
73
  if (msg.type === "progress") {
@@ -164,7 +164,8 @@ exports.CONTAINER_TYPES = {
164
164
  * Check if a node type is a container (holds methods).
165
165
  */
166
166
  function isContainerType(langId, nodeType) {
167
- var _a, _b;
167
+ var _a;
168
+ var _b;
168
169
  return (_b = (_a = exports.CONTAINER_TYPES[langId]) === null || _a === void 0 ? void 0 : _a.includes(nodeType)) !== null && _b !== void 0 ? _b : false;
169
170
  }
170
171
  /**
@@ -374,7 +374,8 @@ class Skeletonizer {
374
374
  const refs = [];
375
375
  const seen = new Set();
376
376
  const extract = (n) => {
377
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
377
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
378
+ var _k, _l, _m, _o;
378
379
  if (n.type === "call_expression" ||
379
380
  n.type === "call" ||
380
381
  n.type === "function_call") {
@@ -401,13 +402,13 @@ class Skeletonizer {
401
402
  else {
402
403
  // Swift/Kotlin: call_expression has no "function" field;
403
404
  // the callable is a positional child
404
- const firstChild = ((_d = n.namedChildren) !== null && _d !== void 0 ? _d : [])[0];
405
+ const firstChild = ((_k = n.namedChildren) !== null && _k !== void 0 ? _k : [])[0];
405
406
  if (firstChild) {
406
407
  let funcName = firstChild.text;
407
408
  if (firstChild.type === "navigation_expression") {
408
- const suffix = ((_e = firstChild.namedChildren) !== null && _e !== void 0 ? _e : []).find((c) => c.type === "navigation_suffix");
409
+ const suffix = ((_l = firstChild.namedChildren) !== null && _l !== void 0 ? _l : []).find((c) => c.type === "navigation_suffix");
409
410
  const methodId = suffix
410
- ? ((_f = suffix.namedChildren) !== null && _f !== void 0 ? _f : []).find((c) => c.type === "simple_identifier")
411
+ ? ((_m = suffix.namedChildren) !== null && _m !== void 0 ? _m : []).find((c) => c.type === "simple_identifier")
411
412
  : null;
412
413
  if (methodId)
413
414
  funcName = methodId.text;
@@ -423,7 +424,7 @@ class Skeletonizer {
423
424
  n.type === "invocation_expression" // C#
424
425
  ) {
425
426
  // Java/C# method calls
426
- const nameNode = ((_g = n.childForFieldName) === null || _g === void 0 ? void 0 : _g.call(n, "name")) || ((_h = n.childForFieldName) === null || _h === void 0 ? void 0 : _h.call(n, "function"));
427
+ const nameNode = ((_d = n.childForFieldName) === null || _d === void 0 ? void 0 : _d.call(n, "name")) || ((_e = n.childForFieldName) === null || _e === void 0 ? void 0 : _e.call(n, "function"));
427
428
  if (nameNode) {
428
429
  refs.push(nameNode.text);
429
430
  seen.add(nameNode.text);
@@ -433,7 +434,7 @@ class Skeletonizer {
433
434
  n.type === "command" || // Ruby
434
435
  n.type === "command_call" // Ruby
435
436
  ) {
436
- const nameNode = ((_j = n.childForFieldName) === null || _j === void 0 ? void 0 : _j.call(n, "method")) || ((_k = n.childForFieldName) === null || _k === void 0 ? void 0 : _k.call(n, "name"));
437
+ const nameNode = ((_f = n.childForFieldName) === null || _f === void 0 ? void 0 : _f.call(n, "method")) || ((_g = n.childForFieldName) === null || _g === void 0 ? void 0 : _g.call(n, "name"));
437
438
  if (nameNode) {
438
439
  refs.push(nameNode.text);
439
440
  seen.add(nameNode.text);
@@ -447,7 +448,7 @@ class Skeletonizer {
447
448
  c.type === "nested_identifier");
448
449
  if (nameChild) {
449
450
  const name = nameChild.type === "member_expression"
450
- ? ((_o = (_m = (_l = nameChild.childForFieldName) === null || _l === void 0 ? void 0 : _l.call(nameChild, "property")) === null || _m === void 0 ? void 0 : _m.text) !== null && _o !== void 0 ? _o : nameChild.text)
451
+ ? ((_o = (_j = (_h = nameChild.childForFieldName) === null || _h === void 0 ? void 0 : _h.call(nameChild, "property")) === null || _j === void 0 ? void 0 : _j.text) !== null && _o !== void 0 ? _o : nameChild.text)
451
452
  : nameChild.text;
452
453
  if (name && /^[A-Z]/.test(name) && !seen.has(name)) {
453
454
  seen.add(name);
@@ -315,7 +315,8 @@ class VectorDB {
315
315
  * defer idle shutdown so we don't tear down LanceDB mid-optimize. */
316
316
  /** Bytes held by LanceDB's index + metadata caches (0 before first connect). */
317
317
  cacheSizeBytes() {
318
- var _a, _b;
318
+ var _a;
319
+ var _b;
319
320
  try {
320
321
  return Number((_b = (_a = this.session) === null || _a === void 0 ? void 0 : _a.sizeBytes()) !== null && _b !== void 0 ? _b : 0);
321
322
  }
@@ -574,7 +575,7 @@ class VectorDB {
574
575
  return result;
575
576
  }
576
577
  finally {
577
- yield (temporaryExclusiveLease === null || temporaryExclusiveLease === void 0 ? void 0 : temporaryExclusiveLease.release());
578
+ yield temporaryExclusiveLease === null || temporaryExclusiveLease === void 0 ? void 0 : temporaryExclusiveLease.release();
578
579
  }
579
580
  }));
580
581
  }
@@ -850,8 +851,7 @@ class VectorDB {
850
851
  rec.defined_symbols = (_g = rec.defined_symbols) !== null && _g !== void 0 ? _g : [];
851
852
  rec.referenced_symbols = (_h = rec.referenced_symbols) !== null && _h !== void 0 ? _h : [];
852
853
  rec.type_referenced_symbols = (_j = rec.type_referenced_symbols) !== null && _j !== void 0 ? _j : [];
853
- rec.member_referenced_symbols =
854
- (_k = rec.member_referenced_symbols) !== null && _k !== void 0 ? _k : [];
854
+ rec.member_referenced_symbols = (_k = rec.member_referenced_symbols) !== null && _k !== void 0 ? _k : [];
855
855
  rec.imports = (_l = rec.imports) !== null && _l !== void 0 ? _l : [];
856
856
  rec.exports = (_m = rec.exports) !== null && _m !== void 0 ? _m : [];
857
857
  rec.role = (_o = rec.role) !== null && _o !== void 0 ? _o : "";
@@ -936,7 +936,8 @@ class VectorDB {
936
936
  }
937
937
  createVectorIndexUnsafe(rebuild, retries, checkOnly) {
938
938
  return __awaiter(this, void 0, void 0, function* () {
939
- var _a, _b;
939
+ var _a;
940
+ var _b;
940
941
  const table = yield this.ensureTableUnsafe();
941
942
  const rowCount = yield table.countRows();
942
943
  if (rowCount < (0, ann_config_1.annMinRows)())