@aiready/cli 0.10.4 → 0.12.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.
- package/.turbo/turbo-build.log +7 -7
- package/.turbo/turbo-lint.log +9 -1
- package/.turbo/turbo-test.log +16 -4
- package/dist/chunk-N56YAZVN.mjs +194 -0
- package/dist/chunk-YBZKPKW3.mjs +161 -0
- package/dist/cli.js +198 -892
- package/dist/cli.mjs +87 -582
- package/dist/index.js +116 -353
- package/dist/index.mjs +1 -1
- package/package.json +12 -12
- package/src/.aiready/aiready-report-20260306-213155.json +24657 -0
- package/src/.aiready/aiready-report-20260306-213925.json +24657 -0
- package/src/.aiready/aiready-report-20260307-092852.json +50609 -0
- package/src/.aiready/aiready-report-20260307-094301.json +50609 -0
- package/src/__tests__/cli.test.ts +55 -29
- package/src/commands/scan.ts +108 -698
- package/src/index.ts +154 -436
- package/dist/chunk-EQ2HQSTJ.mjs +0 -414
- package/dist/chunk-R3O7QPKD.mjs +0 -419
- package/dist/chunk-VUCNUYI7.mjs +0 -417
|
@@ -1,37 +1,63 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
2
2
|
import { analyzeUnified } from '../index';
|
|
3
|
-
|
|
4
|
-
// Mock the individual tools
|
|
5
|
-
vi.mock('@aiready/pattern-detect', () => ({
|
|
6
|
-
analyzePatterns: vi.fn().mockResolvedValue({
|
|
7
|
-
results: [],
|
|
8
|
-
duplicates: [],
|
|
9
|
-
files: [],
|
|
10
|
-
}),
|
|
11
|
-
generateSummary: vi.fn().mockReturnValue({
|
|
12
|
-
totalDuplicateLines: 0,
|
|
13
|
-
potentialSavings: 0,
|
|
14
|
-
}),
|
|
15
|
-
}));
|
|
16
|
-
|
|
17
|
-
vi.mock('@aiready/context-analyzer', () => ({
|
|
18
|
-
analyzeContext: vi.fn().mockResolvedValue([]),
|
|
19
|
-
generateSummary: vi.fn().mockReturnValue({
|
|
20
|
-
totalFiles: 0,
|
|
21
|
-
averageCohesion: 0,
|
|
22
|
-
averageFragmentation: 0,
|
|
23
|
-
}),
|
|
24
|
-
}));
|
|
3
|
+
import { ToolRegistry, ToolName, SpokeOutputSchema } from '@aiready/core';
|
|
25
4
|
|
|
26
5
|
describe('CLI Unified Analysis', () => {
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
ToolRegistry.clear();
|
|
8
|
+
|
|
9
|
+
// Register mock providers
|
|
10
|
+
ToolRegistry.register({
|
|
11
|
+
id: ToolName.PatternDetect,
|
|
12
|
+
alias: ['patterns'],
|
|
13
|
+
analyze: async () =>
|
|
14
|
+
SpokeOutputSchema.parse({
|
|
15
|
+
results: [],
|
|
16
|
+
summary: {},
|
|
17
|
+
metadata: { toolName: ToolName.PatternDetect, version: '1.0.0' },
|
|
18
|
+
}),
|
|
19
|
+
score: () => ({
|
|
20
|
+
toolName: ToolName.PatternDetect,
|
|
21
|
+
score: 80,
|
|
22
|
+
factors: [],
|
|
23
|
+
recommendations: [],
|
|
24
|
+
rawMetrics: {},
|
|
25
|
+
}),
|
|
26
|
+
defaultWeight: 10,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
ToolRegistry.register({
|
|
30
|
+
id: ToolName.ContextAnalyzer,
|
|
31
|
+
alias: ['context'],
|
|
32
|
+
analyze: async () =>
|
|
33
|
+
SpokeOutputSchema.parse({
|
|
34
|
+
results: [],
|
|
35
|
+
summary: {},
|
|
36
|
+
metadata: { toolName: ToolName.ContextAnalyzer, version: '1.0.0' },
|
|
37
|
+
}),
|
|
38
|
+
score: () => ({
|
|
39
|
+
toolName: ToolName.ContextAnalyzer,
|
|
40
|
+
score: 70,
|
|
41
|
+
factors: [],
|
|
42
|
+
recommendations: [],
|
|
43
|
+
rawMetrics: {},
|
|
44
|
+
}),
|
|
45
|
+
defaultWeight: 10,
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
afterEach(() => {
|
|
50
|
+
ToolRegistry.clear();
|
|
51
|
+
});
|
|
52
|
+
|
|
27
53
|
it('should run unified analysis with both tools', async () => {
|
|
28
54
|
const results = await analyzeUnified({
|
|
29
55
|
rootDir: '/test',
|
|
30
56
|
tools: ['patterns', 'context'],
|
|
31
57
|
});
|
|
32
58
|
|
|
33
|
-
expect(results).toHaveProperty(
|
|
34
|
-
expect(results).toHaveProperty(
|
|
59
|
+
expect(results).toHaveProperty(ToolName.PatternDetect);
|
|
60
|
+
expect(results).toHaveProperty(ToolName.ContextAnalyzer);
|
|
35
61
|
expect(results).toHaveProperty('summary');
|
|
36
62
|
});
|
|
37
63
|
|
|
@@ -41,8 +67,8 @@ describe('CLI Unified Analysis', () => {
|
|
|
41
67
|
tools: ['patterns'],
|
|
42
68
|
});
|
|
43
69
|
|
|
44
|
-
expect(results).toHaveProperty(
|
|
45
|
-
expect(results).not.toHaveProperty(
|
|
70
|
+
expect(results).toHaveProperty(ToolName.PatternDetect);
|
|
71
|
+
expect(results).not.toHaveProperty(ToolName.ContextAnalyzer);
|
|
46
72
|
expect(results).toHaveProperty('summary');
|
|
47
73
|
});
|
|
48
74
|
|
|
@@ -52,8 +78,8 @@ describe('CLI Unified Analysis', () => {
|
|
|
52
78
|
tools: ['context'],
|
|
53
79
|
});
|
|
54
80
|
|
|
55
|
-
expect(results).not.toHaveProperty(
|
|
56
|
-
expect(results).toHaveProperty(
|
|
81
|
+
expect(results).not.toHaveProperty(ToolName.PatternDetect);
|
|
82
|
+
expect(results).toHaveProperty(ToolName.ContextAnalyzer);
|
|
57
83
|
expect(results).toHaveProperty('summary');
|
|
58
84
|
});
|
|
59
85
|
});
|