@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
|
@@ -4,213 +4,239 @@
|
|
|
4
4
|
* Parses TypeScript and JavaScript files using @typescript-eslint/typescript-estree
|
|
5
5
|
*/
|
|
6
6
|
import { parse } from '@typescript-eslint/typescript-estree';
|
|
7
|
-
import { Language, ParseError
|
|
7
|
+
import { Language, ParseError } from '../types/language';
|
|
8
8
|
export class TypeScriptParser {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
constructor() {
|
|
10
|
+
this.language = Language.TypeScript;
|
|
11
|
+
this.extensions = ['.ts', '.tsx', '.js', '.jsx'];
|
|
12
|
+
}
|
|
13
|
+
parse(code, filePath) {
|
|
14
|
+
try {
|
|
15
|
+
const isJavaScript = filePath.match(/\.jsx?$/i);
|
|
16
|
+
const ast = parse(code, {
|
|
17
|
+
loc: true,
|
|
18
|
+
range: true,
|
|
19
|
+
jsx: filePath.match(/\.[jt]sx$/i) !== null,
|
|
20
|
+
filePath,
|
|
21
|
+
sourceType: 'module',
|
|
22
|
+
ecmaVersion: 'latest',
|
|
23
|
+
});
|
|
24
|
+
const imports = this.extractImports(ast);
|
|
25
|
+
const exports = this.extractExports(ast, imports);
|
|
26
|
+
return {
|
|
27
|
+
exports,
|
|
28
|
+
imports,
|
|
29
|
+
language: isJavaScript ? Language.JavaScript : Language.TypeScript,
|
|
30
|
+
warnings: [],
|
|
31
|
+
};
|
|
32
|
+
} catch (error) {
|
|
33
|
+
const err = error;
|
|
34
|
+
throw new ParseError(
|
|
35
|
+
`Failed to parse ${filePath}: ${err.message}`,
|
|
36
|
+
filePath
|
|
37
|
+
);
|
|
12
38
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
}
|
|
40
|
+
getNamingConventions() {
|
|
41
|
+
return {
|
|
42
|
+
// camelCase for variables and functions
|
|
43
|
+
variablePattern: /^[a-z][a-zA-Z0-9]*$/,
|
|
44
|
+
functionPattern: /^[a-z][a-zA-Z0-9]*$/,
|
|
45
|
+
// PascalCase for classes
|
|
46
|
+
classPattern: /^[A-Z][a-zA-Z0-9]*$/,
|
|
47
|
+
// UPPER_CASE for constants
|
|
48
|
+
constantPattern: /^[A-Z][A-Z0-9_]*$/,
|
|
49
|
+
// Common exceptions (React hooks, etc.)
|
|
50
|
+
exceptions: ['__filename', '__dirname', '__esModule'],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
canHandle(filePath) {
|
|
54
|
+
return this.extensions.some((ext) => filePath.toLowerCase().endsWith(ext));
|
|
55
|
+
}
|
|
56
|
+
extractImports(ast) {
|
|
57
|
+
const imports = [];
|
|
58
|
+
for (const node of ast.body) {
|
|
59
|
+
if (node.type === 'ImportDeclaration') {
|
|
60
|
+
const specifiers = [];
|
|
61
|
+
let isTypeOnly = false;
|
|
62
|
+
// @ts-ignore - importKind exists but not in types
|
|
63
|
+
if (node.importKind === 'type') {
|
|
64
|
+
isTypeOnly = true;
|
|
32
65
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
66
|
+
for (const spec of node.specifiers) {
|
|
67
|
+
if (spec.type === 'ImportSpecifier') {
|
|
68
|
+
const imported = spec.imported;
|
|
69
|
+
const name =
|
|
70
|
+
imported.type === 'Identifier' ? imported.name : imported.value;
|
|
71
|
+
specifiers.push(name);
|
|
72
|
+
} else if (spec.type === 'ImportDefaultSpecifier') {
|
|
73
|
+
specifiers.push('default');
|
|
74
|
+
} else if (spec.type === 'ImportNamespaceSpecifier') {
|
|
75
|
+
specifiers.push('*');
|
|
76
|
+
}
|
|
36
77
|
}
|
|
78
|
+
imports.push({
|
|
79
|
+
source: node.source.value,
|
|
80
|
+
specifiers,
|
|
81
|
+
isTypeOnly,
|
|
82
|
+
loc: node.loc
|
|
83
|
+
? {
|
|
84
|
+
start: {
|
|
85
|
+
line: node.loc.start.line,
|
|
86
|
+
column: node.loc.start.column,
|
|
87
|
+
},
|
|
88
|
+
end: { line: node.loc.end.line, column: node.loc.end.column },
|
|
89
|
+
}
|
|
90
|
+
: undefined,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
37
93
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
else if (spec.type === 'ImportDefaultSpecifier') {
|
|
71
|
-
specifiers.push('default');
|
|
72
|
-
}
|
|
73
|
-
else if (spec.type === 'ImportNamespaceSpecifier') {
|
|
74
|
-
specifiers.push('*');
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
imports.push({
|
|
78
|
-
source: node.source.value,
|
|
79
|
-
specifiers,
|
|
80
|
-
isTypeOnly,
|
|
81
|
-
loc: node.loc
|
|
82
|
-
? {
|
|
83
|
-
start: { line: node.loc.start.line, column: node.loc.start.column },
|
|
84
|
-
end: { line: node.loc.end.line, column: node.loc.end.column },
|
|
85
|
-
}
|
|
86
|
-
: undefined,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
94
|
+
return imports;
|
|
95
|
+
}
|
|
96
|
+
extractExports(ast, imports) {
|
|
97
|
+
const exports = [];
|
|
98
|
+
const importedNames = new Set(
|
|
99
|
+
imports.flatMap((imp) =>
|
|
100
|
+
imp.specifiers.filter((s) => s !== '*' && s !== 'default')
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
for (const node of ast.body) {
|
|
104
|
+
if (node.type === 'ExportNamedDeclaration' && node.declaration) {
|
|
105
|
+
const extracted = this.extractFromDeclaration(
|
|
106
|
+
node.declaration,
|
|
107
|
+
importedNames
|
|
108
|
+
);
|
|
109
|
+
exports.push(...extracted);
|
|
110
|
+
} else if (node.type === 'ExportDefaultDeclaration') {
|
|
111
|
+
// Default export
|
|
112
|
+
let name = 'default';
|
|
113
|
+
let type = 'default';
|
|
114
|
+
if (
|
|
115
|
+
node.declaration.type === 'FunctionDeclaration' &&
|
|
116
|
+
node.declaration.id
|
|
117
|
+
) {
|
|
118
|
+
name = node.declaration.id.name;
|
|
119
|
+
type = 'function';
|
|
120
|
+
} else if (
|
|
121
|
+
node.declaration.type === 'ClassDeclaration' &&
|
|
122
|
+
node.declaration.id
|
|
123
|
+
) {
|
|
124
|
+
name = node.declaration.id.name;
|
|
125
|
+
type = 'class';
|
|
89
126
|
}
|
|
90
|
-
|
|
127
|
+
exports.push({
|
|
128
|
+
name,
|
|
129
|
+
type,
|
|
130
|
+
loc: node.loc
|
|
131
|
+
? {
|
|
132
|
+
start: {
|
|
133
|
+
line: node.loc.start.line,
|
|
134
|
+
column: node.loc.start.column,
|
|
135
|
+
},
|
|
136
|
+
end: { line: node.loc.end.line, column: node.loc.end.column },
|
|
137
|
+
}
|
|
138
|
+
: undefined,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
91
141
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
142
|
+
return exports;
|
|
143
|
+
}
|
|
144
|
+
extractFromDeclaration(declaration, importedNames) {
|
|
145
|
+
const exports = [];
|
|
146
|
+
if (declaration.type === 'FunctionDeclaration' && declaration.id) {
|
|
147
|
+
exports.push({
|
|
148
|
+
name: declaration.id.name,
|
|
149
|
+
type: 'function',
|
|
150
|
+
parameters: declaration.params.map((p) =>
|
|
151
|
+
p.type === 'Identifier' ? p.name : 'unknown'
|
|
152
|
+
),
|
|
153
|
+
loc: declaration.loc
|
|
154
|
+
? {
|
|
155
|
+
start: {
|
|
156
|
+
line: declaration.loc.start.line,
|
|
157
|
+
column: declaration.loc.start.column,
|
|
158
|
+
},
|
|
159
|
+
end: {
|
|
160
|
+
line: declaration.loc.end.line,
|
|
161
|
+
column: declaration.loc.end.column,
|
|
162
|
+
},
|
|
99
163
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
type,
|
|
117
|
-
loc: node.loc
|
|
118
|
-
? {
|
|
119
|
-
start: { line: node.loc.start.line, column: node.loc.start.column },
|
|
120
|
-
end: { line: node.loc.end.line, column: node.loc.end.column },
|
|
121
|
-
}
|
|
122
|
-
: undefined,
|
|
123
|
-
});
|
|
164
|
+
: undefined,
|
|
165
|
+
});
|
|
166
|
+
} else if (declaration.type === 'ClassDeclaration' && declaration.id) {
|
|
167
|
+
exports.push({
|
|
168
|
+
name: declaration.id.name,
|
|
169
|
+
type: 'class',
|
|
170
|
+
loc: declaration.loc
|
|
171
|
+
? {
|
|
172
|
+
start: {
|
|
173
|
+
line: declaration.loc.start.line,
|
|
174
|
+
column: declaration.loc.start.column,
|
|
175
|
+
},
|
|
176
|
+
end: {
|
|
177
|
+
line: declaration.loc.end.line,
|
|
178
|
+
column: declaration.loc.end.column,
|
|
179
|
+
},
|
|
124
180
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
: undefined,
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
else if (declaration.type === 'ClassDeclaration' && declaration.id) {
|
|
147
|
-
exports.push({
|
|
148
|
-
name: declaration.id.name,
|
|
149
|
-
type: 'class',
|
|
150
|
-
loc: declaration.loc
|
|
151
|
-
? {
|
|
152
|
-
start: {
|
|
153
|
-
line: declaration.loc.start.line,
|
|
154
|
-
column: declaration.loc.start.column,
|
|
155
|
-
},
|
|
156
|
-
end: { line: declaration.loc.end.line, column: declaration.loc.end.column },
|
|
157
|
-
}
|
|
158
|
-
: undefined,
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
else if (declaration.type === 'VariableDeclaration') {
|
|
162
|
-
for (const declarator of declaration.declarations) {
|
|
163
|
-
if (declarator.id.type === 'Identifier') {
|
|
164
|
-
exports.push({
|
|
165
|
-
name: declarator.id.name,
|
|
166
|
-
type: 'const',
|
|
167
|
-
loc: declarator.loc
|
|
168
|
-
? {
|
|
169
|
-
start: {
|
|
170
|
-
line: declarator.loc.start.line,
|
|
171
|
-
column: declarator.loc.start.column,
|
|
172
|
-
},
|
|
173
|
-
end: {
|
|
174
|
-
line: declarator.loc.end.line,
|
|
175
|
-
column: declarator.loc.end.column,
|
|
176
|
-
},
|
|
177
|
-
}
|
|
178
|
-
: undefined,
|
|
179
|
-
});
|
|
181
|
+
: undefined,
|
|
182
|
+
});
|
|
183
|
+
} else if (declaration.type === 'VariableDeclaration') {
|
|
184
|
+
for (const declarator of declaration.declarations) {
|
|
185
|
+
if (declarator.id.type === 'Identifier') {
|
|
186
|
+
exports.push({
|
|
187
|
+
name: declarator.id.name,
|
|
188
|
+
type: 'const',
|
|
189
|
+
loc: declarator.loc
|
|
190
|
+
? {
|
|
191
|
+
start: {
|
|
192
|
+
line: declarator.loc.start.line,
|
|
193
|
+
column: declarator.loc.start.column,
|
|
194
|
+
},
|
|
195
|
+
end: {
|
|
196
|
+
line: declarator.loc.end.line,
|
|
197
|
+
column: declarator.loc.end.column,
|
|
198
|
+
},
|
|
180
199
|
}
|
|
181
|
-
|
|
200
|
+
: undefined,
|
|
201
|
+
});
|
|
182
202
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
203
|
+
}
|
|
204
|
+
} else if (declaration.type === 'TSTypeAliasDeclaration') {
|
|
205
|
+
exports.push({
|
|
206
|
+
name: declaration.id.name,
|
|
207
|
+
type: 'type',
|
|
208
|
+
loc: declaration.loc
|
|
209
|
+
? {
|
|
210
|
+
start: {
|
|
211
|
+
line: declaration.loc.start.line,
|
|
212
|
+
column: declaration.loc.start.column,
|
|
213
|
+
},
|
|
214
|
+
end: {
|
|
215
|
+
line: declaration.loc.end.line,
|
|
216
|
+
column: declaration.loc.end.column,
|
|
217
|
+
},
|
|
218
|
+
}
|
|
219
|
+
: undefined,
|
|
220
|
+
});
|
|
221
|
+
} else if (declaration.type === 'TSInterfaceDeclaration') {
|
|
222
|
+
exports.push({
|
|
223
|
+
name: declaration.id.name,
|
|
224
|
+
type: 'interface',
|
|
225
|
+
loc: declaration.loc
|
|
226
|
+
? {
|
|
227
|
+
start: {
|
|
228
|
+
line: declaration.loc.start.line,
|
|
229
|
+
column: declaration.loc.start.column,
|
|
230
|
+
},
|
|
231
|
+
end: {
|
|
232
|
+
line: declaration.loc.end.line,
|
|
233
|
+
column: declaration.loc.end.column,
|
|
234
|
+
},
|
|
235
|
+
}
|
|
236
|
+
: undefined,
|
|
237
|
+
});
|
|
214
238
|
}
|
|
239
|
+
return exports;
|
|
240
|
+
}
|
|
215
241
|
}
|
|
216
|
-
//# sourceMappingURL=typescript-parser.js.map
|
|
242
|
+
//# sourceMappingURL=typescript-parser.js.map
|
package/dist/scoring.d.ts
CHANGED
|
@@ -5,52 +5,52 @@
|
|
|
5
5
|
* Each tool contributes a 0-100 score with configurable weights.
|
|
6
6
|
*/
|
|
7
7
|
export interface ToolScoringOutput {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
8
|
+
/** Unique tool identifier (e.g., "pattern-detect") */
|
|
9
|
+
toolName: string;
|
|
10
|
+
/** Normalized 0-100 score for this tool */
|
|
11
|
+
score: number;
|
|
12
|
+
/** Raw metrics used to calculate the score */
|
|
13
|
+
rawMetrics: Record<string, any>;
|
|
14
|
+
/** Factors that influenced the score */
|
|
15
|
+
factors: Array<{
|
|
16
|
+
name: string;
|
|
17
|
+
impact: number;
|
|
18
|
+
description: string;
|
|
19
|
+
}>;
|
|
20
|
+
/** Actionable recommendations with estimated impact */
|
|
21
|
+
recommendations: Array<{
|
|
22
|
+
action: string;
|
|
23
|
+
estimatedImpact: number;
|
|
24
|
+
priority: 'high' | 'medium' | 'low';
|
|
25
|
+
}>;
|
|
26
26
|
}
|
|
27
27
|
export interface ScoringResult {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
/** Overall AI Readiness Score (0-100) */
|
|
29
|
+
overall: number;
|
|
30
|
+
/** Rating category */
|
|
31
|
+
rating: 'Excellent' | 'Good' | 'Fair' | 'Needs Work' | 'Critical';
|
|
32
|
+
/** Timestamp of score calculation */
|
|
33
|
+
timestamp: string;
|
|
34
|
+
/** Tools that contributed to this score */
|
|
35
|
+
toolsUsed: string[];
|
|
36
|
+
/** Breakdown by tool */
|
|
37
|
+
breakdown: ToolScoringOutput[];
|
|
38
|
+
/** Calculation details */
|
|
39
|
+
calculation: {
|
|
40
|
+
formula: string;
|
|
41
|
+
weights: Record<string, number>;
|
|
42
|
+
normalized: string;
|
|
43
|
+
};
|
|
44
44
|
}
|
|
45
45
|
export interface ScoringConfig {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
/** Minimum passing score (exit code 1 if below) */
|
|
47
|
+
threshold?: number;
|
|
48
|
+
/** Show detailed breakdown in output */
|
|
49
|
+
showBreakdown?: boolean;
|
|
50
|
+
/** Path to baseline JSON for comparison */
|
|
51
|
+
compareBaseline?: string;
|
|
52
|
+
/** Auto-save score to this path */
|
|
53
|
+
saveTo?: string;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* Default weights for known tools.
|
|
@@ -72,13 +72,19 @@ export declare function normalizeToolName(shortName: string): string;
|
|
|
72
72
|
* 3. Default weight
|
|
73
73
|
* 4. 10 (for unknown tools)
|
|
74
74
|
*/
|
|
75
|
-
export declare function getToolWeight(
|
|
75
|
+
export declare function getToolWeight(
|
|
76
|
+
toolName: string,
|
|
77
|
+
toolConfig?: {
|
|
76
78
|
scoreWeight?: number;
|
|
77
|
-
},
|
|
79
|
+
},
|
|
80
|
+
cliOverride?: number
|
|
81
|
+
): number;
|
|
78
82
|
/**
|
|
79
83
|
* Parse weight string from CLI (e.g., "patterns:50,context:30")
|
|
80
84
|
*/
|
|
81
|
-
export declare function parseWeightString(
|
|
85
|
+
export declare function parseWeightString(
|
|
86
|
+
weightStr?: string
|
|
87
|
+
): Map<string, number>;
|
|
82
88
|
/**
|
|
83
89
|
* Calculate overall AI Readiness Score from multiple tool scores.
|
|
84
90
|
*
|
|
@@ -87,7 +93,11 @@ export declare function parseWeightString(weightStr?: string): Map<string, numbe
|
|
|
87
93
|
* This allows dynamic composition - score adjusts automatically
|
|
88
94
|
* based on which tools actually ran.
|
|
89
95
|
*/
|
|
90
|
-
export declare function calculateOverallScore(
|
|
96
|
+
export declare function calculateOverallScore(
|
|
97
|
+
toolOutputs: Map<string, ToolScoringOutput>,
|
|
98
|
+
config?: any,
|
|
99
|
+
cliWeights?: Map<string, number>
|
|
100
|
+
): ScoringResult;
|
|
91
101
|
/**
|
|
92
102
|
* Convert numeric score to rating category
|
|
93
103
|
*/
|
|
@@ -96,8 +106,8 @@ export declare function getRating(score: number): ScoringResult['rating'];
|
|
|
96
106
|
* Get rating emoji and color for display
|
|
97
107
|
*/
|
|
98
108
|
export declare function getRatingDisplay(rating: ScoringResult['rating']): {
|
|
99
|
-
|
|
100
|
-
|
|
109
|
+
emoji: string;
|
|
110
|
+
color: string;
|
|
101
111
|
};
|
|
102
112
|
/**
|
|
103
113
|
* Format score for display with rating
|
|
@@ -107,4 +117,4 @@ export declare function formatScore(result: ScoringResult): string;
|
|
|
107
117
|
* Format individual tool score for display
|
|
108
118
|
*/
|
|
109
119
|
export declare function formatToolScore(output: ToolScoringOutput): string;
|
|
110
|
-
//# sourceMappingURL=scoring.d.ts.map
|
|
120
|
+
//# sourceMappingURL=scoring.d.ts.map
|