@aiready/core 0.23.2 → 0.23.3
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 +325 -103
- package/dist/index.d.ts +325 -103
- package/dist/index.js +307 -324
- package/dist/index.mjs +283 -306
- 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-OQ6IGDXG.mjs
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
// src/types/schema.ts
|
|
2
|
-
import { z } from
|
|
2
|
+
import { z } from 'zod';
|
|
3
3
|
var Severity = /* @__PURE__ */ ((Severity2) => {
|
|
4
|
-
Severity2[
|
|
5
|
-
Severity2[
|
|
6
|
-
Severity2[
|
|
7
|
-
Severity2[
|
|
4
|
+
Severity2['Critical'] = 'critical';
|
|
5
|
+
Severity2['Major'] = 'major';
|
|
6
|
+
Severity2['Minor'] = 'minor';
|
|
7
|
+
Severity2['Info'] = 'info';
|
|
8
8
|
return Severity2;
|
|
9
9
|
})(Severity || {});
|
|
10
10
|
var SeveritySchema = z.nativeEnum(Severity);
|
|
11
11
|
var IssueType = /* @__PURE__ */ ((IssueType2) => {
|
|
12
|
-
IssueType2[
|
|
13
|
-
IssueType2[
|
|
14
|
-
IssueType2[
|
|
15
|
-
IssueType2[
|
|
16
|
-
IssueType2[
|
|
17
|
-
IssueType2[
|
|
18
|
-
IssueType2[
|
|
19
|
-
IssueType2[
|
|
20
|
-
IssueType2[
|
|
21
|
-
IssueType2[
|
|
22
|
-
IssueType2[
|
|
23
|
-
IssueType2[
|
|
24
|
-
IssueType2[
|
|
25
|
-
IssueType2[
|
|
26
|
-
IssueType2[
|
|
27
|
-
IssueType2[
|
|
28
|
-
IssueType2[
|
|
29
|
-
IssueType2[
|
|
12
|
+
IssueType2['DuplicatePattern'] = 'duplicate-pattern';
|
|
13
|
+
IssueType2['PatternInconsistency'] = 'pattern-inconsistency';
|
|
14
|
+
IssueType2['ContextFragmentation'] = 'context-fragmentation';
|
|
15
|
+
IssueType2['DependencyHealth'] = 'dependency-health';
|
|
16
|
+
IssueType2['CircularDependency'] = 'circular-dependency';
|
|
17
|
+
IssueType2['DocDrift'] = 'doc-drift';
|
|
18
|
+
IssueType2['NamingInconsistency'] = 'naming-inconsistency';
|
|
19
|
+
IssueType2['NamingQuality'] = 'naming-quality';
|
|
20
|
+
IssueType2['ArchitectureInconsistency'] = 'architecture-inconsistency';
|
|
21
|
+
IssueType2['DeadCode'] = 'dead-code';
|
|
22
|
+
IssueType2['MissingTypes'] = 'missing-types';
|
|
23
|
+
IssueType2['MagicLiteral'] = 'magic-literal';
|
|
24
|
+
IssueType2['BooleanTrap'] = 'boolean-trap';
|
|
25
|
+
IssueType2['AiSignalClarity'] = 'ai-signal-clarity';
|
|
26
|
+
IssueType2['LowTestability'] = 'low-testability';
|
|
27
|
+
IssueType2['AgentNavigationFailure'] = 'agent-navigation-failure';
|
|
28
|
+
IssueType2['AmbiguousApi'] = 'ambiguous-api';
|
|
29
|
+
IssueType2['ChangeAmplification'] = 'change-amplification';
|
|
30
30
|
return IssueType2;
|
|
31
31
|
})(IssueType || {});
|
|
32
32
|
var IssueTypeSchema = z.nativeEnum(IssueType);
|
|
33
33
|
var AnalysisStatus = /* @__PURE__ */ ((AnalysisStatus2) => {
|
|
34
|
-
AnalysisStatus2[
|
|
35
|
-
AnalysisStatus2[
|
|
36
|
-
AnalysisStatus2[
|
|
34
|
+
AnalysisStatus2['Processing'] = 'processing';
|
|
35
|
+
AnalysisStatus2['Completed'] = 'completed';
|
|
36
|
+
AnalysisStatus2['Failed'] = 'failed';
|
|
37
37
|
return AnalysisStatus2;
|
|
38
38
|
})(AnalysisStatus || {});
|
|
39
39
|
var AnalysisStatusSchema = z.nativeEnum(AnalysisStatus);
|
|
40
40
|
var ModelTier = /* @__PURE__ */ ((ModelTier2) => {
|
|
41
|
-
ModelTier2[
|
|
42
|
-
ModelTier2[
|
|
43
|
-
ModelTier2[
|
|
44
|
-
ModelTier2[
|
|
41
|
+
ModelTier2['Compact'] = 'compact';
|
|
42
|
+
ModelTier2['Standard'] = 'standard';
|
|
43
|
+
ModelTier2['Extended'] = 'extended';
|
|
44
|
+
ModelTier2['Frontier'] = 'frontier';
|
|
45
45
|
return ModelTier2;
|
|
46
46
|
})(ModelTier || {});
|
|
47
47
|
var ModelTierSchema = z.nativeEnum(ModelTier);
|
|
@@ -50,14 +50,14 @@ var LocationSchema = z.object({
|
|
|
50
50
|
line: z.number(),
|
|
51
51
|
column: z.number().optional(),
|
|
52
52
|
endLine: z.number().optional(),
|
|
53
|
-
endColumn: z.number().optional()
|
|
53
|
+
endColumn: z.number().optional(),
|
|
54
54
|
});
|
|
55
55
|
var IssueSchema = z.object({
|
|
56
56
|
type: IssueTypeSchema,
|
|
57
57
|
severity: SeveritySchema,
|
|
58
58
|
message: z.string(),
|
|
59
59
|
location: LocationSchema,
|
|
60
|
-
suggestion: z.string().optional()
|
|
60
|
+
suggestion: z.string().optional(),
|
|
61
61
|
});
|
|
62
62
|
var MetricsSchema = z.object({
|
|
63
63
|
tokenCost: z.number().optional(),
|
|
@@ -74,102 +74,113 @@ var MetricsSchema = z.object({
|
|
|
74
74
|
// Business value metrics
|
|
75
75
|
estimatedMonthlyCost: z.number().optional(),
|
|
76
76
|
estimatedDeveloperHours: z.number().optional(),
|
|
77
|
-
comprehensionDifficultyIndex: z.number().optional()
|
|
77
|
+
comprehensionDifficultyIndex: z.number().optional(),
|
|
78
78
|
});
|
|
79
79
|
var AnalysisResultSchema = z.object({
|
|
80
80
|
fileName: z.string(),
|
|
81
81
|
issues: z.array(IssueSchema),
|
|
82
|
-
metrics: MetricsSchema
|
|
82
|
+
metrics: MetricsSchema,
|
|
83
83
|
});
|
|
84
84
|
var SpokeOutputSchema = z.object({
|
|
85
85
|
results: z.array(AnalysisResultSchema),
|
|
86
86
|
summary: z.any(),
|
|
87
|
-
metadata: z
|
|
88
|
-
|
|
89
|
-
version: z.string(),
|
|
90
|
-
timestamp: z.string()
|
|
91
|
-
}).catchall(z.any()).optional()
|
|
92
|
-
});
|
|
93
|
-
var UnifiedReportSchema = z.object({
|
|
94
|
-
summary: z.object({
|
|
95
|
-
totalFiles: z.number(),
|
|
96
|
-
totalIssues: z.number(),
|
|
97
|
-
criticalIssues: z.number(),
|
|
98
|
-
majorIssues: z.number()
|
|
99
|
-
}),
|
|
100
|
-
results: z.array(AnalysisResultSchema),
|
|
101
|
-
scoring: z.object({
|
|
102
|
-
overall: z.number(),
|
|
103
|
-
rating: z.string(),
|
|
104
|
-
timestamp: z.string(),
|
|
105
|
-
breakdown: z.array(z.object({
|
|
87
|
+
metadata: z
|
|
88
|
+
.object({
|
|
106
89
|
toolName: z.string(),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
90
|
+
version: z.string(),
|
|
91
|
+
timestamp: z.string(),
|
|
92
|
+
})
|
|
93
|
+
.catchall(z.any())
|
|
94
|
+
.optional(),
|
|
95
|
+
});
|
|
96
|
+
var UnifiedReportSchema = z
|
|
97
|
+
.object({
|
|
98
|
+
summary: z.object({
|
|
99
|
+
totalFiles: z.number(),
|
|
100
|
+
totalIssues: z.number(),
|
|
101
|
+
criticalIssues: z.number(),
|
|
102
|
+
majorIssues: z.number(),
|
|
103
|
+
}),
|
|
104
|
+
results: z.array(AnalysisResultSchema),
|
|
105
|
+
scoring: z
|
|
106
|
+
.object({
|
|
107
|
+
overall: z.number(),
|
|
108
|
+
rating: z.string(),
|
|
109
|
+
timestamp: z.string(),
|
|
110
|
+
breakdown: z.array(
|
|
111
|
+
z
|
|
112
|
+
.object({
|
|
113
|
+
toolName: z.string(),
|
|
114
|
+
score: z.number(),
|
|
115
|
+
})
|
|
116
|
+
.catchall(z.any())
|
|
117
|
+
),
|
|
118
|
+
})
|
|
119
|
+
.optional(),
|
|
120
|
+
})
|
|
121
|
+
.catchall(z.any());
|
|
111
122
|
|
|
112
123
|
// src/types/language.ts
|
|
113
124
|
var Language = /* @__PURE__ */ ((Language2) => {
|
|
114
|
-
Language2[
|
|
115
|
-
Language2[
|
|
116
|
-
Language2[
|
|
117
|
-
Language2[
|
|
118
|
-
Language2[
|
|
119
|
-
Language2[
|
|
120
|
-
Language2[
|
|
125
|
+
Language2['TypeScript'] = 'typescript';
|
|
126
|
+
Language2['JavaScript'] = 'javascript';
|
|
127
|
+
Language2['Python'] = 'python';
|
|
128
|
+
Language2['Java'] = 'java';
|
|
129
|
+
Language2['Go'] = 'go';
|
|
130
|
+
Language2['Rust'] = 'rust';
|
|
131
|
+
Language2['CSharp'] = 'csharp';
|
|
121
132
|
return Language2;
|
|
122
133
|
})(Language || {});
|
|
123
134
|
var LANGUAGE_EXTENSIONS = {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
135
|
+
'.ts': 'typescript' /* TypeScript */,
|
|
136
|
+
'.tsx': 'typescript' /* TypeScript */,
|
|
137
|
+
'.js': 'javascript' /* JavaScript */,
|
|
138
|
+
'.jsx': 'javascript' /* JavaScript */,
|
|
139
|
+
'.py': 'python' /* Python */,
|
|
140
|
+
'.java': 'java' /* Java */,
|
|
141
|
+
'.go': 'go' /* Go */,
|
|
142
|
+
'.rs': 'rust' /* Rust */,
|
|
143
|
+
'.cs': 'csharp' /* CSharp */,
|
|
133
144
|
};
|
|
134
145
|
var ParseError = class extends Error {
|
|
135
146
|
constructor(message, filePath, loc) {
|
|
136
147
|
super(message);
|
|
137
148
|
this.filePath = filePath;
|
|
138
149
|
this.loc = loc;
|
|
139
|
-
this.name =
|
|
150
|
+
this.name = 'ParseError';
|
|
140
151
|
}
|
|
141
152
|
};
|
|
142
153
|
|
|
143
154
|
// src/scoring.ts
|
|
144
155
|
var DEFAULT_TOOL_WEIGHTS = {
|
|
145
|
-
|
|
146
|
-
|
|
156
|
+
'pattern-detect': 22,
|
|
157
|
+
'context-analyzer': 19,
|
|
147
158
|
consistency: 14,
|
|
148
|
-
|
|
149
|
-
|
|
159
|
+
'ai-signal-clarity': 11,
|
|
160
|
+
'agent-grounding': 10,
|
|
150
161
|
testability: 10,
|
|
151
|
-
|
|
152
|
-
deps: 6
|
|
162
|
+
'doc-drift': 8,
|
|
163
|
+
deps: 6,
|
|
153
164
|
};
|
|
154
165
|
var TOOL_NAME_MAP = {
|
|
155
|
-
patterns:
|
|
156
|
-
context:
|
|
157
|
-
consistency:
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
grounding:
|
|
161
|
-
|
|
162
|
-
testability:
|
|
163
|
-
tests:
|
|
164
|
-
|
|
165
|
-
docs:
|
|
166
|
-
deps:
|
|
166
|
+
patterns: 'pattern-detect',
|
|
167
|
+
context: 'context-analyzer',
|
|
168
|
+
consistency: 'consistency',
|
|
169
|
+
'AI signal clarity': 'ai-signal-clarity',
|
|
170
|
+
'ai-signal-clarity': 'ai-signal-clarity',
|
|
171
|
+
grounding: 'agent-grounding',
|
|
172
|
+
'agent-grounding': 'agent-grounding',
|
|
173
|
+
testability: 'testability',
|
|
174
|
+
tests: 'testability',
|
|
175
|
+
'doc-drift': 'doc-drift',
|
|
176
|
+
docs: 'doc-drift',
|
|
177
|
+
deps: 'deps',
|
|
167
178
|
};
|
|
168
179
|
var CONTEXT_TIER_THRESHOLDS = {
|
|
169
180
|
compact: { idealTokens: 3e3, criticalTokens: 1e4, idealDepth: 4 },
|
|
170
181
|
standard: { idealTokens: 5e3, criticalTokens: 15e3, idealDepth: 5 },
|
|
171
182
|
extended: { idealTokens: 15e3, criticalTokens: 5e4, idealDepth: 7 },
|
|
172
|
-
frontier: { idealTokens: 5e4, criticalTokens: 15e4, idealDepth: 10 }
|
|
183
|
+
frontier: { idealTokens: 5e4, criticalTokens: 15e4, idealDepth: 10 },
|
|
173
184
|
};
|
|
174
185
|
var SIZE_ADJUSTED_THRESHOLDS = {
|
|
175
186
|
xs: 80,
|
|
@@ -180,20 +191,21 @@ var SIZE_ADJUSTED_THRESHOLDS = {
|
|
|
180
191
|
// 200-500 files
|
|
181
192
|
large: 65,
|
|
182
193
|
// 500-2000 files
|
|
183
|
-
enterprise: 58
|
|
194
|
+
enterprise: 58,
|
|
184
195
|
// 2000+ files
|
|
185
196
|
};
|
|
186
197
|
function getProjectSizeTier(fileCount) {
|
|
187
|
-
if (fileCount < 50) return
|
|
188
|
-
if (fileCount < 200) return
|
|
189
|
-
if (fileCount < 500) return
|
|
190
|
-
if (fileCount < 2e3) return
|
|
191
|
-
return
|
|
198
|
+
if (fileCount < 50) return 'xs';
|
|
199
|
+
if (fileCount < 200) return 'small';
|
|
200
|
+
if (fileCount < 500) return 'medium';
|
|
201
|
+
if (fileCount < 2e3) return 'large';
|
|
202
|
+
return 'enterprise';
|
|
192
203
|
}
|
|
193
|
-
function getRecommendedThreshold(fileCount, modelTier =
|
|
204
|
+
function getRecommendedThreshold(fileCount, modelTier = 'standard') {
|
|
194
205
|
const sizeTier = getProjectSizeTier(fileCount);
|
|
195
206
|
const base = SIZE_ADJUSTED_THRESHOLDS[sizeTier];
|
|
196
|
-
const modelBonus =
|
|
207
|
+
const modelBonus =
|
|
208
|
+
modelTier === 'frontier' ? -3 : modelTier === 'extended' ? -2 : 0;
|
|
197
209
|
return base + modelBonus;
|
|
198
210
|
}
|
|
199
211
|
function normalizeToolName(shortName) {
|
|
@@ -213,9 +225,9 @@ function parseWeightString(weightStr) {
|
|
|
213
225
|
if (!weightStr) {
|
|
214
226
|
return weights;
|
|
215
227
|
}
|
|
216
|
-
const pairs = weightStr.split(
|
|
228
|
+
const pairs = weightStr.split(',');
|
|
217
229
|
for (const pair of pairs) {
|
|
218
|
-
const [toolShortName, weightStr2] = pair.split(
|
|
230
|
+
const [toolShortName, weightStr2] = pair.split(':');
|
|
219
231
|
if (toolShortName && weightStr2) {
|
|
220
232
|
const toolName = normalizeToolName(toolShortName.trim());
|
|
221
233
|
const weight = parseInt(weightStr2.trim(), 10);
|
|
@@ -228,13 +240,14 @@ function parseWeightString(weightStr) {
|
|
|
228
240
|
}
|
|
229
241
|
function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
230
242
|
if (toolOutputs.size === 0) {
|
|
231
|
-
throw new Error(
|
|
243
|
+
throw new Error('No tool outputs provided for scoring');
|
|
232
244
|
}
|
|
233
245
|
const weights = /* @__PURE__ */ new Map();
|
|
234
246
|
for (const [toolName] of toolOutputs.entries()) {
|
|
235
247
|
const cliWeight = cliWeights?.get(toolName);
|
|
236
248
|
const configWeight = config?.tools?.[toolName]?.scoreWeight;
|
|
237
|
-
const weight =
|
|
249
|
+
const weight =
|
|
250
|
+
cliWeight ?? configWeight ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? 5;
|
|
238
251
|
weights.set(toolName, weight);
|
|
239
252
|
}
|
|
240
253
|
let weightedSum = 0;
|
|
@@ -259,44 +272,44 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
|
259
272
|
return `(${output.score} \xD7 ${w})`;
|
|
260
273
|
}
|
|
261
274
|
);
|
|
262
|
-
const formulaStr = `[${formulaParts.join(
|
|
275
|
+
const formulaStr = `[${formulaParts.join(' + ')}] / ${totalWeight} = ${overall}`;
|
|
263
276
|
return {
|
|
264
277
|
overall,
|
|
265
278
|
rating,
|
|
266
|
-
timestamp:
|
|
279
|
+
timestamp: /* @__PURE__ */ new Date().toISOString(),
|
|
267
280
|
toolsUsed,
|
|
268
281
|
breakdown,
|
|
269
282
|
calculation: {
|
|
270
283
|
formula: formulaStr,
|
|
271
284
|
weights: calculationWeights,
|
|
272
|
-
normalized: formulaStr
|
|
273
|
-
}
|
|
285
|
+
normalized: formulaStr,
|
|
286
|
+
},
|
|
274
287
|
};
|
|
275
288
|
}
|
|
276
289
|
function getRating(score) {
|
|
277
|
-
if (score >= 90) return
|
|
278
|
-
if (score >= 75) return
|
|
279
|
-
if (score >= 60) return
|
|
280
|
-
if (score >= 40) return
|
|
281
|
-
return
|
|
290
|
+
if (score >= 90) return 'Excellent';
|
|
291
|
+
if (score >= 75) return 'Good';
|
|
292
|
+
if (score >= 60) return 'Fair';
|
|
293
|
+
if (score >= 40) return 'Needs Work';
|
|
294
|
+
return 'Critical';
|
|
282
295
|
}
|
|
283
|
-
function getRatingWithContext(score, fileCount, modelTier =
|
|
296
|
+
function getRatingWithContext(score, fileCount, modelTier = 'standard') {
|
|
284
297
|
const threshold = getRecommendedThreshold(fileCount, modelTier);
|
|
285
298
|
const normalized = score - threshold + 70;
|
|
286
299
|
return getRating(normalized);
|
|
287
300
|
}
|
|
288
301
|
function getRatingDisplay(rating) {
|
|
289
302
|
switch (rating) {
|
|
290
|
-
case
|
|
291
|
-
return { emoji:
|
|
292
|
-
case
|
|
293
|
-
return { emoji:
|
|
294
|
-
case
|
|
295
|
-
return { emoji:
|
|
296
|
-
case
|
|
297
|
-
return { emoji:
|
|
298
|
-
case
|
|
299
|
-
return { emoji:
|
|
303
|
+
case 'Excellent':
|
|
304
|
+
return { emoji: '\u2705', color: 'green' };
|
|
305
|
+
case 'Good':
|
|
306
|
+
return { emoji: '\u{1F44D}', color: 'blue' };
|
|
307
|
+
case 'Fair':
|
|
308
|
+
return { emoji: '\u26A0\uFE0F', color: 'yellow' };
|
|
309
|
+
case 'Needs Work':
|
|
310
|
+
return { emoji: '\u{1F528}', color: 'orange' };
|
|
311
|
+
case 'Critical':
|
|
312
|
+
return { emoji: '\u274C', color: 'red' };
|
|
300
313
|
}
|
|
301
314
|
}
|
|
302
315
|
function formatScore(result) {
|
|
@@ -311,17 +324,22 @@ function formatToolScore(output) {
|
|
|
311
324
|
result += ` Factors:
|
|
312
325
|
`;
|
|
313
326
|
output.factors.forEach((factor) => {
|
|
314
|
-
const impactSign = factor.impact > 0 ?
|
|
327
|
+
const impactSign = factor.impact > 0 ? '+' : '';
|
|
315
328
|
result += ` \u2022 ${factor.name}: ${impactSign}${factor.impact} - ${factor.description}
|
|
316
329
|
`;
|
|
317
330
|
});
|
|
318
|
-
result +=
|
|
331
|
+
result += '\n';
|
|
319
332
|
}
|
|
320
333
|
if (output.recommendations && output.recommendations.length > 0) {
|
|
321
334
|
result += ` Recommendations:
|
|
322
335
|
`;
|
|
323
336
|
output.recommendations.forEach((rec, i) => {
|
|
324
|
-
const priorityIcon =
|
|
337
|
+
const priorityIcon =
|
|
338
|
+
rec.priority === 'high'
|
|
339
|
+
? '\u{1F534}'
|
|
340
|
+
: rec.priority === 'medium'
|
|
341
|
+
? '\u{1F7E1}'
|
|
342
|
+
: '\u{1F535}';
|
|
325
343
|
result += ` ${i + 1}. ${priorityIcon} ${rec.action}
|
|
326
344
|
`;
|
|
327
345
|
result += ` Impact: +${rec.estimatedImpact} points
|
|
@@ -531,5 +549,5 @@ export {
|
|
|
531
549
|
getRatingDisplay,
|
|
532
550
|
formatScore,
|
|
533
551
|
formatToolScore,
|
|
534
|
-
generateHTML
|
|
552
|
+
generateHTML,
|
|
535
553
|
};
|