@aiready/cli 0.12.11 → 0.12.14

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