@aiready/cli 0.12.12 → 0.12.16
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.
- package/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-test.log +76 -21
- package/dist/chunk-2QOU5KKW.mjs +301 -0
- package/dist/chunk-55ZUD52M.mjs +290 -0
- package/dist/chunk-BD7XZYET.mjs +302 -0
- package/dist/chunk-VOKP7FGM.mjs +303 -0
- package/dist/cli.js +40 -15
- package/dist/cli.mjs +4 -1
- package/dist/index.js +37 -15
- package/dist/index.mjs +1 -1
- package/package.json +12 -12
- package/src/__tests__/config-shape.test.ts +106 -0
- package/src/commands/scan.ts +3 -0
- package/src/index.ts +44 -17
package/src/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
GLOBAL_SCAN_OPTIONS,
|
|
7
7
|
GLOBAL_INFRA_OPTIONS,
|
|
8
8
|
COMMON_FINE_TUNING_OPTIONS,
|
|
9
|
+
initializeParsers,
|
|
9
10
|
} from '@aiready/core';
|
|
10
11
|
import type {
|
|
11
12
|
AnalysisResult,
|
|
@@ -92,19 +93,44 @@ const TOOL_PACKAGE_MAP: Record<string, string> = {
|
|
|
92
93
|
};
|
|
93
94
|
|
|
94
95
|
/**
|
|
95
|
-
*
|
|
96
|
+
* Deeply sanitizes a configuration object by removing infrastructure keys like rootDir.
|
|
97
|
+
* Works recursively to clean up nested tool configurations to ensure compatibility
|
|
98
|
+
* with the AIReadyConfig schema for portable configuration files.
|
|
96
99
|
*/
|
|
97
|
-
function
|
|
98
|
-
if (!
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
function sanitizeConfigRecursive(obj: any): any {
|
|
101
|
+
if (!obj || typeof obj !== 'object' || Array.isArray(obj)) return obj;
|
|
102
|
+
|
|
103
|
+
const sanitized: any = {};
|
|
104
|
+
const infraToStrip = [
|
|
105
|
+
'rootDir',
|
|
106
|
+
'onProgress',
|
|
107
|
+
'progressCallback',
|
|
108
|
+
'streamResults',
|
|
109
|
+
'batchSize',
|
|
110
|
+
'useSmartDefaults',
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
114
|
+
// Skip infrastructure keys that shouldn't be in a portable config file
|
|
115
|
+
if (infraToStrip.includes(key)) continue;
|
|
116
|
+
|
|
117
|
+
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
118
|
+
sanitized[key] = sanitizeConfigRecursive(value);
|
|
119
|
+
} else {
|
|
120
|
+
sanitized[key] = value;
|
|
103
121
|
}
|
|
104
|
-
}
|
|
122
|
+
}
|
|
123
|
+
|
|
105
124
|
return sanitized;
|
|
106
125
|
}
|
|
107
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Sanitize tool configuration by removing global options to match AIReadyConfig schema
|
|
129
|
+
*/
|
|
130
|
+
function sanitizeToolConfig(config: any): any {
|
|
131
|
+
return sanitizeConfigRecursive(config);
|
|
132
|
+
}
|
|
133
|
+
|
|
108
134
|
/**
|
|
109
135
|
* AIReady Unified Analysis
|
|
110
136
|
* Orchestrates all registered tools via the ToolRegistry.
|
|
@@ -112,6 +138,9 @@ function sanitizeToolConfig(config: any): any {
|
|
|
112
138
|
export async function analyzeUnified(
|
|
113
139
|
options: UnifiedAnalysisOptions
|
|
114
140
|
): Promise<UnifiedAnalysisResult> {
|
|
141
|
+
// Initialize language parsers
|
|
142
|
+
await initializeParsers();
|
|
143
|
+
|
|
115
144
|
const startTime = Date.now();
|
|
116
145
|
const requestedTools = options.tools || [
|
|
117
146
|
'patterns',
|
|
@@ -169,9 +198,9 @@ export async function analyzeUnified(
|
|
|
169
198
|
|
|
170
199
|
try {
|
|
171
200
|
// Sanitize options for metadata tracking (remove functions/internal keys)
|
|
172
|
-
const
|
|
173
|
-
delete (
|
|
174
|
-
delete (
|
|
201
|
+
const sanitizedOptions = { ...options };
|
|
202
|
+
delete (sanitizedOptions as any).onProgress;
|
|
203
|
+
delete (sanitizedOptions as any).progressCallback;
|
|
175
204
|
|
|
176
205
|
// 1. Start with sanitized global subset
|
|
177
206
|
const toolOptions: any = {
|
|
@@ -286,8 +315,9 @@ export async function analyzeUnified(
|
|
|
286
315
|
}
|
|
287
316
|
}
|
|
288
317
|
|
|
289
|
-
// Finalize configuration for metadata to match AIReadyConfig
|
|
290
|
-
|
|
318
|
+
// Finalize configuration for metadata to match AIReadyConfig schema
|
|
319
|
+
// We use sanitizeConfigRecursive to ensure no internal keys (like rootDir) remain
|
|
320
|
+
result.summary.config = sanitizeConfigRecursive({
|
|
291
321
|
scan: {
|
|
292
322
|
tools: requestedTools,
|
|
293
323
|
include: options.include,
|
|
@@ -295,10 +325,7 @@ export async function analyzeUnified(
|
|
|
295
325
|
},
|
|
296
326
|
// Use 'tools' for tool-specific configurations to match AIReadyConfig
|
|
297
327
|
tools: result.summary.toolConfigs,
|
|
298
|
-
|
|
299
|
-
rootDir: options.rootDir,
|
|
300
|
-
useSmartDefaults: options.useSmartDefaults,
|
|
301
|
-
};
|
|
328
|
+
});
|
|
302
329
|
|
|
303
330
|
result.summary.executionTime = Date.now() - startTime;
|
|
304
331
|
return result;
|