@aiready/cli 0.9.36 → 0.9.38
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 +9 -16
- package/.turbo/turbo-test.log +4 -4
- package/dist/chunk-JQG7ZATX.mjs +211 -0
- package/dist/cli.js +263 -365
- package/dist/cli.mjs +27 -20
- package/dist/index.js +51 -0
- package/dist/index.mjs +1 -2
- package/package.json +11 -11
- package/src/commands/scan.ts +15 -15
- package/src/index.ts +61 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/cli@0.9.
|
|
3
|
+
> @aiready/cli@0.9.38 build /Users/pengcao/projects/aiready/packages/cli
|
|
4
4
|
> tsup src/index.ts src/cli.ts --format cjs,esm
|
|
5
5
|
|
|
6
6
|
[34mCLI[39m Building entry: src/cli.ts, src/index.ts
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
|
|
13
|
-
[90m[[
|
|
13
|
+
[90m[[90m10:33:35 PM[90m][39m [43m[30m WARN [39m[49m [33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1m"import.meta" is not available with the "cjs" output format and will be empty[0m [empty-import-meta]
|
|
14
14
|
|
|
15
15
|
src/cli.ts:22:31:
|
|
16
16
|
[37m 22 │ return dirname(fileURLToPath([32mimport.meta[37m.url));
|
|
@@ -20,17 +20,10 @@
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
[32mCJS[39m [1mdist/cli.js [22m[
|
|
24
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
25
|
-
[32mCJS[39m ⚡️ Build success in
|
|
26
|
-
[32mESM[39m [1mdist/
|
|
27
|
-
[32mESM[39m [1mdist/cli.mjs
|
|
28
|
-
[32mESM[39m [1mdist/
|
|
29
|
-
[32mESM[39m
|
|
30
|
-
[32mESM[39m [1mdist/chunk-XAF2EW5H.mjs [22m[32m1.75 KB[39m
|
|
31
|
-
[32mESM[39m [1mdist/chunk-RBWLQRKR.mjs [22m[32m1.39 KB[39m
|
|
32
|
-
[32mESM[39m [1mdist/chunk-Y6FXYEAI.mjs [22m[32m390.00 B[39m
|
|
33
|
-
[32mESM[39m [1mdist/chunk-YIS6WTY5.mjs [22m[32m1.41 KB[39m
|
|
34
|
-
[32mESM[39m [1mdist/testability-VDZJZ4MF.mjs [22m[32m123.00 B[39m
|
|
35
|
-
[32mESM[39m [1mdist/chunk-N4SLON5K.mjs [22m[32m4.91 KB[39m
|
|
36
|
-
[32mESM[39m ⚡️ Build success in 28ms
|
|
23
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m72.49 KB[39m
|
|
24
|
+
[32mCJS[39m [1mdist/index.js [22m[32m8.47 KB[39m
|
|
25
|
+
[32mCJS[39m ⚡️ Build success in 31ms
|
|
26
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m138.00 B[39m
|
|
27
|
+
[32mESM[39m [1mdist/cli.mjs [22m[32m62.83 KB[39m
|
|
28
|
+
[32mESM[39m [1mdist/chunk-JQG7ZATX.mjs [22m[32m7.12 KB[39m
|
|
29
|
+
[32mESM[39m ⚡️ Build success in 31ms
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/cli@0.9.
|
|
3
|
+
> @aiready/cli@0.9.38 test /Users/pengcao/projects/aiready/packages/cli
|
|
4
4
|
> vitest run
|
|
5
5
|
|
|
6
6
|
[?25l
|
|
7
7
|
[1m[46m RUN [49m[22m [36mv4.0.18 [39m[90m/Users/pengcao/projects/aiready/packages/cli[39m
|
|
8
8
|
|
|
9
|
-
[32m✓[39m src/__tests__/cli.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
9
|
+
[32m✓[39m src/__tests__/cli.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
10
10
|
[32m✓[39m dist/__tests__/cli.test.js [2m([22m[2m3 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
11
11
|
|
|
12
12
|
[2m Test Files [22m [1m[32m2 passed[39m[22m[90m (2)[39m
|
|
13
13
|
[2m Tests [22m [1m[32m6 passed[39m[22m[90m (6)[39m
|
|
14
|
-
[2m Start at [22m
|
|
15
|
-
[2m Duration [22m 1.
|
|
14
|
+
[2m Start at [22m 22:34:03
|
|
15
|
+
[2m Duration [22m 1.10s[2m (transform 479ms, setup 0ms, import 1.68s, tests 8ms, environment 0ms)[22m
|
|
16
16
|
|
|
17
17
|
[?25h
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// src/index.ts
|
|
9
|
+
import { analyzePatterns } from "@aiready/pattern-detect";
|
|
10
|
+
import { analyzeContext } from "@aiready/context-analyzer";
|
|
11
|
+
import { analyzeConsistency } from "@aiready/consistency";
|
|
12
|
+
var severityOrder = {
|
|
13
|
+
critical: 4,
|
|
14
|
+
major: 3,
|
|
15
|
+
minor: 2,
|
|
16
|
+
info: 1
|
|
17
|
+
};
|
|
18
|
+
function sortBySeverity(results) {
|
|
19
|
+
return results.map((file) => {
|
|
20
|
+
const sortedIssues = [...file.issues].sort((a, b) => {
|
|
21
|
+
const severityDiff = (severityOrder[b.severity] || 0) - (severityOrder[a.severity] || 0);
|
|
22
|
+
if (severityDiff !== 0) return severityDiff;
|
|
23
|
+
return (a.location?.line || 0) - (b.location?.line || 0);
|
|
24
|
+
});
|
|
25
|
+
return { ...file, issues: sortedIssues };
|
|
26
|
+
}).sort((a, b) => {
|
|
27
|
+
const aMaxSeverity = Math.max(...a.issues.map((i) => severityOrder[i.severity] || 0), 0);
|
|
28
|
+
const bMaxSeverity = Math.max(...b.issues.map((i) => severityOrder[i.severity] || 0), 0);
|
|
29
|
+
if (aMaxSeverity !== bMaxSeverity) {
|
|
30
|
+
return bMaxSeverity - aMaxSeverity;
|
|
31
|
+
}
|
|
32
|
+
if (a.issues.length !== b.issues.length) {
|
|
33
|
+
return b.issues.length - a.issues.length;
|
|
34
|
+
}
|
|
35
|
+
return a.fileName.localeCompare(b.fileName);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async function analyzeUnified(options) {
|
|
39
|
+
const startTime = Date.now();
|
|
40
|
+
const tools = options.tools || ["patterns", "context", "consistency"];
|
|
41
|
+
const result = {
|
|
42
|
+
summary: {
|
|
43
|
+
totalIssues: 0,
|
|
44
|
+
toolsRun: tools,
|
|
45
|
+
executionTime: 0
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
if (tools.includes("patterns")) {
|
|
49
|
+
const patternResult = await analyzePatterns(options);
|
|
50
|
+
if (options.progressCallback) {
|
|
51
|
+
options.progressCallback({ tool: "patterns", data: patternResult });
|
|
52
|
+
}
|
|
53
|
+
result.patterns = sortBySeverity(patternResult.results);
|
|
54
|
+
result.duplicates = patternResult.duplicates;
|
|
55
|
+
result.summary.totalIssues += patternResult.results.reduce(
|
|
56
|
+
(sum, file) => sum + file.issues.length,
|
|
57
|
+
0
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
if (tools.includes("context")) {
|
|
61
|
+
const contextResults = await analyzeContext(options);
|
|
62
|
+
if (options.progressCallback) {
|
|
63
|
+
options.progressCallback({ tool: "context", data: contextResults });
|
|
64
|
+
}
|
|
65
|
+
result.context = contextResults.sort((a, b) => {
|
|
66
|
+
const severityDiff = (severityOrder[b.severity] || 0) - (severityOrder[a.severity] || 0);
|
|
67
|
+
if (severityDiff !== 0) return severityDiff;
|
|
68
|
+
if (a.tokenCost !== b.tokenCost) return b.tokenCost - a.tokenCost;
|
|
69
|
+
return b.fragmentationScore - a.fragmentationScore;
|
|
70
|
+
});
|
|
71
|
+
result.summary.totalIssues += result.context?.length || 0;
|
|
72
|
+
}
|
|
73
|
+
if (tools.includes("consistency")) {
|
|
74
|
+
const consistencyOptions = {
|
|
75
|
+
rootDir: options.rootDir,
|
|
76
|
+
include: options.include,
|
|
77
|
+
exclude: options.exclude,
|
|
78
|
+
...options.consistency || {}
|
|
79
|
+
};
|
|
80
|
+
const report = await analyzeConsistency(consistencyOptions);
|
|
81
|
+
if (options.progressCallback) {
|
|
82
|
+
options.progressCallback({ tool: "consistency", data: report });
|
|
83
|
+
}
|
|
84
|
+
if (report.results) {
|
|
85
|
+
report.results = sortBySeverity(report.results);
|
|
86
|
+
}
|
|
87
|
+
result.consistency = report;
|
|
88
|
+
result.summary.totalIssues += report.summary.totalIssues;
|
|
89
|
+
}
|
|
90
|
+
if (tools.includes("doc-drift")) {
|
|
91
|
+
const { analyzeDocDrift } = await import("@aiready/doc-drift");
|
|
92
|
+
const report = await analyzeDocDrift({
|
|
93
|
+
rootDir: options.rootDir,
|
|
94
|
+
include: options.include,
|
|
95
|
+
exclude: options.exclude
|
|
96
|
+
});
|
|
97
|
+
if (options.progressCallback) {
|
|
98
|
+
options.progressCallback({ tool: "doc-drift", data: report });
|
|
99
|
+
}
|
|
100
|
+
result.docDrift = report;
|
|
101
|
+
result.summary.totalIssues += report.issues?.length || 0;
|
|
102
|
+
}
|
|
103
|
+
if (tools.includes("deps-health")) {
|
|
104
|
+
const { analyzeDeps } = await import("@aiready/deps");
|
|
105
|
+
const report = await analyzeDeps({
|
|
106
|
+
rootDir: options.rootDir,
|
|
107
|
+
include: options.include,
|
|
108
|
+
exclude: options.exclude
|
|
109
|
+
});
|
|
110
|
+
if (options.progressCallback) {
|
|
111
|
+
options.progressCallback({ tool: "deps-health", data: report });
|
|
112
|
+
}
|
|
113
|
+
result.deps = report;
|
|
114
|
+
result.summary.totalIssues += report.issues?.length || 0;
|
|
115
|
+
}
|
|
116
|
+
if (tools.includes("hallucination")) {
|
|
117
|
+
const { analyzeHallucinationRisk } = await import("@aiready/hallucination-risk");
|
|
118
|
+
const report = await analyzeHallucinationRisk({
|
|
119
|
+
rootDir: options.rootDir,
|
|
120
|
+
include: options.include,
|
|
121
|
+
exclude: options.exclude
|
|
122
|
+
});
|
|
123
|
+
if (options.progressCallback) {
|
|
124
|
+
options.progressCallback({ tool: "hallucination", data: report });
|
|
125
|
+
}
|
|
126
|
+
result.hallucination = report;
|
|
127
|
+
result.summary.totalIssues += report.results?.reduce((sum, r) => sum + (r.issues?.length || 0), 0) || 0;
|
|
128
|
+
}
|
|
129
|
+
if (tools.includes("grounding")) {
|
|
130
|
+
const { analyzeAgentGrounding } = await import("@aiready/agent-grounding");
|
|
131
|
+
const report = await analyzeAgentGrounding({
|
|
132
|
+
rootDir: options.rootDir,
|
|
133
|
+
include: options.include,
|
|
134
|
+
exclude: options.exclude
|
|
135
|
+
});
|
|
136
|
+
if (options.progressCallback) {
|
|
137
|
+
options.progressCallback({ tool: "grounding", data: report });
|
|
138
|
+
}
|
|
139
|
+
result.grounding = report;
|
|
140
|
+
result.summary.totalIssues += report.issues?.length || 0;
|
|
141
|
+
}
|
|
142
|
+
if (tools.includes("testability")) {
|
|
143
|
+
const { analyzeTestability } = await import("@aiready/testability");
|
|
144
|
+
const report = await analyzeTestability({
|
|
145
|
+
rootDir: options.rootDir,
|
|
146
|
+
include: options.include,
|
|
147
|
+
exclude: options.exclude
|
|
148
|
+
});
|
|
149
|
+
if (options.progressCallback) {
|
|
150
|
+
options.progressCallback({ tool: "testability", data: report });
|
|
151
|
+
}
|
|
152
|
+
result.testability = report;
|
|
153
|
+
result.summary.totalIssues += report.issues?.length || 0;
|
|
154
|
+
}
|
|
155
|
+
result.summary.executionTime = Date.now() - startTime;
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
function generateUnifiedSummary(result) {
|
|
159
|
+
const { summary } = result;
|
|
160
|
+
let output = `\u{1F680} AIReady Analysis Complete
|
|
161
|
+
|
|
162
|
+
`;
|
|
163
|
+
output += `\u{1F4CA} Summary:
|
|
164
|
+
`;
|
|
165
|
+
output += ` Tools run: ${summary.toolsRun.join(", ")}
|
|
166
|
+
`;
|
|
167
|
+
output += ` Total issues found: ${summary.totalIssues}
|
|
168
|
+
`;
|
|
169
|
+
output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
|
|
170
|
+
|
|
171
|
+
`;
|
|
172
|
+
if (result.patterns) {
|
|
173
|
+
output += `\u{1F50D} Pattern Analysis: ${result.patterns.length} issues
|
|
174
|
+
`;
|
|
175
|
+
}
|
|
176
|
+
if (result.context) {
|
|
177
|
+
output += `\u{1F9E0} Context Analysis: ${result.context.length} issues
|
|
178
|
+
`;
|
|
179
|
+
}
|
|
180
|
+
if (result.consistency) {
|
|
181
|
+
output += `\u{1F3F7}\uFE0F Consistency Analysis: ${result.consistency.summary.totalIssues} issues
|
|
182
|
+
`;
|
|
183
|
+
}
|
|
184
|
+
if (result.docDrift) {
|
|
185
|
+
output += `\u{1F4DD} Doc Drift Analysis: ${result.docDrift.issues?.length || 0} issues
|
|
186
|
+
`;
|
|
187
|
+
}
|
|
188
|
+
if (result.deps) {
|
|
189
|
+
output += `\u{1F4E6} Dependency Health: ${result.deps.issues?.length || 0} issues
|
|
190
|
+
`;
|
|
191
|
+
}
|
|
192
|
+
if (result.hallucination) {
|
|
193
|
+
output += `\u{1F9E0} Hallucination Risk: ${result.hallucination.summary?.totalSignals || 0} signals
|
|
194
|
+
`;
|
|
195
|
+
}
|
|
196
|
+
if (result.grounding) {
|
|
197
|
+
output += `\u{1F9ED} Agent Grounding: ${result.grounding.issues?.length || 0} issues
|
|
198
|
+
`;
|
|
199
|
+
}
|
|
200
|
+
if (result.testability) {
|
|
201
|
+
output += `\u{1F9EA} Testability Index: ${result.testability.issues?.length || 0} issues
|
|
202
|
+
`;
|
|
203
|
+
}
|
|
204
|
+
return output;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export {
|
|
208
|
+
__require,
|
|
209
|
+
analyzeUnified,
|
|
210
|
+
generateUnifiedSummary
|
|
211
|
+
};
|