semantic-complexity 0.0.2-1895c257 → 0.0.5-e791286c

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.
@@ -0,0 +1,187 @@
1
+ /**
2
+ * v0.0.3: Interaction Matrix for Second-Order Tensor Analysis
3
+ *
4
+ * M[i,j] represents the interaction strength between dimensions i and j.
5
+ * - Diagonal: self-interaction (typically 1.0)
6
+ * - Off-diagonal: cross-dimension interaction
7
+ */
8
+ /**
9
+ * Default interaction matrix (symmetric, positive semi-definite)
10
+ */
11
+ export const DEFAULT_MATRIX = [
12
+ // C N S A Λ
13
+ [1.0, 0.3, 0.2, 0.2, 0.3], // Control
14
+ [0.3, 1.0, 0.4, 0.8, 0.2], // Nesting × Async ↑
15
+ [0.2, 0.4, 1.0, 0.5, 0.9], // State × Coupling ↑↑
16
+ [0.2, 0.8, 0.5, 1.0, 0.4], // Async × Nesting ↑
17
+ [0.3, 0.2, 0.9, 0.4, 1.0], // Coupling × State ↑↑
18
+ ];
19
+ /**
20
+ * Module-type specific interaction matrices
21
+ */
22
+ export const MODULE_MATRICES = {
23
+ api: [
24
+ // API: Coupling interactions are critical
25
+ [1.0, 0.2, 0.3, 0.2, 0.4],
26
+ [0.2, 1.0, 0.3, 0.6, 0.2],
27
+ [0.3, 0.3, 1.0, 0.4, 1.5], // State × Coupling ↑↑↑
28
+ [0.2, 0.6, 0.4, 1.0, 0.5],
29
+ [0.4, 0.2, 1.5, 0.5, 1.0], // Coupling × State ↑↑↑
30
+ ],
31
+ lib: [
32
+ // LIB: Control/Nesting interactions are important
33
+ [1.0, 1.2, 0.2, 0.2, 0.2], // Control × Nesting ↑
34
+ [1.2, 1.0, 0.3, 0.5, 0.2], // Nesting × Control ↑
35
+ [0.2, 0.3, 1.0, 0.3, 0.6],
36
+ [0.2, 0.5, 0.3, 1.0, 0.3],
37
+ [0.2, 0.2, 0.6, 0.3, 1.0],
38
+ ],
39
+ app: [
40
+ // APP: State/Async interactions are critical
41
+ [1.0, 0.3, 0.3, 0.3, 0.3],
42
+ [0.3, 1.0, 0.5, 0.9, 0.2], // Nesting × Async ↑
43
+ [0.3, 0.5, 1.0, 1.3, 0.7], // State × Async ↑↑
44
+ [0.3, 0.9, 1.3, 1.0, 0.4], // Async × State ↑↑
45
+ [0.3, 0.2, 0.7, 0.4, 1.0],
46
+ ],
47
+ web: [
48
+ // WEB: Nesting is most important (component hierarchy)
49
+ [1.0, 0.5, 0.2, 0.4, 0.2],
50
+ [0.5, 1.5, 0.3, 0.6, 0.2], // Nesting self-weight ↑
51
+ [0.2, 0.3, 1.0, 0.3, 0.5],
52
+ [0.4, 0.6, 0.3, 1.0, 0.3],
53
+ [0.2, 0.2, 0.5, 0.3, 1.0],
54
+ ],
55
+ data: [
56
+ // DATA: State is most important (entity definitions)
57
+ [1.0, 0.2, 0.3, 0.1, 0.4],
58
+ [0.2, 1.0, 0.2, 0.1, 0.2],
59
+ [0.3, 0.2, 1.5, 0.2, 0.8], // State self-weight ↑, State × Coupling ↑
60
+ [0.1, 0.1, 0.2, 1.0, 0.2],
61
+ [0.4, 0.2, 0.8, 0.2, 1.0], // Coupling × State ↑
62
+ ],
63
+ infra: [
64
+ // INFRA: Async and Coupling are critical (DB/IO)
65
+ [1.0, 0.2, 0.2, 0.3, 0.4],
66
+ [0.2, 1.0, 0.2, 0.3, 0.2],
67
+ [0.2, 0.2, 1.0, 0.4, 0.6],
68
+ [0.3, 0.3, 0.4, 1.5, 0.8], // Async self-weight ↑, Async × Coupling ↑
69
+ [0.4, 0.2, 0.6, 0.8, 1.5], // Coupling self-weight ↑, Coupling × Async ↑
70
+ ],
71
+ deploy: [
72
+ // DEPLOY: All interactions should be minimal
73
+ [1.0, 0.1, 0.1, 0.1, 0.2],
74
+ [0.1, 1.0, 0.1, 0.1, 0.1],
75
+ [0.1, 0.1, 1.0, 0.1, 0.3],
76
+ [0.1, 0.1, 0.1, 1.0, 0.2],
77
+ [0.2, 0.1, 0.3, 0.2, 1.0],
78
+ ],
79
+ unknown: DEFAULT_MATRIX,
80
+ };
81
+ /**
82
+ * Get interaction matrix for module type
83
+ */
84
+ export function getInteractionMatrix(moduleType) {
85
+ return MODULE_MATRICES[moduleType] ?? DEFAULT_MATRIX;
86
+ }
87
+ /**
88
+ * Convert Vector5D to array
89
+ */
90
+ export function vectorToArray(v) {
91
+ return [v.control, v.nesting, v.state, v.async, v.coupling];
92
+ }
93
+ /**
94
+ * Create Vector5D from array
95
+ */
96
+ export function arrayToVector(arr) {
97
+ if (arr.length !== 5) {
98
+ throw new Error('Vector5D requires exactly 5 values');
99
+ }
100
+ return {
101
+ control: arr[0],
102
+ nesting: arr[1],
103
+ state: arr[2],
104
+ async: arr[3],
105
+ coupling: arr[4],
106
+ };
107
+ }
108
+ /**
109
+ * Create zero vector
110
+ */
111
+ export function zeroVector() {
112
+ return { control: 0, nesting: 0, state: 0, async: 0, coupling: 0 };
113
+ }
114
+ /**
115
+ * Calculate L2 norm of vector
116
+ */
117
+ export function vectorNorm(v) {
118
+ const arr = vectorToArray(v);
119
+ return Math.sqrt(arr.reduce((sum, x) => sum + x * x, 0));
120
+ }
121
+ /**
122
+ * Calculate dot product of two vectors
123
+ */
124
+ export function dotProduct(v1, v2) {
125
+ const a1 = vectorToArray(v1);
126
+ const a2 = vectorToArray(v2);
127
+ return a1.reduce((sum, x, i) => sum + x * a2[i], 0);
128
+ }
129
+ /**
130
+ * Calculate quadratic form: v^T M v
131
+ *
132
+ * This captures dimension interactions.
133
+ */
134
+ export function quadraticForm(v, matrix) {
135
+ const arr = vectorToArray(v);
136
+ let result = 0;
137
+ for (let i = 0; i < 5; i++) {
138
+ for (let j = 0; j < 5; j++) {
139
+ result += arr[i] * matrix[i][j] * arr[j];
140
+ }
141
+ }
142
+ return result;
143
+ }
144
+ /**
145
+ * Check if matrix is positive semi-definite using diagonal dominance
146
+ * (conservative approximation)
147
+ */
148
+ export function isPositiveSemidefinite(matrix) {
149
+ for (let i = 0; i < 5; i++) {
150
+ let rowSum = 0;
151
+ for (let j = 0; j < 5; j++) {
152
+ if (i !== j) {
153
+ rowSum += Math.abs(matrix[i][j]);
154
+ }
155
+ }
156
+ if (matrix[i][i] < rowSum) {
157
+ return false;
158
+ }
159
+ }
160
+ return true;
161
+ }
162
+ /**
163
+ * Euclidean distance between two vectors
164
+ */
165
+ export function euclideanDistance(v1, v2) {
166
+ const a1 = vectorToArray(v1);
167
+ const a2 = vectorToArray(v2);
168
+ const sumSquares = a1.reduce((sum, x, i) => sum + Math.pow(x - a2[i], 2), 0);
169
+ return Math.sqrt(sumSquares);
170
+ }
171
+ /**
172
+ * Mahalanobis-like distance using interaction matrix
173
+ *
174
+ * δ(v, target) = sqrt((v - target)^T M (v - target))
175
+ */
176
+ export function mahalanobisDistance(v, target, matrix) {
177
+ const diff = {
178
+ control: v.control - target.control,
179
+ nesting: v.nesting - target.nesting,
180
+ state: v.state - target.state,
181
+ async: v.async - target.async,
182
+ coupling: v.coupling - target.coupling,
183
+ };
184
+ const result = quadraticForm(diff, matrix);
185
+ return Math.sqrt(Math.abs(result));
186
+ }
187
+ //# sourceMappingURL=matrix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matrix.js","sourceRoot":"","sources":["../../src/tensor/matrix.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAc;IACvC,6BAA6B;IAC7B,CAAC,GAAG,EAAG,GAAG,EAAG,GAAG,EAAG,GAAG,EAAG,GAAG,CAAC,EAAG,UAAU;IAC1C,CAAC,GAAG,EAAG,GAAG,EAAG,GAAG,EAAG,GAAG,EAAG,GAAG,CAAC,EAAG,oBAAoB;IACpD,CAAC,GAAG,EAAG,GAAG,EAAG,GAAG,EAAG,GAAG,EAAG,GAAG,CAAC,EAAG,sBAAsB;IACtD,CAAC,GAAG,EAAG,GAAG,EAAG,GAAG,EAAG,GAAG,EAAG,GAAG,CAAC,EAAG,oBAAoB;IACpD,CAA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CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7E,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAC/B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,CAAW,EACX,MAAgB,EAChB,MAAiB;IAEjB,MAAM,IAAI,GAAa;QACrB,OAAO,EAAE,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO;QACnC,OAAO,EAAE,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO;QACnC,KAAK,EAAE,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;QAC7B,KAAK,EAAE,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;QAC7B,QAAQ,EAAE,CAAC,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ;KACvC,CAAC;IACF,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * v0.0.3: Tensor-based Complexity Scoring
3
+ *
4
+ * score = v^T M v + <v, w> + ε‖v‖²
5
+ */
6
+ import type { TensorScore, Vector5D, ModuleType, ConvergenceAnalysis, HodgeDecomposition, ComplexityLevel, RefactoringRecommendation } from './types.js';
7
+ /**
8
+ * Default linear weights
9
+ */
10
+ export declare const DEFAULT_WEIGHTS: Vector5D;
11
+ /**
12
+ * Calculate raw sum of dimensions (CDR-SOB style)
13
+ * Simple sum: C + N + S + A + Λ
14
+ */
15
+ export declare function calculateRawSum(vector: Vector5D): number;
16
+ /**
17
+ * Calculate rawSum threshold from canonical profile upper bounds
18
+ */
19
+ export declare function calculateRawSumThreshold(moduleType: ModuleType): number;
20
+ /**
21
+ * Calculate tensor-based complexity score
22
+ *
23
+ * @param vector - 5D complexity vector
24
+ * @param moduleType - Module type for context-aware analysis
25
+ * @param epsilon - Regularization parameter (default: 2.0)
26
+ * @param weights - Linear weights (default: DEFAULT_WEIGHTS)
27
+ */
28
+ export declare function calculateTensorScore(vector: Vector5D, moduleType?: ModuleType, epsilon?: number, weights?: Vector5D): TensorScore;
29
+ /**
30
+ * Calculate convergence score
31
+ *
32
+ * Returns:
33
+ * < 0: Safe zone (converged)
34
+ * 0-1: ε-neighborhood (review needed)
35
+ * > 1: Violation zone
36
+ */
37
+ export declare function convergenceScore(current: number, threshold: number, epsilon: number): number;
38
+ /**
39
+ * Estimate Lipschitz constant from two points
40
+ *
41
+ * k = |f(x) - f(y)| / |x - y|
42
+ * For contraction mapping, we need k < 1
43
+ */
44
+ export declare function estimateLipschitz(v1: Vector5D, v2: Vector5D, score1: number, score2: number): number;
45
+ /**
46
+ * Analyze convergence status
47
+ */
48
+ export declare function analyzeConvergence(score: number, threshold?: number, epsilon?: number, options?: {
49
+ prevVector?: Vector5D;
50
+ currVector?: Vector5D;
51
+ prevScore?: number;
52
+ isOscillating?: boolean;
53
+ }): ConvergenceAnalysis;
54
+ /**
55
+ * Hodge decomposition of complexity vector
56
+ *
57
+ * - H^{2,0} (holomorphic): Control + Nesting → Local algorithmic
58
+ * - H^{0,2} (anti-holomorphic): State + Coupling → Global structural
59
+ * - H^{1,1} (harmonic): Async → Mixed/balanced
60
+ */
61
+ export declare function hodgeDecomposition(vector: Vector5D, weights?: Vector5D): HodgeDecomposition;
62
+ /**
63
+ * Classify complexity score into level
64
+ */
65
+ export declare function classifyComplexityLevel(score: number): ComplexityLevel;
66
+ /**
67
+ * Generate refactoring recommendations based on vector analysis
68
+ */
69
+ export declare function recommendRefactoring(vector: Vector5D, weights?: Vector5D): RefactoringRecommendation[];
70
+ /**
71
+ * Check if in safe zone (below threshold - ε)
72
+ */
73
+ export declare function isSafe(score: TensorScore): boolean;
74
+ /**
75
+ * Check if needs review (in ε-neighborhood)
76
+ */
77
+ export declare function needsReview(score: TensorScore): boolean;
78
+ /**
79
+ * Check if violates threshold
80
+ */
81
+ export declare function isViolation(score: TensorScore): boolean;
82
+ //# sourceMappingURL=scoring.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scoring.d.ts","sourceRoot":"","sources":["../../src/tensor/scoring.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EACR,UAAU,EACV,mBAAmB,EAEnB,kBAAkB,EAClB,eAAe,EACf,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAYpB;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAM7B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAExD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CASvE;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,QAAQ,EAChB,UAAU,GAAE,UAAsB,EAClC,OAAO,GAAE,MAAY,EACrB,OAAO,GAAE,QAA0B,GAClC,WAAW,CAiCb;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACd,MAAM,CAMR;AAYD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,QAAQ,EACZ,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,MAAM,CAeR;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,MAAa,EACxB,OAAO,GAAE,MAAY,EACrB,OAAO,CAAC,EAAE;IACR,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GACA,mBAAmB,CAyBrB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,QAAQ,EAChB,OAAO,GAAE,QAA0B,GAClC,kBAAkB,CAqBpB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,CAMtE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,QAAQ,EAChB,OAAO,GAAE,QAA0B,GAClC,yBAAyB,EAAE,CAqC7B;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAElD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAEvD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAEvD"}
@@ -0,0 +1,233 @@
1
+ /**
2
+ * v0.0.3: Tensor-based Complexity Scoring
3
+ *
4
+ * score = v^T M v + <v, w> + ε‖v‖²
5
+ */
6
+ import { getInteractionMatrix, quadraticForm, dotProduct, vectorNorm, vectorToArray, } from './matrix.js';
7
+ import { getCanonicalProfile } from './canonical.js';
8
+ /**
9
+ * Default linear weights
10
+ */
11
+ export const DEFAULT_WEIGHTS = {
12
+ control: 1.0,
13
+ nesting: 1.5,
14
+ state: 2.0,
15
+ async: 2.5,
16
+ coupling: 3.0,
17
+ };
18
+ /**
19
+ * Calculate raw sum of dimensions (CDR-SOB style)
20
+ * Simple sum: C + N + S + A + Λ
21
+ */
22
+ export function calculateRawSum(vector) {
23
+ return vector.control + vector.nesting + vector.state + vector.async + vector.coupling;
24
+ }
25
+ /**
26
+ * Calculate rawSum threshold from canonical profile upper bounds
27
+ */
28
+ export function calculateRawSumThreshold(moduleType) {
29
+ const profile = getCanonicalProfile(moduleType);
30
+ return (profile.control[1] +
31
+ profile.nesting[1] +
32
+ profile.state[1] +
33
+ profile.async[1] +
34
+ profile.coupling[1]);
35
+ }
36
+ /**
37
+ * Calculate tensor-based complexity score
38
+ *
39
+ * @param vector - 5D complexity vector
40
+ * @param moduleType - Module type for context-aware analysis
41
+ * @param epsilon - Regularization parameter (default: 2.0)
42
+ * @param weights - Linear weights (default: DEFAULT_WEIGHTS)
43
+ */
44
+ export function calculateTensorScore(vector, moduleType = 'unknown', epsilon = 2.0, weights = DEFAULT_WEIGHTS) {
45
+ // Get interaction matrix for module type
46
+ const matrix = getInteractionMatrix(moduleType);
47
+ // Calculate components
48
+ const linear = dotProduct(vector, weights);
49
+ const quadratic = quadraticForm(vector, matrix) * 0.1; // Scale factor
50
+ const raw = linear + quadratic;
51
+ // ε-regularization
52
+ const normSquared = Math.pow(vectorNorm(vector), 2);
53
+ const regularization = epsilon * normSquared * 0.01; // Scale factor
54
+ const regularized = raw + regularization;
55
+ // CDR-SOB style: simple sum and threshold
56
+ const rawSum = calculateRawSum(vector);
57
+ const rawSumThreshold = calculateRawSumThreshold(moduleType);
58
+ const rawSumRatio = rawSumThreshold > 0 ? rawSum / rawSumThreshold : 0;
59
+ return {
60
+ linear: Math.round(linear * 100) / 100,
61
+ quadratic: Math.round(quadratic * 100) / 100,
62
+ raw: Math.round(raw * 100) / 100,
63
+ regularization: Math.round(regularization * 100) / 100,
64
+ regularized: Math.round(regularized * 100) / 100,
65
+ epsilon,
66
+ moduleType,
67
+ vector,
68
+ // CDR-SOB style
69
+ rawSum: Math.round(rawSum * 100) / 100,
70
+ rawSumThreshold,
71
+ rawSumRatio: Math.round(rawSumRatio * 1000) / 1000,
72
+ };
73
+ }
74
+ /**
75
+ * Calculate convergence score
76
+ *
77
+ * Returns:
78
+ * < 0: Safe zone (converged)
79
+ * 0-1: ε-neighborhood (review needed)
80
+ * > 1: Violation zone
81
+ */
82
+ export function convergenceScore(current, threshold, epsilon) {
83
+ if (epsilon === 0) {
84
+ return current > threshold - epsilon ? Infinity : 0;
85
+ }
86
+ const target = threshold - epsilon;
87
+ return (current - target) / epsilon;
88
+ }
89
+ /**
90
+ * Determine convergence status from score
91
+ */
92
+ function getConvergenceStatus(convScore, isOscillating = false) {
93
+ if (isOscillating)
94
+ return 'oscillating';
95
+ if (convScore < 0)
96
+ return 'safe';
97
+ if (convScore < 1)
98
+ return 'review';
99
+ return 'violation';
100
+ }
101
+ /**
102
+ * Estimate Lipschitz constant from two points
103
+ *
104
+ * k = |f(x) - f(y)| / |x - y|
105
+ * For contraction mapping, we need k < 1
106
+ */
107
+ export function estimateLipschitz(v1, v2, score1, score2) {
108
+ const a1 = vectorToArray(v1);
109
+ const a2 = vectorToArray(v2);
110
+ // Calculate vector distance
111
+ const vDist = Math.sqrt(a1.reduce((sum, x, i) => sum + Math.pow(x - a2[i], 2), 0));
112
+ if (vDist < 1e-10)
113
+ return 0;
114
+ // Calculate score distance
115
+ const sDist = Math.abs(score1 - score2);
116
+ return sDist / vDist;
117
+ }
118
+ /**
119
+ * Analyze convergence status
120
+ */
121
+ export function analyzeConvergence(score, threshold = 10.0, epsilon = 2.0, options) {
122
+ const target = threshold - epsilon;
123
+ const convScore = convergenceScore(score, threshold, epsilon);
124
+ // Estimate Lipschitz constant if vectors provided
125
+ let lipschitzEstimate = 0;
126
+ if (options?.prevVector && options?.currVector && options?.prevScore !== undefined) {
127
+ lipschitzEstimate = estimateLipschitz(options.prevVector, options.currVector, options.prevScore, score);
128
+ }
129
+ return {
130
+ score,
131
+ threshold,
132
+ epsilon,
133
+ convergenceScore: Math.round(convScore * 1000) / 1000,
134
+ status: getConvergenceStatus(convScore, options?.isOscillating),
135
+ distanceToTarget: Math.round((score - target) * 100) / 100,
136
+ distanceToThreshold: Math.round((threshold - score) * 100) / 100,
137
+ lipschitzEstimate: Math.round(lipschitzEstimate * 1000) / 1000,
138
+ };
139
+ }
140
+ /**
141
+ * Hodge decomposition of complexity vector
142
+ *
143
+ * - H^{2,0} (holomorphic): Control + Nesting → Local algorithmic
144
+ * - H^{0,2} (anti-holomorphic): State + Coupling → Global structural
145
+ * - H^{1,1} (harmonic): Async → Mixed/balanced
146
+ */
147
+ export function hodgeDecomposition(vector, weights = DEFAULT_WEIGHTS) {
148
+ // Algorithmic: Control + Nesting
149
+ const algorithmic = vector.control * weights.control + vector.nesting * weights.nesting;
150
+ // Architectural: State + Coupling
151
+ const architectural = vector.state * weights.state + vector.coupling * weights.coupling;
152
+ // Balanced: Async (bridges both worlds)
153
+ const balanced = vector.async * weights.async;
154
+ const total = algorithmic + architectural + balanced;
155
+ const balanceRatio = total > 0 ? balanced / total : 0;
156
+ return {
157
+ algorithmic: Math.round(algorithmic * 100) / 100,
158
+ architectural: Math.round(architectural * 100) / 100,
159
+ balanced: Math.round(balanced * 100) / 100,
160
+ total: Math.round(total * 100) / 100,
161
+ balanceRatio: Math.round(balanceRatio * 1000) / 1000,
162
+ isHarmonic: balanceRatio >= 0.3,
163
+ };
164
+ }
165
+ /**
166
+ * Classify complexity score into level
167
+ */
168
+ export function classifyComplexityLevel(score) {
169
+ if (score < 2)
170
+ return 'minimal';
171
+ if (score < 5)
172
+ return 'low';
173
+ if (score < 10)
174
+ return 'medium';
175
+ if (score < 20)
176
+ return 'high';
177
+ return 'extreme';
178
+ }
179
+ /**
180
+ * Generate refactoring recommendations based on vector analysis
181
+ */
182
+ export function recommendRefactoring(vector, weights = DEFAULT_WEIGHTS) {
183
+ const dimensions = ['control', 'nesting', 'state', 'async', 'coupling'];
184
+ const arr = vectorToArray(vector);
185
+ const wArr = vectorToArray(weights);
186
+ // Calculate weighted contributions
187
+ const weighted = arr.map((v, i) => v * wArr[i]);
188
+ const total = weighted.reduce((sum, w) => sum + w, 0);
189
+ if (total === 0)
190
+ return [];
191
+ // Calculate contributions and sort by weight
192
+ const contributions = dimensions.map((dim, i) => ({
193
+ dimension: dim,
194
+ weighted: weighted[i],
195
+ percentage: weighted[i] / total,
196
+ }));
197
+ contributions.sort((a, b) => b.weighted - a.weighted);
198
+ // Generate recommendations for top contributors
199
+ const actions = {
200
+ control: 'Extract complex conditionals into separate functions',
201
+ nesting: 'Flatten nested structures using early returns or guard clauses',
202
+ state: 'Reduce state mutations; consider immutable patterns',
203
+ async: 'Simplify async flow; reduce callback nesting',
204
+ coupling: 'Extract dependencies; use dependency injection',
205
+ };
206
+ return contributions
207
+ .filter(c => c.percentage >= 0.1) // Only dimensions contributing >= 10%
208
+ .map(c => ({
209
+ dimension: c.dimension,
210
+ priority: Math.min(5, Math.floor(c.percentage * 10) + 1),
211
+ action: actions[c.dimension],
212
+ expectedImpact: Math.round(c.weighted * 0.3 * 100) / 100, // Assume 30% reduction
213
+ }));
214
+ }
215
+ /**
216
+ * Check if in safe zone (below threshold - ε)
217
+ */
218
+ export function isSafe(score) {
219
+ return score.regularized < 8.0; // threshold(10) - ε(2)
220
+ }
221
+ /**
222
+ * Check if needs review (in ε-neighborhood)
223
+ */
224
+ export function needsReview(score) {
225
+ return score.regularized >= 8.0 && score.regularized < 10.0;
226
+ }
227
+ /**
228
+ * Check if violates threshold
229
+ */
230
+ export function isViolation(score) {
231
+ return score.regularized >= 10.0;
232
+ }
233
+ //# sourceMappingURL=scoring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scoring.js","sourceRoot":"","sources":["../../src/tensor/scoring.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAa;IACvC,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,GAAG;IACZ,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,GAAG;CACd,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,MAAgB;IAC9C,OAAO,MAAM,CAAC,OAAO,GAAG,MAA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