@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-KI7XORTN.mjs
CHANGED
|
@@ -1,88 +1,89 @@
|
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
'pattern-detect': 40,
|
|
35
|
+
'context-analyzer': 35,
|
|
36
|
+
consistency: 25,
|
|
37
|
+
'ai-signal-clarity': 20,
|
|
38
|
+
'agent-grounding': 18,
|
|
39
|
+
testability: 18,
|
|
40
|
+
'doc-drift': 15,
|
|
41
|
+
deps: 12,
|
|
42
42
|
};
|
|
43
43
|
var TOOL_NAME_MAP = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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,
|
|
65
65
|
// < 50 files
|
|
66
|
-
|
|
66
|
+
small: 75,
|
|
67
67
|
// 50-200 files
|
|
68
|
-
|
|
68
|
+
medium: 70,
|
|
69
69
|
// 200-500 files
|
|
70
|
-
|
|
70
|
+
large: 65,
|
|
71
71
|
// 500-2000 files
|
|
72
|
-
|
|
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] ?? 10;
|
|
127
129
|
weights.set(toolName, weight);
|
|
128
130
|
}
|
|
129
131
|
let weightedSum = 0;
|
|
@@ -142,48 +144,50 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
|
142
144
|
}
|
|
143
145
|
const overall = Math.round(weightedSum / totalWeight);
|
|
144
146
|
const rating = getRating(overall);
|
|
145
|
-
const formulaParts = Array.from(toolOutputs.entries()).map(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
const formulaParts = Array.from(toolOutputs.entries()).map(
|
|
148
|
+
([name, output]) => {
|
|
149
|
+
const w = weights.get(name) || 10;
|
|
150
|
+
return `(${output.score} \xD7 ${w})`;
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
const formulaStr = `[${formulaParts.join(' + ')}] / ${totalWeight} = ${overall}`;
|
|
150
154
|
return {
|
|
151
155
|
overall,
|
|
152
156
|
rating,
|
|
153
|
-
timestamp:
|
|
157
|
+
timestamp: /* @__PURE__ */ new Date().toISOString(),
|
|
154
158
|
toolsUsed,
|
|
155
159
|
breakdown,
|
|
156
160
|
calculation: {
|
|
157
161
|
formula: formulaStr,
|
|
158
162
|
weights: calculationWeights,
|
|
159
|
-
normalized: formulaStr
|
|
160
|
-
}
|
|
163
|
+
normalized: formulaStr,
|
|
164
|
+
},
|
|
161
165
|
};
|
|
162
166
|
}
|
|
163
167
|
function getRating(score) {
|
|
164
|
-
if (score >= 90) return
|
|
165
|
-
if (score >= 75) return
|
|
166
|
-
if (score >= 60) return
|
|
167
|
-
if (score >= 40) return
|
|
168
|
-
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';
|
|
169
173
|
}
|
|
170
|
-
function getRatingWithContext(score, fileCount, modelTier =
|
|
174
|
+
function getRatingWithContext(score, fileCount, modelTier = 'standard') {
|
|
171
175
|
const threshold = getRecommendedThreshold(fileCount, modelTier);
|
|
172
176
|
const normalized = score - threshold + 70;
|
|
173
177
|
return getRating(normalized);
|
|
174
178
|
}
|
|
175
179
|
function getRatingDisplay(rating) {
|
|
176
180
|
switch (rating) {
|
|
177
|
-
case
|
|
178
|
-
return { emoji:
|
|
179
|
-
case
|
|
180
|
-
return { emoji:
|
|
181
|
-
case
|
|
182
|
-
return { emoji:
|
|
183
|
-
case
|
|
184
|
-
return { emoji:
|
|
185
|
-
case
|
|
186
|
-
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' };
|
|
187
191
|
}
|
|
188
192
|
}
|
|
189
193
|
function formatScore(result) {
|
|
@@ -198,17 +202,22 @@ function formatToolScore(output) {
|
|
|
198
202
|
result += ` Factors:
|
|
199
203
|
`;
|
|
200
204
|
output.factors.forEach((factor) => {
|
|
201
|
-
const impactSign = factor.impact > 0 ?
|
|
205
|
+
const impactSign = factor.impact > 0 ? '+' : '';
|
|
202
206
|
result += ` \u2022 ${factor.name}: ${impactSign}${factor.impact} - ${factor.description}
|
|
203
207
|
`;
|
|
204
208
|
});
|
|
205
|
-
result +=
|
|
209
|
+
result += '\n';
|
|
206
210
|
}
|
|
207
211
|
if (output.recommendations && output.recommendations.length > 0) {
|
|
208
212
|
result += ` Recommendations:
|
|
209
213
|
`;
|
|
210
214
|
output.recommendations.forEach((rec, i) => {
|
|
211
|
-
const priorityIcon =
|
|
215
|
+
const priorityIcon =
|
|
216
|
+
rec.priority === 'high'
|
|
217
|
+
? '\u{1F534}'
|
|
218
|
+
: rec.priority === 'medium'
|
|
219
|
+
? '\u{1F7E1}'
|
|
220
|
+
: '\u{1F535}';
|
|
212
221
|
result += ` ${i + 1}. ${priorityIcon} ${rec.action}
|
|
213
222
|
`;
|
|
214
223
|
result += ` Impact: +${rec.estimatedImpact} points
|
|
@@ -404,5 +413,5 @@ export {
|
|
|
404
413
|
getRatingDisplay,
|
|
405
414
|
formatScore,
|
|
406
415
|
formatToolScore,
|
|
407
|
-
generateHTML
|
|
416
|
+
generateHTML,
|
|
408
417
|
};
|