@aiready/cli 0.3.4 → 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 +16 -11
- package/dist/cli.js +24 -6
- package/dist/cli.mjs +24 -6
- package/package.json +4 -4
- package/src/cli.ts +36 -6
- 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[32m9.79 KB[39m
|
|
13
12
|
[32mCJS[39m [1mdist/index.js [22m[32m2.57 KB[39m
|
|
14
|
-
[32mCJS[39m
|
|
15
|
-
[
|
|
16
|
-
[32mESM[39m [1mdist/cli.mjs [22m[32m6.94 KB[39m
|
|
13
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m10.77 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 51ms
|
|
17
15
|
[32mESM[39m [1mdist/index.mjs [22m[32m138.00 B[39m
|
|
18
|
-
[32mESM[39m
|
|
16
|
+
[32mESM[39m [1mdist/chunk-KZKXZKES.mjs [22m[32m1.45 KB[39m
|
|
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";
|
|
@@ -122,13 +128,13 @@ program.command("scan").description("Run unified analysis on a codebase").argume
|
|
|
122
128
|
(0, import_core.handleCLIError)(error, "Analysis");
|
|
123
129
|
}
|
|
124
130
|
});
|
|
125
|
-
program.command("patterns").description("Run pattern detection analysis").argument("<directory>", "Directory to analyze").option("-s, --similarity <number>", "Minimum similarity score (0-1)", "0.40").option("-l, --min-lines <number>", "Minimum lines to consider", "5").option("--include <patterns>", "File patterns to include (comma-separated)").option("--exclude <patterns>", "File patterns to exclude (comma-separated)").option("-o, --output <format>", "Output format: console, json", "console").option("--output-file <path>", "Output file path (for json)").action(async (directory, options) => {
|
|
131
|
+
program.command("patterns").description("Run pattern detection analysis").argument("<directory>", "Directory to analyze").option("-s, --similarity <number>", "Minimum similarity score (0-1)", "0.40").option("-l, --min-lines <number>", "Minimum lines to consider", "5").option("--max-candidates <number>", "Maximum candidates per block (performance tuning)").option("--min-shared-tokens <number>", "Minimum shared tokens for candidates (performance tuning)").option("--full-scan", "Disable smart defaults for comprehensive analysis (slower)").option("--include <patterns>", "File patterns to include (comma-separated)").option("--exclude <patterns>", "File patterns to exclude (comma-separated)").option("-o, --output <format>", "Output format: console, json", "console").option("--output-file <path>", "Output file path (for json)").action(async (directory, options) => {
|
|
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,
|
|
137
|
+
useSmartDefaults,
|
|
132
138
|
include: void 0,
|
|
133
139
|
exclude: void 0,
|
|
134
140
|
output: {
|
|
@@ -136,12 +142,24 @@ program.command("patterns").description("Run pattern detection analysis").argume
|
|
|
136
142
|
file: void 0
|
|
137
143
|
}
|
|
138
144
|
};
|
|
139
|
-
|
|
145
|
+
if (!useSmartDefaults) {
|
|
146
|
+
defaults.minSimilarity = 0.4;
|
|
147
|
+
defaults.minLines = 5;
|
|
148
|
+
}
|
|
149
|
+
const cliOptions = {
|
|
140
150
|
minSimilarity: options.similarity ? parseFloat(options.similarity) : void 0,
|
|
141
151
|
minLines: options.minLines ? parseInt(options.minLines) : void 0,
|
|
152
|
+
useSmartDefaults,
|
|
142
153
|
include: options.include?.split(","),
|
|
143
154
|
exclude: options.exclude?.split(",")
|
|
144
|
-
}
|
|
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);
|
|
145
163
|
const { analyzePatterns: analyzePatterns2, generateSummary } = await import("@aiready/pattern-detect");
|
|
146
164
|
const { results } = await analyzePatterns2(finalOptions);
|
|
147
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";
|
|
@@ -51,13 +57,13 @@ program.command("scan").description("Run unified analysis on a codebase").argume
|
|
|
51
57
|
handleCLIError(error, "Analysis");
|
|
52
58
|
}
|
|
53
59
|
});
|
|
54
|
-
program.command("patterns").description("Run pattern detection analysis").argument("<directory>", "Directory to analyze").option("-s, --similarity <number>", "Minimum similarity score (0-1)", "0.40").option("-l, --min-lines <number>", "Minimum lines to consider", "5").option("--include <patterns>", "File patterns to include (comma-separated)").option("--exclude <patterns>", "File patterns to exclude (comma-separated)").option("-o, --output <format>", "Output format: console, json", "console").option("--output-file <path>", "Output file path (for json)").action(async (directory, options) => {
|
|
60
|
+
program.command("patterns").description("Run pattern detection analysis").argument("<directory>", "Directory to analyze").option("-s, --similarity <number>", "Minimum similarity score (0-1)", "0.40").option("-l, --min-lines <number>", "Minimum lines to consider", "5").option("--max-candidates <number>", "Maximum candidates per block (performance tuning)").option("--min-shared-tokens <number>", "Minimum shared tokens for candidates (performance tuning)").option("--full-scan", "Disable smart defaults for comprehensive analysis (slower)").option("--include <patterns>", "File patterns to include (comma-separated)").option("--exclude <patterns>", "File patterns to exclude (comma-separated)").option("-o, --output <format>", "Output format: console, json", "console").option("--output-file <path>", "Output file path (for json)").action(async (directory, options) => {
|
|
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,
|
|
66
|
+
useSmartDefaults,
|
|
61
67
|
include: void 0,
|
|
62
68
|
exclude: void 0,
|
|
63
69
|
output: {
|
|
@@ -65,12 +71,24 @@ program.command("patterns").description("Run pattern detection analysis").argume
|
|
|
65
71
|
file: void 0
|
|
66
72
|
}
|
|
67
73
|
};
|
|
68
|
-
|
|
74
|
+
if (!useSmartDefaults) {
|
|
75
|
+
defaults.minSimilarity = 0.4;
|
|
76
|
+
defaults.minLines = 5;
|
|
77
|
+
}
|
|
78
|
+
const cliOptions = {
|
|
69
79
|
minSimilarity: options.similarity ? parseFloat(options.similarity) : void 0,
|
|
70
80
|
minLines: options.minLines ? parseInt(options.minLines) : void 0,
|
|
81
|
+
useSmartDefaults,
|
|
71
82
|
include: options.include?.split(","),
|
|
72
83
|
exclude: options.exclude?.split(",")
|
|
73
|
-
}
|
|
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);
|
|
74
92
|
const { analyzePatterns, generateSummary } = await import("@aiready/pattern-detect");
|
|
75
93
|
const { results } = await analyzePatterns(finalOptions);
|
|
76
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/context-analyzer": "0.3.
|
|
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);
|
|
@@ -84,6 +92,9 @@ program
|
|
|
84
92
|
.argument('<directory>', 'Directory to analyze')
|
|
85
93
|
.option('-s, --similarity <number>', 'Minimum similarity score (0-1)', '0.40')
|
|
86
94
|
.option('-l, --min-lines <number>', 'Minimum lines to consider', '5')
|
|
95
|
+
.option('--max-candidates <number>', 'Maximum candidates per block (performance tuning)')
|
|
96
|
+
.option('--min-shared-tokens <number>', 'Minimum shared tokens for candidates (performance tuning)')
|
|
97
|
+
.option('--full-scan', 'Disable smart defaults for comprehensive analysis (slower)')
|
|
87
98
|
.option('--include <patterns>', 'File patterns to include (comma-separated)')
|
|
88
99
|
.option('--exclude <patterns>', 'File patterns to exclude (comma-separated)')
|
|
89
100
|
.option('-o, --output <format>', 'Output format: console, json', 'console')
|
|
@@ -94,10 +105,12 @@ program
|
|
|
94
105
|
const startTime = Date.now();
|
|
95
106
|
|
|
96
107
|
try {
|
|
97
|
-
//
|
|
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)
|
|
98
112
|
const defaults = {
|
|
99
|
-
|
|
100
|
-
minLines: 5,
|
|
113
|
+
useSmartDefaults,
|
|
101
114
|
include: undefined,
|
|
102
115
|
exclude: undefined,
|
|
103
116
|
output: {
|
|
@@ -106,13 +119,30 @@ program
|
|
|
106
119
|
},
|
|
107
120
|
};
|
|
108
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
|
+
|
|
109
128
|
// Load and merge config with CLI options
|
|
110
|
-
const
|
|
129
|
+
const cliOptions: any = {
|
|
111
130
|
minSimilarity: options.similarity ? parseFloat(options.similarity) : undefined,
|
|
112
131
|
minLines: options.minLines ? parseInt(options.minLines) : undefined,
|
|
132
|
+
useSmartDefaults,
|
|
113
133
|
include: options.include?.split(','),
|
|
114
134
|
exclude: options.exclude?.split(','),
|
|
115
|
-
}
|
|
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);
|
|
116
146
|
|
|
117
147
|
const { analyzePatterns, generateSummary } = await import('@aiready/pattern-detect');
|
|
118
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 {
|