@aiready/core 0.23.1 → 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 -1094
- package/dist/client.d.ts +2 -1094
- package/dist/client.js +23 -43
- package/dist/client.mjs +3 -25
- package/dist/index.d.mts +380 -108
- package/dist/index.d.ts +380 -108
- package/dist/index.js +609 -445
- package/dist/index.mjs +587 -429
- 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 +2 -2
package/dist/chunk-MH3A3LX6.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,131 +109,142 @@ 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
|
-
|
|
134
|
-
|
|
131
|
+
metadata: z
|
|
132
|
+
.object({
|
|
133
|
+
toolName: z.string(),
|
|
134
|
+
version: z.string().optional(),
|
|
135
|
+
timestamp: z.string().optional(),
|
|
136
|
+
config: z.any().optional(),
|
|
137
|
+
})
|
|
138
|
+
.catchall(z.any())
|
|
139
|
+
.optional(),
|
|
135
140
|
});
|
|
136
|
-
var UnifiedReportSchema = z
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
})
|
|
141
|
+
var UnifiedReportSchema = z
|
|
142
|
+
.object({
|
|
143
|
+
summary: z.object({
|
|
144
|
+
totalFiles: z.number(),
|
|
145
|
+
totalIssues: z.number(),
|
|
146
|
+
criticalIssues: z.number(),
|
|
147
|
+
majorIssues: z.number(),
|
|
148
|
+
}),
|
|
149
|
+
results: z.array(AnalysisResultSchema),
|
|
150
|
+
scoring: z
|
|
151
|
+
.object({
|
|
152
|
+
overall: z.number(),
|
|
153
|
+
rating: z.string(),
|
|
154
|
+
timestamp: z.string(),
|
|
155
|
+
breakdown: z.array(
|
|
156
|
+
z
|
|
157
|
+
.object({
|
|
158
|
+
toolName: z.union([ToolNameSchema, z.string()]),
|
|
159
|
+
score: z.number(),
|
|
160
|
+
})
|
|
161
|
+
.catchall(z.any())
|
|
162
|
+
),
|
|
163
|
+
})
|
|
164
|
+
.optional(),
|
|
165
|
+
})
|
|
166
|
+
.catchall(z.any());
|
|
156
167
|
|
|
157
168
|
// src/types.ts
|
|
158
169
|
var GLOBAL_SCAN_OPTIONS = [
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
170
|
+
'tools',
|
|
171
|
+
'toolConfigs',
|
|
172
|
+
'include',
|
|
173
|
+
'exclude',
|
|
174
|
+
'onProgress',
|
|
175
|
+
'progressCallback',
|
|
176
|
+
'includeTests',
|
|
177
|
+
'useSmartDefaults',
|
|
178
|
+
'costConfig',
|
|
168
179
|
];
|
|
169
180
|
|
|
170
181
|
// src/types/language.ts
|
|
171
182
|
var Language = /* @__PURE__ */ ((Language2) => {
|
|
172
|
-
Language2[
|
|
173
|
-
Language2[
|
|
174
|
-
Language2[
|
|
175
|
-
Language2[
|
|
176
|
-
Language2[
|
|
177
|
-
Language2[
|
|
178
|
-
Language2[
|
|
183
|
+
Language2['TypeScript'] = 'typescript';
|
|
184
|
+
Language2['JavaScript'] = 'javascript';
|
|
185
|
+
Language2['Python'] = 'python';
|
|
186
|
+
Language2['Java'] = 'java';
|
|
187
|
+
Language2['Go'] = 'go';
|
|
188
|
+
Language2['Rust'] = 'rust';
|
|
189
|
+
Language2['CSharp'] = 'csharp';
|
|
179
190
|
return Language2;
|
|
180
191
|
})(Language || {});
|
|
181
192
|
var LANGUAGE_EXTENSIONS = {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
193
|
+
'.ts': 'typescript' /* TypeScript */,
|
|
194
|
+
'.tsx': 'typescript' /* TypeScript */,
|
|
195
|
+
'.js': 'javascript' /* JavaScript */,
|
|
196
|
+
'.jsx': 'javascript' /* JavaScript */,
|
|
197
|
+
'.py': 'python' /* Python */,
|
|
198
|
+
'.java': 'java' /* Java */,
|
|
199
|
+
'.go': 'go' /* Go */,
|
|
200
|
+
'.rs': 'rust' /* Rust */,
|
|
201
|
+
'.cs': 'csharp' /* CSharp */,
|
|
191
202
|
};
|
|
192
203
|
var ParseError = class extends Error {
|
|
193
204
|
constructor(message, filePath, loc) {
|
|
194
205
|
super(message);
|
|
195
206
|
this.filePath = filePath;
|
|
196
207
|
this.loc = loc;
|
|
197
|
-
this.name =
|
|
208
|
+
this.name = 'ParseError';
|
|
198
209
|
}
|
|
199
210
|
};
|
|
200
211
|
|
|
201
212
|
// src/scoring.ts
|
|
202
213
|
var DEFAULT_TOOL_WEIGHTS = {
|
|
203
|
-
[
|
|
204
|
-
[
|
|
205
|
-
[
|
|
206
|
-
[
|
|
207
|
-
[
|
|
208
|
-
[
|
|
209
|
-
[
|
|
210
|
-
[
|
|
211
|
-
[
|
|
214
|
+
['pattern-detect' /* PatternDetect */]: 22,
|
|
215
|
+
['context-analyzer' /* ContextAnalyzer */]: 19,
|
|
216
|
+
['naming-consistency' /* NamingConsistency */]: 14,
|
|
217
|
+
['ai-signal-clarity' /* AiSignalClarity */]: 11,
|
|
218
|
+
['agent-grounding' /* AgentGrounding */]: 10,
|
|
219
|
+
['testability-index' /* TestabilityIndex */]: 10,
|
|
220
|
+
['doc-drift' /* DocDrift */]: 8,
|
|
221
|
+
['dependency-health' /* DependencyHealth */]: 6,
|
|
222
|
+
['change-amplification' /* ChangeAmplification */]: 8,
|
|
212
223
|
};
|
|
213
224
|
var TOOL_NAME_MAP = {
|
|
214
|
-
patterns:
|
|
215
|
-
|
|
216
|
-
context:
|
|
217
|
-
|
|
218
|
-
consistency:
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
grounding:
|
|
223
|
-
|
|
224
|
-
testability:
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
225
|
+
patterns: 'pattern-detect' /* PatternDetect */,
|
|
226
|
+
'pattern-detect': 'pattern-detect' /* PatternDetect */,
|
|
227
|
+
context: 'context-analyzer' /* ContextAnalyzer */,
|
|
228
|
+
'context-analyzer': 'context-analyzer' /* ContextAnalyzer */,
|
|
229
|
+
consistency: 'naming-consistency' /* NamingConsistency */,
|
|
230
|
+
'naming-consistency': 'naming-consistency' /* NamingConsistency */,
|
|
231
|
+
'ai-signal': 'ai-signal-clarity' /* AiSignalClarity */,
|
|
232
|
+
'ai-signal-clarity': 'ai-signal-clarity' /* AiSignalClarity */,
|
|
233
|
+
grounding: 'agent-grounding' /* AgentGrounding */,
|
|
234
|
+
'agent-grounding': 'agent-grounding' /* AgentGrounding */,
|
|
235
|
+
testability: 'testability-index' /* TestabilityIndex */,
|
|
236
|
+
'testability-index': 'testability-index' /* TestabilityIndex */,
|
|
237
|
+
'doc-drift': 'doc-drift' /* DocDrift */,
|
|
238
|
+
'deps-health': 'dependency-health' /* DependencyHealth */,
|
|
239
|
+
'dependency-health': 'dependency-health' /* DependencyHealth */,
|
|
240
|
+
'change-amp': 'change-amplification' /* ChangeAmplification */,
|
|
241
|
+
'change-amplification': 'change-amplification' /* ChangeAmplification */,
|
|
231
242
|
};
|
|
232
243
|
var CONTEXT_TIER_THRESHOLDS = {
|
|
233
244
|
compact: { idealTokens: 3e3, criticalTokens: 1e4, idealDepth: 4 },
|
|
234
245
|
standard: { idealTokens: 5e3, criticalTokens: 15e3, idealDepth: 5 },
|
|
235
246
|
extended: { idealTokens: 15e3, criticalTokens: 5e4, idealDepth: 7 },
|
|
236
|
-
frontier: { idealTokens: 5e4, criticalTokens: 15e4, idealDepth: 10 }
|
|
247
|
+
frontier: { idealTokens: 5e4, criticalTokens: 15e4, idealDepth: 10 },
|
|
237
248
|
};
|
|
238
249
|
var SIZE_ADJUSTED_THRESHOLDS = {
|
|
239
250
|
xs: 80,
|
|
@@ -244,20 +255,21 @@ var SIZE_ADJUSTED_THRESHOLDS = {
|
|
|
244
255
|
// 200-500 files
|
|
245
256
|
large: 65,
|
|
246
257
|
// 500-2000 files
|
|
247
|
-
enterprise: 58
|
|
258
|
+
enterprise: 58,
|
|
248
259
|
// 2000+ files
|
|
249
260
|
};
|
|
250
261
|
function getProjectSizeTier(fileCount) {
|
|
251
|
-
if (fileCount < 50) return
|
|
252
|
-
if (fileCount < 200) return
|
|
253
|
-
if (fileCount < 500) return
|
|
254
|
-
if (fileCount < 2e3) return
|
|
255
|
-
return
|
|
262
|
+
if (fileCount < 50) return 'xs';
|
|
263
|
+
if (fileCount < 200) return 'small';
|
|
264
|
+
if (fileCount < 500) return 'medium';
|
|
265
|
+
if (fileCount < 2e3) return 'large';
|
|
266
|
+
return 'enterprise';
|
|
256
267
|
}
|
|
257
|
-
function getRecommendedThreshold(fileCount, modelTier =
|
|
268
|
+
function getRecommendedThreshold(fileCount, modelTier = 'standard') {
|
|
258
269
|
const sizeTier = getProjectSizeTier(fileCount);
|
|
259
270
|
const base = SIZE_ADJUSTED_THRESHOLDS[sizeTier];
|
|
260
|
-
const modelBonus =
|
|
271
|
+
const modelBonus =
|
|
272
|
+
modelTier === 'frontier' ? -3 : modelTier === 'extended' ? -2 : 0;
|
|
261
273
|
return base + modelBonus;
|
|
262
274
|
}
|
|
263
275
|
function normalizeToolName(shortName) {
|
|
@@ -271,9 +283,9 @@ function getToolWeight(toolName, toolConfig, cliOverride) {
|
|
|
271
283
|
function parseWeightString(weightStr) {
|
|
272
284
|
const weights = /* @__PURE__ */ new Map();
|
|
273
285
|
if (!weightStr) return weights;
|
|
274
|
-
const pairs = weightStr.split(
|
|
286
|
+
const pairs = weightStr.split(',');
|
|
275
287
|
for (const pair of pairs) {
|
|
276
|
-
const [toolShortName, weightStr2] = pair.split(
|
|
288
|
+
const [toolShortName, weightStr2] = pair.split(':');
|
|
277
289
|
if (toolShortName && weightStr2) {
|
|
278
290
|
const toolName = normalizeToolName(toolShortName.trim());
|
|
279
291
|
const weight = parseInt(weightStr2.trim(), 10);
|
|
@@ -286,13 +298,14 @@ function parseWeightString(weightStr) {
|
|
|
286
298
|
}
|
|
287
299
|
function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
288
300
|
if (toolOutputs.size === 0) {
|
|
289
|
-
throw new Error(
|
|
301
|
+
throw new Error('No tool outputs provided for scoring');
|
|
290
302
|
}
|
|
291
303
|
const weights = /* @__PURE__ */ new Map();
|
|
292
304
|
for (const [toolName] of toolOutputs.entries()) {
|
|
293
305
|
const cliWeight = cliWeights?.get(toolName);
|
|
294
306
|
const configWeight = config?.tools?.[toolName]?.scoreWeight;
|
|
295
|
-
const weight =
|
|
307
|
+
const weight =
|
|
308
|
+
cliWeight ?? configWeight ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? 5;
|
|
296
309
|
weights.set(toolName, weight);
|
|
297
310
|
}
|
|
298
311
|
let weightedSum = 0;
|
|
@@ -316,44 +329,44 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
|
316
329
|
return `(${output.score} \xD7 ${w})`;
|
|
317
330
|
}
|
|
318
331
|
);
|
|
319
|
-
const formulaStr = `[${formulaParts.join(
|
|
332
|
+
const formulaStr = `[${formulaParts.join(' + ')}] / ${totalWeight} = ${overall}`;
|
|
320
333
|
return {
|
|
321
334
|
overall,
|
|
322
335
|
rating,
|
|
323
|
-
timestamp:
|
|
336
|
+
timestamp: /* @__PURE__ */ new Date().toISOString(),
|
|
324
337
|
toolsUsed,
|
|
325
338
|
breakdown,
|
|
326
339
|
calculation: {
|
|
327
340
|
formula: formulaStr,
|
|
328
341
|
weights: calculationWeights,
|
|
329
|
-
normalized: formulaStr
|
|
330
|
-
}
|
|
342
|
+
normalized: formulaStr,
|
|
343
|
+
},
|
|
331
344
|
};
|
|
332
345
|
}
|
|
333
346
|
function getRating(score) {
|
|
334
|
-
if (score >= 90) return
|
|
335
|
-
if (score >= 75) return
|
|
336
|
-
if (score >= 60) return
|
|
337
|
-
if (score >= 40) return
|
|
338
|
-
return
|
|
347
|
+
if (score >= 90) return 'Excellent';
|
|
348
|
+
if (score >= 75) return 'Good';
|
|
349
|
+
if (score >= 60) return 'Fair';
|
|
350
|
+
if (score >= 40) return 'Needs Work';
|
|
351
|
+
return 'Critical';
|
|
339
352
|
}
|
|
340
|
-
function getRatingWithContext(score, fileCount, modelTier =
|
|
353
|
+
function getRatingWithContext(score, fileCount, modelTier = 'standard') {
|
|
341
354
|
const threshold = getRecommendedThreshold(fileCount, modelTier);
|
|
342
355
|
const normalized = score - threshold + 70;
|
|
343
356
|
return getRating(normalized);
|
|
344
357
|
}
|
|
345
358
|
function getRatingDisplay(rating) {
|
|
346
359
|
switch (rating) {
|
|
347
|
-
case
|
|
348
|
-
return { emoji:
|
|
349
|
-
case
|
|
350
|
-
return { emoji:
|
|
351
|
-
case
|
|
352
|
-
return { emoji:
|
|
353
|
-
case
|
|
354
|
-
return { emoji:
|
|
355
|
-
case
|
|
356
|
-
return { emoji:
|
|
360
|
+
case 'Excellent':
|
|
361
|
+
return { emoji: '\u2705', color: 'green' };
|
|
362
|
+
case 'Good':
|
|
363
|
+
return { emoji: '\u{1F44D}', color: 'blue' };
|
|
364
|
+
case 'Fair':
|
|
365
|
+
return { emoji: '\u26A0\uFE0F', color: 'yellow' };
|
|
366
|
+
case 'Needs Work':
|
|
367
|
+
return { emoji: '\u{1F528}', color: 'orange' };
|
|
368
|
+
case 'Critical':
|
|
369
|
+
return { emoji: '\u274C', color: 'red' };
|
|
357
370
|
}
|
|
358
371
|
}
|
|
359
372
|
function formatScore(result) {
|
|
@@ -368,17 +381,22 @@ function formatToolScore(output) {
|
|
|
368
381
|
result += ` Factors:
|
|
369
382
|
`;
|
|
370
383
|
output.factors.forEach((factor) => {
|
|
371
|
-
const impactSign = factor.impact > 0 ?
|
|
384
|
+
const impactSign = factor.impact > 0 ? '+' : '';
|
|
372
385
|
result += ` \u2022 ${factor.name}: ${impactSign}${factor.impact} - ${factor.description}
|
|
373
386
|
`;
|
|
374
387
|
});
|
|
375
|
-
result +=
|
|
388
|
+
result += '\n';
|
|
376
389
|
}
|
|
377
390
|
if (output.recommendations && output.recommendations.length > 0) {
|
|
378
391
|
result += ` Recommendations:
|
|
379
392
|
`;
|
|
380
393
|
output.recommendations.forEach((rec, i) => {
|
|
381
|
-
const priorityIcon =
|
|
394
|
+
const priorityIcon =
|
|
395
|
+
rec.priority === 'high'
|
|
396
|
+
? '\u{1F534}'
|
|
397
|
+
: rec.priority === 'medium'
|
|
398
|
+
? '\u{1F7E1}'
|
|
399
|
+
: '\u{1F535}';
|
|
382
400
|
result += ` ${i + 1}. ${priorityIcon} ${rec.action}
|
|
383
401
|
`;
|
|
384
402
|
result += ` Impact: +${rec.estimatedImpact} points
|
|
@@ -593,5 +611,5 @@ export {
|
|
|
593
611
|
getRatingDisplay,
|
|
594
612
|
formatScore,
|
|
595
613
|
formatToolScore,
|
|
596
|
-
generateHTML
|
|
614
|
+
generateHTML,
|
|
597
615
|
};
|