gitnexus 1.0.0

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 (110) hide show
  1. package/README.md +181 -0
  2. package/dist/cli/ai-context.d.ts +21 -0
  3. package/dist/cli/ai-context.js +219 -0
  4. package/dist/cli/analyze.d.ts +10 -0
  5. package/dist/cli/analyze.js +118 -0
  6. package/dist/cli/clean.d.ts +8 -0
  7. package/dist/cli/clean.js +29 -0
  8. package/dist/cli/index.d.ts +2 -0
  9. package/dist/cli/index.js +42 -0
  10. package/dist/cli/list.d.ts +6 -0
  11. package/dist/cli/list.js +27 -0
  12. package/dist/cli/mcp.d.ts +7 -0
  13. package/dist/cli/mcp.js +85 -0
  14. package/dist/cli/serve.d.ts +3 -0
  15. package/dist/cli/serve.js +5 -0
  16. package/dist/cli/status.d.ts +6 -0
  17. package/dist/cli/status.js +27 -0
  18. package/dist/config/ignore-service.d.ts +1 -0
  19. package/dist/config/ignore-service.js +208 -0
  20. package/dist/config/supported-languages.d.ts +11 -0
  21. package/dist/config/supported-languages.js +15 -0
  22. package/dist/core/embeddings/embedder.d.ts +60 -0
  23. package/dist/core/embeddings/embedder.js +205 -0
  24. package/dist/core/embeddings/embedding-pipeline.d.ts +50 -0
  25. package/dist/core/embeddings/embedding-pipeline.js +321 -0
  26. package/dist/core/embeddings/index.d.ts +9 -0
  27. package/dist/core/embeddings/index.js +9 -0
  28. package/dist/core/embeddings/text-generator.d.ts +24 -0
  29. package/dist/core/embeddings/text-generator.js +182 -0
  30. package/dist/core/embeddings/types.d.ts +87 -0
  31. package/dist/core/embeddings/types.js +32 -0
  32. package/dist/core/graph/graph.d.ts +2 -0
  33. package/dist/core/graph/graph.js +61 -0
  34. package/dist/core/graph/types.d.ts +50 -0
  35. package/dist/core/graph/types.js +1 -0
  36. package/dist/core/ingestion/ast-cache.d.ts +11 -0
  37. package/dist/core/ingestion/ast-cache.js +34 -0
  38. package/dist/core/ingestion/call-processor.d.ts +8 -0
  39. package/dist/core/ingestion/call-processor.js +269 -0
  40. package/dist/core/ingestion/cluster-enricher.d.ts +38 -0
  41. package/dist/core/ingestion/cluster-enricher.js +170 -0
  42. package/dist/core/ingestion/community-processor.d.ts +39 -0
  43. package/dist/core/ingestion/community-processor.js +269 -0
  44. package/dist/core/ingestion/entry-point-scoring.d.ts +39 -0
  45. package/dist/core/ingestion/entry-point-scoring.js +235 -0
  46. package/dist/core/ingestion/filesystem-walker.d.ts +5 -0
  47. package/dist/core/ingestion/filesystem-walker.js +26 -0
  48. package/dist/core/ingestion/framework-detection.d.ts +38 -0
  49. package/dist/core/ingestion/framework-detection.js +183 -0
  50. package/dist/core/ingestion/heritage-processor.d.ts +14 -0
  51. package/dist/core/ingestion/heritage-processor.js +134 -0
  52. package/dist/core/ingestion/import-processor.d.ts +8 -0
  53. package/dist/core/ingestion/import-processor.js +490 -0
  54. package/dist/core/ingestion/parsing-processor.d.ts +8 -0
  55. package/dist/core/ingestion/parsing-processor.js +249 -0
  56. package/dist/core/ingestion/pipeline.d.ts +2 -0
  57. package/dist/core/ingestion/pipeline.js +228 -0
  58. package/dist/core/ingestion/process-processor.d.ts +51 -0
  59. package/dist/core/ingestion/process-processor.js +278 -0
  60. package/dist/core/ingestion/structure-processor.d.ts +2 -0
  61. package/dist/core/ingestion/structure-processor.js +36 -0
  62. package/dist/core/ingestion/symbol-table.d.ts +33 -0
  63. package/dist/core/ingestion/symbol-table.js +38 -0
  64. package/dist/core/ingestion/tree-sitter-queries.d.ts +11 -0
  65. package/dist/core/ingestion/tree-sitter-queries.js +319 -0
  66. package/dist/core/ingestion/utils.d.ts +10 -0
  67. package/dist/core/ingestion/utils.js +44 -0
  68. package/dist/core/kuzu/csv-generator.d.ts +22 -0
  69. package/dist/core/kuzu/csv-generator.js +272 -0
  70. package/dist/core/kuzu/kuzu-adapter.d.ts +81 -0
  71. package/dist/core/kuzu/kuzu-adapter.js +568 -0
  72. package/dist/core/kuzu/schema.d.ts +53 -0
  73. package/dist/core/kuzu/schema.js +380 -0
  74. package/dist/core/search/bm25-index.d.ts +22 -0
  75. package/dist/core/search/bm25-index.js +52 -0
  76. package/dist/core/search/hybrid-search.d.ts +49 -0
  77. package/dist/core/search/hybrid-search.js +118 -0
  78. package/dist/core/tree-sitter/parser-loader.d.ts +4 -0
  79. package/dist/core/tree-sitter/parser-loader.js +42 -0
  80. package/dist/lib/utils.d.ts +1 -0
  81. package/dist/lib/utils.js +3 -0
  82. package/dist/mcp/core/embedder.d.ts +27 -0
  83. package/dist/mcp/core/embedder.js +93 -0
  84. package/dist/mcp/core/kuzu-adapter.d.ts +23 -0
  85. package/dist/mcp/core/kuzu-adapter.js +62 -0
  86. package/dist/mcp/local/local-backend.d.ts +73 -0
  87. package/dist/mcp/local/local-backend.js +752 -0
  88. package/dist/mcp/resources.d.ts +31 -0
  89. package/dist/mcp/resources.js +279 -0
  90. package/dist/mcp/server.d.ts +12 -0
  91. package/dist/mcp/server.js +130 -0
  92. package/dist/mcp/staleness.d.ts +15 -0
  93. package/dist/mcp/staleness.js +29 -0
  94. package/dist/mcp/tools.d.ts +24 -0
  95. package/dist/mcp/tools.js +160 -0
  96. package/dist/server/api.d.ts +6 -0
  97. package/dist/server/api.js +156 -0
  98. package/dist/storage/git.d.ts +7 -0
  99. package/dist/storage/git.js +39 -0
  100. package/dist/storage/repo-manager.d.ts +61 -0
  101. package/dist/storage/repo-manager.js +106 -0
  102. package/dist/types/pipeline.d.ts +28 -0
  103. package/dist/types/pipeline.js +16 -0
  104. package/package.json +80 -0
  105. package/skills/debugging.md +104 -0
  106. package/skills/exploring.md +112 -0
  107. package/skills/impact-analysis.md +114 -0
  108. package/skills/refactoring.md +119 -0
  109. package/vendor/leiden/index.cjs +355 -0
  110. package/vendor/leiden/utils.cjs +392 -0
@@ -0,0 +1,392 @@
1
+ /**
2
+ * Graphology Leiden Utils
3
+ * ========================
4
+ *
5
+ * Miscellaneous utilities used by the Leiden algorithm.
6
+ *
7
+ * Vendored from: https://github.com/graphology/graphology/tree/master/src/communities-leiden
8
+ * License: MIT
9
+ */
10
+ var SparseMap = require('mnemonist/sparse-map');
11
+ var createRandom = require('pandemonium/random').createRandom;
12
+
13
+ function addWeightToCommunity(map, community, weight) {
14
+ var currentWeight = map.get(community);
15
+
16
+ if (typeof currentWeight === 'undefined') currentWeight = 0;
17
+
18
+ currentWeight += weight;
19
+
20
+ map.set(community, currentWeight);
21
+ }
22
+
23
+ function UndirectedLeidenAddenda(index, options) {
24
+ options = options || {};
25
+
26
+ var rng = options.rng || Math.random;
27
+ var randomness = 'randomness' in options ? options.randomness : 0.01;
28
+
29
+ this.index = index;
30
+ this.random = createRandom(rng);
31
+ this.randomness = randomness;
32
+ this.rng = rng;
33
+
34
+ var NodesPointerArray = index.counts.constructor;
35
+ var WeightsArray = index.weights.constructor;
36
+
37
+ var order = index.C;
38
+ this.resolution = index.resolution;
39
+
40
+ // Used to group nodes by communities
41
+ this.B = index.C;
42
+ this.C = 0;
43
+ this.communitiesOffsets = new NodesPointerArray(order);
44
+ this.nodesSortedByCommunities = new NodesPointerArray(order);
45
+ this.communitiesBounds = new NodesPointerArray(order + 1);
46
+
47
+ // Used to merge nodes subsets
48
+ this.communityWeights = new WeightsArray(order);
49
+ this.degrees = new WeightsArray(order);
50
+ this.nonSingleton = new Uint8Array(order);
51
+ this.externalEdgeWeightPerCommunity = new WeightsArray(order);
52
+ this.belongings = new NodesPointerArray(order);
53
+ this.neighboringCommunities = new SparseMap(WeightsArray, order);
54
+ this.cumulativeIncrement = new Float64Array(order);
55
+ this.macroCommunities = null;
56
+ }
57
+
58
+ UndirectedLeidenAddenda.prototype.groupByCommunities = function () {
59
+ var index = this.index;
60
+
61
+ var n, i, c, b, o;
62
+
63
+ n = 0;
64
+ o = 0;
65
+
66
+ for (i = 0; i < index.C; i++) {
67
+ c = index.counts[i];
68
+
69
+ if (c !== 0) {
70
+ this.communitiesBounds[o++] = n;
71
+ n += c;
72
+ this.communitiesOffsets[i] = n;
73
+ }
74
+ }
75
+
76
+ this.communitiesBounds[o] = n;
77
+
78
+ o = 0;
79
+
80
+ for (i = 0; i < index.C; i++) {
81
+ b = index.belongings[i];
82
+ o = --this.communitiesOffsets[b];
83
+ this.nodesSortedByCommunities[o] = i;
84
+ }
85
+
86
+ this.B = index.C - index.U;
87
+ this.C = index.C;
88
+ };
89
+
90
+ UndirectedLeidenAddenda.prototype.communities = function () {
91
+ var communities = new Array(this.B);
92
+
93
+ var i, j, community, start, stop;
94
+
95
+ for (i = 0; i < this.B; i++) {
96
+ start = this.communitiesBounds[i];
97
+ stop = this.communitiesBounds[i + 1];
98
+ community = [];
99
+
100
+ for (j = start; j < stop; j++) {
101
+ community.push(j);
102
+ }
103
+
104
+ communities[i] = community;
105
+ }
106
+
107
+ return communities;
108
+ };
109
+
110
+ UndirectedLeidenAddenda.prototype.mergeNodesSubset = function (start, stop) {
111
+ var index = this.index;
112
+ var currentMacroCommunity =
113
+ index.belongings[this.nodesSortedByCommunities[start]];
114
+ var neighboringCommunities = this.neighboringCommunities;
115
+
116
+ var totalNodeWeight = 0;
117
+
118
+ var i, j, w;
119
+ var ei, el, et;
120
+
121
+ // Initializing singletons
122
+ for (j = start; j < stop; j++) {
123
+ i = this.nodesSortedByCommunities[j];
124
+
125
+ this.belongings[i] = i;
126
+ this.nonSingleton[i] = 0;
127
+ this.degrees[i] = 0;
128
+ totalNodeWeight += index.loops[i] / 2;
129
+
130
+ this.communityWeights[i] = index.loops[i];
131
+ this.externalEdgeWeightPerCommunity[i] = 0;
132
+
133
+ ei = index.starts[i];
134
+ el = index.starts[i + 1];
135
+
136
+ for (; ei < el; ei++) {
137
+ et = index.neighborhood[ei];
138
+ w = index.weights[ei];
139
+
140
+ this.degrees[i] += w;
141
+
142
+ if (index.belongings[et] !== currentMacroCommunity) continue;
143
+
144
+ totalNodeWeight += w;
145
+ this.externalEdgeWeightPerCommunity[i] += w;
146
+ this.communityWeights[i] += w;
147
+ }
148
+ }
149
+
150
+ var microDegrees = this.externalEdgeWeightPerCommunity.slice();
151
+
152
+ var s, ri, ci;
153
+ var order = stop - start;
154
+
155
+ var degree,
156
+ bestCommunity,
157
+ qualityValueIncrement,
158
+ maxQualityValueIncrement,
159
+ totalTransformedQualityValueIncrement,
160
+ targetCommunity,
161
+ targetCommunityDegree,
162
+ targetCommunityWeight;
163
+
164
+ var r, lo, hi, mid, chosenCommunity;
165
+
166
+ ri = this.random(start, stop - 1);
167
+
168
+ for (s = start; s < stop; s++, ri++) {
169
+ j = start + (ri % order);
170
+
171
+ i = this.nodesSortedByCommunities[j];
172
+
173
+ if (this.nonSingleton[i] === 1) {
174
+ continue;
175
+ }
176
+
177
+ if (
178
+ this.externalEdgeWeightPerCommunity[i] <
179
+ this.communityWeights[i] *
180
+ (totalNodeWeight / 2 - this.communityWeights[i]) *
181
+ this.resolution
182
+ ) {
183
+ continue;
184
+ }
185
+
186
+ this.communityWeights[i] = 0;
187
+ this.externalEdgeWeightPerCommunity[i] = 0;
188
+
189
+ neighboringCommunities.clear();
190
+ neighboringCommunities.set(i, 0);
191
+
192
+ degree = 0;
193
+
194
+ ei = index.starts[i];
195
+ el = index.starts[i + 1];
196
+
197
+ for (; ei < el; ei++) {
198
+ et = index.neighborhood[ei];
199
+
200
+ if (index.belongings[et] !== currentMacroCommunity) continue;
201
+
202
+ w = index.weights[ei];
203
+
204
+ degree += w;
205
+
206
+ addWeightToCommunity(neighboringCommunities, this.belongings[et], w);
207
+ }
208
+
209
+ bestCommunity = i;
210
+ maxQualityValueIncrement = 0;
211
+ totalTransformedQualityValueIncrement = 0;
212
+
213
+ for (ci = 0; ci < neighboringCommunities.size; ci++) {
214
+ targetCommunity = neighboringCommunities.dense[ci];
215
+ targetCommunityDegree = neighboringCommunities.vals[ci];
216
+ targetCommunityWeight = this.communityWeights[targetCommunity];
217
+
218
+ if (
219
+ this.externalEdgeWeightPerCommunity[targetCommunity] >=
220
+ targetCommunityWeight *
221
+ (totalNodeWeight / 2 - targetCommunityWeight) *
222
+ this.resolution
223
+ ) {
224
+ qualityValueIncrement =
225
+ targetCommunityDegree -
226
+ ((degree + index.loops[i]) *
227
+ targetCommunityWeight *
228
+ this.resolution) /
229
+ totalNodeWeight;
230
+
231
+ if (qualityValueIncrement > maxQualityValueIncrement) {
232
+ bestCommunity = targetCommunity;
233
+ maxQualityValueIncrement = qualityValueIncrement;
234
+ }
235
+
236
+ if (qualityValueIncrement >= 0)
237
+ totalTransformedQualityValueIncrement += Math.exp(
238
+ qualityValueIncrement / this.randomness
239
+ );
240
+ }
241
+
242
+ this.cumulativeIncrement[ci] = totalTransformedQualityValueIncrement;
243
+ }
244
+
245
+ if (
246
+ totalTransformedQualityValueIncrement < Number.MAX_VALUE &&
247
+ totalTransformedQualityValueIncrement < Infinity
248
+ ) {
249
+ r = totalTransformedQualityValueIncrement * this.rng();
250
+ lo = -1;
251
+ hi = neighboringCommunities.size + 1;
252
+
253
+ while (lo < hi - 1) {
254
+ mid = (lo + hi) >>> 1;
255
+
256
+ if (this.cumulativeIncrement[mid] >= r) hi = mid;
257
+ else lo = mid;
258
+ }
259
+
260
+ chosenCommunity = neighboringCommunities.dense[hi];
261
+ } else {
262
+ chosenCommunity = bestCommunity;
263
+ }
264
+
265
+ this.communityWeights[chosenCommunity] += degree + index.loops[i];
266
+
267
+ ei = index.starts[i];
268
+ el = index.starts[i + 1];
269
+
270
+ for (; ei < el; ei++) {
271
+ et = index.neighborhood[ei];
272
+
273
+ if (index.belongings[et] !== currentMacroCommunity) continue;
274
+
275
+ targetCommunity = this.belongings[et];
276
+
277
+ if (targetCommunity === chosenCommunity) {
278
+ this.externalEdgeWeightPerCommunity[chosenCommunity] -=
279
+ microDegrees[et];
280
+ } else {
281
+ this.externalEdgeWeightPerCommunity[chosenCommunity] +=
282
+ microDegrees[et];
283
+ }
284
+ }
285
+
286
+ if (chosenCommunity !== i) {
287
+ this.belongings[i] = chosenCommunity;
288
+ this.nonSingleton[chosenCommunity] = 1;
289
+ this.C--;
290
+ }
291
+ }
292
+
293
+ var microCommunities = this.neighboringCommunities;
294
+ microCommunities.clear();
295
+
296
+ for (j = start; j < stop; j++) {
297
+ i = this.nodesSortedByCommunities[j];
298
+ microCommunities.set(this.belongings[i], 1);
299
+ }
300
+
301
+ return microCommunities.dense.slice(0, microCommunities.size);
302
+ };
303
+
304
+ UndirectedLeidenAddenda.prototype.refinePartition = function () {
305
+ this.groupByCommunities();
306
+
307
+ this.macroCommunities = new Array(this.B);
308
+
309
+ var i, start, stop, mapping;
310
+
311
+ var bounds = this.communitiesBounds;
312
+
313
+ for (i = 0; i < this.B; i++) {
314
+ start = bounds[i];
315
+ stop = bounds[i + 1];
316
+
317
+ mapping = this.mergeNodesSubset(start, stop);
318
+ this.macroCommunities[i] = mapping;
319
+ }
320
+ };
321
+
322
+ UndirectedLeidenAddenda.prototype.split = function () {
323
+ var index = this.index;
324
+ var isolates = this.neighboringCommunities;
325
+
326
+ isolates.clear();
327
+
328
+ var i, community, isolated;
329
+
330
+ for (i = 0; i < index.C; i++) {
331
+ community = this.belongings[i];
332
+
333
+ if (i !== community) continue;
334
+
335
+ isolated = index.isolate(i, this.degrees[i]);
336
+ isolates.set(community, isolated);
337
+ }
338
+
339
+ for (i = 0; i < index.C; i++) {
340
+ community = this.belongings[i];
341
+
342
+ if (i === community) continue;
343
+
344
+ isolated = isolates.get(community);
345
+ index.move(i, this.degrees[i], isolated);
346
+ }
347
+
348
+ var j, macro;
349
+
350
+ for (i = 0; i < this.macroCommunities.length; i++) {
351
+ macro = this.macroCommunities[i];
352
+
353
+ for (j = 0; j < macro.length; j++) macro[j] = isolates.get(macro[j]);
354
+ }
355
+ };
356
+
357
+ UndirectedLeidenAddenda.prototype.zoomOut = function () {
358
+ var index = this.index;
359
+ this.refinePartition();
360
+ this.split();
361
+
362
+ var newLabels = index.zoomOut();
363
+
364
+ var macro, leader, follower;
365
+
366
+ var i, j;
367
+
368
+ for (i = 0; i < this.macroCommunities.length; i++) {
369
+ macro = this.macroCommunities[i];
370
+ leader = newLabels[macro[0]];
371
+
372
+ for (j = 1; j < macro.length; j++) {
373
+ follower = newLabels[macro[j]];
374
+ index.expensiveMove(follower, leader);
375
+ }
376
+ }
377
+ };
378
+
379
+ UndirectedLeidenAddenda.prototype.onlySingletons = function () {
380
+ var index = this.index;
381
+
382
+ var i;
383
+
384
+ for (i = 0; i < index.C; i++) {
385
+ if (index.counts[i] > 1) return false;
386
+ }
387
+
388
+ return true;
389
+ };
390
+
391
+ exports.addWeightToCommunity = addWeightToCommunity;
392
+ exports.UndirectedLeidenAddenda = UndirectedLeidenAddenda;