@aiready/cli 0.14.9 → 0.14.11
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/.aiready/aiready-report-20260319-201106.json +5566 -0
- package/.aiready/aiready-report-20260319-201511.json +5566 -0
- package/.aiready/aiready-report-20260319-202017.json +5708 -0
- package/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-test.log +19 -19
- package/dist/chunk-HBPSESJV.mjs +289 -0
- package/dist/chunk-JRRBBFYB.mjs +307 -0
- package/dist/chunk-YP2EVXQN.mjs +303 -0
- package/dist/chunk-ZQOTGPK4.mjs +289 -0
- package/dist/cli.js +219 -102
- package/dist/cli.mjs +196 -83
- package/dist/index.js +25 -21
- package/dist/index.mjs +1 -1
- package/package.json +12 -12
- package/src/commands/__tests__/init.test.ts +6 -11
- package/src/commands/bug.ts +1 -1
- package/src/commands/consistency.ts +5 -5
- package/src/commands/context.ts +4 -4
- package/src/commands/init.ts +76 -42
- package/src/commands/patterns.ts +3 -3
- package/src/commands/report-formatter.ts +138 -12
- package/src/commands/scan.ts +18 -18
- package/src/commands/upload.ts +6 -6
- package/src/commands/visualize.ts +4 -4
- package/src/index.ts +35 -25
package/src/index.ts
CHANGED
|
@@ -57,6 +57,12 @@ export interface UnifiedAnalysisOptions extends ScanOptions {
|
|
|
57
57
|
total?: number;
|
|
58
58
|
message?: string;
|
|
59
59
|
}) => void;
|
|
60
|
+
/** Files or directories to include in scan */
|
|
61
|
+
include?: string[];
|
|
62
|
+
/** Files or directories to exclude from scan */
|
|
63
|
+
exclude?: string[];
|
|
64
|
+
/** Batch size for comparisons */
|
|
65
|
+
batchSize?: number;
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
/**
|
|
@@ -161,7 +167,7 @@ export async function analyzeUnified(
|
|
|
161
167
|
await initializeParsers();
|
|
162
168
|
|
|
163
169
|
const startTime = Date.now();
|
|
164
|
-
const requestedTools = options.tools
|
|
170
|
+
const requestedTools = options.tools ?? [
|
|
165
171
|
'patterns',
|
|
166
172
|
'context',
|
|
167
173
|
'consistency',
|
|
@@ -186,7 +192,7 @@ export async function analyzeUnified(
|
|
|
186
192
|
// Dynamic Loading: If provider not found, attempt to import the package
|
|
187
193
|
if (!provider) {
|
|
188
194
|
const packageName =
|
|
189
|
-
TOOL_PACKAGE_MAP[toolName]
|
|
195
|
+
TOOL_PACKAGE_MAP[toolName] ??
|
|
190
196
|
(toolName.startsWith('@aiready/') ? toolName : `@aiready/${toolName}`);
|
|
191
197
|
try {
|
|
192
198
|
await import(packageName);
|
|
@@ -301,34 +307,16 @@ export async function analyzeUnified(
|
|
|
301
307
|
|
|
302
308
|
// Track total files analyzed across all tools
|
|
303
309
|
const toolFiles =
|
|
304
|
-
output.summary?.totalFiles
|
|
310
|
+
output.summary?.totalFiles ?? output.summary?.filesAnalyzed ?? 0;
|
|
305
311
|
if (toolFiles > result.summary.totalFiles) {
|
|
306
312
|
result.summary.totalFiles = toolFiles;
|
|
307
313
|
}
|
|
308
314
|
|
|
309
315
|
const issueCount = output.results.reduce(
|
|
310
|
-
(sum: number, file: any) => sum + (file.issues?.length
|
|
316
|
+
(sum: number, file: any) => sum + (file.issues?.length ?? 0),
|
|
311
317
|
0
|
|
312
318
|
);
|
|
313
319
|
result.summary.totalIssues += issueCount;
|
|
314
|
-
|
|
315
|
-
// Robust backward compatibility fallbacks
|
|
316
|
-
// 1. Add all aliases as keys (e.g., 'patterns', 'context', 'consistency')
|
|
317
|
-
if (provider.alias && Array.isArray(provider.alias)) {
|
|
318
|
-
for (const alias of provider.alias) {
|
|
319
|
-
if (!result[alias]) {
|
|
320
|
-
(result as any)[alias] = output;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
// 2. Add camelCase version of canonical ID (e.g., 'patternDetect', 'contextAnalyzer')
|
|
326
|
-
const camelCaseId = provider.id.replace(/-([a-z])/g, (g) =>
|
|
327
|
-
g[1].toUpperCase()
|
|
328
|
-
);
|
|
329
|
-
if (camelCaseId !== provider.id && !result[camelCaseId]) {
|
|
330
|
-
(result as any)[camelCaseId] = output;
|
|
331
|
-
}
|
|
332
320
|
} catch (err) {
|
|
333
321
|
console.error(`❌ Error running tool '${provider.id}':`, err);
|
|
334
322
|
}
|
|
@@ -347,6 +335,28 @@ export async function analyzeUnified(
|
|
|
347
335
|
});
|
|
348
336
|
|
|
349
337
|
result.summary.executionTime = Date.now() - startTime;
|
|
338
|
+
|
|
339
|
+
// Add backward compatibility key mappings (kebab-case -> camelCase and aliases)
|
|
340
|
+
const keyMappings: Record<string, string[]> = {
|
|
341
|
+
'pattern-detect': ['patternDetect', 'patterns'],
|
|
342
|
+
'context-analyzer': ['contextAnalyzer', 'context'],
|
|
343
|
+
'naming-consistency': ['namingConsistency', 'consistency'],
|
|
344
|
+
'ai-signal-clarity': ['aiSignalClarity'],
|
|
345
|
+
'agent-grounding': ['agentGrounding'],
|
|
346
|
+
'testability-index': ['testabilityIndex', 'testability'],
|
|
347
|
+
'doc-drift': ['docDrift'],
|
|
348
|
+
'dependency-health': ['dependencyHealth', 'deps'],
|
|
349
|
+
'change-amplification': ['changeAmplification'],
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
for (const [kebabKey, aliases] of Object.entries(keyMappings)) {
|
|
353
|
+
if (result[kebabKey]) {
|
|
354
|
+
for (const alias of aliases) {
|
|
355
|
+
result[alias] = result[kebabKey];
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
350
360
|
return result;
|
|
351
361
|
}
|
|
352
362
|
|
|
@@ -378,7 +388,7 @@ export async function scoreUnified(
|
|
|
378
388
|
if (!toolScore.tokenBudget) {
|
|
379
389
|
if (toolId === ToolName.PatternDetect && (output as any).duplicates) {
|
|
380
390
|
const wastedTokens = (output as any).duplicates.reduce(
|
|
381
|
-
(sum: number, d: any) => sum + (d.tokenCost
|
|
391
|
+
(sum: number, d: any) => sum + (d.tokenCost ?? 0),
|
|
382
392
|
0
|
|
383
393
|
);
|
|
384
394
|
toolScore.tokenBudget = calculateTokenBudget({
|
|
@@ -394,7 +404,7 @@ export async function scoreUnified(
|
|
|
394
404
|
totalContextTokens: output.summary.totalTokens,
|
|
395
405
|
wastedTokens: {
|
|
396
406
|
duplication: 0,
|
|
397
|
-
fragmentation: output.summary.totalPotentialSavings
|
|
407
|
+
fragmentation: output.summary.totalPotentialSavings ?? 0,
|
|
398
408
|
chattiness: 0,
|
|
399
409
|
},
|
|
400
410
|
});
|
|
@@ -444,7 +454,7 @@ export function generateUnifiedSummary(result: UnifiedAnalysisResult): string {
|
|
|
444
454
|
const toolResult = result[provider.id];
|
|
445
455
|
if (toolResult) {
|
|
446
456
|
const issueCount = toolResult.results.reduce(
|
|
447
|
-
(sum: number, r: any) => sum + (r.issues?.length
|
|
457
|
+
(sum: number, r: any) => sum + (r.issues?.length ?? 0),
|
|
448
458
|
0
|
|
449
459
|
);
|
|
450
460
|
output += `• ${provider.id}: ${issueCount} issues\n`;
|