@aiready/cli 0.14.6 → 0.14.8

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.
@@ -1,272 +0,0 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
- // src/index.ts
9
- import {
10
- ToolRegistry,
11
- ToolName,
12
- calculateOverallScore,
13
- calculateTokenBudget
14
- } from "@aiready/core";
15
- import "@aiready/pattern-detect";
16
- import "@aiready/context-analyzer";
17
- import "@aiready/consistency";
18
- import "@aiready/ai-signal-clarity";
19
- import "@aiready/agent-grounding";
20
- import "@aiready/testability";
21
- import "@aiready/doc-drift";
22
- import "@aiready/deps";
23
- import "@aiready/change-amplification";
24
- var TOOL_PACKAGE_MAP = {
25
- [ToolName.PatternDetect]: "@aiready/pattern-detect",
26
- [ToolName.ContextAnalyzer]: "@aiready/context-analyzer",
27
- [ToolName.NamingConsistency]: "@aiready/consistency",
28
- [ToolName.AiSignalClarity]: "@aiready/ai-signal-clarity",
29
- [ToolName.AgentGrounding]: "@aiready/agent-grounding",
30
- [ToolName.TestabilityIndex]: "@aiready/testability",
31
- [ToolName.DocDrift]: "@aiready/doc-drift",
32
- [ToolName.DependencyHealth]: "@aiready/deps",
33
- [ToolName.ChangeAmplification]: "@aiready/change-amplification",
34
- // Aliases handled by registry
35
- patterns: "@aiready/pattern-detect",
36
- duplicates: "@aiready/pattern-detect",
37
- context: "@aiready/context-analyzer",
38
- fragmentation: "@aiready/context-analyzer",
39
- consistency: "@aiready/consistency",
40
- "ai-signal": "@aiready/ai-signal-clarity",
41
- grounding: "@aiready/agent-grounding",
42
- testability: "@aiready/testability",
43
- "deps-health": "@aiready/deps",
44
- "change-amp": "@aiready/change-amplification"
45
- };
46
- var GLOBAL_SCAN_OPTIONS = [
47
- "rootDir",
48
- "tools",
49
- "toolConfigs",
50
- "include",
51
- "exclude",
52
- "onProgress",
53
- "progressCallback",
54
- "includeTests",
55
- "useSmartDefaults",
56
- "maxDepth",
57
- "streamResults",
58
- "batchSize"
59
- ];
60
- function sanitizeToolConfig(config) {
61
- if (!config || typeof config !== "object") return config;
62
- const sanitized = { ...config };
63
- GLOBAL_SCAN_OPTIONS.forEach((key) => {
64
- delete sanitized[key];
65
- });
66
- return sanitized;
67
- }
68
- async function analyzeUnified(options) {
69
- const startTime = Date.now();
70
- const requestedTools = options.tools || [
71
- "patterns",
72
- "context",
73
- "consistency"
74
- ];
75
- const result = {
76
- summary: {
77
- totalIssues: 0,
78
- criticalIssues: 0,
79
- // Added as per instruction
80
- majorIssues: 0,
81
- // Added as per instruction
82
- totalFiles: 0,
83
- toolsRun: [],
84
- executionTime: 0,
85
- config: options,
86
- toolConfigs: {}
87
- }
88
- };
89
- for (const toolName of requestedTools) {
90
- let provider = ToolRegistry.find(toolName);
91
- if (!provider) {
92
- const packageName = TOOL_PACKAGE_MAP[toolName] || (toolName.startsWith("@aiready/") ? toolName : `@aiready/${toolName}`);
93
- try {
94
- await import(packageName);
95
- provider = ToolRegistry.find(toolName);
96
- if (provider) {
97
- console.log(
98
- `\u2705 Successfully loaded tool provider: ${toolName} from ${packageName}`
99
- );
100
- } else {
101
- console.log(
102
- `\u26A0\uFE0F Loaded ${packageName} but provider ${toolName} still not found in registry.`
103
- );
104
- }
105
- } catch (err) {
106
- console.log(
107
- `\u274C Failed to dynamically load tool ${toolName} (${packageName}):`,
108
- err.message
109
- );
110
- }
111
- }
112
- if (!provider) {
113
- console.warn(
114
- `\u26A0\uFE0F Warning: Tool provider for '${toolName}' not found. Skipping.`
115
- );
116
- continue;
117
- }
118
- try {
119
- const sanitizedConfig = { ...options };
120
- delete sanitizedConfig.onProgress;
121
- delete sanitizedConfig.progressCallback;
122
- const toolOptions = {
123
- ...options,
124
- ...options.toolConfigs?.[provider.id] || {},
125
- onProgress: (processed, total, message) => {
126
- if (options.progressCallback) {
127
- options.progressCallback({
128
- tool: provider.id,
129
- processed,
130
- total,
131
- message
132
- });
133
- }
134
- }
135
- };
136
- const output = await provider.analyze(toolOptions);
137
- if (output.metadata) {
138
- output.metadata.config = sanitizedConfig;
139
- }
140
- if (options.progressCallback) {
141
- options.progressCallback({ tool: provider.id, data: output });
142
- }
143
- result[provider.id] = output;
144
- result.summary.toolsRun.push(provider.id);
145
- if (output.summary?.config) {
146
- result.summary.toolConfigs[provider.id] = sanitizeToolConfig(output.summary.config);
147
- } else if (output.metadata?.config) {
148
- result.summary.toolConfigs[provider.id] = sanitizeToolConfig(output.metadata.config);
149
- }
150
- const toolFiles = output.summary?.totalFiles || output.summary?.filesAnalyzed || 0;
151
- if (toolFiles > result.summary.totalFiles) {
152
- result.summary.totalFiles = toolFiles;
153
- }
154
- const issueCount = output.results.reduce(
155
- (sum, file) => sum + (file.issues?.length || 0),
156
- 0
157
- );
158
- result.summary.totalIssues += issueCount;
159
- if (provider.alias && Array.isArray(provider.alias)) {
160
- for (const alias of provider.alias) {
161
- if (!result[alias]) {
162
- result[alias] = output;
163
- }
164
- }
165
- }
166
- const camelCaseId = provider.id.replace(
167
- /-([a-z])/g,
168
- (g) => g[1].toUpperCase()
169
- );
170
- if (camelCaseId !== provider.id && !result[camelCaseId]) {
171
- result[camelCaseId] = output;
172
- }
173
- } catch (err) {
174
- console.error(`\u274C Error running tool '${provider.id}':`, err);
175
- }
176
- }
177
- result.summary.config = {
178
- ...options,
179
- toolConfigs: result.summary.toolConfigs
180
- };
181
- result.summary.executionTime = Date.now() - startTime;
182
- return result;
183
- }
184
- async function scoreUnified(results, options) {
185
- const toolScores = /* @__PURE__ */ new Map();
186
- for (const toolId of results.summary.toolsRun) {
187
- const provider = ToolRegistry.get(toolId);
188
- if (!provider) continue;
189
- const output = results[toolId];
190
- if (!output) continue;
191
- try {
192
- const toolScore = provider.score(output, options);
193
- if (!toolScore.tokenBudget) {
194
- if (toolId === ToolName.PatternDetect && output.duplicates) {
195
- const wastedTokens = output.duplicates.reduce(
196
- (sum, d) => sum + (d.tokenCost || 0),
197
- 0
198
- );
199
- toolScore.tokenBudget = calculateTokenBudget({
200
- totalContextTokens: wastedTokens * 2,
201
- wastedTokens: {
202
- duplication: wastedTokens,
203
- fragmentation: 0,
204
- chattiness: 0
205
- }
206
- });
207
- } else if (toolId === ToolName.ContextAnalyzer && output.summary) {
208
- toolScore.tokenBudget = calculateTokenBudget({
209
- totalContextTokens: output.summary.totalTokens,
210
- wastedTokens: {
211
- duplication: 0,
212
- fragmentation: output.summary.totalPotentialSavings || 0,
213
- chattiness: 0
214
- }
215
- });
216
- }
217
- }
218
- toolScores.set(toolId, toolScore);
219
- } catch (err) {
220
- console.error(`\u274C Error scoring tool '${toolId}':`, err);
221
- }
222
- }
223
- if (toolScores.size === 0) {
224
- return {
225
- overall: 0,
226
- rating: "Critical",
227
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
228
- toolsUsed: [],
229
- breakdown: [],
230
- calculation: {
231
- formula: "0 / 0 = 0",
232
- weights: {},
233
- normalized: "0 / 0 = 0"
234
- }
235
- };
236
- }
237
- return calculateOverallScore(toolScores, options, void 0);
238
- }
239
- function generateUnifiedSummary(result) {
240
- const { summary } = result;
241
- let output = `\u{1F680} AIReady Analysis Complete
242
-
243
- `;
244
- output += `\u{1F4CA} Summary:
245
- `;
246
- output += ` Tools run: ${summary.toolsRun.join(", ")}
247
- `;
248
- output += ` Total issues found: ${summary.totalIssues}
249
- `;
250
- output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
251
-
252
- `;
253
- for (const provider of ToolRegistry.getAll()) {
254
- const toolResult = result[provider.id];
255
- if (toolResult) {
256
- const issueCount = toolResult.results.reduce(
257
- (sum, r) => sum + (r.issues?.length || 0),
258
- 0
259
- );
260
- output += `\u2022 ${provider.id}: ${issueCount} issues
261
- `;
262
- }
263
- }
264
- return output;
265
- }
266
-
267
- export {
268
- __require,
269
- analyzeUnified,
270
- scoreUnified,
271
- generateUnifiedSummary
272
- };
@@ -1,161 +0,0 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
- // src/index.ts
9
- import {
10
- ToolRegistry,
11
- ToolName,
12
- calculateOverallScore,
13
- calculateTokenBudget
14
- } from "@aiready/core";
15
- var TOOL_PACKAGE_MAP = {
16
- [ToolName.PatternDetect]: "@aiready/pattern-detect",
17
- [ToolName.ContextAnalyzer]: "@aiready/context-analyzer",
18
- [ToolName.NamingConsistency]: "@aiready/consistency",
19
- [ToolName.AiSignalClarity]: "@aiready/ai-signal-clarity",
20
- [ToolName.AgentGrounding]: "@aiready/agent-grounding",
21
- [ToolName.TestabilityIndex]: "@aiready/testability",
22
- [ToolName.DocDrift]: "@aiready/doc-drift",
23
- [ToolName.DependencyHealth]: "@aiready/deps",
24
- [ToolName.ChangeAmplification]: "@aiready/change-amplification",
25
- // Aliases handled by registry
26
- "patterns": "@aiready/pattern-detect",
27
- "context": "@aiready/context-analyzer",
28
- "consistency": "@aiready/consistency"
29
- };
30
- async function analyzeUnified(options) {
31
- const startTime = Date.now();
32
- const requestedTools = options.tools || ["patterns", "context", "consistency"];
33
- const result = {
34
- summary: {
35
- totalIssues: 0,
36
- toolsRun: [],
37
- executionTime: 0
38
- }
39
- };
40
- for (const toolName of requestedTools) {
41
- let provider = ToolRegistry.find(toolName);
42
- if (!provider) {
43
- const packageName = TOOL_PACKAGE_MAP[toolName] || (toolName.startsWith("@aiready/") ? toolName : `@aiready/${toolName}`);
44
- try {
45
- await import(packageName);
46
- provider = ToolRegistry.find(toolName);
47
- if (provider) {
48
- console.log(`\u2705 Successfully loaded tool provider: ${toolName} from ${packageName}`);
49
- } else {
50
- console.log(`\u26A0\uFE0F Loaded ${packageName} but provider ${toolName} still not found in registry.`);
51
- }
52
- } catch (err) {
53
- console.log(`\u274C Failed to dynamically load tool ${toolName} (${packageName}):`, err.message);
54
- }
55
- }
56
- if (!provider) {
57
- console.warn(`\u26A0\uFE0F Warning: Tool provider for '${toolName}' not found. Skipping.`);
58
- continue;
59
- }
60
- try {
61
- const output = await provider.analyze(options);
62
- if (options.progressCallback) {
63
- options.progressCallback({ tool: provider.id, data: output });
64
- }
65
- result[provider.id] = output;
66
- result.summary.toolsRun.push(provider.id);
67
- const issueCount = output.results.reduce(
68
- (sum, file) => sum + (file.issues?.length || 0),
69
- 0
70
- );
71
- result.summary.totalIssues += issueCount;
72
- if (provider.id === ToolName.PatternDetect) result.patternDetect = output;
73
- if (provider.id === ToolName.ContextAnalyzer) result.contextAnalyzer = output;
74
- } catch (err) {
75
- console.error(`\u274C Error running tool '${provider.id}':`, err);
76
- }
77
- }
78
- result.summary.executionTime = Date.now() - startTime;
79
- return result;
80
- }
81
- async function scoreUnified(results, options) {
82
- const toolScores = /* @__PURE__ */ new Map();
83
- for (const toolId of results.summary.toolsRun) {
84
- const provider = ToolRegistry.get(toolId);
85
- if (!provider) continue;
86
- const output = results[toolId];
87
- if (!output) continue;
88
- try {
89
- const toolScore = provider.score(output, options);
90
- if (!toolScore.tokenBudget) {
91
- if (toolId === ToolName.PatternDetect && output.duplicates) {
92
- const wastedTokens = output.duplicates.reduce(
93
- (sum, d) => sum + (d.tokenCost || 0),
94
- 0
95
- );
96
- toolScore.tokenBudget = calculateTokenBudget({
97
- totalContextTokens: wastedTokens * 2,
98
- wastedTokens: { duplication: wastedTokens, fragmentation: 0, chattiness: 0 }
99
- });
100
- } else if (toolId === ToolName.ContextAnalyzer && output.summary) {
101
- toolScore.tokenBudget = calculateTokenBudget({
102
- totalContextTokens: output.summary.totalTokens,
103
- wastedTokens: { duplication: 0, fragmentation: output.summary.totalPotentialSavings || 0, chattiness: 0 }
104
- });
105
- }
106
- }
107
- toolScores.set(toolId, toolScore);
108
- } catch (err) {
109
- console.error(`\u274C Error scoring tool '${toolId}':`, err);
110
- }
111
- }
112
- if (toolScores.size === 0) {
113
- return {
114
- overall: 0,
115
- rating: "Critical",
116
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
117
- toolsUsed: [],
118
- breakdown: [],
119
- calculation: {
120
- formula: "0 / 0 = 0",
121
- weights: {},
122
- normalized: "0 / 0 = 0"
123
- }
124
- };
125
- }
126
- return calculateOverallScore(toolScores, options, void 0);
127
- }
128
- function generateUnifiedSummary(result) {
129
- const { summary } = result;
130
- let output = `\u{1F680} AIReady Analysis Complete
131
-
132
- `;
133
- output += `\u{1F4CA} Summary:
134
- `;
135
- output += ` Tools run: ${summary.toolsRun.join(", ")}
136
- `;
137
- output += ` Total issues found: ${summary.totalIssues}
138
- `;
139
- output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
140
-
141
- `;
142
- for (const provider of ToolRegistry.getAll()) {
143
- const toolResult = result[provider.id];
144
- if (toolResult) {
145
- const issueCount = toolResult.results.reduce(
146
- (sum, r) => sum + (r.issues?.length || 0),
147
- 0
148
- );
149
- output += `\u2022 ${provider.id}: ${issueCount} issues
150
- `;
151
- }
152
- }
153
- return output;
154
- }
155
-
156
- export {
157
- __require,
158
- analyzeUnified,
159
- scoreUnified,
160
- generateUnifiedSummary
161
- };
@@ -1,277 +0,0 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
- // src/index.ts
9
- import {
10
- ToolRegistry,
11
- ToolName,
12
- calculateOverallScore,
13
- calculateTokenBudget,
14
- GLOBAL_SCAN_OPTIONS
15
- } from "@aiready/core";
16
- import "@aiready/pattern-detect";
17
- import "@aiready/context-analyzer";
18
- import "@aiready/consistency";
19
- import "@aiready/ai-signal-clarity";
20
- import "@aiready/agent-grounding";
21
- import "@aiready/testability";
22
- import "@aiready/doc-drift";
23
- import "@aiready/deps";
24
- import "@aiready/change-amplification";
25
- var TOOL_PACKAGE_MAP = {
26
- [ToolName.PatternDetect]: "@aiready/pattern-detect",
27
- [ToolName.ContextAnalyzer]: "@aiready/context-analyzer",
28
- [ToolName.NamingConsistency]: "@aiready/consistency",
29
- [ToolName.AiSignalClarity]: "@aiready/ai-signal-clarity",
30
- [ToolName.AgentGrounding]: "@aiready/agent-grounding",
31
- [ToolName.TestabilityIndex]: "@aiready/testability",
32
- [ToolName.DocDrift]: "@aiready/doc-drift",
33
- [ToolName.DependencyHealth]: "@aiready/deps",
34
- [ToolName.ChangeAmplification]: "@aiready/change-amplification",
35
- // Aliases handled by registry
36
- patterns: "@aiready/pattern-detect",
37
- duplicates: "@aiready/pattern-detect",
38
- context: "@aiready/context-analyzer",
39
- fragmentation: "@aiready/context-analyzer",
40
- consistency: "@aiready/consistency",
41
- "ai-signal": "@aiready/ai-signal-clarity",
42
- grounding: "@aiready/agent-grounding",
43
- testability: "@aiready/testability",
44
- "deps-health": "@aiready/deps",
45
- "change-amp": "@aiready/change-amplification"
46
- };
47
- function sanitizeToolConfig(config) {
48
- if (!config || typeof config !== "object") return config;
49
- const sanitized = { ...config };
50
- GLOBAL_SCAN_OPTIONS.forEach((key) => {
51
- if (key !== "rootDir") {
52
- delete sanitized[key];
53
- }
54
- });
55
- return sanitized;
56
- }
57
- async function analyzeUnified(options) {
58
- const startTime = Date.now();
59
- const requestedTools = options.tools || [
60
- "patterns",
61
- "context",
62
- "consistency"
63
- ];
64
- const result = {
65
- summary: {
66
- totalIssues: 0,
67
- criticalIssues: 0,
68
- // Added as per instruction
69
- majorIssues: 0,
70
- // Added as per instruction
71
- totalFiles: 0,
72
- toolsRun: [],
73
- executionTime: 0,
74
- config: options,
75
- toolConfigs: {}
76
- }
77
- };
78
- for (const toolName of requestedTools) {
79
- let provider = ToolRegistry.find(toolName);
80
- if (!provider) {
81
- const packageName = TOOL_PACKAGE_MAP[toolName] || (toolName.startsWith("@aiready/") ? toolName : `@aiready/${toolName}`);
82
- try {
83
- await import(packageName);
84
- provider = ToolRegistry.find(toolName);
85
- if (provider) {
86
- console.log(
87
- `\u2705 Successfully loaded tool provider: ${toolName} from ${packageName}`
88
- );
89
- } else {
90
- console.log(
91
- `\u26A0\uFE0F Loaded ${packageName} but provider ${toolName} still not found in registry.`
92
- );
93
- }
94
- } catch (err) {
95
- console.log(
96
- `\u274C Failed to dynamically load tool ${toolName} (${packageName}):`,
97
- err.message
98
- );
99
- }
100
- }
101
- if (!provider) {
102
- console.warn(
103
- `\u26A0\uFE0F Warning: Tool provider for '${toolName}' not found. Skipping.`
104
- );
105
- continue;
106
- }
107
- try {
108
- const sanitizedConfig = { ...options };
109
- delete sanitizedConfig.onProgress;
110
- delete sanitizedConfig.progressCallback;
111
- const toolOptions = {
112
- rootDir: options.rootDir
113
- // Always include rootDir
114
- };
115
- GLOBAL_SCAN_OPTIONS.forEach((key) => {
116
- if (key in options && key !== "toolConfigs") {
117
- toolOptions[key] = options[key];
118
- }
119
- });
120
- if (options.toolConfigs?.[provider.id]) {
121
- Object.assign(toolOptions, options.toolConfigs[provider.id]);
122
- } else if (options[provider.id]) {
123
- Object.assign(toolOptions, options[provider.id]);
124
- }
125
- toolOptions.onProgress = (processed, total, message) => {
126
- if (options.progressCallback) {
127
- options.progressCallback({
128
- tool: provider.id,
129
- processed,
130
- total,
131
- message
132
- });
133
- }
134
- };
135
- const output = await provider.analyze(toolOptions);
136
- if (output.metadata) {
137
- output.metadata.config = sanitizeToolConfig(toolOptions);
138
- }
139
- if (options.progressCallback) {
140
- options.progressCallback({ tool: provider.id, data: output });
141
- }
142
- result[provider.id] = output;
143
- result.summary.toolsRun.push(provider.id);
144
- if (output.summary?.config) {
145
- result.summary.toolConfigs[provider.id] = sanitizeToolConfig(
146
- output.summary.config
147
- );
148
- } else if (output.metadata?.config) {
149
- result.summary.toolConfigs[provider.id] = sanitizeToolConfig(
150
- output.metadata.config
151
- );
152
- } else {
153
- result.summary.toolConfigs[provider.id] = sanitizeToolConfig(toolOptions);
154
- }
155
- const toolFiles = output.summary?.totalFiles || output.summary?.filesAnalyzed || 0;
156
- if (toolFiles > result.summary.totalFiles) {
157
- result.summary.totalFiles = toolFiles;
158
- }
159
- const issueCount = output.results.reduce(
160
- (sum, file) => sum + (file.issues?.length || 0),
161
- 0
162
- );
163
- result.summary.totalIssues += issueCount;
164
- if (provider.alias && Array.isArray(provider.alias)) {
165
- for (const alias of provider.alias) {
166
- if (!result[alias]) {
167
- result[alias] = output;
168
- }
169
- }
170
- }
171
- const camelCaseId = provider.id.replace(
172
- /-([a-z])/g,
173
- (g) => g[1].toUpperCase()
174
- );
175
- if (camelCaseId !== provider.id && !result[camelCaseId]) {
176
- result[camelCaseId] = output;
177
- }
178
- } catch (err) {
179
- console.error(`\u274C Error running tool '${provider.id}':`, err);
180
- }
181
- }
182
- result.summary.config = {
183
- ...options,
184
- toolConfigs: result.summary.toolConfigs
185
- };
186
- result.summary.executionTime = Date.now() - startTime;
187
- return result;
188
- }
189
- async function scoreUnified(results, options) {
190
- const toolScores = /* @__PURE__ */ new Map();
191
- for (const toolId of results.summary.toolsRun) {
192
- const provider = ToolRegistry.get(toolId);
193
- if (!provider) continue;
194
- const output = results[toolId];
195
- if (!output) continue;
196
- try {
197
- const toolScore = provider.score(output, options);
198
- if (!toolScore.tokenBudget) {
199
- if (toolId === ToolName.PatternDetect && output.duplicates) {
200
- const wastedTokens = output.duplicates.reduce(
201
- (sum, d) => sum + (d.tokenCost || 0),
202
- 0
203
- );
204
- toolScore.tokenBudget = calculateTokenBudget({
205
- totalContextTokens: wastedTokens * 2,
206
- wastedTokens: {
207
- duplication: wastedTokens,
208
- fragmentation: 0,
209
- chattiness: 0
210
- }
211
- });
212
- } else if (toolId === ToolName.ContextAnalyzer && output.summary) {
213
- toolScore.tokenBudget = calculateTokenBudget({
214
- totalContextTokens: output.summary.totalTokens,
215
- wastedTokens: {
216
- duplication: 0,
217
- fragmentation: output.summary.totalPotentialSavings || 0,
218
- chattiness: 0
219
- }
220
- });
221
- }
222
- }
223
- toolScores.set(toolId, toolScore);
224
- } catch (err) {
225
- console.error(`\u274C Error scoring tool '${toolId}':`, err);
226
- }
227
- }
228
- if (toolScores.size === 0) {
229
- return {
230
- overall: 0,
231
- rating: "Critical",
232
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
233
- toolsUsed: [],
234
- breakdown: [],
235
- calculation: {
236
- formula: "0 / 0 = 0",
237
- weights: {},
238
- normalized: "0 / 0 = 0"
239
- }
240
- };
241
- }
242
- return calculateOverallScore(toolScores, options, void 0);
243
- }
244
- function generateUnifiedSummary(result) {
245
- const { summary } = result;
246
- let output = `\u{1F680} AIReady Analysis Complete
247
-
248
- `;
249
- output += `\u{1F4CA} Summary:
250
- `;
251
- output += ` Tools run: ${summary.toolsRun.join(", ")}
252
- `;
253
- output += ` Total issues found: ${summary.totalIssues}
254
- `;
255
- output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
256
-
257
- `;
258
- for (const provider of ToolRegistry.getAll()) {
259
- const toolResult = result[provider.id];
260
- if (toolResult) {
261
- const issueCount = toolResult.results.reduce(
262
- (sum, r) => sum + (r.issues?.length || 0),
263
- 0
264
- );
265
- output += `\u2022 ${provider.id}: ${issueCount} issues
266
- `;
267
- }
268
- }
269
- return output;
270
- }
271
-
272
- export {
273
- __require,
274
- analyzeUnified,
275
- scoreUnified,
276
- generateUnifiedSummary
277
- };