@aiready/cli 0.3.5 → 0.3.6
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 +15 -10
- package/dist/cli.js +23 -12
- package/dist/cli.mjs +23 -12
- package/package.json +4 -4
- package/src/cli.ts +33 -13
- package/src/index.ts +6 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/cli@0.3.
|
|
3
|
+
> @aiready/cli@0.3.6 build /Users/pengcao/projects/aiready/packages/cli
|
|
4
4
|
> tsup src/index.ts src/cli.ts --format cjs,esm --dts
|
|
5
5
|
|
|
6
6
|
[34mCLI[39m Building entry: src/cli.ts, src/index.ts
|
|
@@ -9,16 +9,21 @@
|
|
|
9
9
|
[34mCLI[39m Target: es2020
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[32mCJS[39m [1mdist/cli.js [22m[32m10.43 KB[39m
|
|
13
12
|
[32mCJS[39m [1mdist/index.js [22m[32m2.57 KB[39m
|
|
14
|
-
[32mCJS[39m
|
|
13
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m10.77 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 51ms
|
|
15
15
|
[32mESM[39m [1mdist/index.mjs [22m[32m138.00 B[39m
|
|
16
16
|
[32mESM[39m [1mdist/chunk-KZKXZKES.mjs [22m[32m1.45 KB[39m
|
|
17
|
-
[32mESM[39m [1mdist/cli.mjs [22m[32m7.
|
|
18
|
-
[32mESM[39m ⚡️ Build success in
|
|
17
|
+
[32mESM[39m [1mdist/cli.mjs [22m[32m7.92 KB[39m
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 51ms
|
|
19
19
|
DTS Build start
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
src/cli.ts(57,17): error TS2339: Property 'getSmartDefaults' does not exist on type '{ default: typeof import("/Users/pengcao/projects/aiready/packages/pattern-detect/dist/index"); analyzePatterns: (options: PatternDetectOptions) => Promise<{ results: AnalysisResult[]; duplicates: DuplicatePattern[]; files: string[]; }>; detectDuplicatePatterns: (files: FileContent[], options: DetectionOptions) => P...'.
|
|
21
|
+
|
|
22
|
+
[31mError: error occurred in dts build
|
|
23
|
+
at Worker.<anonymous> (/Users/pengcao/projects/aiready/node_modules/.pnpm/tsup@8.5.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/dist/index.js:1545:26)
|
|
24
|
+
at Worker.emit (node:events:519:28)
|
|
25
|
+
at MessagePort.<anonymous> (node:internal/worker:269:53)
|
|
26
|
+
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:827:20)
|
|
27
|
+
at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)[39m
|
|
28
|
+
DTS Build error
|
|
29
|
+
[41m[30m ELIFECYCLE [39m[49m [31mCommand failed with exit code 1.[39m
|
package/dist/cli.js
CHANGED
|
@@ -97,11 +97,17 @@ program.command("scan").description("Run unified analysis on a codebase").argume
|
|
|
97
97
|
file: void 0
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
|
-
const
|
|
100
|
+
const baseOptions = (0, import_core.loadMergedConfig)(directory, defaults, {
|
|
101
101
|
tools: options.tools ? options.tools.split(",").map((t) => t.trim()) : void 0,
|
|
102
102
|
include: options.include?.split(","),
|
|
103
103
|
exclude: options.exclude?.split(",")
|
|
104
104
|
});
|
|
105
|
+
let finalOptions = { ...baseOptions };
|
|
106
|
+
if (baseOptions.tools.includes("patterns")) {
|
|
107
|
+
const { getSmartDefaults } = await import("@aiready/pattern-detect");
|
|
108
|
+
const patternSmartDefaults = await getSmartDefaults(directory, baseOptions);
|
|
109
|
+
finalOptions = { ...patternSmartDefaults, ...finalOptions };
|
|
110
|
+
}
|
|
105
111
|
const results = await analyzeUnified(finalOptions);
|
|
106
112
|
const elapsedTime = (0, import_core.getElapsedTime)(startTime);
|
|
107
113
|
const outputFormat = options.output || finalOptions.output?.format || "console";
|
|
@@ -126,12 +132,9 @@ program.command("patterns").description("Run pattern detection analysis").argume
|
|
|
126
132
|
console.log(import_chalk.default.blue("\u{1F50D} Analyzing patterns...\n"));
|
|
127
133
|
const startTime = Date.now();
|
|
128
134
|
try {
|
|
135
|
+
const useSmartDefaults = !options.fullScan;
|
|
129
136
|
const defaults = {
|
|
130
|
-
|
|
131
|
-
minLines: 5,
|
|
132
|
-
maxCandidatesPerBlock: 100,
|
|
133
|
-
minSharedTokens: 8,
|
|
134
|
-
useSmartDefaults: true,
|
|
137
|
+
useSmartDefaults,
|
|
135
138
|
include: void 0,
|
|
136
139
|
exclude: void 0,
|
|
137
140
|
output: {
|
|
@@ -139,16 +142,24 @@ program.command("patterns").description("Run pattern detection analysis").argume
|
|
|
139
142
|
file: void 0
|
|
140
143
|
}
|
|
141
144
|
};
|
|
142
|
-
|
|
145
|
+
if (!useSmartDefaults) {
|
|
146
|
+
defaults.minSimilarity = 0.4;
|
|
147
|
+
defaults.minLines = 5;
|
|
148
|
+
}
|
|
149
|
+
const cliOptions = {
|
|
143
150
|
minSimilarity: options.similarity ? parseFloat(options.similarity) : void 0,
|
|
144
151
|
minLines: options.minLines ? parseInt(options.minLines) : void 0,
|
|
145
|
-
|
|
146
|
-
minSharedTokens: options.minSharedTokens ? parseInt(options.minSharedTokens) : void 0,
|
|
147
|
-
// If --full-scan is specified, don't use smart defaults
|
|
148
|
-
useSmartDefaults: !options.fullScan,
|
|
152
|
+
useSmartDefaults,
|
|
149
153
|
include: options.include?.split(","),
|
|
150
154
|
exclude: options.exclude?.split(",")
|
|
151
|
-
}
|
|
155
|
+
};
|
|
156
|
+
if (options.maxCandidates) {
|
|
157
|
+
cliOptions.maxCandidatesPerBlock = parseInt(options.maxCandidates);
|
|
158
|
+
}
|
|
159
|
+
if (options.minSharedTokens) {
|
|
160
|
+
cliOptions.minSharedTokens = parseInt(options.minSharedTokens);
|
|
161
|
+
}
|
|
162
|
+
const finalOptions = (0, import_core.loadMergedConfig)(directory, defaults, cliOptions);
|
|
152
163
|
const { analyzePatterns: analyzePatterns2, generateSummary } = await import("@aiready/pattern-detect");
|
|
153
164
|
const { results } = await analyzePatterns2(finalOptions);
|
|
154
165
|
const elapsedTime = (0, import_core.getElapsedTime)(startTime);
|
package/dist/cli.mjs
CHANGED
|
@@ -26,11 +26,17 @@ program.command("scan").description("Run unified analysis on a codebase").argume
|
|
|
26
26
|
file: void 0
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
const
|
|
29
|
+
const baseOptions = loadMergedConfig(directory, defaults, {
|
|
30
30
|
tools: options.tools ? options.tools.split(",").map((t) => t.trim()) : void 0,
|
|
31
31
|
include: options.include?.split(","),
|
|
32
32
|
exclude: options.exclude?.split(",")
|
|
33
33
|
});
|
|
34
|
+
let finalOptions = { ...baseOptions };
|
|
35
|
+
if (baseOptions.tools.includes("patterns")) {
|
|
36
|
+
const { getSmartDefaults } = await import("@aiready/pattern-detect");
|
|
37
|
+
const patternSmartDefaults = await getSmartDefaults(directory, baseOptions);
|
|
38
|
+
finalOptions = { ...patternSmartDefaults, ...finalOptions };
|
|
39
|
+
}
|
|
34
40
|
const results = await analyzeUnified(finalOptions);
|
|
35
41
|
const elapsedTime = getElapsedTime(startTime);
|
|
36
42
|
const outputFormat = options.output || finalOptions.output?.format || "console";
|
|
@@ -55,12 +61,9 @@ program.command("patterns").description("Run pattern detection analysis").argume
|
|
|
55
61
|
console.log(chalk.blue("\u{1F50D} Analyzing patterns...\n"));
|
|
56
62
|
const startTime = Date.now();
|
|
57
63
|
try {
|
|
64
|
+
const useSmartDefaults = !options.fullScan;
|
|
58
65
|
const defaults = {
|
|
59
|
-
|
|
60
|
-
minLines: 5,
|
|
61
|
-
maxCandidatesPerBlock: 100,
|
|
62
|
-
minSharedTokens: 8,
|
|
63
|
-
useSmartDefaults: true,
|
|
66
|
+
useSmartDefaults,
|
|
64
67
|
include: void 0,
|
|
65
68
|
exclude: void 0,
|
|
66
69
|
output: {
|
|
@@ -68,16 +71,24 @@ program.command("patterns").description("Run pattern detection analysis").argume
|
|
|
68
71
|
file: void 0
|
|
69
72
|
}
|
|
70
73
|
};
|
|
71
|
-
|
|
74
|
+
if (!useSmartDefaults) {
|
|
75
|
+
defaults.minSimilarity = 0.4;
|
|
76
|
+
defaults.minLines = 5;
|
|
77
|
+
}
|
|
78
|
+
const cliOptions = {
|
|
72
79
|
minSimilarity: options.similarity ? parseFloat(options.similarity) : void 0,
|
|
73
80
|
minLines: options.minLines ? parseInt(options.minLines) : void 0,
|
|
74
|
-
|
|
75
|
-
minSharedTokens: options.minSharedTokens ? parseInt(options.minSharedTokens) : void 0,
|
|
76
|
-
// If --full-scan is specified, don't use smart defaults
|
|
77
|
-
useSmartDefaults: !options.fullScan,
|
|
81
|
+
useSmartDefaults,
|
|
78
82
|
include: options.include?.split(","),
|
|
79
83
|
exclude: options.exclude?.split(",")
|
|
80
|
-
}
|
|
84
|
+
};
|
|
85
|
+
if (options.maxCandidates) {
|
|
86
|
+
cliOptions.maxCandidatesPerBlock = parseInt(options.maxCandidates);
|
|
87
|
+
}
|
|
88
|
+
if (options.minSharedTokens) {
|
|
89
|
+
cliOptions.minSharedTokens = parseInt(options.minSharedTokens);
|
|
90
|
+
}
|
|
91
|
+
const finalOptions = loadMergedConfig(directory, defaults, cliOptions);
|
|
81
92
|
const { analyzePatterns, generateSummary } = await import("@aiready/pattern-detect");
|
|
82
93
|
const { results } = await analyzePatterns(finalOptions);
|
|
83
94
|
const elapsedTime = getElapsedTime(startTime);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Unified CLI for AIReady analysis tools",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"commander": "^12.1.0",
|
|
13
13
|
"chalk": "^5.3.0",
|
|
14
|
-
"@aiready/
|
|
15
|
-
"@aiready/
|
|
16
|
-
"@aiready/
|
|
14
|
+
"@aiready/pattern-detect": "0.7.9",
|
|
15
|
+
"@aiready/core": "0.3.6",
|
|
16
|
+
"@aiready/context-analyzer": "0.3.7"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"tsup": "^8.3.5",
|
package/src/cli.ts
CHANGED
|
@@ -45,12 +45,20 @@ program
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
// Load and merge config with CLI options
|
|
48
|
-
const
|
|
48
|
+
const baseOptions = loadMergedConfig(directory, defaults, {
|
|
49
49
|
tools: options.tools ? options.tools.split(',').map((t: string) => t.trim()) as ('patterns' | 'context')[] : undefined,
|
|
50
50
|
include: options.include?.split(','),
|
|
51
51
|
exclude: options.exclude?.split(','),
|
|
52
52
|
}) as any;
|
|
53
53
|
|
|
54
|
+
// Apply smart defaults for pattern detection if patterns tool is enabled
|
|
55
|
+
let finalOptions = { ...baseOptions };
|
|
56
|
+
if (baseOptions.tools.includes('patterns')) {
|
|
57
|
+
const { getSmartDefaults } = await import('@aiready/pattern-detect');
|
|
58
|
+
const patternSmartDefaults = await getSmartDefaults(directory, baseOptions);
|
|
59
|
+
finalOptions = { ...patternSmartDefaults, ...finalOptions };
|
|
60
|
+
}
|
|
61
|
+
|
|
54
62
|
const results = await analyzeUnified(finalOptions);
|
|
55
63
|
|
|
56
64
|
const elapsedTime = getElapsedTime(startTime);
|
|
@@ -97,13 +105,12 @@ program
|
|
|
97
105
|
const startTime = Date.now();
|
|
98
106
|
|
|
99
107
|
try {
|
|
100
|
-
//
|
|
108
|
+
// Determine if smart defaults should be used
|
|
109
|
+
const useSmartDefaults = !options.fullScan;
|
|
110
|
+
|
|
111
|
+
// Define defaults (only for options not handled by smart defaults)
|
|
101
112
|
const defaults = {
|
|
102
|
-
|
|
103
|
-
minLines: 5,
|
|
104
|
-
maxCandidatesPerBlock: 100,
|
|
105
|
-
minSharedTokens: 8,
|
|
106
|
-
useSmartDefaults: true,
|
|
113
|
+
useSmartDefaults,
|
|
107
114
|
include: undefined,
|
|
108
115
|
exclude: undefined,
|
|
109
116
|
output: {
|
|
@@ -112,17 +119,30 @@ program
|
|
|
112
119
|
},
|
|
113
120
|
};
|
|
114
121
|
|
|
122
|
+
// Set fallback defaults only if smart defaults are disabled
|
|
123
|
+
if (!useSmartDefaults) {
|
|
124
|
+
(defaults as any).minSimilarity = 0.4;
|
|
125
|
+
(defaults as any).minLines = 5;
|
|
126
|
+
}
|
|
127
|
+
|
|
115
128
|
// Load and merge config with CLI options
|
|
116
|
-
const
|
|
129
|
+
const cliOptions: any = {
|
|
117
130
|
minSimilarity: options.similarity ? parseFloat(options.similarity) : undefined,
|
|
118
131
|
minLines: options.minLines ? parseInt(options.minLines) : undefined,
|
|
119
|
-
|
|
120
|
-
minSharedTokens: options.minSharedTokens ? parseInt(options.minSharedTokens) : undefined,
|
|
121
|
-
// If --full-scan is specified, don't use smart defaults
|
|
122
|
-
useSmartDefaults: !options.fullScan,
|
|
132
|
+
useSmartDefaults,
|
|
123
133
|
include: options.include?.split(','),
|
|
124
134
|
exclude: options.exclude?.split(','),
|
|
125
|
-
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// Only include performance tuning options if explicitly specified
|
|
138
|
+
if (options.maxCandidates) {
|
|
139
|
+
cliOptions.maxCandidatesPerBlock = parseInt(options.maxCandidates);
|
|
140
|
+
}
|
|
141
|
+
if (options.minSharedTokens) {
|
|
142
|
+
cliOptions.minSharedTokens = parseInt(options.minSharedTokens);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const finalOptions = loadMergedConfig(directory, defaults, cliOptions);
|
|
126
146
|
|
|
127
147
|
const { analyzePatterns, generateSummary } = await import('@aiready/pattern-detect');
|
|
128
148
|
|
package/src/index.ts
CHANGED
|
@@ -2,9 +2,15 @@ import { analyzePatterns } from '@aiready/pattern-detect';
|
|
|
2
2
|
import { analyzeContext } from '@aiready/context-analyzer';
|
|
3
3
|
import type { AnalysisResult, ScanOptions } from '@aiready/core';
|
|
4
4
|
import type { ContextAnalysisResult } from '@aiready/context-analyzer';
|
|
5
|
+
import type { PatternDetectOptions } from '@aiready/pattern-detect';
|
|
5
6
|
|
|
6
7
|
export interface UnifiedAnalysisOptions extends ScanOptions {
|
|
7
8
|
tools?: ('patterns' | 'context')[];
|
|
9
|
+
minSimilarity?: number;
|
|
10
|
+
minLines?: number;
|
|
11
|
+
maxCandidatesPerBlock?: number;
|
|
12
|
+
minSharedTokens?: number;
|
|
13
|
+
useSmartDefaults?: boolean;
|
|
8
14
|
}
|
|
9
15
|
|
|
10
16
|
export interface UnifiedAnalysisResult {
|