@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-YCA4FTEK.mjs
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
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 ToolName = /* @__PURE__ */ ((ToolName2) => {
|
|
12
|
-
ToolName2[
|
|
13
|
-
ToolName2[
|
|
14
|
-
ToolName2[
|
|
15
|
-
ToolName2[
|
|
16
|
-
ToolName2[
|
|
17
|
-
ToolName2[
|
|
18
|
-
ToolName2[
|
|
19
|
-
ToolName2[
|
|
20
|
-
ToolName2[
|
|
21
|
-
ToolName2[
|
|
22
|
-
ToolName2[
|
|
23
|
-
ToolName2[
|
|
24
|
-
ToolName2[
|
|
12
|
+
ToolName2['PatternDetect'] = 'pattern-detect';
|
|
13
|
+
ToolName2['ContextAnalyzer'] = 'context-analyzer';
|
|
14
|
+
ToolName2['NamingConsistency'] = 'naming-consistency';
|
|
15
|
+
ToolName2['AiSignalClarity'] = 'ai-signal-clarity';
|
|
16
|
+
ToolName2['AgentGrounding'] = 'agent-grounding';
|
|
17
|
+
ToolName2['TestabilityIndex'] = 'testability-index';
|
|
18
|
+
ToolName2['DocDrift'] = 'doc-drift';
|
|
19
|
+
ToolName2['DependencyHealth'] = 'dependency-health';
|
|
20
|
+
ToolName2['ChangeAmplification'] = 'change-amplification';
|
|
21
|
+
ToolName2['CognitiveLoad'] = 'cognitive-load';
|
|
22
|
+
ToolName2['PatternEntropy'] = 'pattern-entropy';
|
|
23
|
+
ToolName2['ConceptCohesion'] = 'concept-cohesion';
|
|
24
|
+
ToolName2['SemanticDistance'] = 'semantic-distance';
|
|
25
25
|
return ToolName2;
|
|
26
26
|
})(ToolName || {});
|
|
27
27
|
var ToolNameSchema = z.nativeEnum(ToolName);
|
|
28
28
|
var FRIENDLY_TOOL_NAMES = {
|
|
29
|
-
[
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
35
|
-
[
|
|
36
|
-
[
|
|
37
|
-
[
|
|
38
|
-
[
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
[
|
|
29
|
+
['pattern-detect' /* PatternDetect */]: 'Semantic Duplicates',
|
|
30
|
+
['context-analyzer' /* ContextAnalyzer */]: 'Context Fragmentation',
|
|
31
|
+
['naming-consistency' /* NamingConsistency */]: 'Naming Consistency',
|
|
32
|
+
['ai-signal-clarity' /* AiSignalClarity */]: 'AI Signal Clarity',
|
|
33
|
+
['agent-grounding' /* AgentGrounding */]: 'Agent Grounding',
|
|
34
|
+
['testability-index' /* TestabilityIndex */]: 'Testability Index',
|
|
35
|
+
['doc-drift' /* DocDrift */]: 'Documentation Health',
|
|
36
|
+
['dependency-health' /* DependencyHealth */]: 'Dependency Health',
|
|
37
|
+
['change-amplification' /* ChangeAmplification */]: 'Change Amplification',
|
|
38
|
+
['cognitive-load' /* CognitiveLoad */]: 'Cognitive Load',
|
|
39
|
+
['pattern-entropy' /* PatternEntropy */]: 'Pattern Entropy',
|
|
40
|
+
['concept-cohesion' /* ConceptCohesion */]: 'Concept Cohesion',
|
|
41
|
+
['semantic-distance' /* SemanticDistance */]: 'Semantic Distance',
|
|
42
42
|
};
|
|
43
43
|
var IssueType = /* @__PURE__ */ ((IssueType2) => {
|
|
44
|
-
IssueType2[
|
|
45
|
-
IssueType2[
|
|
46
|
-
IssueType2[
|
|
47
|
-
IssueType2[
|
|
48
|
-
IssueType2[
|
|
49
|
-
IssueType2[
|
|
50
|
-
IssueType2[
|
|
51
|
-
IssueType2[
|
|
52
|
-
IssueType2[
|
|
53
|
-
IssueType2[
|
|
54
|
-
IssueType2[
|
|
55
|
-
IssueType2[
|
|
56
|
-
IssueType2[
|
|
57
|
-
IssueType2[
|
|
58
|
-
IssueType2[
|
|
59
|
-
IssueType2[
|
|
60
|
-
IssueType2[
|
|
61
|
-
IssueType2[
|
|
44
|
+
IssueType2['DuplicatePattern'] = 'duplicate-pattern';
|
|
45
|
+
IssueType2['PatternInconsistency'] = 'pattern-inconsistency';
|
|
46
|
+
IssueType2['ContextFragmentation'] = 'context-fragmentation';
|
|
47
|
+
IssueType2['DependencyHealth'] = 'dependency-health';
|
|
48
|
+
IssueType2['CircularDependency'] = 'circular-dependency';
|
|
49
|
+
IssueType2['DocDrift'] = 'doc-drift';
|
|
50
|
+
IssueType2['NamingInconsistency'] = 'naming-inconsistency';
|
|
51
|
+
IssueType2['NamingQuality'] = 'naming-quality';
|
|
52
|
+
IssueType2['ArchitectureInconsistency'] = 'architecture-inconsistency';
|
|
53
|
+
IssueType2['DeadCode'] = 'dead-code';
|
|
54
|
+
IssueType2['MissingTypes'] = 'missing-types';
|
|
55
|
+
IssueType2['MagicLiteral'] = 'magic-literal';
|
|
56
|
+
IssueType2['BooleanTrap'] = 'boolean-trap';
|
|
57
|
+
IssueType2['AiSignalClarity'] = 'ai-signal-clarity';
|
|
58
|
+
IssueType2['LowTestability'] = 'low-testability';
|
|
59
|
+
IssueType2['AgentNavigationFailure'] = 'agent-navigation-failure';
|
|
60
|
+
IssueType2['AmbiguousApi'] = 'ambiguous-api';
|
|
61
|
+
IssueType2['ChangeAmplification'] = 'change-amplification';
|
|
62
62
|
return IssueType2;
|
|
63
63
|
})(IssueType || {});
|
|
64
64
|
var IssueTypeSchema = z.nativeEnum(IssueType);
|
|
65
65
|
var AnalysisStatus = /* @__PURE__ */ ((AnalysisStatus2) => {
|
|
66
|
-
AnalysisStatus2[
|
|
67
|
-
AnalysisStatus2[
|
|
68
|
-
AnalysisStatus2[
|
|
66
|
+
AnalysisStatus2['Processing'] = 'processing';
|
|
67
|
+
AnalysisStatus2['Completed'] = 'completed';
|
|
68
|
+
AnalysisStatus2['Failed'] = 'failed';
|
|
69
69
|
return AnalysisStatus2;
|
|
70
70
|
})(AnalysisStatus || {});
|
|
71
71
|
var AnalysisStatusSchema = z.nativeEnum(AnalysisStatus);
|
|
72
72
|
var ModelTier = /* @__PURE__ */ ((ModelTier2) => {
|
|
73
|
-
ModelTier2[
|
|
74
|
-
ModelTier2[
|
|
75
|
-
ModelTier2[
|
|
76
|
-
ModelTier2[
|
|
73
|
+
ModelTier2['Compact'] = 'compact';
|
|
74
|
+
ModelTier2['Standard'] = 'standard';
|
|
75
|
+
ModelTier2['Extended'] = 'extended';
|
|
76
|
+
ModelTier2['Frontier'] = 'frontier';
|
|
77
77
|
return ModelTier2;
|
|
78
78
|
})(ModelTier || {});
|
|
79
79
|
var ModelTierSchema = z.nativeEnum(ModelTier);
|
|
@@ -82,14 +82,14 @@ var LocationSchema = z.object({
|
|
|
82
82
|
line: z.number(),
|
|
83
83
|
column: z.number().optional(),
|
|
84
84
|
endLine: z.number().optional(),
|
|
85
|
-
endColumn: z.number().optional()
|
|
85
|
+
endColumn: z.number().optional(),
|
|
86
86
|
});
|
|
87
87
|
var IssueSchema = z.object({
|
|
88
88
|
type: IssueTypeSchema,
|
|
89
89
|
severity: SeveritySchema,
|
|
90
90
|
message: z.string(),
|
|
91
91
|
location: LocationSchema,
|
|
92
|
-
suggestion: z.string().optional()
|
|
92
|
+
suggestion: z.string().optional(),
|
|
93
93
|
});
|
|
94
94
|
var MetricsSchema = z.object({
|
|
95
95
|
tokenCost: z.number().optional(),
|
|
@@ -109,117 +109,128 @@ var MetricsSchema = z.object({
|
|
|
109
109
|
comprehensionDifficultyIndex: z.number().optional(),
|
|
110
110
|
// Extended metrics for specific spokes
|
|
111
111
|
totalSymbols: z.number().optional(),
|
|
112
|
-
totalExports: z.number().optional()
|
|
112
|
+
totalExports: z.number().optional(),
|
|
113
113
|
});
|
|
114
114
|
var AnalysisResultSchema = z.object({
|
|
115
115
|
fileName: z.string(),
|
|
116
116
|
issues: z.array(IssueSchema),
|
|
117
|
-
metrics: MetricsSchema
|
|
117
|
+
metrics: MetricsSchema,
|
|
118
118
|
});
|
|
119
|
-
var SpokeSummarySchema = z
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
119
|
+
var SpokeSummarySchema = z
|
|
120
|
+
.object({
|
|
121
|
+
totalFiles: z.number().optional(),
|
|
122
|
+
totalIssues: z.number().optional(),
|
|
123
|
+
criticalIssues: z.number().optional(),
|
|
124
|
+
majorIssues: z.number().optional(),
|
|
125
|
+
score: z.number().optional(),
|
|
126
|
+
})
|
|
127
|
+
.catchall(z.any());
|
|
126
128
|
var SpokeOutputSchema = z.object({
|
|
127
129
|
results: z.array(AnalysisResultSchema),
|
|
128
130
|
summary: SpokeSummarySchema,
|
|
129
|
-
metadata: z
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
metadata: z
|
|
132
|
+
.object({
|
|
133
|
+
toolName: z.string(),
|
|
134
|
+
version: z.string().optional(),
|
|
135
|
+
timestamp: z.string().optional(),
|
|
136
|
+
})
|
|
137
|
+
.catchall(z.any())
|
|
138
|
+
.optional(),
|
|
134
139
|
});
|
|
135
|
-
var UnifiedReportSchema = z
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
})
|
|
140
|
+
var UnifiedReportSchema = z
|
|
141
|
+
.object({
|
|
142
|
+
summary: z.object({
|
|
143
|
+
totalFiles: z.number(),
|
|
144
|
+
totalIssues: z.number(),
|
|
145
|
+
criticalIssues: z.number(),
|
|
146
|
+
majorIssues: z.number(),
|
|
147
|
+
}),
|
|
148
|
+
results: z.array(AnalysisResultSchema),
|
|
149
|
+
scoring: z
|
|
150
|
+
.object({
|
|
151
|
+
overall: z.number(),
|
|
152
|
+
rating: z.string(),
|
|
153
|
+
timestamp: z.string(),
|
|
154
|
+
breakdown: z.array(
|
|
155
|
+
z
|
|
156
|
+
.object({
|
|
157
|
+
toolName: z.union([ToolNameSchema, z.string()]),
|
|
158
|
+
score: z.number(),
|
|
159
|
+
})
|
|
160
|
+
.catchall(z.any())
|
|
161
|
+
),
|
|
162
|
+
})
|
|
163
|
+
.optional(),
|
|
164
|
+
})
|
|
165
|
+
.catchall(z.any());
|
|
155
166
|
|
|
156
167
|
// src/types/language.ts
|
|
157
168
|
var Language = /* @__PURE__ */ ((Language2) => {
|
|
158
|
-
Language2[
|
|
159
|
-
Language2[
|
|
160
|
-
Language2[
|
|
161
|
-
Language2[
|
|
162
|
-
Language2[
|
|
163
|
-
Language2[
|
|
164
|
-
Language2[
|
|
169
|
+
Language2['TypeScript'] = 'typescript';
|
|
170
|
+
Language2['JavaScript'] = 'javascript';
|
|
171
|
+
Language2['Python'] = 'python';
|
|
172
|
+
Language2['Java'] = 'java';
|
|
173
|
+
Language2['Go'] = 'go';
|
|
174
|
+
Language2['Rust'] = 'rust';
|
|
175
|
+
Language2['CSharp'] = 'csharp';
|
|
165
176
|
return Language2;
|
|
166
177
|
})(Language || {});
|
|
167
178
|
var LANGUAGE_EXTENSIONS = {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
179
|
+
'.ts': 'typescript' /* TypeScript */,
|
|
180
|
+
'.tsx': 'typescript' /* TypeScript */,
|
|
181
|
+
'.js': 'javascript' /* JavaScript */,
|
|
182
|
+
'.jsx': 'javascript' /* JavaScript */,
|
|
183
|
+
'.py': 'python' /* Python */,
|
|
184
|
+
'.java': 'java' /* Java */,
|
|
185
|
+
'.go': 'go' /* Go */,
|
|
186
|
+
'.rs': 'rust' /* Rust */,
|
|
187
|
+
'.cs': 'csharp' /* CSharp */,
|
|
177
188
|
};
|
|
178
189
|
var ParseError = class extends Error {
|
|
179
190
|
constructor(message, filePath, loc) {
|
|
180
191
|
super(message);
|
|
181
192
|
this.filePath = filePath;
|
|
182
193
|
this.loc = loc;
|
|
183
|
-
this.name =
|
|
194
|
+
this.name = 'ParseError';
|
|
184
195
|
}
|
|
185
196
|
};
|
|
186
197
|
|
|
187
198
|
// src/scoring.ts
|
|
188
199
|
var DEFAULT_TOOL_WEIGHTS = {
|
|
189
|
-
[
|
|
190
|
-
[
|
|
191
|
-
[
|
|
192
|
-
[
|
|
193
|
-
[
|
|
194
|
-
[
|
|
195
|
-
[
|
|
196
|
-
[
|
|
197
|
-
[
|
|
200
|
+
['pattern-detect' /* PatternDetect */]: 22,
|
|
201
|
+
['context-analyzer' /* ContextAnalyzer */]: 19,
|
|
202
|
+
['naming-consistency' /* NamingConsistency */]: 14,
|
|
203
|
+
['ai-signal-clarity' /* AiSignalClarity */]: 11,
|
|
204
|
+
['agent-grounding' /* AgentGrounding */]: 10,
|
|
205
|
+
['testability-index' /* TestabilityIndex */]: 10,
|
|
206
|
+
['doc-drift' /* DocDrift */]: 8,
|
|
207
|
+
['dependency-health' /* DependencyHealth */]: 6,
|
|
208
|
+
['change-amplification' /* ChangeAmplification */]: 8,
|
|
198
209
|
};
|
|
199
210
|
var TOOL_NAME_MAP = {
|
|
200
|
-
patterns:
|
|
201
|
-
|
|
202
|
-
context:
|
|
203
|
-
|
|
204
|
-
consistency:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
grounding:
|
|
209
|
-
|
|
210
|
-
testability:
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
211
|
+
patterns: 'pattern-detect' /* PatternDetect */,
|
|
212
|
+
'pattern-detect': 'pattern-detect' /* PatternDetect */,
|
|
213
|
+
context: 'context-analyzer' /* ContextAnalyzer */,
|
|
214
|
+
'context-analyzer': 'context-analyzer' /* ContextAnalyzer */,
|
|
215
|
+
consistency: 'naming-consistency' /* NamingConsistency */,
|
|
216
|
+
'naming-consistency': 'naming-consistency' /* NamingConsistency */,
|
|
217
|
+
'ai-signal': 'ai-signal-clarity' /* AiSignalClarity */,
|
|
218
|
+
'ai-signal-clarity': 'ai-signal-clarity' /* AiSignalClarity */,
|
|
219
|
+
grounding: 'agent-grounding' /* AgentGrounding */,
|
|
220
|
+
'agent-grounding': 'agent-grounding' /* AgentGrounding */,
|
|
221
|
+
testability: 'testability-index' /* TestabilityIndex */,
|
|
222
|
+
'testability-index': 'testability-index' /* TestabilityIndex */,
|
|
223
|
+
'doc-drift': 'doc-drift' /* DocDrift */,
|
|
224
|
+
'deps-health': 'dependency-health' /* DependencyHealth */,
|
|
225
|
+
'dependency-health': 'dependency-health' /* DependencyHealth */,
|
|
226
|
+
'change-amp': 'change-amplification' /* ChangeAmplification */,
|
|
227
|
+
'change-amplification': 'change-amplification' /* ChangeAmplification */,
|
|
217
228
|
};
|
|
218
229
|
var CONTEXT_TIER_THRESHOLDS = {
|
|
219
230
|
compact: { idealTokens: 3e3, criticalTokens: 1e4, idealDepth: 4 },
|
|
220
231
|
standard: { idealTokens: 5e3, criticalTokens: 15e3, idealDepth: 5 },
|
|
221
232
|
extended: { idealTokens: 15e3, criticalTokens: 5e4, idealDepth: 7 },
|
|
222
|
-
frontier: { idealTokens: 5e4, criticalTokens: 15e4, idealDepth: 10 }
|
|
233
|
+
frontier: { idealTokens: 5e4, criticalTokens: 15e4, idealDepth: 10 },
|
|
223
234
|
};
|
|
224
235
|
var SIZE_ADJUSTED_THRESHOLDS = {
|
|
225
236
|
xs: 80,
|
|
@@ -230,20 +241,21 @@ var SIZE_ADJUSTED_THRESHOLDS = {
|
|
|
230
241
|
// 200-500 files
|
|
231
242
|
large: 65,
|
|
232
243
|
// 500-2000 files
|
|
233
|
-
enterprise: 58
|
|
244
|
+
enterprise: 58,
|
|
234
245
|
// 2000+ files
|
|
235
246
|
};
|
|
236
247
|
function getProjectSizeTier(fileCount) {
|
|
237
|
-
if (fileCount < 50) return
|
|
238
|
-
if (fileCount < 200) return
|
|
239
|
-
if (fileCount < 500) return
|
|
240
|
-
if (fileCount < 2e3) return
|
|
241
|
-
return
|
|
248
|
+
if (fileCount < 50) return 'xs';
|
|
249
|
+
if (fileCount < 200) return 'small';
|
|
250
|
+
if (fileCount < 500) return 'medium';
|
|
251
|
+
if (fileCount < 2e3) return 'large';
|
|
252
|
+
return 'enterprise';
|
|
242
253
|
}
|
|
243
|
-
function getRecommendedThreshold(fileCount, modelTier =
|
|
254
|
+
function getRecommendedThreshold(fileCount, modelTier = 'standard') {
|
|
244
255
|
const sizeTier = getProjectSizeTier(fileCount);
|
|
245
256
|
const base = SIZE_ADJUSTED_THRESHOLDS[sizeTier];
|
|
246
|
-
const modelBonus =
|
|
257
|
+
const modelBonus =
|
|
258
|
+
modelTier === 'frontier' ? -3 : modelTier === 'extended' ? -2 : 0;
|
|
247
259
|
return base + modelBonus;
|
|
248
260
|
}
|
|
249
261
|
function normalizeToolName(shortName) {
|
|
@@ -257,9 +269,9 @@ function getToolWeight(toolName, toolConfig, cliOverride) {
|
|
|
257
269
|
function parseWeightString(weightStr) {
|
|
258
270
|
const weights = /* @__PURE__ */ new Map();
|
|
259
271
|
if (!weightStr) return weights;
|
|
260
|
-
const pairs = weightStr.split(
|
|
272
|
+
const pairs = weightStr.split(',');
|
|
261
273
|
for (const pair of pairs) {
|
|
262
|
-
const [toolShortName, weightStr2] = pair.split(
|
|
274
|
+
const [toolShortName, weightStr2] = pair.split(':');
|
|
263
275
|
if (toolShortName && weightStr2) {
|
|
264
276
|
const toolName = normalizeToolName(toolShortName.trim());
|
|
265
277
|
const weight = parseInt(weightStr2.trim(), 10);
|
|
@@ -272,13 +284,14 @@ function parseWeightString(weightStr) {
|
|
|
272
284
|
}
|
|
273
285
|
function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
274
286
|
if (toolOutputs.size === 0) {
|
|
275
|
-
throw new Error(
|
|
287
|
+
throw new Error('No tool outputs provided for scoring');
|
|
276
288
|
}
|
|
277
289
|
const weights = /* @__PURE__ */ new Map();
|
|
278
290
|
for (const [toolName] of toolOutputs.entries()) {
|
|
279
291
|
const cliWeight = cliWeights?.get(toolName);
|
|
280
292
|
const configWeight = config?.tools?.[toolName]?.scoreWeight;
|
|
281
|
-
const weight =
|
|
293
|
+
const weight =
|
|
294
|
+
cliWeight ?? configWeight ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? 5;
|
|
282
295
|
weights.set(toolName, weight);
|
|
283
296
|
}
|
|
284
297
|
let weightedSum = 0;
|
|
@@ -302,44 +315,44 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
|
302
315
|
return `(${output.score} \xD7 ${w})`;
|
|
303
316
|
}
|
|
304
317
|
);
|
|
305
|
-
const formulaStr = `[${formulaParts.join(
|
|
318
|
+
const formulaStr = `[${formulaParts.join(' + ')}] / ${totalWeight} = ${overall}`;
|
|
306
319
|
return {
|
|
307
320
|
overall,
|
|
308
321
|
rating,
|
|
309
|
-
timestamp:
|
|
322
|
+
timestamp: /* @__PURE__ */ new Date().toISOString(),
|
|
310
323
|
toolsUsed,
|
|
311
324
|
breakdown,
|
|
312
325
|
calculation: {
|
|
313
326
|
formula: formulaStr,
|
|
314
327
|
weights: calculationWeights,
|
|
315
|
-
normalized: formulaStr
|
|
316
|
-
}
|
|
328
|
+
normalized: formulaStr,
|
|
329
|
+
},
|
|
317
330
|
};
|
|
318
331
|
}
|
|
319
332
|
function getRating(score) {
|
|
320
|
-
if (score >= 90) return
|
|
321
|
-
if (score >= 75) return
|
|
322
|
-
if (score >= 60) return
|
|
323
|
-
if (score >= 40) return
|
|
324
|
-
return
|
|
333
|
+
if (score >= 90) return 'Excellent';
|
|
334
|
+
if (score >= 75) return 'Good';
|
|
335
|
+
if (score >= 60) return 'Fair';
|
|
336
|
+
if (score >= 40) return 'Needs Work';
|
|
337
|
+
return 'Critical';
|
|
325
338
|
}
|
|
326
|
-
function getRatingWithContext(score, fileCount, modelTier =
|
|
339
|
+
function getRatingWithContext(score, fileCount, modelTier = 'standard') {
|
|
327
340
|
const threshold = getRecommendedThreshold(fileCount, modelTier);
|
|
328
341
|
const normalized = score - threshold + 70;
|
|
329
342
|
return getRating(normalized);
|
|
330
343
|
}
|
|
331
344
|
function getRatingDisplay(rating) {
|
|
332
345
|
switch (rating) {
|
|
333
|
-
case
|
|
334
|
-
return { emoji:
|
|
335
|
-
case
|
|
336
|
-
return { emoji:
|
|
337
|
-
case
|
|
338
|
-
return { emoji:
|
|
339
|
-
case
|
|
340
|
-
return { emoji:
|
|
341
|
-
case
|
|
342
|
-
return { emoji:
|
|
346
|
+
case 'Excellent':
|
|
347
|
+
return { emoji: '\u2705', color: 'green' };
|
|
348
|
+
case 'Good':
|
|
349
|
+
return { emoji: '\u{1F44D}', color: 'blue' };
|
|
350
|
+
case 'Fair':
|
|
351
|
+
return { emoji: '\u26A0\uFE0F', color: 'yellow' };
|
|
352
|
+
case 'Needs Work':
|
|
353
|
+
return { emoji: '\u{1F528}', color: 'orange' };
|
|
354
|
+
case 'Critical':
|
|
355
|
+
return { emoji: '\u274C', color: 'red' };
|
|
343
356
|
}
|
|
344
357
|
}
|
|
345
358
|
function formatScore(result) {
|
|
@@ -354,17 +367,22 @@ function formatToolScore(output) {
|
|
|
354
367
|
result += ` Factors:
|
|
355
368
|
`;
|
|
356
369
|
output.factors.forEach((factor) => {
|
|
357
|
-
const impactSign = factor.impact > 0 ?
|
|
370
|
+
const impactSign = factor.impact > 0 ? '+' : '';
|
|
358
371
|
result += ` \u2022 ${factor.name}: ${impactSign}${factor.impact} - ${factor.description}
|
|
359
372
|
`;
|
|
360
373
|
});
|
|
361
|
-
result +=
|
|
374
|
+
result += '\n';
|
|
362
375
|
}
|
|
363
376
|
if (output.recommendations && output.recommendations.length > 0) {
|
|
364
377
|
result += ` Recommendations:
|
|
365
378
|
`;
|
|
366
379
|
output.recommendations.forEach((rec, i) => {
|
|
367
|
-
const priorityIcon =
|
|
380
|
+
const priorityIcon =
|
|
381
|
+
rec.priority === 'high'
|
|
382
|
+
? '\u{1F534}'
|
|
383
|
+
: rec.priority === 'medium'
|
|
384
|
+
? '\u{1F7E1}'
|
|
385
|
+
: '\u{1F535}';
|
|
368
386
|
result += ` ${i + 1}. ${priorityIcon} ${rec.action}
|
|
369
387
|
`;
|
|
370
388
|
result += ` Impact: +${rec.estimatedImpact} points
|
|
@@ -578,5 +596,5 @@ export {
|
|
|
578
596
|
getRatingDisplay,
|
|
579
597
|
formatScore,
|
|
580
598
|
formatToolScore,
|
|
581
|
-
generateHTML
|
|
599
|
+
generateHTML,
|
|
582
600
|
};
|