grepmax 0.17.5 → 0.17.6

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.
@@ -533,6 +533,26 @@ class TreeSitterChunker {
533
533
  if (name)
534
534
  definedSymbols.push(name);
535
535
  const referencedSymbols = [];
536
+ // Reduce a constructor / instanceof operand to a simple symbol name:
537
+ // bare identifier -> its text; `ns.ClassName` member -> the rightmost
538
+ // property (`ClassName`). Returns null for shapes we can't name.
539
+ const simpleRefName = (node) => {
540
+ var _a, _b;
541
+ if (!node)
542
+ return null;
543
+ if (node.type === "member_expression") {
544
+ const prop = node.childForFieldName
545
+ ? node.childForFieldName("property")
546
+ : null;
547
+ return (_a = prop === null || prop === void 0 ? void 0 : prop.text) !== null && _a !== void 0 ? _a : null;
548
+ }
549
+ return (_b = node.text) !== null && _b !== void 0 ? _b : null;
550
+ };
551
+ const addRef = (name) => {
552
+ if (name && !referencedSymbols.includes(name)) {
553
+ referencedSymbols.push(name);
554
+ }
555
+ };
536
556
  const extractRefs = (n) => {
537
557
  var _a, _b, _c, _d, _e, _f, _g, _h;
538
558
  // Handle JS/TS (call_expression), Python (call), Lua (function_call)
@@ -597,6 +617,41 @@ class TreeSitterChunker {
597
617
  }
598
618
  }
599
619
  }
620
+ // Identifier-as-value references (TS/JS): edges the call-expression
621
+ // capture above misses. These feed the graph-walk consumers (PPR,
622
+ // `gmax dead <ClassName>`, audit) that need class/enum references,
623
+ // not just method-call names.
624
+ if (n.type === "new_expression") {
625
+ // `new ClassName(...)` — constructor is always a type reference.
626
+ const ctor = n.childForFieldName
627
+ ? n.childForFieldName("constructor")
628
+ : null;
629
+ addRef(simpleRefName(ctor));
630
+ }
631
+ else if (n.type === "binary_expression") {
632
+ // `x instanceof ClassName` — the right operand is a type reference.
633
+ const op = n.childForFieldName
634
+ ? n.childForFieldName("operator")
635
+ : null;
636
+ if ((op === null || op === void 0 ? void 0 : op.text) === "instanceof") {
637
+ const right = n.childForFieldName
638
+ ? n.childForFieldName("right")
639
+ : null;
640
+ addRef(simpleRefName(right));
641
+ }
642
+ }
643
+ else if (n.type === "member_expression") {
644
+ // `ClassName.MEMBER` / `Enum.MEMBER` — capture the object only when
645
+ // it looks like a type/namespace (Capitalized identifier), so we
646
+ // get `ErrorCodes` from `ErrorCodes.VALIDATION` without flooding
647
+ // the graph with `this.x` / `req.body` / lowercase-local access.
648
+ const obj = n.childForFieldName
649
+ ? n.childForFieldName("object")
650
+ : null;
651
+ if (obj && obj.type === "identifier" && /^[A-Z]/.test(obj.text)) {
652
+ addRef(obj.text);
653
+ }
654
+ }
600
655
  for (const child of (_h = n.namedChildren) !== null && _h !== void 0 ? _h : []) {
601
656
  extractRefs(child);
602
657
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grepmax",
3
- "version": "0.17.5",
3
+ "version": "0.17.6",
4
4
  "author": "Robert Owens <78518764+reowens@users.noreply.github.com>",
5
5
  "homepage": "https://github.com/reowens/grepmax",
6
6
  "bugs": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grepmax",
3
- "version": "0.17.5",
3
+ "version": "0.17.6",
4
4
  "description": "Semantic code search for Claude Code. Automatically indexes your project and provides intelligent search capabilities.",
5
5
  "author": {
6
6
  "name": "Robert Owens",