@aiready/core 0.23.20 → 0.23.22

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.
Files changed (116) hide show
  1. package/dist/chunk-2N7ISIKE.mjs +158 -0
  2. package/dist/chunk-ARUIZO7M.mjs +297 -0
  3. package/dist/chunk-CYC5EGEI.mjs +297 -0
  4. package/dist/{chunk-REU6OUBT.mjs → chunk-DBOPSRBC.mjs} +47 -22
  5. package/dist/chunk-E55RNGGK.mjs +852 -0
  6. package/dist/chunk-EZ7ECLAZ.mjs +299 -0
  7. package/dist/chunk-FNPULWG7.mjs +248 -0
  8. package/dist/chunk-FZTFKZUQ.mjs +250 -0
  9. package/dist/chunk-GTS642BQ.mjs +262 -0
  10. package/dist/chunk-IXPY5J4K.mjs +248 -0
  11. package/dist/chunk-JJQLYW6Z.mjs +111 -0
  12. package/dist/chunk-L6BKANJC.mjs +130 -0
  13. package/dist/chunk-LXEO5PG3.mjs +292 -0
  14. package/dist/chunk-LZHO636W.mjs +501 -0
  15. package/dist/chunk-MTK2IIDZ.mjs +262 -0
  16. package/dist/chunk-QDCQETSI.mjs +262 -0
  17. package/dist/chunk-QZNY7B2N.mjs +248 -0
  18. package/dist/chunk-RCZSMGCX.mjs +250 -0
  19. package/dist/chunk-SWZOT67M.mjs +250 -0
  20. package/dist/chunk-U3IY2CFC.mjs +36 -0
  21. package/dist/chunk-UBCM5Y6R.mjs +275 -0
  22. package/dist/chunk-UTCRW3N7.mjs +301 -0
  23. package/dist/{chunk-SQHS6PFL.mjs → chunk-UYLH35LA.mjs} +47 -22
  24. package/dist/{chunk-ZB3EHHAG.mjs → chunk-WVNVC2PP.mjs} +90 -60
  25. package/dist/chunk-WYOW6O3P.mjs +114 -0
  26. package/dist/{chunk-RMH2TPAT.mjs → chunk-YRSSR4KN.mjs} +87 -59
  27. package/dist/client/index.d.mts +2 -0
  28. package/dist/client/index.d.ts +2 -0
  29. package/dist/client/index.js +922 -0
  30. package/dist/client/index.mjs +104 -0
  31. package/dist/client-2xbeKnrg.d.mts +1291 -0
  32. package/dist/client-2xbeKnrg.d.ts +1291 -0
  33. package/dist/client-4HLAGzFg.d.mts +1291 -0
  34. package/dist/client-4HLAGzFg.d.ts +1291 -0
  35. package/dist/client-B4TQwNa7.d.mts +1290 -0
  36. package/dist/client-B4TQwNa7.d.ts +1290 -0
  37. package/dist/client-Bdi4ty0v.d.mts +1294 -0
  38. package/dist/client-Bdi4ty0v.d.ts +1294 -0
  39. package/dist/client-BsKpUH3H.d.mts +1339 -0
  40. package/dist/client-BsKpUH3H.d.ts +1339 -0
  41. package/dist/client-Bv1zOaWF.d.mts +1291 -0
  42. package/dist/client-Bv1zOaWF.d.ts +1291 -0
  43. package/dist/client-Bz9YJMIX.d.mts +1290 -0
  44. package/dist/client-Bz9YJMIX.d.ts +1290 -0
  45. package/dist/client-CBpzm34X.d.mts +1291 -0
  46. package/dist/client-CBpzm34X.d.ts +1291 -0
  47. package/dist/client-CNu_tCZZ.d.mts +1305 -0
  48. package/dist/client-CNu_tCZZ.d.ts +1305 -0
  49. package/dist/client-CmEvxxQu.d.mts +1339 -0
  50. package/dist/client-CmEvxxQu.d.ts +1339 -0
  51. package/dist/client-Ctl_0z6F.d.mts +1294 -0
  52. package/dist/client-Ctl_0z6F.d.ts +1294 -0
  53. package/dist/client-DGMAxkZc.d.mts +1339 -0
  54. package/dist/client-DGMAxkZc.d.ts +1339 -0
  55. package/dist/client-DZq-CqcD.d.mts +1292 -0
  56. package/dist/client-DZq-CqcD.d.ts +1292 -0
  57. package/dist/{client-CYz0qxGB.d.mts → client-DcqGfDTt.d.mts} +90 -23
  58. package/dist/{client-CYz0qxGB.d.ts → client-DcqGfDTt.d.ts} +90 -23
  59. package/dist/{client-jGuH6TAG.d.mts → client-O8RvSRm0.d.mts} +18 -1
  60. package/dist/{client-jGuH6TAG.d.ts → client-O8RvSRm0.d.ts} +18 -1
  61. package/dist/client.d.mts +1 -1
  62. package/dist/client.d.ts +1 -1
  63. package/dist/client.js +47 -13
  64. package/dist/client.mjs +6 -4
  65. package/dist/csharp-parser-4ZKCSX5B.mjs +9 -0
  66. package/dist/csharp-parser-5HKICCRR.mjs +9 -0
  67. package/dist/csharp-parser-JCKXIAJW.mjs +9 -0
  68. package/dist/go-parser-J4KIH4RG.mjs +9 -0
  69. package/dist/go-parser-TKXL3DVH.mjs +9 -0
  70. package/dist/go-parser-XOM232XZ.mjs +9 -0
  71. package/dist/index-Ctl_0z6F.d.mts +1294 -0
  72. package/dist/index-Ctl_0z6F.d.ts +1294 -0
  73. package/dist/index.d.mts +372 -165
  74. package/dist/index.d.ts +372 -165
  75. package/dist/index.js +3825 -3123
  76. package/dist/index.mjs +901 -2128
  77. package/dist/java-parser-3KHXOXRQ.mjs +9 -0
  78. package/dist/java-parser-MASGS4WB.mjs +9 -0
  79. package/dist/java-parser-T5LXD63J.mjs +9 -0
  80. package/dist/python-parser-FNFK2473.mjs +8 -0
  81. package/dist/typescript-parser-2GGNRNB5.mjs +7 -0
  82. package/dist/typescript-parser-3ENJ6C7H.mjs +7 -0
  83. package/dist/typescript-parser-4GI7DPSW.mjs +7 -0
  84. package/dist/typescript-parser-4H3HUBO4.mjs +7 -0
  85. package/dist/typescript-parser-K63IVZMF.mjs +7 -0
  86. package/dist/typescript-parser-ZJKROMQG.mjs +7 -0
  87. package/package.json +6 -6
  88. package/dist/chunk-2Y6WZCES.mjs +0 -859
  89. package/dist/chunk-5SHLHMH7.mjs +0 -760
  90. package/dist/chunk-CGOS2J6T.mjs +0 -807
  91. package/dist/chunk-FMNCV4CC.mjs +0 -859
  92. package/dist/chunk-Q55AMEFV.mjs +0 -760
  93. package/dist/chunk-ST75O5C5.mjs +0 -859
  94. package/dist/chunk-TJXR2CHZ.mjs +0 -799
  95. package/dist/client-BEoUYNLp.d.mts +0 -1191
  96. package/dist/client-BEoUYNLp.d.ts +0 -1191
  97. package/dist/client-BrIMPk89.d.mts +0 -1214
  98. package/dist/client-BrIMPk89.d.ts +0 -1214
  99. package/dist/client-C5BuGX4F.d.mts +0 -1205
  100. package/dist/client-C5BuGX4F.d.ts +0 -1205
  101. package/dist/client-CKcjnPXt.d.mts +0 -1214
  102. package/dist/client-CKcjnPXt.d.ts +0 -1214
  103. package/dist/client-CLulBnie.d.mts +0 -1182
  104. package/dist/client-CLulBnie.d.ts +0 -1182
  105. package/dist/client-CQwvp8ep.d.mts +0 -1182
  106. package/dist/client-CQwvp8ep.d.ts +0 -1182
  107. package/dist/client-DLvFR2qA.d.mts +0 -1197
  108. package/dist/client-DLvFR2qA.d.ts +0 -1197
  109. package/dist/client-PFPdeo-z.d.mts +0 -1186
  110. package/dist/client-PFPdeo-z.d.ts +0 -1186
  111. package/dist/client-WVCAIWdJ.d.mts +0 -1192
  112. package/dist/client-WVCAIWdJ.d.ts +0 -1192
  113. package/dist/client-pYldIAg2.d.mts +0 -1209
  114. package/dist/client-pYldIAg2.d.ts +0 -1209
  115. package/dist/client-wk2fgk1q.d.mts +0 -1184
  116. package/dist/client-wk2fgk1q.d.ts +0 -1184
@@ -0,0 +1,301 @@
1
+ import {
2
+ ParseError
3
+ } from "./chunk-U3IY2CFC.mjs";
4
+
5
+ // src/parsers/typescript-parser.ts
6
+ import { parse } from "@typescript-eslint/typescript-estree";
7
+ var TypeScriptParser = class {
8
+ constructor() {
9
+ this.language = "typescript" /* TypeScript */;
10
+ this.extensions = [".ts", ".tsx", ".js", ".jsx"];
11
+ }
12
+ async initialize() {
13
+ }
14
+ canHandle(filePath) {
15
+ return this.extensions.some((ext) => filePath.endsWith(ext));
16
+ }
17
+ async getAST(code, filePath) {
18
+ try {
19
+ return parse(code, {
20
+ filePath,
21
+ loc: true,
22
+ range: true,
23
+ tokens: true,
24
+ comment: true,
25
+ jsx: filePath.endsWith("x")
26
+ });
27
+ } catch (error) {
28
+ throw new ParseError(error.message, filePath, {
29
+ line: error.lineNumber || 1,
30
+ column: error.column || 0
31
+ });
32
+ }
33
+ }
34
+ parse(code, filePath) {
35
+ try {
36
+ const ast = parse(code, {
37
+ filePath,
38
+ loc: true,
39
+ range: true,
40
+ tokens: true,
41
+ comment: true,
42
+ jsx: filePath.endsWith("x")
43
+ });
44
+ const imports = this.extractImports(ast);
45
+ const exports = this.extractExports(ast, code, filePath);
46
+ return {
47
+ exports,
48
+ imports,
49
+ language: this.language
50
+ };
51
+ } catch (error) {
52
+ throw new ParseError(error.message, filePath, {
53
+ line: error.lineNumber || 1,
54
+ column: error.column || 0
55
+ });
56
+ }
57
+ }
58
+ getNamingConventions() {
59
+ return {
60
+ variablePattern: /^[a-z][a-zA-Z0-9]*$/,
61
+ functionPattern: /^[a-z][a-zA-Z0-9]*$/,
62
+ classPattern: /^[A-Z][a-zA-Z0-9]*$/,
63
+ constantPattern: /^[A-Z][A-Z0-9_]*$/,
64
+ typePattern: /^[A-Z][a-zA-Z0-9]*$/,
65
+ interfacePattern: /^I?[A-Z][a-zA-Z0-9]*$/
66
+ };
67
+ }
68
+ analyzeMetadata(node, code) {
69
+ if (!code) return {};
70
+ return {
71
+ isPure: this.isLikelyPure(node),
72
+ hasSideEffects: !this.isLikelyPure(node)
73
+ };
74
+ }
75
+ extractImports(ast) {
76
+ const imports = [];
77
+ for (const node of ast.body) {
78
+ if (node.type === "ImportDeclaration") {
79
+ const specifiers = [];
80
+ let isTypeOnly = false;
81
+ if (node.importKind === "type") {
82
+ isTypeOnly = true;
83
+ }
84
+ for (const spec of node.specifiers) {
85
+ if (spec.type === "ImportSpecifier") {
86
+ const imported = spec.imported;
87
+ const name = imported.type === "Identifier" ? imported.name : imported.value;
88
+ specifiers.push(name);
89
+ } else if (spec.type === "ImportDefaultSpecifier") {
90
+ specifiers.push("default");
91
+ } else if (spec.type === "ImportNamespaceSpecifier") {
92
+ specifiers.push("*");
93
+ }
94
+ }
95
+ imports.push({
96
+ source: node.source.value,
97
+ specifiers,
98
+ isTypeOnly,
99
+ loc: node.loc ? {
100
+ start: {
101
+ line: node.loc.start.line,
102
+ column: node.loc.start.column
103
+ },
104
+ end: { line: node.loc.end.line, column: node.loc.end.column }
105
+ } : void 0
106
+ });
107
+ }
108
+ }
109
+ return imports;
110
+ }
111
+ extractExports(ast, code, filePath) {
112
+ const exports = [];
113
+ for (const node of ast.body) {
114
+ if (node.type === "ExportNamedDeclaration") {
115
+ if (node.declaration) {
116
+ const declaration = node.declaration;
117
+ if ((declaration.type === "FunctionDeclaration" || declaration.type === "TSDeclareFunction") && declaration.id) {
118
+ exports.push(
119
+ this.createExport(
120
+ declaration.id.name,
121
+ "function",
122
+ node,
123
+ // Pass the outer ExportNamedDeclaration
124
+ code,
125
+ filePath
126
+ )
127
+ );
128
+ } else if (declaration.type === "ClassDeclaration" && declaration.id) {
129
+ exports.push(
130
+ this.createExport(
131
+ declaration.id.name,
132
+ "class",
133
+ node,
134
+ // Pass the outer ExportNamedDeclaration
135
+ code,
136
+ filePath
137
+ )
138
+ );
139
+ } else if (declaration.type === "TSTypeAliasDeclaration") {
140
+ exports.push(
141
+ this.createExport(
142
+ declaration.id.name,
143
+ "type",
144
+ node,
145
+ // Pass the outer ExportNamedDeclaration
146
+ code,
147
+ filePath
148
+ )
149
+ );
150
+ } else if (declaration.type === "TSInterfaceDeclaration") {
151
+ exports.push(
152
+ this.createExport(
153
+ declaration.id.name,
154
+ "interface",
155
+ node,
156
+ // Pass the outer ExportNamedDeclaration
157
+ code,
158
+ filePath
159
+ )
160
+ );
161
+ } else if (declaration.type === "VariableDeclaration") {
162
+ for (const decl of declaration.declarations) {
163
+ if (decl.id.type === "Identifier") {
164
+ exports.push(
165
+ this.createExport(
166
+ decl.id.name,
167
+ "const",
168
+ node,
169
+ // Pass the outer ExportNamedDeclaration
170
+ code,
171
+ filePath,
172
+ decl.init
173
+ )
174
+ );
175
+ }
176
+ }
177
+ }
178
+ }
179
+ } else if (node.type === "ExportDefaultDeclaration") {
180
+ exports.push(
181
+ this.createExport("default", "default", node, code, filePath)
182
+ );
183
+ }
184
+ }
185
+ return exports;
186
+ }
187
+ createExport(name, type, node, code, filePath, initializer) {
188
+ const documentation = this.extractDocumentation(node, code);
189
+ let methodCount;
190
+ let propertyCount;
191
+ let parameters;
192
+ let isPrimitive = false;
193
+ let isTyped = false;
194
+ if (initializer) {
195
+ if (initializer.type === "Literal" || initializer.type === "TemplateLiteral" && initializer.expressions.length === 0) {
196
+ isPrimitive = true;
197
+ }
198
+ }
199
+ const structNode = node.type === "ExportNamedDeclaration" ? node.declaration : node.type === "ExportDefaultDeclaration" ? node.declaration : node;
200
+ if (filePath.endsWith(".ts") || filePath.endsWith(".tsx")) {
201
+ if (structNode.type === "TSTypeAliasDeclaration" || structNode.type === "TSInterfaceDeclaration" || structNode.type === "TSEnumDeclaration") {
202
+ isTyped = true;
203
+ } else if (structNode.type === "FunctionDeclaration" || structNode.type === "TSDeclareFunction") {
204
+ const hasReturnType = !!structNode.returnType;
205
+ const allParamsTyped = structNode.params.length === 0 || structNode.params.every((p) => !!p.typeAnnotation);
206
+ isTyped = hasReturnType && allParamsTyped;
207
+ } else if (structNode.type === "VariableDeclaration") {
208
+ isTyped = structNode.declarations.every(
209
+ (d) => !!d.id.typeAnnotation || !!d.init
210
+ );
211
+ } else if (structNode.type === "ClassDeclaration") {
212
+ isTyped = true;
213
+ }
214
+ } else if (filePath.endsWith(".js") || filePath.endsWith(".jsx")) {
215
+ isTyped = false;
216
+ }
217
+ if (structNode.type === "ClassDeclaration" || structNode.type === "TSInterfaceDeclaration") {
218
+ const body = structNode.type === "ClassDeclaration" ? structNode.body.body : structNode.body.body;
219
+ methodCount = body.filter(
220
+ (m) => m.type === "MethodDefinition" || m.type === "TSMethodSignature"
221
+ ).length;
222
+ propertyCount = body.filter(
223
+ (m) => m.type === "PropertyDefinition" || m.type === "TSPropertySignature"
224
+ ).length;
225
+ if (structNode.type === "ClassDeclaration") {
226
+ const constructor = body.find(
227
+ (m) => m.type === "MethodDefinition" && m.kind === "constructor"
228
+ );
229
+ if (constructor && constructor.value && constructor.value.params) {
230
+ parameters = constructor.value.params.map((p) => {
231
+ if (p.type === "Identifier") return p.name;
232
+ if (p.type === "TSParameterProperty" && p.parameter.type === "Identifier") {
233
+ return p.parameter.name;
234
+ }
235
+ return void 0;
236
+ }).filter(Boolean);
237
+ }
238
+ }
239
+ }
240
+ if (!parameters && (structNode.type === "FunctionDeclaration" || structNode.type === "TSDeclareFunction" || structNode.type === "MethodDefinition")) {
241
+ const funcNode = structNode.type === "MethodDefinition" ? structNode.value : structNode;
242
+ if (funcNode && funcNode.params) {
243
+ parameters = funcNode.params.map((p) => {
244
+ if (p.type === "Identifier") return p.name;
245
+ return void 0;
246
+ }).filter(Boolean);
247
+ }
248
+ }
249
+ return {
250
+ name,
251
+ type,
252
+ isPrimitive,
253
+ loc: node.loc ? {
254
+ start: { line: node.loc.start.line, column: node.loc.start.column },
255
+ end: { line: node.loc.end.line, column: node.loc.end.column }
256
+ } : void 0,
257
+ documentation,
258
+ methodCount,
259
+ propertyCount,
260
+ parameters,
261
+ isPure: this.isLikelyPure(node),
262
+ hasSideEffects: !this.isLikelyPure(node),
263
+ isTyped
264
+ };
265
+ }
266
+ extractDocumentation(node, code) {
267
+ if (node.range) {
268
+ const start = node.range[0];
269
+ const precedingCode = code.substring(0, start);
270
+ const jsdocMatch = precedingCode.match(/\/\*\*([\s\S]*?)\*\/\s*$/);
271
+ if (jsdocMatch) {
272
+ return {
273
+ content: jsdocMatch[1].trim(),
274
+ type: "jsdoc"
275
+ };
276
+ }
277
+ }
278
+ return void 0;
279
+ }
280
+ isLikelyPure(node) {
281
+ const structNode = node.type === "ExportNamedDeclaration" ? node.declaration : node.type === "ExportDefaultDeclaration" ? node.declaration : node;
282
+ if (structNode.type === "VariableDeclaration" && structNode.kind === "const")
283
+ return true;
284
+ if (structNode.type === "FunctionDeclaration" || structNode.type === "TSDeclareFunction" || structNode.type === "MethodDefinition" && structNode.value) {
285
+ const body = structNode.type === "MethodDefinition" ? structNode.value.body : structNode.body;
286
+ if (body && body.type === "BlockStatement") {
287
+ const bodyContent = JSON.stringify(body);
288
+ if (bodyContent.includes('"name":"console"') || bodyContent.includes('"name":"process"') || bodyContent.includes('"type":"AssignmentExpression"')) {
289
+ return false;
290
+ }
291
+ return true;
292
+ }
293
+ return true;
294
+ }
295
+ return false;
296
+ }
297
+ };
298
+
299
+ export {
300
+ TypeScriptParser
301
+ };
@@ -344,26 +344,54 @@ var ReadinessRating = /* @__PURE__ */ ((ReadinessRating2) => {
344
344
  ReadinessRating2["Critical"] = "Critical";
345
345
  return ReadinessRating2;
346
346
  })(ReadinessRating || {});
347
+ function getRatingMetadata(score) {
348
+ if (score >= 90) {
349
+ return {
350
+ label: "Excellent",
351
+ slug: "excellent",
352
+ emoji: "\u2705",
353
+ rating: "Excellent" /* Excellent */
354
+ };
355
+ }
356
+ if (score >= 75) {
357
+ return {
358
+ label: "Good",
359
+ slug: "good",
360
+ emoji: "\u{1F44D}",
361
+ rating: "Good" /* Good */
362
+ };
363
+ }
364
+ if (score >= 60) {
365
+ return {
366
+ label: "Fair",
367
+ slug: "fair",
368
+ emoji: "\u{1F44C}",
369
+ rating: "Fair" /* Fair */
370
+ };
371
+ }
372
+ if (score >= 40) {
373
+ return {
374
+ label: "Needs Work",
375
+ slug: "needs-work",
376
+ emoji: "\u{1F528}",
377
+ rating: "Needs Work" /* NeedsWork */
378
+ };
379
+ }
380
+ return {
381
+ label: "Critical",
382
+ slug: "critical",
383
+ emoji: "\u{1F6A8}",
384
+ rating: "Critical" /* Critical */
385
+ };
386
+ }
347
387
  function getRatingLabel(score) {
348
- if (score >= 90) return "Excellent";
349
- if (score >= 75) return "Good";
350
- if (score >= 60) return "Fair";
351
- if (score >= 40) return "Needs Work";
352
- return "Critical";
388
+ return getRatingMetadata(score).label;
353
389
  }
354
390
  function getRatingSlug(score) {
355
- if (score >= 90) return "excellent";
356
- if (score >= 75) return "good";
357
- if (score >= 60) return "fair";
358
- if (score >= 40) return "needs-work";
359
- return "critical";
391
+ return getRatingMetadata(score).slug;
360
392
  }
361
393
  function getRatingEmoji(score) {
362
- if (score >= 90) return "\u2705";
363
- if (score >= 75) return "\u{1F44D}";
364
- if (score >= 60) return "\u{1F44C}";
365
- if (score >= 40) return "\u{1F528}";
366
- return "\u{1F6A8}";
394
+ return getRatingMetadata(score).emoji;
367
395
  }
368
396
  function getToolEmoji(score) {
369
397
  return getRatingEmoji(score);
@@ -383,11 +411,7 @@ function getPriorityIcon(priority) {
383
411
  }
384
412
  }
385
413
  function getRating(score) {
386
- if (score >= 90) return "Excellent" /* Excellent */;
387
- if (score >= 75) return "Good" /* Good */;
388
- if (score >= 60) return "Fair" /* Fair */;
389
- if (score >= 40) return "Needs Work" /* NeedsWork */;
390
- return "Critical" /* Critical */;
414
+ return getRatingMetadata(score).rating;
391
415
  }
392
416
 
393
417
  // src/scoring.ts
@@ -557,8 +581,8 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
557
581
  const rating = getRating(overall);
558
582
  const formulaParts = Array.from(toolOutputs.entries()).map(
559
583
  ([name, output]) => {
560
- const w = weights.get(name) ?? 5;
561
- return `(${output.score} \xD7 ${w})`;
584
+ const weight = weights.get(name) ?? 5;
585
+ return `(${output.score} \xD7 ${weight})`;
562
586
  }
563
587
  );
564
588
  const formulaStr = `[${formulaParts.join(" + ")}] / ${totalWeight} = ${overall}`;
@@ -832,6 +856,7 @@ export {
832
856
  LANGUAGE_EXTENSIONS,
833
857
  ParseError,
834
858
  ReadinessRating,
859
+ getRatingMetadata,
835
860
  getRatingLabel,
836
861
  getRatingSlug,
837
862
  getRatingEmoji,
@@ -304,44 +304,7 @@ var COMMON_FINE_TUNING_OPTIONS = [
304
304
  "showBreakdown"
305
305
  ];
306
306
 
307
- // src/types/language.ts
308
- var Language = /* @__PURE__ */ ((Language2) => {
309
- Language2["TypeScript"] = "typescript";
310
- Language2["JavaScript"] = "javascript";
311
- Language2["Python"] = "python";
312
- Language2["Java"] = "java";
313
- Language2["Go"] = "go";
314
- Language2["Rust"] = "rust";
315
- Language2["CSharp"] = "csharp";
316
- return Language2;
317
- })(Language || {});
318
- var LANGUAGE_EXTENSIONS = {
319
- ".ts": "typescript" /* TypeScript */,
320
- ".tsx": "typescript" /* TypeScript */,
321
- ".js": "javascript" /* JavaScript */,
322
- ".jsx": "javascript" /* JavaScript */,
323
- ".py": "python" /* Python */,
324
- ".java": "java" /* Java */,
325
- ".go": "go" /* Go */,
326
- ".rs": "rust" /* Rust */,
327
- ".cs": "csharp" /* CSharp */
328
- };
329
- var ParseError = class extends Error {
330
- constructor(message, filePath, loc) {
331
- super(message);
332
- this.filePath = filePath;
333
- this.loc = loc;
334
- this.name = "ParseError";
335
- }
336
- };
337
-
338
- // src/scoring.ts
339
- var RecommendationPriority = /* @__PURE__ */ ((RecommendationPriority2) => {
340
- RecommendationPriority2["High"] = "high";
341
- RecommendationPriority2["Medium"] = "medium";
342
- RecommendationPriority2["Low"] = "low";
343
- return RecommendationPriority2;
344
- })(RecommendationPriority || {});
307
+ // src/utils/rating-helpers.ts
345
308
  var ReadinessRating = /* @__PURE__ */ ((ReadinessRating2) => {
346
309
  ReadinessRating2["Excellent"] = "Excellent";
347
310
  ReadinessRating2["Good"] = "Good";
@@ -350,6 +313,85 @@ var ReadinessRating = /* @__PURE__ */ ((ReadinessRating2) => {
350
313
  ReadinessRating2["Critical"] = "Critical";
351
314
  return ReadinessRating2;
352
315
  })(ReadinessRating || {});
316
+ function getRatingMetadata(score) {
317
+ if (score >= 90) {
318
+ return {
319
+ label: "Excellent",
320
+ slug: "excellent",
321
+ emoji: "\u2705",
322
+ rating: "Excellent" /* Excellent */
323
+ };
324
+ }
325
+ if (score >= 75) {
326
+ return {
327
+ label: "Good",
328
+ slug: "good",
329
+ emoji: "\u{1F44D}",
330
+ rating: "Good" /* Good */
331
+ };
332
+ }
333
+ if (score >= 60) {
334
+ return {
335
+ label: "Fair",
336
+ slug: "fair",
337
+ emoji: "\u{1F44C}",
338
+ rating: "Fair" /* Fair */
339
+ };
340
+ }
341
+ if (score >= 40) {
342
+ return {
343
+ label: "Needs Work",
344
+ slug: "needs-work",
345
+ emoji: "\u{1F528}",
346
+ rating: "Needs Work" /* NeedsWork */
347
+ };
348
+ }
349
+ return {
350
+ label: "Critical",
351
+ slug: "critical",
352
+ emoji: "\u{1F6A8}",
353
+ rating: "Critical" /* Critical */
354
+ };
355
+ }
356
+ function getRatingLabel(score) {
357
+ return getRatingMetadata(score).label;
358
+ }
359
+ function getRatingSlug(score) {
360
+ return getRatingMetadata(score).slug;
361
+ }
362
+ function getRatingEmoji(score) {
363
+ return getRatingMetadata(score).emoji;
364
+ }
365
+ function getToolEmoji(score) {
366
+ return getRatingEmoji(score);
367
+ }
368
+ function getPriorityIcon(priority) {
369
+ switch (priority) {
370
+ case "critical":
371
+ return "\u{1F534}";
372
+ case "high":
373
+ return "\u{1F7E0}";
374
+ case "medium":
375
+ return "\u{1F7E1}";
376
+ case "low":
377
+ return "\u{1F535}";
378
+ default:
379
+ return "\u26AA";
380
+ }
381
+ }
382
+ function getRating(score) {
383
+ return getRatingMetadata(score).rating;
384
+ }
385
+
386
+ // src/scoring-types.ts
387
+ var RecommendationPriority = /* @__PURE__ */ ((RecommendationPriority2) => {
388
+ RecommendationPriority2["High"] = "high";
389
+ RecommendationPriority2["Medium"] = "medium";
390
+ RecommendationPriority2["Low"] = "low";
391
+ return RecommendationPriority2;
392
+ })(RecommendationPriority || {});
393
+
394
+ // src/scoring.ts
353
395
  var DEFAULT_TOOL_WEIGHTS = {
354
396
  ["pattern-detect" /* PatternDetect */]: 22,
355
397
  ["context-analyzer" /* ContextAnalyzer */]: 19,
@@ -510,8 +552,8 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
510
552
  const rating = getRating(overall);
511
553
  const formulaParts = Array.from(toolOutputs.entries()).map(
512
554
  ([name, output]) => {
513
- const w = weights.get(name) ?? 5;
514
- return `(${output.score} \xD7 ${w})`;
555
+ const weight = weights.get(name) ?? 5;
556
+ return `(${output.score} \xD7 ${weight})`;
515
557
  }
516
558
  );
517
559
  const formulaStr = `[${formulaParts.join(" + ")}] / ${totalWeight} = ${overall}`;
@@ -528,20 +570,6 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
528
570
  }
529
571
  };
530
572
  }
531
- function getRating(score) {
532
- if (score >= 90) return "Excellent" /* Excellent */;
533
- if (score >= 75) return "Good" /* Good */;
534
- if (score >= 60) return "Fair" /* Fair */;
535
- if (score >= 40) return "Needs Work" /* NeedsWork */;
536
- return "Critical" /* Critical */;
537
- }
538
- function getRatingSlug(score) {
539
- if (score >= 90) return "excellent";
540
- if (score >= 75) return "good";
541
- if (score >= 60) return "fair";
542
- if (score >= 40) return "needs-work";
543
- return "critical";
544
- }
545
573
  function getRatingWithContext(score, fileCount, modelTier = "standard") {
546
574
  const threshold = getRecommendedThreshold(fileCount, modelTier);
547
575
  const normalized = score - threshold + 70;
@@ -795,11 +823,15 @@ export {
795
823
  GLOBAL_INFRA_OPTIONS,
796
824
  GLOBAL_SCAN_OPTIONS,
797
825
  COMMON_FINE_TUNING_OPTIONS,
798
- Language,
799
- LANGUAGE_EXTENSIONS,
800
- ParseError,
801
- RecommendationPriority,
802
826
  ReadinessRating,
827
+ getRatingMetadata,
828
+ getRatingLabel,
829
+ getRatingSlug,
830
+ getRatingEmoji,
831
+ getToolEmoji,
832
+ getPriorityIcon,
833
+ getRating,
834
+ RecommendationPriority,
803
835
  DEFAULT_TOOL_WEIGHTS,
804
836
  TOOL_NAME_MAP,
805
837
  ScoringProfile,
@@ -812,8 +844,6 @@ export {
812
844
  getToolWeight,
813
845
  parseWeightString,
814
846
  calculateOverallScore,
815
- getRating,
816
- getRatingSlug,
817
847
  getRatingWithContext,
818
848
  getRatingDisplay,
819
849
  formatScore,
@@ -0,0 +1,114 @@
1
+ // src/parsers/shared-parser-utils.ts
2
+ var SIDE_EFFECT_KEYWORDS = [
3
+ "print(",
4
+ "console.",
5
+ "System.out",
6
+ "System.err",
7
+ "fmt.",
8
+ "File.Write",
9
+ "Files.write",
10
+ "os.Exit",
11
+ "panic(",
12
+ "throw ",
13
+ "Logging.",
14
+ "log."
15
+ ];
16
+ function analyzeGeneralMetadata(node, code, options = {}) {
17
+ const metadata = {
18
+ isPure: true,
19
+ hasSideEffects: false
20
+ };
21
+ try {
22
+ let prev = node.previousNamedSibling || node.previousSibling || null;
23
+ while (prev && /attribute|decorator/i.test(prev.type)) {
24
+ prev = prev.previousNamedSibling || prev.previousSibling || null;
25
+ }
26
+ while (prev && /comment|xml|doc/i.test(prev.type)) {
27
+ const text = prev.text || "";
28
+ if (text.trim().startsWith("/**")) {
29
+ metadata.documentation = {
30
+ content: text.replace(/^[/*]+|[/*]+$/g, "").trim(),
31
+ type: "jsdoc"
32
+ };
33
+ break;
34
+ }
35
+ if (text.trim().startsWith("///")) {
36
+ metadata.documentation = {
37
+ content: text.replace(/^\/\/\//, "").trim(),
38
+ type: "xml-doc"
39
+ };
40
+ break;
41
+ }
42
+ if (text.trim().startsWith("//")) {
43
+ metadata.documentation = {
44
+ content: text.replace(/^\/\//, "").trim(),
45
+ type: "comment"
46
+ };
47
+ break;
48
+ }
49
+ prev = prev.previousSibling || null;
50
+ }
51
+ } catch {
52
+ }
53
+ const signatures = [
54
+ ...SIDE_EFFECT_KEYWORDS,
55
+ ...options.sideEffectSignatures || []
56
+ ];
57
+ const walk = (n) => {
58
+ if (/assign|assignment|assignment_statement|assignment_expression/i.test(
59
+ n.type
60
+ )) {
61
+ metadata.isPure = false;
62
+ metadata.hasSideEffects = true;
63
+ }
64
+ const text = n.text;
65
+ for (const sig of signatures) {
66
+ if (text.includes(sig)) {
67
+ metadata.isPure = false;
68
+ metadata.hasSideEffects = true;
69
+ break;
70
+ }
71
+ }
72
+ if (!metadata.hasSideEffects) {
73
+ for (let i = 0; i < n.childCount; i++) {
74
+ const child = n.child(i);
75
+ if (child) walk(child);
76
+ }
77
+ }
78
+ };
79
+ walk(node);
80
+ return metadata;
81
+ }
82
+ function extractParameterNames(node) {
83
+ const params = [];
84
+ const candidates = [
85
+ // common field name
86
+ node.childForFieldName ? node.childForFieldName("parameters") : null,
87
+ node.childForFieldName ? node.childForFieldName("parameter_list") : null,
88
+ node.children.find((c) => c.type === "parameter_list") || null,
89
+ node.children.find((c) => c.type === "parameters") || null,
90
+ node.children.find((c) => c.type === "formal_parameters") || null,
91
+ node.children.find((c) => c.type === "formal_parameter") || null
92
+ ];
93
+ const list = candidates.find(Boolean);
94
+ if (!list) return params;
95
+ for (const child of list.children) {
96
+ if (!child) continue;
97
+ const id = child.childForFieldName?.("name") || child.children.find(
98
+ (c) => [
99
+ "identifier",
100
+ "variable_name",
101
+ "name",
102
+ "parameter",
103
+ "formal_parameter"
104
+ ].includes(c.type)
105
+ ) || (child.type === "identifier" ? child : void 0);
106
+ if (id && typeof id.text === "string") params.push(id.text);
107
+ }
108
+ return params;
109
+ }
110
+
111
+ export {
112
+ analyzeGeneralMetadata,
113
+ extractParameterNames
114
+ };