@aiready/cli 0.14.26 → 0.15.0

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.
@@ -0,0 +1,328 @@
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/orchestrator.ts
9
+ import {
10
+ ToolRegistry,
11
+ ToolName,
12
+ initializeParsers,
13
+ GLOBAL_INFRA_OPTIONS,
14
+ COMMON_FINE_TUNING_OPTIONS
15
+ } from "@aiready/core";
16
+ var TOOL_PACKAGE_MAP = {
17
+ [ToolName.PatternDetect]: "@aiready/pattern-detect",
18
+ [ToolName.ContextAnalyzer]: "@aiready/context-analyzer",
19
+ [ToolName.NamingConsistency]: "@aiready/consistency",
20
+ [ToolName.AiSignalClarity]: "@aiready/ai-signal-clarity",
21
+ [ToolName.AgentGrounding]: "@aiready/agent-grounding",
22
+ [ToolName.TestabilityIndex]: "@aiready/testability",
23
+ [ToolName.DocDrift]: "@aiready/doc-drift",
24
+ [ToolName.DependencyHealth]: "@aiready/deps",
25
+ [ToolName.ChangeAmplification]: "@aiready/change-amplification",
26
+ [ToolName.ContractEnforcement]: "@aiready/contract-enforcement",
27
+ // Aliases handled by registry
28
+ patterns: "@aiready/pattern-detect",
29
+ duplicates: "@aiready/pattern-detect",
30
+ context: "@aiready/context-analyzer",
31
+ fragmentation: "@aiready/context-analyzer",
32
+ consistency: "@aiready/consistency",
33
+ "ai-signal": "@aiready/ai-signal-clarity",
34
+ grounding: "@aiready/agent-grounding",
35
+ testability: "@aiready/testability",
36
+ "deps-health": "@aiready/deps",
37
+ "change-amp": "@aiready/change-amplification",
38
+ contract: "@aiready/contract-enforcement"
39
+ };
40
+ var UnifiedOrchestrator = class {
41
+ /**
42
+ * Initialize orchestrator with a tool registry.
43
+ * Injection pattern helps with testability and AI readiness score.
44
+ */
45
+ constructor(registry = ToolRegistry) {
46
+ this.registry = registry;
47
+ }
48
+ /**
49
+ * Deeply sanitizes a configuration object.
50
+ */
51
+ sanitizeConfig(obj) {
52
+ if (!obj || typeof obj !== "object" || Array.isArray(obj)) return obj;
53
+ const sanitized = {};
54
+ const infraToStrip = [
55
+ "rootDir",
56
+ "onProgress",
57
+ "progressCallback",
58
+ "streamResults",
59
+ "batchSize",
60
+ "useSmartDefaults"
61
+ ];
62
+ for (const [key, value] of Object.entries(obj)) {
63
+ if (infraToStrip.includes(key)) continue;
64
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
65
+ sanitized[key] = this.sanitizeConfig(value);
66
+ } else {
67
+ sanitized[key] = value;
68
+ }
69
+ }
70
+ return sanitized;
71
+ }
72
+ /**
73
+ * Performs the unified analysis.
74
+ */
75
+ async analyze(options) {
76
+ await initializeParsers();
77
+ const startTime = Date.now();
78
+ const requestedTools = options.tools ?? [
79
+ "patterns",
80
+ "context",
81
+ "consistency"
82
+ ];
83
+ const result = {
84
+ summary: {
85
+ totalIssues: 0,
86
+ criticalIssues: 0,
87
+ majorIssues: 0,
88
+ totalFiles: 0,
89
+ toolsRun: [],
90
+ executionTime: 0,
91
+ config: options,
92
+ toolConfigs: {}
93
+ }
94
+ };
95
+ for (const toolName of requestedTools) {
96
+ let provider = this.registry.find(toolName);
97
+ if (!provider) {
98
+ const packageName = TOOL_PACKAGE_MAP[toolName] ?? (toolName.startsWith("@aiready/") ? toolName : `@aiready/${toolName}`);
99
+ try {
100
+ await import(packageName);
101
+ provider = this.registry.find(toolName);
102
+ } catch (err) {
103
+ console.log(
104
+ `\u274C Failed to dynamically load tool ${toolName} (${packageName}):`,
105
+ err.message
106
+ );
107
+ }
108
+ }
109
+ if (!provider) {
110
+ console.warn(
111
+ `\u26A0\uFE0F Warning: Tool provider for '${toolName}' not found. Skipping.`
112
+ );
113
+ continue;
114
+ }
115
+ try {
116
+ const toolOptions = {
117
+ rootDir: options.rootDir
118
+ };
119
+ [...GLOBAL_INFRA_OPTIONS, ...COMMON_FINE_TUNING_OPTIONS].forEach(
120
+ (key) => {
121
+ if (key in options && key !== "toolConfigs" && key !== "tools") {
122
+ toolOptions[key] = options[key];
123
+ }
124
+ }
125
+ );
126
+ if (options.toolConfigs?.[provider.id]) {
127
+ Object.assign(toolOptions, options.toolConfigs[provider.id]);
128
+ } else if (options.tools && !Array.isArray(options.tools) && typeof options.tools === "object" && options.tools[provider.id]) {
129
+ Object.assign(toolOptions, options.tools[provider.id]);
130
+ }
131
+ toolOptions.onProgress = (processed, total, msg) => {
132
+ if (options.progressCallback) {
133
+ options.progressCallback({
134
+ tool: provider.id,
135
+ processed,
136
+ total,
137
+ message: msg
138
+ });
139
+ }
140
+ };
141
+ const output = await provider.analyze(toolOptions);
142
+ if (output.metadata) {
143
+ output.metadata.config = this.sanitizeConfig(toolOptions);
144
+ }
145
+ if (options.progressCallback) {
146
+ options.progressCallback({ tool: provider.id, data: output });
147
+ }
148
+ result[provider.id] = output;
149
+ result.summary.toolsRun.push(provider.id);
150
+ const toolConfig = output.summary?.config ?? output.metadata?.config ?? toolOptions;
151
+ result.summary.toolConfigs[provider.id] = this.sanitizeConfig(toolConfig);
152
+ const toolFiles = output.summary?.totalFiles ?? output.summary?.filesAnalyzed ?? 0;
153
+ if (toolFiles > result.summary.totalFiles) {
154
+ result.summary.totalFiles = toolFiles;
155
+ }
156
+ const issueCount = output.results.reduce(
157
+ (sum, file) => sum + (file.issues?.length ?? 0),
158
+ 0
159
+ );
160
+ result.summary.totalIssues += issueCount;
161
+ } catch (err) {
162
+ console.error(`\u274C Error running tool '${provider.id}':`, err);
163
+ }
164
+ }
165
+ result.summary.config = this.sanitizeConfig({
166
+ scan: {
167
+ tools: requestedTools,
168
+ include: options.include,
169
+ exclude: options.exclude
170
+ },
171
+ tools: result.summary.toolConfigs
172
+ });
173
+ result.summary.executionTime = Date.now() - startTime;
174
+ this.applyLegacyKeys(result);
175
+ return result;
176
+ }
177
+ applyLegacyKeys(result) {
178
+ const keyMappings = {
179
+ "pattern-detect": ["patternDetect", "patterns"],
180
+ "context-analyzer": ["contextAnalyzer", "context"],
181
+ "naming-consistency": ["namingConsistency", "consistency"],
182
+ "ai-signal-clarity": ["aiSignalClarity"],
183
+ "agent-grounding": ["agentGrounding"],
184
+ "testability-index": ["testabilityIndex", "testability"],
185
+ "doc-drift": ["docDrift"],
186
+ "dependency-health": ["dependencyHealth", "deps"],
187
+ "change-amplification": ["changeAmplification"],
188
+ "contract-enforcement": ["contractEnforcement", "contract"]
189
+ };
190
+ for (const [kebabKey, aliases] of Object.entries(keyMappings)) {
191
+ if (result[kebabKey]) {
192
+ for (const alias of aliases) {
193
+ result[alias] = result[kebabKey];
194
+ }
195
+ }
196
+ }
197
+ }
198
+ };
199
+ async function analyzeUnified(options) {
200
+ const orchestrator = new UnifiedOrchestrator(ToolRegistry);
201
+ return orchestrator.analyze(options);
202
+ }
203
+
204
+ // src/scoring-orchestrator.ts
205
+ import {
206
+ ToolRegistry as ToolRegistry2,
207
+ ToolName as ToolName2,
208
+ calculateOverallScore,
209
+ calculateTokenBudget
210
+ } from "@aiready/core";
211
+ var ScoringOrchestrator = class {
212
+ /**
213
+ * Initialize scoring orchestrator with a tool registry.
214
+ * Injection pattern helps with testability and AI readiness score.
215
+ */
216
+ constructor(registry = ToolRegistry2) {
217
+ this.registry = registry;
218
+ }
219
+ /**
220
+ * Calculates scores for all analyzed tools.
221
+ */
222
+ async score(results, options) {
223
+ const toolScores = /* @__PURE__ */ new Map();
224
+ for (const toolId of results.summary.toolsRun) {
225
+ const provider = this.registry.get(toolId);
226
+ if (!provider) continue;
227
+ const output = results[toolId];
228
+ if (!output) continue;
229
+ try {
230
+ const toolScore = provider.score(output, options);
231
+ if (!toolScore.tokenBudget) {
232
+ if (toolId === ToolName2.PatternDetect && output.duplicates) {
233
+ const wastedTokens = output.duplicates.reduce(
234
+ (sum, d) => sum + (d.tokenCost ?? 0),
235
+ 0
236
+ );
237
+ toolScore.tokenBudget = calculateTokenBudget({
238
+ totalContextTokens: wastedTokens * 2,
239
+ wastedTokens: {
240
+ duplication: wastedTokens,
241
+ fragmentation: 0,
242
+ chattiness: 0
243
+ }
244
+ });
245
+ } else if (toolId === ToolName2.ContextAnalyzer && output.summary) {
246
+ toolScore.tokenBudget = calculateTokenBudget({
247
+ totalContextTokens: output.summary.totalTokens,
248
+ wastedTokens: {
249
+ duplication: 0,
250
+ fragmentation: output.summary.totalPotentialSavings ?? 0,
251
+ chattiness: 0
252
+ }
253
+ });
254
+ }
255
+ }
256
+ toolScores.set(toolId, toolScore);
257
+ } catch (err) {
258
+ console.error(`\u274C Error scoring tool '${toolId}':`, err);
259
+ }
260
+ }
261
+ if (toolScores.size === 0) {
262
+ return this.emptyScoringResult();
263
+ }
264
+ return calculateOverallScore(toolScores, options, void 0);
265
+ }
266
+ /**
267
+ * Generate human-readable summary of unified results.
268
+ */
269
+ generateSummary(result) {
270
+ const { summary } = result;
271
+ let output = `\u{1F680} AIReady Analysis Complete
272
+
273
+ `;
274
+ output += `\u{1F4CA} Summary:
275
+ `;
276
+ output += ` Tools run: ${summary.toolsRun.join(", ")}
277
+ `;
278
+ output += ` Total issues found: ${summary.totalIssues}
279
+ `;
280
+ output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
281
+
282
+ `;
283
+ for (const provider of this.registry.getAll()) {
284
+ const toolResult = result[provider.id];
285
+ if (toolResult) {
286
+ const issueCount = toolResult.results.reduce(
287
+ (sum, r) => sum + (r.issues?.length ?? 0),
288
+ 0
289
+ );
290
+ output += `\u2022 ${provider.id}: ${issueCount} issues
291
+ `;
292
+ }
293
+ }
294
+ return output;
295
+ }
296
+ emptyScoringResult() {
297
+ return {
298
+ overall: 0,
299
+ rating: "Critical",
300
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
301
+ toolsUsed: [],
302
+ breakdown: [],
303
+ calculation: {
304
+ formula: "0 / 0 = 0",
305
+ weights: {},
306
+ normalized: "0 / 0 = 0"
307
+ }
308
+ };
309
+ }
310
+ };
311
+ async function scoreUnified(results, options) {
312
+ const orchestrator = new ScoringOrchestrator(ToolRegistry2);
313
+ return orchestrator.score(results, options);
314
+ }
315
+ function generateUnifiedSummary(result) {
316
+ const orchestrator = new ScoringOrchestrator(ToolRegistry2);
317
+ return orchestrator.generateSummary(result);
318
+ }
319
+
320
+ export {
321
+ __require,
322
+ TOOL_PACKAGE_MAP,
323
+ UnifiedOrchestrator,
324
+ analyzeUnified,
325
+ ScoringOrchestrator,
326
+ scoreUnified,
327
+ generateUnifiedSummary
328
+ };
@@ -0,0 +1,327 @@
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/orchestrator.ts
9
+ import {
10
+ ToolRegistry,
11
+ ToolName,
12
+ initializeParsers,
13
+ GLOBAL_INFRA_OPTIONS,
14
+ COMMON_FINE_TUNING_OPTIONS
15
+ } from "@aiready/core";
16
+ var TOOL_PACKAGE_MAP = {
17
+ [ToolName.PatternDetect]: "@aiready/pattern-detect",
18
+ [ToolName.ContextAnalyzer]: "@aiready/context-analyzer",
19
+ [ToolName.NamingConsistency]: "@aiready/consistency",
20
+ [ToolName.AiSignalClarity]: "@aiready/ai-signal-clarity",
21
+ [ToolName.AgentGrounding]: "@aiready/agent-grounding",
22
+ [ToolName.TestabilityIndex]: "@aiready/testability",
23
+ [ToolName.DocDrift]: "@aiready/doc-drift",
24
+ [ToolName.DependencyHealth]: "@aiready/deps",
25
+ [ToolName.ChangeAmplification]: "@aiready/change-amplification",
26
+ [ToolName.ContractEnforcement]: "@aiready/contract-enforcement",
27
+ // Aliases handled by registry
28
+ patterns: "@aiready/pattern-detect",
29
+ duplicates: "@aiready/pattern-detect",
30
+ context: "@aiready/context-analyzer",
31
+ fragmentation: "@aiready/context-analyzer",
32
+ consistency: "@aiready/consistency",
33
+ "ai-signal": "@aiready/ai-signal-clarity",
34
+ grounding: "@aiready/agent-grounding",
35
+ testability: "@aiready/testability",
36
+ "deps-health": "@aiready/deps",
37
+ "change-amp": "@aiready/change-amplification",
38
+ contract: "@aiready/contract-enforcement"
39
+ };
40
+ var UnifiedOrchestrator = class {
41
+ /**
42
+ * Initialize orchestrator with a tool registry.
43
+ * Injection pattern helps with testability and AI readiness score.
44
+ */
45
+ constructor(registry = ToolRegistry) {
46
+ this.registry = registry;
47
+ }
48
+ /**
49
+ * Deeply sanitizes a configuration object.
50
+ */
51
+ sanitizeConfig(obj) {
52
+ if (!obj || typeof obj !== "object" || Array.isArray(obj)) return obj;
53
+ const sanitized = {};
54
+ const infraToStrip = [
55
+ "rootDir",
56
+ "onProgress",
57
+ "progressCallback",
58
+ "streamResults",
59
+ "batchSize",
60
+ "useSmartDefaults"
61
+ ];
62
+ for (const [key, value] of Object.entries(obj)) {
63
+ if (infraToStrip.includes(key)) continue;
64
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
65
+ sanitized[key] = this.sanitizeConfig(value);
66
+ } else {
67
+ sanitized[key] = value;
68
+ }
69
+ }
70
+ return sanitized;
71
+ }
72
+ /**
73
+ * Performs the unified analysis.
74
+ */
75
+ async analyze(options) {
76
+ await initializeParsers();
77
+ const startTime = Date.now();
78
+ const requestedTools = options.tools ?? [
79
+ "patterns",
80
+ "context",
81
+ "consistency"
82
+ ];
83
+ const result = {
84
+ summary: {
85
+ totalIssues: 0,
86
+ criticalIssues: 0,
87
+ majorIssues: 0,
88
+ totalFiles: 0,
89
+ toolsRun: [],
90
+ executionTime: 0,
91
+ config: options,
92
+ toolConfigs: {}
93
+ }
94
+ };
95
+ for (const toolName of requestedTools) {
96
+ let provider = this.registry.find(toolName);
97
+ if (!provider) {
98
+ const packageName = TOOL_PACKAGE_MAP[toolName] ?? (toolName.startsWith("@aiready/") ? toolName : `@aiready/${toolName}`);
99
+ try {
100
+ await import(packageName);
101
+ provider = this.registry.find(toolName);
102
+ } catch (err) {
103
+ console.log(
104
+ `\u274C Failed to dynamically load tool ${toolName} (${packageName}):`,
105
+ err.message
106
+ );
107
+ }
108
+ }
109
+ if (!provider) {
110
+ console.warn(
111
+ `\u26A0\uFE0F Warning: Tool provider for '${toolName}' not found. Skipping.`
112
+ );
113
+ continue;
114
+ }
115
+ try {
116
+ const toolOptions = {
117
+ rootDir: options.rootDir
118
+ };
119
+ [...GLOBAL_INFRA_OPTIONS, ...COMMON_FINE_TUNING_OPTIONS].forEach(
120
+ (key) => {
121
+ if (key in options && key !== "toolConfigs" && key !== "tools") {
122
+ toolOptions[key] = options[key];
123
+ }
124
+ }
125
+ );
126
+ if (options.toolConfigs?.[provider.id]) {
127
+ Object.assign(toolOptions, options.toolConfigs[provider.id]);
128
+ } else if (options.tools && !Array.isArray(options.tools) && typeof options.tools === "object" && options.tools[provider.id]) {
129
+ Object.assign(toolOptions, options.tools[provider.id]);
130
+ }
131
+ toolOptions.onProgress = (processed, total, msg) => {
132
+ if (options.progressCallback) {
133
+ options.progressCallback({
134
+ tool: provider.id,
135
+ processed,
136
+ total,
137
+ message: msg
138
+ });
139
+ }
140
+ };
141
+ const output = await provider.analyze(toolOptions);
142
+ if (output.metadata) {
143
+ output.metadata.config = this.sanitizeConfig(toolOptions);
144
+ }
145
+ if (options.progressCallback) {
146
+ options.progressCallback({ tool: provider.id, data: output });
147
+ }
148
+ result[provider.id] = output;
149
+ result.summary.toolsRun.push(provider.id);
150
+ const toolConfig = output.summary?.config ?? output.metadata?.config ?? toolOptions;
151
+ result.summary.toolConfigs[provider.id] = this.sanitizeConfig(toolConfig);
152
+ const toolFiles = output.summary?.totalFiles ?? output.summary?.filesAnalyzed ?? 0;
153
+ if (toolFiles > result.summary.totalFiles) {
154
+ result.summary.totalFiles = toolFiles;
155
+ }
156
+ const issueCount = output.results.reduce(
157
+ (sum, file) => sum + (file.issues?.length ?? 0),
158
+ 0
159
+ );
160
+ result.summary.totalIssues += issueCount;
161
+ } catch (err) {
162
+ console.error(`\u274C Error running tool '${provider.id}':`, err);
163
+ }
164
+ }
165
+ result.summary.config = this.sanitizeConfig({
166
+ scan: {
167
+ tools: requestedTools,
168
+ include: options.include,
169
+ exclude: options.exclude
170
+ },
171
+ tools: result.summary.toolConfigs
172
+ });
173
+ result.summary.executionTime = Date.now() - startTime;
174
+ this.applyLegacyKeys(result);
175
+ return result;
176
+ }
177
+ applyLegacyKeys(result) {
178
+ const keyMappings = {
179
+ "pattern-detect": ["patternDetect", "patterns"],
180
+ "context-analyzer": ["contextAnalyzer", "context"],
181
+ "naming-consistency": ["namingConsistency", "consistency"],
182
+ "ai-signal-clarity": ["aiSignalClarity"],
183
+ "agent-grounding": ["agentGrounding"],
184
+ "testability-index": ["testabilityIndex", "testability"],
185
+ "doc-drift": ["docDrift"],
186
+ "dependency-health": ["dependencyHealth", "deps"],
187
+ "change-amplification": ["changeAmplification"]
188
+ };
189
+ for (const [kebabKey, aliases] of Object.entries(keyMappings)) {
190
+ if (result[kebabKey]) {
191
+ for (const alias of aliases) {
192
+ result[alias] = result[kebabKey];
193
+ }
194
+ }
195
+ }
196
+ }
197
+ };
198
+ async function analyzeUnified(options) {
199
+ const orchestrator = new UnifiedOrchestrator(ToolRegistry);
200
+ return orchestrator.analyze(options);
201
+ }
202
+
203
+ // src/scoring-orchestrator.ts
204
+ import {
205
+ ToolRegistry as ToolRegistry2,
206
+ ToolName as ToolName2,
207
+ calculateOverallScore,
208
+ calculateTokenBudget
209
+ } from "@aiready/core";
210
+ var ScoringOrchestrator = class {
211
+ /**
212
+ * Initialize scoring orchestrator with a tool registry.
213
+ * Injection pattern helps with testability and AI readiness score.
214
+ */
215
+ constructor(registry = ToolRegistry2) {
216
+ this.registry = registry;
217
+ }
218
+ /**
219
+ * Calculates scores for all analyzed tools.
220
+ */
221
+ async score(results, options) {
222
+ const toolScores = /* @__PURE__ */ new Map();
223
+ for (const toolId of results.summary.toolsRun) {
224
+ const provider = this.registry.get(toolId);
225
+ if (!provider) continue;
226
+ const output = results[toolId];
227
+ if (!output) continue;
228
+ try {
229
+ const toolScore = provider.score(output, options);
230
+ if (!toolScore.tokenBudget) {
231
+ if (toolId === ToolName2.PatternDetect && output.duplicates) {
232
+ const wastedTokens = output.duplicates.reduce(
233
+ (sum, d) => sum + (d.tokenCost ?? 0),
234
+ 0
235
+ );
236
+ toolScore.tokenBudget = calculateTokenBudget({
237
+ totalContextTokens: wastedTokens * 2,
238
+ wastedTokens: {
239
+ duplication: wastedTokens,
240
+ fragmentation: 0,
241
+ chattiness: 0
242
+ }
243
+ });
244
+ } else if (toolId === ToolName2.ContextAnalyzer && output.summary) {
245
+ toolScore.tokenBudget = calculateTokenBudget({
246
+ totalContextTokens: output.summary.totalTokens,
247
+ wastedTokens: {
248
+ duplication: 0,
249
+ fragmentation: output.summary.totalPotentialSavings ?? 0,
250
+ chattiness: 0
251
+ }
252
+ });
253
+ }
254
+ }
255
+ toolScores.set(toolId, toolScore);
256
+ } catch (err) {
257
+ console.error(`\u274C Error scoring tool '${toolId}':`, err);
258
+ }
259
+ }
260
+ if (toolScores.size === 0) {
261
+ return this.emptyScoringResult();
262
+ }
263
+ return calculateOverallScore(toolScores, options, void 0);
264
+ }
265
+ /**
266
+ * Generate human-readable summary of unified results.
267
+ */
268
+ generateSummary(result) {
269
+ const { summary } = result;
270
+ let output = `\u{1F680} AIReady Analysis Complete
271
+
272
+ `;
273
+ output += `\u{1F4CA} Summary:
274
+ `;
275
+ output += ` Tools run: ${summary.toolsRun.join(", ")}
276
+ `;
277
+ output += ` Total issues found: ${summary.totalIssues}
278
+ `;
279
+ output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
280
+
281
+ `;
282
+ for (const provider of this.registry.getAll()) {
283
+ const toolResult = result[provider.id];
284
+ if (toolResult) {
285
+ const issueCount = toolResult.results.reduce(
286
+ (sum, r) => sum + (r.issues?.length ?? 0),
287
+ 0
288
+ );
289
+ output += `\u2022 ${provider.id}: ${issueCount} issues
290
+ `;
291
+ }
292
+ }
293
+ return output;
294
+ }
295
+ emptyScoringResult() {
296
+ return {
297
+ overall: 0,
298
+ rating: "Critical",
299
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
300
+ toolsUsed: [],
301
+ breakdown: [],
302
+ calculation: {
303
+ formula: "0 / 0 = 0",
304
+ weights: {},
305
+ normalized: "0 / 0 = 0"
306
+ }
307
+ };
308
+ }
309
+ };
310
+ async function scoreUnified(results, options) {
311
+ const orchestrator = new ScoringOrchestrator(ToolRegistry2);
312
+ return orchestrator.score(results, options);
313
+ }
314
+ function generateUnifiedSummary(result) {
315
+ const orchestrator = new ScoringOrchestrator(ToolRegistry2);
316
+ return orchestrator.generateSummary(result);
317
+ }
318
+
319
+ export {
320
+ __require,
321
+ TOOL_PACKAGE_MAP,
322
+ UnifiedOrchestrator,
323
+ analyzeUnified,
324
+ ScoringOrchestrator,
325
+ scoreUnified,
326
+ generateUnifiedSummary
327
+ };