@aiready/cli 0.12.10 → 0.12.12

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.
@@ -140,12 +140,14 @@ export async function scanAction(directory: string, options: ScanOptions) {
140
140
  const { getSmartDefaults } = await import('@aiready/pattern-detect');
141
141
  const patternSmartDefaults = await getSmartDefaults(
142
142
  resolvedDir,
143
- baseOptions
143
+ finalOptions.toolConfigs?.[ToolName.PatternDetect] || {}
144
144
  );
145
- finalOptions = {
145
+
146
+ // Merge smart defaults into toolConfigs instead of root level
147
+ if (!finalOptions.toolConfigs) finalOptions.toolConfigs = {};
148
+ finalOptions.toolConfigs[ToolName.PatternDetect] = {
146
149
  ...patternSmartDefaults,
147
- ...finalOptions,
148
- ...baseOptions,
150
+ ...finalOptions.toolConfigs[ToolName.PatternDetect],
149
151
  };
150
152
  }
151
153
 
package/src/index.ts CHANGED
@@ -4,6 +4,8 @@ import {
4
4
  calculateOverallScore,
5
5
  calculateTokenBudget,
6
6
  GLOBAL_SCAN_OPTIONS,
7
+ GLOBAL_INFRA_OPTIONS,
8
+ COMMON_FINE_TUNING_OPTIONS,
7
9
  } from '@aiready/core';
8
10
  import type {
9
11
  AnalysisResult,
@@ -95,7 +97,7 @@ const TOOL_PACKAGE_MAP: Record<string, string> = {
95
97
  function sanitizeToolConfig(config: any): any {
96
98
  if (!config || typeof config !== 'object') return config;
97
99
  const sanitized = { ...config };
98
- GLOBAL_SCAN_OPTIONS.forEach((key: string) => {
100
+ GLOBAL_INFRA_OPTIONS.forEach((key: string) => {
99
101
  if (key !== 'rootDir') {
100
102
  delete (sanitized as any)[key];
101
103
  }
@@ -176,16 +178,29 @@ export async function analyzeUnified(
176
178
  rootDir: options.rootDir, // Always include rootDir
177
179
  };
178
180
 
179
- // 2. Add other global options that tools might need
180
- GLOBAL_SCAN_OPTIONS.forEach((key) => {
181
- if (key in options && key !== 'toolConfigs') {
182
- toolOptions[key] = (options as any)[key];
181
+ // 1. Pass through all known infra and fine-tuning options from root level
182
+ [...GLOBAL_INFRA_OPTIONS, ...COMMON_FINE_TUNING_OPTIONS].forEach(
183
+ (key) => {
184
+ if (key in options && key !== 'toolConfigs' && key !== 'tools') {
185
+ toolOptions[key] = (options as any)[key];
186
+ }
183
187
  }
184
- });
188
+ );
185
189
 
186
190
  // 3. Add tool-specific overrides
191
+ // Check priority:
192
+ // a) options.toolConfigs[toolId]
193
+ // b) options.tools[toolId] (if tools is an object, not the array of tool names)
194
+ // c) options[toolId] (legacy)
187
195
  if (options.toolConfigs?.[provider.id]) {
188
196
  Object.assign(toolOptions, options.toolConfigs[provider.id]);
197
+ } else if (
198
+ options.tools &&
199
+ !Array.isArray(options.tools) &&
200
+ typeof options.tools === 'object' &&
201
+ (options.tools as any)[provider.id]
202
+ ) {
203
+ Object.assign(toolOptions, (options.tools as any)[provider.id]);
189
204
  } else if ((options as any)[provider.id]) {
190
205
  // Fallback for legacy tool-specific keys
191
206
  Object.assign(toolOptions, (options as any)[provider.id]);
@@ -271,10 +286,18 @@ export async function analyzeUnified(
271
286
  }
272
287
  }
273
288
 
274
- // Finalize configuration for metadata
289
+ // Finalize configuration for metadata to match AIReadyConfig structure
275
290
  result.summary.config = {
276
- ...options,
277
- toolConfigs: result.summary.toolConfigs,
291
+ scan: {
292
+ tools: requestedTools,
293
+ include: options.include,
294
+ exclude: options.exclude,
295
+ },
296
+ // Use 'tools' for tool-specific configurations to match AIReadyConfig
297
+ tools: result.summary.toolConfigs,
298
+ // Keep top-level options for backward compatibility
299
+ rootDir: options.rootDir,
300
+ useSmartDefaults: options.useSmartDefaults,
278
301
  };
279
302
 
280
303
  result.summary.executionTime = Date.now() - startTime;