@aiready/core 0.23.2 → 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.
Files changed (79) hide show
  1. package/dist/__tests__/parser-factory.test.d.ts +1 -1
  2. package/dist/__tests__/parser-factory.test.js +62 -50
  3. package/dist/__tests__/python-parser.test.d.ts +1 -1
  4. package/dist/__tests__/python-parser.test.js +111 -109
  5. package/dist/__tests__/scoring.test.d.ts +1 -1
  6. package/dist/__tests__/scoring.test.js +193 -176
  7. package/dist/chunk-3YI4IS3D.mjs +191 -173
  8. package/dist/chunk-5HIXDC3X.mjs +273 -251
  9. package/dist/chunk-5V3L53AE.mjs +805 -0
  10. package/dist/chunk-CKVKHN3G.mjs +228 -211
  11. package/dist/chunk-COHIBX3Q.mjs +213 -195
  12. package/dist/chunk-CWRCDSKZ.mjs +91 -82
  13. package/dist/chunk-D3D3NCRR.mjs +147 -129
  14. package/dist/chunk-HCFYP7UD.mjs +805 -0
  15. package/dist/chunk-HFLFBA6F.mjs +79 -72
  16. package/dist/chunk-HKSARRCD.mjs +66 -58
  17. package/dist/chunk-JJ5JL5FX.mjs +91 -82
  18. package/dist/chunk-KDSTXVLQ.mjs +724 -0
  19. package/dist/chunk-KI7XORTN.mjs +91 -82
  20. package/dist/chunk-LTMHFNFK.mjs +690 -0
  21. package/dist/chunk-LTNXTXRI.mjs +228 -211
  22. package/dist/chunk-M22BXHBR.mjs +805 -0
  23. package/dist/chunk-MH3A3LX6.mjs +200 -182
  24. package/dist/chunk-NGHT7JOG.mjs +697 -0
  25. package/dist/chunk-OQ6IGDXG.mjs +147 -129
  26. package/dist/chunk-QAFB3HXQ.mjs +181 -165
  27. package/dist/chunk-QQBKXHLU.mjs +678 -0
  28. package/dist/chunk-RDHYGES7.mjs +678 -0
  29. package/dist/chunk-SWTDBVYJ.mjs +228 -213
  30. package/dist/chunk-UIWL5JQB.mjs +79 -72
  31. package/dist/chunk-UQGI67WR.mjs +79 -72
  32. package/dist/chunk-UTZOO4XO.mjs +147 -131
  33. package/dist/chunk-X4F46I5L.mjs +213 -195
  34. package/dist/chunk-XKK7YHPX.mjs +204 -186
  35. package/dist/chunk-YCA4FTEK.mjs +190 -172
  36. package/dist/chunk-ZSZRRTJM.mjs +719 -0
  37. package/dist/client-BgmiMoil.d.mts +1344 -0
  38. package/dist/client-BgmiMoil.d.ts +1344 -0
  39. package/dist/client-BxGrPuuN.d.mts +1191 -0
  40. package/dist/client-BxGrPuuN.d.ts +1191 -0
  41. package/dist/client-D-cn9ydj.d.mts +1136 -0
  42. package/dist/client-D-cn9ydj.d.ts +1136 -0
  43. package/dist/client-D9seCH4K.d.mts +1334 -0
  44. package/dist/client-D9seCH4K.d.ts +1334 -0
  45. package/dist/client-DIXIh7rw.d.mts +1193 -0
  46. package/dist/client-DIXIh7rw.d.ts +1193 -0
  47. package/dist/client-DVHXWOHw.d.mts +1245 -0
  48. package/dist/client-DVHXWOHw.d.ts +1245 -0
  49. package/dist/client.d.mts +2 -1098
  50. package/dist/client.d.ts +2 -1098
  51. package/dist/client.js +23 -43
  52. package/dist/client.mjs +3 -25
  53. package/dist/index.d.mts +325 -103
  54. package/dist/index.d.ts +325 -103
  55. package/dist/index.js +307 -324
  56. package/dist/index.mjs +283 -306
  57. package/dist/parsers/parser-factory.d.ts +45 -45
  58. package/dist/parsers/parser-factory.js +86 -84
  59. package/dist/parsers/python-parser.d.ts +33 -28
  60. package/dist/parsers/python-parser.js +224 -222
  61. package/dist/parsers/typescript-parser.d.ts +15 -10
  62. package/dist/parsers/typescript-parser.js +223 -197
  63. package/dist/scoring.d.ts +59 -49
  64. package/dist/scoring.js +129 -127
  65. package/dist/types/language.d.ts +104 -93
  66. package/dist/types/language.js +23 -23
  67. package/dist/types.d.ts +105 -87
  68. package/dist/types.js +1 -1
  69. package/dist/utils/ast-parser.d.ts +42 -33
  70. package/dist/utils/ast-parser.js +159 -162
  71. package/dist/utils/cli-helpers.d.ts +27 -10
  72. package/dist/utils/cli-helpers.js +45 -43
  73. package/dist/utils/config.d.ts +8 -3
  74. package/dist/utils/config.js +67 -69
  75. package/dist/utils/file-scanner.d.ts +1 -1
  76. package/dist/utils/file-scanner.js +80 -76
  77. package/dist/utils/metrics.d.ts +1 -1
  78. package/dist/utils/metrics.js +2 -2
  79. package/package.json +1 -1
@@ -1,88 +1,89 @@
1
1
  // src/types/language.ts
2
2
  var Language = /* @__PURE__ */ ((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";
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
- ".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 */
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 = "ParseError";
28
+ this.name = 'ParseError';
29
29
  }
30
30
  };
31
31
 
32
32
  // src/scoring.ts
33
33
  var DEFAULT_TOOL_WEIGHTS = {
34
- "pattern-detect": 22,
35
- "context-analyzer": 19,
36
- "consistency": 14,
37
- "ai-signal-clarity": 11,
38
- "agent-grounding": 10,
39
- "testability": 10,
40
- "doc-drift": 8,
41
- "deps": 6
34
+ 'pattern-detect': 22,
35
+ 'context-analyzer': 19,
36
+ consistency: 14,
37
+ 'ai-signal-clarity': 11,
38
+ 'agent-grounding': 10,
39
+ testability: 10,
40
+ 'doc-drift': 8,
41
+ deps: 6,
42
42
  };
43
43
  var TOOL_NAME_MAP = {
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"
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
- "xs": 80,
64
+ xs: 80,
65
65
  // < 50 files
66
- "small": 75,
66
+ small: 75,
67
67
  // 50-200 files
68
- "medium": 70,
68
+ medium: 70,
69
69
  // 200-500 files
70
- "large": 65,
70
+ large: 65,
71
71
  // 500-2000 files
72
- "enterprise": 58
72
+ enterprise: 58,
73
73
  // 2000+ files
74
74
  };
75
75
  function getProjectSizeTier(fileCount) {
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";
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 = "standard") {
82
+ function getRecommendedThreshold(fileCount, modelTier = 'standard') {
83
83
  const sizeTier = getProjectSizeTier(fileCount);
84
84
  const base = SIZE_ADJUSTED_THRESHOLDS[sizeTier];
85
- const modelBonus = modelTier === "frontier" ? -3 : modelTier === "extended" ? -2 : 0;
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("No tool outputs provided for scoring");
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 = cliWeight ?? configWeight ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? 10;
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(([name, output]) => {
146
- const w = weights.get(name) || 10;
147
- return `(${output.score} \xD7 ${w})`;
148
- });
149
- const formulaStr = `[${formulaParts.join(" + ")}] / ${totalWeight} = ${overall}`;
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: (/* @__PURE__ */ new Date()).toISOString(),
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 "Excellent";
165
- if (score >= 75) return "Good";
166
- if (score >= 60) return "Fair";
167
- if (score >= 40) return "Needs Work";
168
- return "Critical";
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 = "standard") {
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 "Excellent":
178
- return { emoji: "\u2705", color: "green" };
179
- case "Good":
180
- return { emoji: "\u{1F44D}", color: "blue" };
181
- case "Fair":
182
- return { emoji: "\u26A0\uFE0F", color: "yellow" };
183
- case "Needs Work":
184
- return { emoji: "\u{1F528}", color: "orange" };
185
- case "Critical":
186
- return { emoji: "\u274C", color: "red" };
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 += "\n";
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 = rec.priority === "high" ? "\u{1F534}" : rec.priority === "medium" ? "\u{1F7E1}" : "\u{1F535}";
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
  };