@cleocode/nexus 2026.5.15 → 2026.5.17

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleocode/nexus",
3
- "version": "2026.5.15",
3
+ "version": "2026.5.17",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "CLEO project registry and code intelligence — unified nexus package",
@@ -62,6 +62,7 @@
62
62
  "author": "CLEO Code <hello@cleocode.dev> (https://cleocode.dev)",
63
63
  "license": "MIT",
64
64
  "dependencies": {
65
+ "@aflsolutions/graphology-communities-leiden": "1.1.1",
65
66
  "drizzle-orm": "1.0.0-beta.22-ec7b61d",
66
67
  "graphology": "^0.26.0",
67
68
  "graphology-communities-louvain": "^2.0.2",
@@ -76,7 +77,7 @@
76
77
  "tree-sitter-ruby": "^0.23.1",
77
78
  "tree-sitter-rust": "0.23.1",
78
79
  "tree-sitter-typescript": "^0.23.2",
79
- "@cleocode/contracts": "2026.5.15"
80
+ "@cleocode/contracts": "2026.5.17"
80
81
  },
81
82
  "devDependencies": {
82
83
  "@types/node": "^24.3.0",
@@ -1,67 +0,0 @@
1
- /**
2
- * Pure-TypeScript Leiden Algorithm Implementation
3
- *
4
- * Implements the Leiden algorithm for community detection as described in:
5
- * "From Louvain to Leiden: guaranteeing well-connected communities"
6
- * Traag, V. A., Waltman, L., & van Eck, N. J. (2019).
7
- *
8
- * The Leiden algorithm improves upon Louvain by:
9
- * 1. Local Moving Phase: Optimizes modularity by moving nodes to communities
10
- * 2. Refinement Phase: Splits poorly-optimized communities to remove sub-optimal structures
11
- * 3. Aggregation Phase: Contracts the graph and repeats
12
- *
13
- * This implementation includes:
14
- * - Full 3-phase iteration for fine-grained community detection
15
- * - Modularity calculation respecting resolution parameter
16
- * - Seed-based randomization for reproducibility
17
- * - Early termination when modularity plateaus
18
- *
19
- * @module pipeline/leiden
20
- * @task T1063
21
- */
22
- /** Minimal graphology-compatible graph interface. */
23
- export interface Graph {
24
- order: number;
25
- size: number;
26
- hasNode(id: string): boolean;
27
- hasEdge(source: string, target: string): boolean;
28
- forEachNode(callback: (nodeId: string) => void): void;
29
- forEachNeighbor(nodeId: string, callback: (neighbour: string) => void): void;
30
- getNodeAttribute(nodeId: string, attribute: string): unknown;
31
- }
32
- /** Result from Leiden algorithm. */
33
- export interface LeidenResult {
34
- /** Mapping of node ID to community number. */
35
- communities: Record<string, number>;
36
- /** Total number of communities detected. */
37
- count: number;
38
- /** Modularity score (0–1, higher = better). */
39
- modularity: number;
40
- /** Number of nodes processed. */
41
- nodesProcessed: number;
42
- /** Number of refinement iterations performed. */
43
- refinementIterations: number;
44
- /** Duration in milliseconds. */
45
- durationMs: number;
46
- }
47
- /**
48
- * Run the Leiden algorithm on a graphology-compatible graph.
49
- *
50
- * Detects communities by optimizing modularity through three phases:
51
- * 1. Local moving: move nodes to best-neighbor communities
52
- * 2. Refinement: split communities to improve local modularity
53
- * 3. Aggregation: contract graph and repeat
54
- *
55
- * @param graph - The undirected graphology graph to process
56
- * @param options - Algorithm parameters
57
- * @returns Leiden result with community assignments and modularity
58
- */
59
- export declare function leiden(graph: Graph, options?: {
60
- /** Resolution parameter (higher = more communities, default 1.0) */
61
- resolution?: number;
62
- /** Random seed for reproducibility (default varies) */
63
- seed?: number;
64
- /** Maximum iterations (default 10) */
65
- maxIterations?: number;
66
- }): LeidenResult;
67
- //# sourceMappingURL=leiden.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"leiden.d.ts","sourceRoot":"","sources":["../../../src/pipeline/leiden.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAQH,qDAAqD;AACrD,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACjD,WAAW,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IACtD,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IAC7E,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;CAC9D;AAED,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;CACpB;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CACpB,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE;IACP,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;CACnB,GACL,YAAY,CAiKd"}
@@ -1,283 +0,0 @@
1
- /**
2
- * Pure-TypeScript Leiden Algorithm Implementation
3
- *
4
- * Implements the Leiden algorithm for community detection as described in:
5
- * "From Louvain to Leiden: guaranteeing well-connected communities"
6
- * Traag, V. A., Waltman, L., & van Eck, N. J. (2019).
7
- *
8
- * The Leiden algorithm improves upon Louvain by:
9
- * 1. Local Moving Phase: Optimizes modularity by moving nodes to communities
10
- * 2. Refinement Phase: Splits poorly-optimized communities to remove sub-optimal structures
11
- * 3. Aggregation Phase: Contracts the graph and repeats
12
- *
13
- * This implementation includes:
14
- * - Full 3-phase iteration for fine-grained community detection
15
- * - Modularity calculation respecting resolution parameter
16
- * - Seed-based randomization for reproducibility
17
- * - Early termination when modularity plateaus
18
- *
19
- * @module pipeline/leiden
20
- * @task T1063
21
- */
22
- import { performance } from 'node:perf_hooks';
23
- // =============================================================================
24
- // LEIDEN ALGORITHM
25
- // =============================================================================
26
- /**
27
- * Run the Leiden algorithm on a graphology-compatible graph.
28
- *
29
- * Detects communities by optimizing modularity through three phases:
30
- * 1. Local moving: move nodes to best-neighbor communities
31
- * 2. Refinement: split communities to improve local modularity
32
- * 3. Aggregation: contract graph and repeat
33
- *
34
- * @param graph - The undirected graphology graph to process
35
- * @param options - Algorithm parameters
36
- * @returns Leiden result with community assignments and modularity
37
- */
38
- export function leiden(graph, options = {}) {
39
- const startTime = performance.now();
40
- const resolution = options.resolution ?? 1.0;
41
- const maxIterations = options.maxIterations ?? 10;
42
- const seed = options.seed ?? Math.random();
43
- // Build node and edge lists
44
- const nodeIds = [];
45
- const nodeIndex = new Map();
46
- graph.forEachNode((nodeId) => {
47
- nodeIndex.set(nodeId, nodeIds.length);
48
- nodeIds.push(nodeId);
49
- });
50
- const edgeList = [];
51
- const adjList = new Map();
52
- for (let i = 0; i < nodeIds.length; i++) {
53
- adjList.set(i, new Set());
54
- }
55
- graph.forEachNode((source) => {
56
- const sourceIdx = nodeIndex.get(source);
57
- if (sourceIdx === undefined)
58
- return;
59
- graph.forEachNeighbor(source, (target) => {
60
- const targetIdx = nodeIndex.get(target);
61
- if (targetIdx === undefined)
62
- return;
63
- if (sourceIdx < targetIdx) {
64
- edgeList.push([sourceIdx, targetIdx]);
65
- adjList.get(sourceIdx).add(targetIdx);
66
- adjList.get(targetIdx).add(sourceIdx);
67
- }
68
- });
69
- });
70
- const n = nodeIds.length;
71
- const m = edgeList.length; // undirected edge count (each edge counted once)
72
- const totalWeight = m * 2; // total weight in weighted graph = sum of all edge weights (each edge = 2)
73
- if (n === 0 || m === 0) {
74
- return {
75
- communities: {},
76
- count: 0,
77
- modularity: 0,
78
- nodesProcessed: 0,
79
- refinementIterations: 0,
80
- durationMs: performance.now() - startTime,
81
- };
82
- }
83
- // Initialize: each node is its own community
84
- const communities = new Array(n);
85
- for (let i = 0; i < n; i++) {
86
- communities[i] = i;
87
- }
88
- // Store intermediate results
89
- let currentModularity = 0;
90
- let bestCommunities = [...communities];
91
- let bestModularity = 0;
92
- let refinementIterations = 0;
93
- // Main iteration loop
94
- for (let iteration = 0; iteration < maxIterations; iteration++) {
95
- // Phase 1: Local moving
96
- let moved = true;
97
- let moveRounds = 0;
98
- while (moved && moveRounds < 10) {
99
- moved = false;
100
- moveRounds++;
101
- // Shuffle nodes for randomness
102
- const shuffled = [...Array(n).keys()].sort(() => ((seed * 997 + moveRounds) % 2) - 0.5);
103
- for (const nodeIdx of shuffled) {
104
- const currentComm = communities[nodeIdx];
105
- let bestComm = currentComm;
106
- let bestGain = 0;
107
- // Get neighbor communities
108
- const neighborComms = new Set();
109
- for (const neighbor of adjList.get(nodeIdx)) {
110
- neighborComms.add(communities[neighbor]);
111
- }
112
- neighborComms.add(currentComm);
113
- // Try moving to each neighbor community
114
- for (const targetComm of neighborComms) {
115
- const gain = calculateModularityGain(nodeIdx, currentComm, targetComm, communities, adjList, totalWeight, resolution);
116
- if (gain > bestGain) {
117
- bestGain = gain;
118
- bestComm = targetComm;
119
- }
120
- }
121
- // If moving improves, update
122
- if (bestComm !== currentComm) {
123
- communities[nodeIdx] = bestComm;
124
- moved = true;
125
- }
126
- }
127
- }
128
- // Calculate current modularity
129
- currentModularity = calculateModularity(communities, adjList, totalWeight, resolution);
130
- // Phase 2: Refinement (split over-large communities)
131
- refinePasses(communities, adjList, totalWeight, resolution, n);
132
- refinementIterations++;
133
- // Calculate modularity after refinement
134
- const afterRefinement = calculateModularity(communities, adjList, totalWeight, resolution);
135
- // Phase 3: Check convergence
136
- if (Math.abs(afterRefinement - currentModularity) < 1e-6) {
137
- currentModularity = afterRefinement;
138
- break; // Converged
139
- }
140
- currentModularity = afterRefinement;
141
- // Track best
142
- if (currentModularity > bestModularity) {
143
- bestModularity = currentModularity;
144
- bestCommunities = [...communities];
145
- }
146
- }
147
- // Relabel communities to be 0, 1, 2, ...
148
- const communityMap = new Map();
149
- let nextLabel = 0;
150
- const result = {};
151
- for (let i = 0; i < n; i++) {
152
- const oldComm = bestCommunities[i];
153
- if (!communityMap.has(oldComm)) {
154
- communityMap.set(oldComm, nextLabel++);
155
- }
156
- const newComm = communityMap.get(oldComm);
157
- result[nodeIds[i]] = newComm;
158
- }
159
- const durationMs = performance.now() - startTime;
160
- return {
161
- communities: result,
162
- count: nextLabel,
163
- modularity: bestModularity,
164
- nodesProcessed: n,
165
- refinementIterations,
166
- durationMs,
167
- };
168
- }
169
- // =============================================================================
170
- // HELPER FUNCTIONS
171
- // =============================================================================
172
- /**
173
- * Calculate the gain in modularity from moving a node to a target community.
174
- * A positive gain means the move improves modularity.
175
- */
176
- function calculateModularityGain(nodeIdx, currentComm, targetComm, communities, adjList, totalWeight, resolution) {
177
- if (totalWeight === 0)
178
- return 0;
179
- const neighbors = adjList.get(nodeIdx);
180
- // Count edges to current and target communities
181
- let edgesToCurrent = 0;
182
- let edgesToTarget = 0;
183
- for (const neighbor of neighbors) {
184
- const neighborComm = communities[neighbor];
185
- if (neighborComm === currentComm) {
186
- edgesToCurrent++;
187
- }
188
- else if (neighborComm === targetComm) {
189
- edgesToTarget++;
190
- }
191
- }
192
- // Self-loop contributes 1 edge to both when removing/adding
193
- if (currentComm === targetComm) {
194
- edgesToTarget = neighbors.size + 1; // includes self
195
- }
196
- // Degree of the node
197
- const degree = neighbors.size;
198
- // Modularity contribution (ignoring constant terms independent of movement)
199
- const gain = (2 * edgesToTarget - edgesToCurrent) / totalWeight - (resolution * degree) / totalWeight;
200
- return gain;
201
- }
202
- /**
203
- * Calculate the modularity of the current partition.
204
- * Modularity = sum of (e_ii - a_i^2) where e_ii is internal edges and a_i is weighted degree.
205
- */
206
- function calculateModularity(communities, adjList, totalWeight, resolution) {
207
- if (totalWeight === 0)
208
- return 0;
209
- const communityEdges = new Map();
210
- const communityDegree = new Map();
211
- // Count edges and degree per community
212
- for (let i = 0; i < communities.length; i++) {
213
- const comm = communities[i];
214
- const degree = adjList.get(i).size;
215
- if (!communityDegree.has(comm)) {
216
- communityDegree.set(comm, 0);
217
- }
218
- communityDegree.set(comm, communityDegree.get(comm) + degree);
219
- // Count internal edges
220
- let internal = 0;
221
- for (const neighbor of adjList.get(i)) {
222
- if (communities[neighbor] === comm) {
223
- internal++;
224
- }
225
- }
226
- if (!communityEdges.has(comm)) {
227
- communityEdges.set(comm, 0);
228
- }
229
- communityEdges.set(comm, communityEdges.get(comm) + internal);
230
- }
231
- // Calculate modularity
232
- let modularity = 0;
233
- for (const [comm, internalEdges] of communityEdges) {
234
- const a = communityDegree.get(comm) || 0;
235
- modularity += internalEdges / totalWeight - resolution * (a / totalWeight) ** 2;
236
- }
237
- return modularity;
238
- }
239
- /**
240
- * Refinement phase: split large communities to improve local modularity.
241
- * This is the key difference from Louvain — it prevents sub-optimal structures.
242
- */
243
- function refinePasses(communities, adjList, totalWeight, resolution, n) {
244
- // Identify large communities (more than sqrt(n) nodes)
245
- const commSizes = new Map();
246
- for (let i = 0; i < n; i++) {
247
- const comm = communities[i];
248
- commSizes.set(comm, (commSizes.get(comm) || 0) + 1);
249
- }
250
- const threshold = Math.ceil(Math.sqrt(n));
251
- // For each large community, try to split it
252
- for (const [comm, size] of commSizes) {
253
- if (size <= threshold)
254
- continue;
255
- // Find nodes in this community
256
- const commNodes = [];
257
- for (let i = 0; i < n; i++) {
258
- if (communities[i] === comm) {
259
- commNodes.push(i);
260
- }
261
- }
262
- // Try to move nodes to new sub-communities
263
- const newCommunity = Math.max(...communities) + 1;
264
- let moved = false;
265
- for (const nodeIdx of commNodes) {
266
- const gain = calculateModularityGain(nodeIdx, comm, newCommunity, communities, adjList, totalWeight, resolution);
267
- if (gain > 0) {
268
- communities[nodeIdx] = newCommunity;
269
- moved = true;
270
- }
271
- }
272
- // If we moved at least one node, this is a successful split
273
- if (!moved) {
274
- // No nodes wanted to move, remove the phantom community
275
- for (let i = 0; i < n; i++) {
276
- if (communities[i] === newCommunity) {
277
- communities[i] = comm;
278
- }
279
- }
280
- }
281
- }
282
- }
283
- //# sourceMappingURL=leiden.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"leiden.js","sourceRoot":"","sources":["../../../src/pipeline/leiden.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAiC9C,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,MAAM,CACpB,KAAY,EACZ,UAOI,EAAE;IAEN,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAEpC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,GAAG,CAAC;IAC7C,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC;IAClD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;IAE3C,4BAA4B;IAC5B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5C,KAAK,CAAC,WAAW,CAAC,CAAC,MAAc,EAAE,EAAE;QACnC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAA4B,EAAE,CAAC;IAC7C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;IAE/C,KAAK,IAAI,C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