@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.
@@ -1,6 +1,6 @@
1
1
 
2
2
  
3
- > @aiready/cli@0.9.36 build /Users/pengcao/projects/aiready/packages/cli
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
  CLI Building entry: src/cli.ts, src/index.ts
@@ -10,7 +10,7 @@
10
10
  CJS Build start
11
11
  ESM Build start
12
12
 
13
- [9:41:44 PM]  WARN  ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta]
13
+ [10:33:35 PM]  WARN  ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta]
14
14
 
15
15
  src/cli.ts:22:31:
16
16
   22 │ return dirname(fileURLToPath(import.meta.url));
@@ -20,17 +20,10 @@
20
20
 
21
21
 
22
22
 
23
- CJS dist/cli.js 77.14 KB
24
- CJS dist/index.js 6.63 KB
25
- CJS ⚡️ Build success in 28ms
26
- ESM dist/hallucination-risk-XU6E7IGN.mjs 135.00 B
27
- ESM dist/cli.mjs 62.85 KB
28
- ESM dist/index.mjs 169.00 B
29
- ESM dist/agent-grounding-DAOSU4MF.mjs 129.00 B
30
- ESM dist/chunk-XAF2EW5H.mjs 1.75 KB
31
- ESM dist/chunk-RBWLQRKR.mjs 1.39 KB
32
- ESM dist/chunk-Y6FXYEAI.mjs 390.00 B
33
- ESM dist/chunk-YIS6WTY5.mjs 1.41 KB
34
- ESM dist/testability-VDZJZ4MF.mjs 123.00 B
35
- ESM dist/chunk-N4SLON5K.mjs 4.91 KB
36
- ESM ⚡️ Build success in 28ms
23
+ CJS dist/cli.js 72.49 KB
24
+ CJS dist/index.js 8.47 KB
25
+ CJS ⚡️ Build success in 31ms
26
+ ESM dist/index.mjs 138.00 B
27
+ ESM dist/cli.mjs 62.83 KB
28
+ ESM dist/chunk-JQG7ZATX.mjs 7.12 KB
29
+ ESM ⚡️ Build success in 31ms
@@ -1,17 +1,17 @@
1
1
 
2
2
  
3
- > @aiready/cli@0.9.36 test /Users/pengcao/projects/aiready/packages/cli
3
+ > @aiready/cli@0.9.38 test /Users/pengcao/projects/aiready/packages/cli
4
4
  > vitest run
5
5
 
6
6
  [?25l
7
7
   RUN  v4.0.18 /Users/pengcao/projects/aiready/packages/cli
8
8
 
9
- ✓ src/__tests__/cli.test.ts (3 tests) 3ms
9
+ ✓ src/__tests__/cli.test.ts (3 tests) 6ms
10
10
  ✓ dist/__tests__/cli.test.js (3 tests) 3ms
11
11
 
12
12
   Test Files  2 passed (2)
13
13
   Tests  6 passed (6)
14
-  Start at  21:42:04
15
-  Duration  1.60s (transform 926ms, setup 0ms, import 2.72s, tests 5ms, environment 0ms)
14
+  Start at  22:34:03
15
+  Duration  1.10s (transform 479ms, setup 0ms, import 1.68s, tests 8ms, environment 0ms)
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
+ };