@aiready/core 0.23.2 → 0.23.4
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/dist/__tests__/parser-factory.test.d.ts +1 -1
- package/dist/__tests__/parser-factory.test.js +62 -50
- package/dist/__tests__/python-parser.test.d.ts +1 -1
- package/dist/__tests__/python-parser.test.js +111 -109
- package/dist/__tests__/scoring.test.d.ts +1 -1
- package/dist/__tests__/scoring.test.js +193 -176
- package/dist/chunk-3YI4IS3D.mjs +191 -173
- package/dist/chunk-5HIXDC3X.mjs +273 -251
- package/dist/chunk-5V3L53AE.mjs +805 -0
- package/dist/chunk-CKVKHN3G.mjs +228 -211
- package/dist/chunk-COHIBX3Q.mjs +213 -195
- package/dist/chunk-CWRCDSKZ.mjs +91 -82
- package/dist/chunk-D3D3NCRR.mjs +147 -129
- package/dist/chunk-HCFYP7UD.mjs +805 -0
- package/dist/chunk-HFLFBA6F.mjs +79 -72
- package/dist/chunk-HKSARRCD.mjs +66 -58
- package/dist/chunk-JJ5JL5FX.mjs +91 -82
- package/dist/chunk-KDSTXVLQ.mjs +724 -0
- package/dist/chunk-KI7XORTN.mjs +91 -82
- package/dist/chunk-LTMHFNFK.mjs +690 -0
- package/dist/chunk-LTNXTXRI.mjs +228 -211
- package/dist/chunk-M22BXHBR.mjs +805 -0
- package/dist/chunk-MH3A3LX6.mjs +200 -182
- package/dist/chunk-NGHT7JOG.mjs +697 -0
- package/dist/chunk-OQ6IGDXG.mjs +147 -129
- package/dist/chunk-QAFB3HXQ.mjs +181 -165
- package/dist/chunk-QQBKXHLU.mjs +678 -0
- package/dist/chunk-RDHYGES7.mjs +678 -0
- package/dist/chunk-SWTDBVYJ.mjs +228 -213
- package/dist/chunk-UIWL5JQB.mjs +79 -72
- package/dist/chunk-UQGI67WR.mjs +79 -72
- package/dist/chunk-UTZOO4XO.mjs +147 -131
- package/dist/chunk-X4F46I5L.mjs +213 -195
- package/dist/chunk-XKK7YHPX.mjs +204 -186
- package/dist/chunk-YCA4FTEK.mjs +190 -172
- package/dist/chunk-ZSZRRTJM.mjs +719 -0
- package/dist/client-BgmiMoil.d.mts +1344 -0
- package/dist/client-BgmiMoil.d.ts +1344 -0
- package/dist/client-BxGrPuuN.d.mts +1191 -0
- package/dist/client-BxGrPuuN.d.ts +1191 -0
- package/dist/client-D-cn9ydj.d.mts +1136 -0
- package/dist/client-D-cn9ydj.d.ts +1136 -0
- package/dist/client-D9seCH4K.d.mts +1334 -0
- package/dist/client-D9seCH4K.d.ts +1334 -0
- package/dist/client-DIXIh7rw.d.mts +1193 -0
- package/dist/client-DIXIh7rw.d.ts +1193 -0
- package/dist/client-DVHXWOHw.d.mts +1245 -0
- package/dist/client-DVHXWOHw.d.ts +1245 -0
- package/dist/client.d.mts +2 -1098
- package/dist/client.d.ts +2 -1098
- package/dist/client.js +23 -43
- package/dist/client.mjs +3 -25
- package/dist/index.d.mts +329 -107
- package/dist/index.d.ts +329 -107
- package/dist/index.js +329 -340
- package/dist/index.mjs +305 -322
- package/dist/parsers/parser-factory.d.ts +45 -45
- package/dist/parsers/parser-factory.js +86 -84
- package/dist/parsers/python-parser.d.ts +33 -28
- package/dist/parsers/python-parser.js +224 -222
- package/dist/parsers/typescript-parser.d.ts +15 -10
- package/dist/parsers/typescript-parser.js +223 -197
- package/dist/scoring.d.ts +59 -49
- package/dist/scoring.js +129 -127
- package/dist/types/language.d.ts +104 -93
- package/dist/types/language.js +23 -23
- package/dist/types.d.ts +105 -87
- package/dist/types.js +1 -1
- package/dist/utils/ast-parser.d.ts +42 -33
- package/dist/utils/ast-parser.js +159 -162
- package/dist/utils/cli-helpers.d.ts +27 -10
- package/dist/utils/cli-helpers.js +45 -43
- package/dist/utils/config.d.ts +8 -3
- package/dist/utils/config.js +67 -69
- package/dist/utils/file-scanner.d.ts +1 -1
- package/dist/utils/file-scanner.js +80 -76
- package/dist/utils/metrics.d.ts +1 -1
- package/dist/utils/metrics.js +2 -2
- package/package.json +1 -1
package/dist/chunk-UIWL5JQB.mjs
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
// src/types/language.ts
|
|
2
2
|
var Language = /* @__PURE__ */ ((Language2) => {
|
|
3
|
-
Language2[
|
|
4
|
-
Language2[
|
|
5
|
-
Language2[
|
|
6
|
-
Language2[
|
|
7
|
-
Language2[
|
|
8
|
-
Language2[
|
|
9
|
-
Language2[
|
|
3
|
+
Language2['TypeScript'] = 'typescript';
|
|
4
|
+
Language2['JavaScript'] = 'javascript';
|
|
5
|
+
Language2['Python'] = 'python';
|
|
6
|
+
Language2['Java'] = 'java';
|
|
7
|
+
Language2['Go'] = 'go';
|
|
8
|
+
Language2['Rust'] = 'rust';
|
|
9
|
+
Language2['CSharp'] = 'csharp';
|
|
10
10
|
return Language2;
|
|
11
11
|
})(Language || {});
|
|
12
12
|
var LANGUAGE_EXTENSIONS = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
'.ts': 'typescript' /* TypeScript */,
|
|
14
|
+
'.tsx': 'typescript' /* TypeScript */,
|
|
15
|
+
'.js': 'javascript' /* JavaScript */,
|
|
16
|
+
'.jsx': 'javascript' /* JavaScript */,
|
|
17
|
+
'.py': 'python' /* Python */,
|
|
18
|
+
'.java': 'java' /* Java */,
|
|
19
|
+
'.go': 'go' /* Go */,
|
|
20
|
+
'.rs': 'rust' /* Rust */,
|
|
21
|
+
'.cs': 'csharp' /* CSharp */,
|
|
22
22
|
};
|
|
23
23
|
var ParseError = class extends Error {
|
|
24
24
|
constructor(message, filePath, loc) {
|
|
25
25
|
super(message);
|
|
26
26
|
this.filePath = filePath;
|
|
27
27
|
this.loc = loc;
|
|
28
|
-
this.name =
|
|
28
|
+
this.name = 'ParseError';
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
// src/scoring.ts
|
|
33
33
|
var DEFAULT_TOOL_WEIGHTS = {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
'pattern-detect': 22,
|
|
35
|
+
'context-analyzer': 19,
|
|
36
36
|
consistency: 14,
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
'ai-signal-clarity': 11,
|
|
38
|
+
'agent-grounding': 10,
|
|
39
39
|
testability: 10,
|
|
40
|
-
|
|
41
|
-
deps: 6
|
|
40
|
+
'doc-drift': 8,
|
|
41
|
+
deps: 6,
|
|
42
42
|
};
|
|
43
43
|
var TOOL_NAME_MAP = {
|
|
44
|
-
patterns:
|
|
45
|
-
context:
|
|
46
|
-
consistency:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
grounding:
|
|
50
|
-
|
|
51
|
-
testability:
|
|
52
|
-
tests:
|
|
53
|
-
|
|
54
|
-
docs:
|
|
55
|
-
deps:
|
|
44
|
+
patterns: 'pattern-detect',
|
|
45
|
+
context: 'context-analyzer',
|
|
46
|
+
consistency: 'consistency',
|
|
47
|
+
'AI signal clarity': 'ai-signal-clarity',
|
|
48
|
+
'ai-signal-clarity': 'ai-signal-clarity',
|
|
49
|
+
grounding: 'agent-grounding',
|
|
50
|
+
'agent-grounding': 'agent-grounding',
|
|
51
|
+
testability: 'testability',
|
|
52
|
+
tests: 'testability',
|
|
53
|
+
'doc-drift': 'doc-drift',
|
|
54
|
+
docs: 'doc-drift',
|
|
55
|
+
deps: 'deps',
|
|
56
56
|
};
|
|
57
57
|
var CONTEXT_TIER_THRESHOLDS = {
|
|
58
58
|
compact: { idealTokens: 3e3, criticalTokens: 1e4, idealDepth: 4 },
|
|
59
59
|
standard: { idealTokens: 5e3, criticalTokens: 15e3, idealDepth: 5 },
|
|
60
60
|
extended: { idealTokens: 15e3, criticalTokens: 5e4, idealDepth: 7 },
|
|
61
|
-
frontier: { idealTokens: 5e4, criticalTokens: 15e4, idealDepth: 10 }
|
|
61
|
+
frontier: { idealTokens: 5e4, criticalTokens: 15e4, idealDepth: 10 },
|
|
62
62
|
};
|
|
63
63
|
var SIZE_ADJUSTED_THRESHOLDS = {
|
|
64
64
|
xs: 80,
|
|
@@ -69,20 +69,21 @@ var SIZE_ADJUSTED_THRESHOLDS = {
|
|
|
69
69
|
// 200-500 files
|
|
70
70
|
large: 65,
|
|
71
71
|
// 500-2000 files
|
|
72
|
-
enterprise: 58
|
|
72
|
+
enterprise: 58,
|
|
73
73
|
// 2000+ files
|
|
74
74
|
};
|
|
75
75
|
function getProjectSizeTier(fileCount) {
|
|
76
|
-
if (fileCount < 50) return
|
|
77
|
-
if (fileCount < 200) return
|
|
78
|
-
if (fileCount < 500) return
|
|
79
|
-
if (fileCount < 2e3) return
|
|
80
|
-
return
|
|
76
|
+
if (fileCount < 50) return 'xs';
|
|
77
|
+
if (fileCount < 200) return 'small';
|
|
78
|
+
if (fileCount < 500) return 'medium';
|
|
79
|
+
if (fileCount < 2e3) return 'large';
|
|
80
|
+
return 'enterprise';
|
|
81
81
|
}
|
|
82
|
-
function getRecommendedThreshold(fileCount, modelTier =
|
|
82
|
+
function getRecommendedThreshold(fileCount, modelTier = 'standard') {
|
|
83
83
|
const sizeTier = getProjectSizeTier(fileCount);
|
|
84
84
|
const base = SIZE_ADJUSTED_THRESHOLDS[sizeTier];
|
|
85
|
-
const modelBonus =
|
|
85
|
+
const modelBonus =
|
|
86
|
+
modelTier === 'frontier' ? -3 : modelTier === 'extended' ? -2 : 0;
|
|
86
87
|
return base + modelBonus;
|
|
87
88
|
}
|
|
88
89
|
function normalizeToolName(shortName) {
|
|
@@ -102,9 +103,9 @@ function parseWeightString(weightStr) {
|
|
|
102
103
|
if (!weightStr) {
|
|
103
104
|
return weights;
|
|
104
105
|
}
|
|
105
|
-
const pairs = weightStr.split(
|
|
106
|
+
const pairs = weightStr.split(',');
|
|
106
107
|
for (const pair of pairs) {
|
|
107
|
-
const [toolShortName, weightStr2] = pair.split(
|
|
108
|
+
const [toolShortName, weightStr2] = pair.split(':');
|
|
108
109
|
if (toolShortName && weightStr2) {
|
|
109
110
|
const toolName = normalizeToolName(toolShortName.trim());
|
|
110
111
|
const weight = parseInt(weightStr2.trim(), 10);
|
|
@@ -117,13 +118,14 @@ function parseWeightString(weightStr) {
|
|
|
117
118
|
}
|
|
118
119
|
function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
119
120
|
if (toolOutputs.size === 0) {
|
|
120
|
-
throw new Error(
|
|
121
|
+
throw new Error('No tool outputs provided for scoring');
|
|
121
122
|
}
|
|
122
123
|
const weights = /* @__PURE__ */ new Map();
|
|
123
124
|
for (const [toolName] of toolOutputs.entries()) {
|
|
124
125
|
const cliWeight = cliWeights?.get(toolName);
|
|
125
126
|
const configWeight = config?.tools?.[toolName]?.scoreWeight;
|
|
126
|
-
const weight =
|
|
127
|
+
const weight =
|
|
128
|
+
cliWeight ?? configWeight ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? 5;
|
|
127
129
|
weights.set(toolName, weight);
|
|
128
130
|
}
|
|
129
131
|
let weightedSum = 0;
|
|
@@ -148,44 +150,44 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
|
148
150
|
return `(${output.score} \xD7 ${w})`;
|
|
149
151
|
}
|
|
150
152
|
);
|
|
151
|
-
const formulaStr = `[${formulaParts.join(
|
|
153
|
+
const formulaStr = `[${formulaParts.join(' + ')}] / ${totalWeight} = ${overall}`;
|
|
152
154
|
return {
|
|
153
155
|
overall,
|
|
154
156
|
rating,
|
|
155
|
-
timestamp:
|
|
157
|
+
timestamp: /* @__PURE__ */ new Date().toISOString(),
|
|
156
158
|
toolsUsed,
|
|
157
159
|
breakdown,
|
|
158
160
|
calculation: {
|
|
159
161
|
formula: formulaStr,
|
|
160
162
|
weights: calculationWeights,
|
|
161
|
-
normalized: formulaStr
|
|
162
|
-
}
|
|
163
|
+
normalized: formulaStr,
|
|
164
|
+
},
|
|
163
165
|
};
|
|
164
166
|
}
|
|
165
167
|
function getRating(score) {
|
|
166
|
-
if (score >= 90) return
|
|
167
|
-
if (score >= 75) return
|
|
168
|
-
if (score >= 60) return
|
|
169
|
-
if (score >= 40) return
|
|
170
|
-
return
|
|
168
|
+
if (score >= 90) return 'Excellent';
|
|
169
|
+
if (score >= 75) return 'Good';
|
|
170
|
+
if (score >= 60) return 'Fair';
|
|
171
|
+
if (score >= 40) return 'Needs Work';
|
|
172
|
+
return 'Critical';
|
|
171
173
|
}
|
|
172
|
-
function getRatingWithContext(score, fileCount, modelTier =
|
|
174
|
+
function getRatingWithContext(score, fileCount, modelTier = 'standard') {
|
|
173
175
|
const threshold = getRecommendedThreshold(fileCount, modelTier);
|
|
174
176
|
const normalized = score - threshold + 70;
|
|
175
177
|
return getRating(normalized);
|
|
176
178
|
}
|
|
177
179
|
function getRatingDisplay(rating) {
|
|
178
180
|
switch (rating) {
|
|
179
|
-
case
|
|
180
|
-
return { emoji:
|
|
181
|
-
case
|
|
182
|
-
return { emoji:
|
|
183
|
-
case
|
|
184
|
-
return { emoji:
|
|
185
|
-
case
|
|
186
|
-
return { emoji:
|
|
187
|
-
case
|
|
188
|
-
return { emoji:
|
|
181
|
+
case 'Excellent':
|
|
182
|
+
return { emoji: '\u2705', color: 'green' };
|
|
183
|
+
case 'Good':
|
|
184
|
+
return { emoji: '\u{1F44D}', color: 'blue' };
|
|
185
|
+
case 'Fair':
|
|
186
|
+
return { emoji: '\u26A0\uFE0F', color: 'yellow' };
|
|
187
|
+
case 'Needs Work':
|
|
188
|
+
return { emoji: '\u{1F528}', color: 'orange' };
|
|
189
|
+
case 'Critical':
|
|
190
|
+
return { emoji: '\u274C', color: 'red' };
|
|
189
191
|
}
|
|
190
192
|
}
|
|
191
193
|
function formatScore(result) {
|
|
@@ -200,17 +202,22 @@ function formatToolScore(output) {
|
|
|
200
202
|
result += ` Factors:
|
|
201
203
|
`;
|
|
202
204
|
output.factors.forEach((factor) => {
|
|
203
|
-
const impactSign = factor.impact > 0 ?
|
|
205
|
+
const impactSign = factor.impact > 0 ? '+' : '';
|
|
204
206
|
result += ` \u2022 ${factor.name}: ${impactSign}${factor.impact} - ${factor.description}
|
|
205
207
|
`;
|
|
206
208
|
});
|
|
207
|
-
result +=
|
|
209
|
+
result += '\n';
|
|
208
210
|
}
|
|
209
211
|
if (output.recommendations && output.recommendations.length > 0) {
|
|
210
212
|
result += ` Recommendations:
|
|
211
213
|
`;
|
|
212
214
|
output.recommendations.forEach((rec, i) => {
|
|
213
|
-
const priorityIcon =
|
|
215
|
+
const priorityIcon =
|
|
216
|
+
rec.priority === 'high'
|
|
217
|
+
? '\u{1F534}'
|
|
218
|
+
: rec.priority === 'medium'
|
|
219
|
+
? '\u{1F7E1}'
|
|
220
|
+
: '\u{1F535}';
|
|
214
221
|
result += ` ${i + 1}. ${priorityIcon} ${rec.action}
|
|
215
222
|
`;
|
|
216
223
|
result += ` Impact: +${rec.estimatedImpact} points
|
|
@@ -406,5 +413,5 @@ export {
|
|
|
406
413
|
getRatingDisplay,
|
|
407
414
|
formatScore,
|
|
408
415
|
formatToolScore,
|
|
409
|
-
generateHTML
|
|
416
|
+
generateHTML,
|
|
410
417
|
};
|
package/dist/chunk-UQGI67WR.mjs
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
// src/types/language.ts
|
|
2
2
|
var Language = /* @__PURE__ */ ((Language2) => {
|
|
3
|
-
Language2[
|
|
4
|
-
Language2[
|
|
5
|
-
Language2[
|
|
6
|
-
Language2[
|
|
7
|
-
Language2[
|
|
8
|
-
Language2[
|
|
9
|
-
Language2[
|
|
3
|
+
Language2['TypeScript'] = 'typescript';
|
|
4
|
+
Language2['JavaScript'] = 'javascript';
|
|
5
|
+
Language2['Python'] = 'python';
|
|
6
|
+
Language2['Java'] = 'java';
|
|
7
|
+
Language2['Go'] = 'go';
|
|
8
|
+
Language2['Rust'] = 'rust';
|
|
9
|
+
Language2['CSharp'] = 'csharp';
|
|
10
10
|
return Language2;
|
|
11
11
|
})(Language || {});
|
|
12
12
|
var LANGUAGE_EXTENSIONS = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
'.ts': 'typescript' /* TypeScript */,
|
|
14
|
+
'.tsx': 'typescript' /* TypeScript */,
|
|
15
|
+
'.js': 'javascript' /* JavaScript */,
|
|
16
|
+
'.jsx': 'javascript' /* JavaScript */,
|
|
17
|
+
'.py': 'python' /* Python */,
|
|
18
|
+
'.java': 'java' /* Java */,
|
|
19
|
+
'.go': 'go' /* Go */,
|
|
20
|
+
'.rs': 'rust' /* Rust */,
|
|
21
|
+
'.cs': 'csharp' /* CSharp */,
|
|
22
22
|
};
|
|
23
23
|
var ParseError = class extends Error {
|
|
24
24
|
constructor(message, filePath, loc) {
|
|
25
25
|
super(message);
|
|
26
26
|
this.filePath = filePath;
|
|
27
27
|
this.loc = loc;
|
|
28
|
-
this.name =
|
|
28
|
+
this.name = 'ParseError';
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
// src/scoring.ts
|
|
33
33
|
var DEFAULT_TOOL_WEIGHTS = {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
'pattern-detect': 22,
|
|
35
|
+
'context-analyzer': 19,
|
|
36
36
|
consistency: 14,
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
'ai-signal-clarity': 11,
|
|
38
|
+
'agent-grounding': 10,
|
|
39
39
|
testability: 10,
|
|
40
|
-
|
|
41
|
-
deps: 6
|
|
40
|
+
'doc-drift': 8,
|
|
41
|
+
deps: 6,
|
|
42
42
|
};
|
|
43
43
|
var TOOL_NAME_MAP = {
|
|
44
|
-
patterns:
|
|
45
|
-
context:
|
|
46
|
-
consistency:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
grounding:
|
|
50
|
-
|
|
51
|
-
testability:
|
|
52
|
-
tests:
|
|
53
|
-
|
|
54
|
-
docs:
|
|
55
|
-
deps:
|
|
44
|
+
patterns: 'pattern-detect',
|
|
45
|
+
context: 'context-analyzer',
|
|
46
|
+
consistency: 'consistency',
|
|
47
|
+
'AI signal clarity': 'ai-signal-clarity',
|
|
48
|
+
'ai-signal-clarity': 'ai-signal-clarity',
|
|
49
|
+
grounding: 'agent-grounding',
|
|
50
|
+
'agent-grounding': 'agent-grounding',
|
|
51
|
+
testability: 'testability',
|
|
52
|
+
tests: 'testability',
|
|
53
|
+
'doc-drift': 'doc-drift',
|
|
54
|
+
docs: 'doc-drift',
|
|
55
|
+
deps: 'deps',
|
|
56
56
|
};
|
|
57
57
|
var CONTEXT_TIER_THRESHOLDS = {
|
|
58
58
|
compact: { idealTokens: 3e3, criticalTokens: 1e4, idealDepth: 4 },
|
|
59
59
|
standard: { idealTokens: 5e3, criticalTokens: 15e3, idealDepth: 5 },
|
|
60
60
|
extended: { idealTokens: 15e3, criticalTokens: 5e4, idealDepth: 7 },
|
|
61
|
-
frontier: { idealTokens: 5e4, criticalTokens: 15e4, idealDepth: 10 }
|
|
61
|
+
frontier: { idealTokens: 5e4, criticalTokens: 15e4, idealDepth: 10 },
|
|
62
62
|
};
|
|
63
63
|
var SIZE_ADJUSTED_THRESHOLDS = {
|
|
64
64
|
xs: 80,
|
|
@@ -69,20 +69,21 @@ var SIZE_ADJUSTED_THRESHOLDS = {
|
|
|
69
69
|
// 200-500 files
|
|
70
70
|
large: 65,
|
|
71
71
|
// 500-2000 files
|
|
72
|
-
enterprise: 58
|
|
72
|
+
enterprise: 58,
|
|
73
73
|
// 2000+ files
|
|
74
74
|
};
|
|
75
75
|
function getProjectSizeTier(fileCount) {
|
|
76
|
-
if (fileCount < 50) return
|
|
77
|
-
if (fileCount < 200) return
|
|
78
|
-
if (fileCount < 500) return
|
|
79
|
-
if (fileCount < 2e3) return
|
|
80
|
-
return
|
|
76
|
+
if (fileCount < 50) return 'xs';
|
|
77
|
+
if (fileCount < 200) return 'small';
|
|
78
|
+
if (fileCount < 500) return 'medium';
|
|
79
|
+
if (fileCount < 2e3) return 'large';
|
|
80
|
+
return 'enterprise';
|
|
81
81
|
}
|
|
82
|
-
function getRecommendedThreshold(fileCount, modelTier =
|
|
82
|
+
function getRecommendedThreshold(fileCount, modelTier = 'standard') {
|
|
83
83
|
const sizeTier = getProjectSizeTier(fileCount);
|
|
84
84
|
const base = SIZE_ADJUSTED_THRESHOLDS[sizeTier];
|
|
85
|
-
const modelBonus =
|
|
85
|
+
const modelBonus =
|
|
86
|
+
modelTier === 'frontier' ? -3 : modelTier === 'extended' ? -2 : 0;
|
|
86
87
|
return base + modelBonus;
|
|
87
88
|
}
|
|
88
89
|
function normalizeToolName(shortName) {
|
|
@@ -102,9 +103,9 @@ function parseWeightString(weightStr) {
|
|
|
102
103
|
if (!weightStr) {
|
|
103
104
|
return weights;
|
|
104
105
|
}
|
|
105
|
-
const pairs = weightStr.split(
|
|
106
|
+
const pairs = weightStr.split(',');
|
|
106
107
|
for (const pair of pairs) {
|
|
107
|
-
const [toolShortName, weightStr2] = pair.split(
|
|
108
|
+
const [toolShortName, weightStr2] = pair.split(':');
|
|
108
109
|
if (toolShortName && weightStr2) {
|
|
109
110
|
const toolName = normalizeToolName(toolShortName.trim());
|
|
110
111
|
const weight = parseInt(weightStr2.trim(), 10);
|
|
@@ -117,13 +118,14 @@ function parseWeightString(weightStr) {
|
|
|
117
118
|
}
|
|
118
119
|
function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
119
120
|
if (toolOutputs.size === 0) {
|
|
120
|
-
throw new Error(
|
|
121
|
+
throw new Error('No tool outputs provided for scoring');
|
|
121
122
|
}
|
|
122
123
|
const weights = /* @__PURE__ */ new Map();
|
|
123
124
|
for (const [toolName] of toolOutputs.entries()) {
|
|
124
125
|
const cliWeight = cliWeights?.get(toolName);
|
|
125
126
|
const configWeight = config?.tools?.[toolName]?.scoreWeight;
|
|
126
|
-
const weight =
|
|
127
|
+
const weight =
|
|
128
|
+
cliWeight ?? configWeight ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? 5;
|
|
127
129
|
weights.set(toolName, weight);
|
|
128
130
|
}
|
|
129
131
|
let weightedSum = 0;
|
|
@@ -148,44 +150,44 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
|
148
150
|
return `(${output.score} \xD7 ${w})`;
|
|
149
151
|
}
|
|
150
152
|
);
|
|
151
|
-
const formulaStr = `[${formulaParts.join(
|
|
153
|
+
const formulaStr = `[${formulaParts.join(' + ')}] / ${totalWeight} = ${overall}`;
|
|
152
154
|
return {
|
|
153
155
|
overall,
|
|
154
156
|
rating,
|
|
155
|
-
timestamp:
|
|
157
|
+
timestamp: /* @__PURE__ */ new Date().toISOString(),
|
|
156
158
|
toolsUsed,
|
|
157
159
|
breakdown,
|
|
158
160
|
calculation: {
|
|
159
161
|
formula: formulaStr,
|
|
160
162
|
weights: calculationWeights,
|
|
161
|
-
normalized: formulaStr
|
|
162
|
-
}
|
|
163
|
+
normalized: formulaStr,
|
|
164
|
+
},
|
|
163
165
|
};
|
|
164
166
|
}
|
|
165
167
|
function getRating(score) {
|
|
166
|
-
if (score >= 90) return
|
|
167
|
-
if (score >= 75) return
|
|
168
|
-
if (score >= 60) return
|
|
169
|
-
if (score >= 40) return
|
|
170
|
-
return
|
|
168
|
+
if (score >= 90) return 'Excellent';
|
|
169
|
+
if (score >= 75) return 'Good';
|
|
170
|
+
if (score >= 60) return 'Fair';
|
|
171
|
+
if (score >= 40) return 'Needs Work';
|
|
172
|
+
return 'Critical';
|
|
171
173
|
}
|
|
172
|
-
function getRatingWithContext(score, fileCount, modelTier =
|
|
174
|
+
function getRatingWithContext(score, fileCount, modelTier = 'standard') {
|
|
173
175
|
const threshold = getRecommendedThreshold(fileCount, modelTier);
|
|
174
176
|
const normalized = score - threshold + 70;
|
|
175
177
|
return getRating(normalized);
|
|
176
178
|
}
|
|
177
179
|
function getRatingDisplay(rating) {
|
|
178
180
|
switch (rating) {
|
|
179
|
-
case
|
|
180
|
-
return { emoji:
|
|
181
|
-
case
|
|
182
|
-
return { emoji:
|
|
183
|
-
case
|
|
184
|
-
return { emoji:
|
|
185
|
-
case
|
|
186
|
-
return { emoji:
|
|
187
|
-
case
|
|
188
|
-
return { emoji:
|
|
181
|
+
case 'Excellent':
|
|
182
|
+
return { emoji: '\u2705', color: 'green' };
|
|
183
|
+
case 'Good':
|
|
184
|
+
return { emoji: '\u{1F44D}', color: 'blue' };
|
|
185
|
+
case 'Fair':
|
|
186
|
+
return { emoji: '\u26A0\uFE0F', color: 'yellow' };
|
|
187
|
+
case 'Needs Work':
|
|
188
|
+
return { emoji: '\u{1F528}', color: 'orange' };
|
|
189
|
+
case 'Critical':
|
|
190
|
+
return { emoji: '\u274C', color: 'red' };
|
|
189
191
|
}
|
|
190
192
|
}
|
|
191
193
|
function formatScore(result) {
|
|
@@ -200,17 +202,22 @@ function formatToolScore(output) {
|
|
|
200
202
|
result += ` Factors:
|
|
201
203
|
`;
|
|
202
204
|
output.factors.forEach((factor) => {
|
|
203
|
-
const impactSign = factor.impact > 0 ?
|
|
205
|
+
const impactSign = factor.impact > 0 ? '+' : '';
|
|
204
206
|
result += ` \u2022 ${factor.name}: ${impactSign}${factor.impact} - ${factor.description}
|
|
205
207
|
`;
|
|
206
208
|
});
|
|
207
|
-
result +=
|
|
209
|
+
result += '\n';
|
|
208
210
|
}
|
|
209
211
|
if (output.recommendations && output.recommendations.length > 0) {
|
|
210
212
|
result += ` Recommendations:
|
|
211
213
|
`;
|
|
212
214
|
output.recommendations.forEach((rec, i) => {
|
|
213
|
-
const priorityIcon =
|
|
215
|
+
const priorityIcon =
|
|
216
|
+
rec.priority === 'high'
|
|
217
|
+
? '\u{1F534}'
|
|
218
|
+
: rec.priority === 'medium'
|
|
219
|
+
? '\u{1F7E1}'
|
|
220
|
+
: '\u{1F535}';
|
|
214
221
|
result += ` ${i + 1}. ${priorityIcon} ${rec.action}
|
|
215
222
|
`;
|
|
216
223
|
result += ` Impact: +${rec.estimatedImpact} points
|
|
@@ -406,5 +413,5 @@ export {
|
|
|
406
413
|
getRatingDisplay,
|
|
407
414
|
formatScore,
|
|
408
415
|
formatToolScore,
|
|
409
|
-
generateHTML
|
|
416
|
+
generateHTML,
|
|
410
417
|
};
|