gitnexus 1.6.6-rc.136 → 1.6.6-rc.138

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.
@@ -36,11 +36,21 @@ export function splitNamespaceUseDeclaration(stmtNode) {
36
36
  if (groupNode !== null) {
37
37
  return decomposeGrouped(stmtNode, groupNode, qualifier);
38
38
  }
39
- // Single use clause (possibly aliased).
40
- const spec = parseSingleUseClause(stmtNode, qualifier);
41
- if (spec === null)
42
- return [];
43
- return [buildImportMatch(stmtNode, spec)];
39
+ // Non-grouped: iterate namespace_use_clause children (one per comma-separated
40
+ // import in `use A, B, C;`). The first import is also a namespace_use_clause
41
+ // in the grammar version used by the monorepo; namespace_name child handling
42
+ // was removed after confirming the clause wrapper covers all positions.
43
+ const out = [];
44
+ for (let i = 0; i < stmtNode.namedChildCount; i++) {
45
+ const child = stmtNode.namedChild(i);
46
+ if (child === null || child.type !== 'namespace_use_clause')
47
+ continue;
48
+ const spec = parseUseClause(child, qualifier);
49
+ if (spec !== null) {
50
+ out.push(buildImportMatch(stmtNode, spec));
51
+ }
52
+ }
53
+ return out;
44
54
  }
45
55
  // ── Qualifier detection ────────────────────────────────────────────────────
46
56
  /**
@@ -61,29 +71,6 @@ function detectQualifier(node) {
61
71
  return 'const';
62
72
  return 'namespace';
63
73
  }
64
- // ── Single clause parsing ──────────────────────────────────────────────────
65
- function parseSingleUseClause(node, qualifier) {
66
- // A plain `namespace_use_declaration` has one or more
67
- // `namespace_use_clause` named children (each clause is one import,
68
- // comma-separated for multiple). For the single case there is one.
69
- const clause = findNamedChild(node, 'namespace_use_clause');
70
- if (clause !== null)
71
- return parseUseClause(clause, qualifier);
72
- // Older grammar versions may put the qualified_name directly under
73
- // the declaration node. Check for a qualified_name or name child.
74
- const qualName = findNamedChild(node, 'qualified_name') ?? findNamedChild(node, 'name');
75
- if (qualName === null)
76
- return null;
77
- const source = qualName.text.trim();
78
- if (source === '')
79
- return null;
80
- return {
81
- kind: qualifier,
82
- source,
83
- name: lastSegment(source),
84
- atNode: node,
85
- };
86
- }
87
74
  function parseUseClause(clause, qualifier) {
88
75
  // namespace_use_clause:
89
76
  // qualified_name (or name)
@@ -136,8 +123,10 @@ function parseUseClause(clause, qualifier) {
136
123
  * `const` keyword inside the group.
137
124
  */
138
125
  function decomposeGrouped(stmtNode, groupNode, outerQualifier) {
139
- // The prefix is the qualified_name that precedes the `{...}` group.
140
- const prefixNode = findNamedChild(stmtNode, 'qualified_name') ?? findNamedChild(stmtNode, 'name');
126
+ // The prefix is the namespace_name that precedes the `{...}` group.
127
+ // tree-sitter-php emits the leading path as a namespace_name child,
128
+ // not qualified_name.
129
+ const prefixNode = findNamedChild(stmtNode, 'namespace_name') ?? findNamedChild(stmtNode, 'name');
141
130
  const prefix = prefixNode?.text.trim() ?? '';
142
131
  const out = [];
143
132
  for (let i = 0; i < groupNode.namedChildCount; i++) {
@@ -51,6 +51,7 @@ const PHP_SCOPE_QUERY = `
51
51
  (interface_declaration) @scope.class
52
52
  (trait_declaration) @scope.class
53
53
  (enum_declaration) @scope.class
54
+ (anonymous_class) @scope.class
54
55
 
55
56
  (method_declaration) @scope.function
56
57
  (function_definition) @scope.function
@@ -71,6 +72,10 @@ const PHP_SCOPE_QUERY = `
71
72
  (enum_declaration
72
73
  name: (name) @declaration.name) @declaration.enum
73
74
 
75
+ ;; Enum case
76
+ (enum_case
77
+ name: (name) @declaration.name) @declaration.const
78
+
74
79
  ;; ── Declarations — methods / functions / constructors ─────────────────────
75
80
 
76
81
  (method_declaration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitnexus",
3
- "version": "1.6.6-rc.136",
3
+ "version": "1.6.6-rc.138",
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",