@aiready/cli 0.9.41 → 0.9.45

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.41 build /Users/pengcao/projects/aiready/packages/cli
3
+ > @aiready/cli@0.9.45 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
@@ -9,21 +9,21 @@
9
9
  CLI Target: es2020
10
10
  CJS Build start
11
11
  ESM Build start
12
- ESM dist/index.mjs 138.00 B
13
- ESM dist/cli.mjs 70.01 KB
14
- ESM dist/chunk-HLBKROD3.mjs 7.85 KB
15
- ESM ⚡️ Build success in 84ms
16
12
 
17
- [10:18:57 PM]  WARN  ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta]
13
+ [2:01:22 PM]  WARN  ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta]
18
14
 
19
- src/cli.ts:23:31:
20
-  23 │ return dirname(fileURLToPath(import.meta.url));
15
+ src/cli.ts:25:31:
16
+  25 │ return dirname(fileURLToPath(import.meta.url));
21
17
  ╵ ~~~~~~~~~~~
22
18
 
23
19
  You need to set the output format to "esm" for "import.meta" to work correctly.
24
20
 
25
21
 
26
22
 
27
- CJS dist/index.js 9.20 KB
28
- CJS dist/cli.js 80.33 KB
29
- CJS ⚡️ Build success in 101ms
23
+ CJS dist/index.js 9.42 KB
24
+ CJS dist/cli.js 88.27 KB
25
+ CJS ⚡️ Build success in 107ms
26
+ ESM dist/cli.mjs 77.34 KB
27
+ ESM dist/chunk-LLJMKNBI.mjs 8.07 KB
28
+ ESM dist/index.mjs 138.00 B
29
+ ESM ⚡️ Build success in 107ms
@@ -0,0 +1,5 @@
1
+
2
+ 
3
+ > @aiready/cli@0.9.41 lint /Users/pengcao/projects/aiready/packages/cli
4
+ > eslint src
5
+
@@ -1,17 +1,17 @@
1
1
 
2
2
  
3
- > @aiready/cli@0.9.41 test /Users/pengcao/projects/aiready/packages/cli
3
+ > @aiready/cli@0.9.43 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
10
  ✓ dist/__tests__/cli.test.js (3 tests) 9ms
10
- ✓ src/__tests__/cli.test.ts (3 tests) 4ms
11
11
 
12
12
   Test Files  2 passed (2)
13
13
   Tests  6 passed (6)
14
-  Start at  22:19:18
15
-  Duration  1.91s (transform 392ms, setup 0ms, import 2.04s, tests 13ms, environment 0ms)
14
+  Start at  00:56:33
15
+  Duration  7.83s (transform 2.63s, setup 0ms, import 12.42s, tests 12ms, environment 0ms)
16
16
 
17
17
  [?25h
package/README.md CHANGED
@@ -37,7 +37,28 @@ The CLI provides both unified analysis (scan multiple tools at once) and individ
37
37
  aiready scan .
38
38
 
39
39
  # Run a specific tool
40
- aiready pattern-detect .
40
+ aiready patterns . --similarity 0.6
41
+
42
+ ## 🌐 Platform Integration
43
+
44
+ Connect your local scans to the [AIReady Dashboard](https://getaiready.dev/dashboard).
45
+
46
+ ### Automatic Upload
47
+ Scan and upload results in one step:
48
+ ```bash
49
+ aiready scan . --upload --api-key ar_...
50
+ ```
51
+
52
+ ### Manual Upload
53
+ Upload an existing report JSON:
54
+ ```bash
55
+ aiready upload .aiready/latest.json --api-key ar_...
56
+ ```
57
+
58
+ ### Options
59
+ - `--upload`: Automatically upload results after scan
60
+ - `--api-key <key>`: Your platform API key (or set `AIREADY_API_KEY`)
61
+ - `--server <url>`: Custom platform URL (optional)
41
62
  ```
42
63
 
43
64
  ## License
@@ -0,0 +1,243 @@
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(
28
+ ...a.issues.map((i) => severityOrder[i.severity] || 0),
29
+ 0
30
+ );
31
+ const bMaxSeverity = Math.max(
32
+ ...b.issues.map((i) => severityOrder[i.severity] || 0),
33
+ 0
34
+ );
35
+ if (aMaxSeverity !== bMaxSeverity) {
36
+ return bMaxSeverity - aMaxSeverity;
37
+ }
38
+ if (a.issues.length !== b.issues.length) {
39
+ return b.issues.length - a.issues.length;
40
+ }
41
+ return a.fileName.localeCompare(b.fileName);
42
+ });
43
+ }
44
+ async function analyzeUnified(options) {
45
+ const startTime = Date.now();
46
+ const tools = options.tools || ["patterns", "context", "consistency"];
47
+ const result = {
48
+ summary: {
49
+ totalIssues: 0,
50
+ toolsRun: tools,
51
+ executionTime: 0
52
+ }
53
+ };
54
+ if (tools.includes("patterns")) {
55
+ const patternResult = await analyzePatterns(options);
56
+ if (options.progressCallback) {
57
+ options.progressCallback({ tool: "patterns", data: patternResult });
58
+ }
59
+ result.patterns = sortBySeverity(patternResult.results);
60
+ result.duplicates = patternResult.duplicates;
61
+ result.summary.totalIssues += patternResult.results.reduce(
62
+ (sum, file) => sum + file.issues.length,
63
+ 0
64
+ );
65
+ }
66
+ if (tools.includes("context")) {
67
+ const contextResults = await analyzeContext(options);
68
+ if (options.progressCallback) {
69
+ options.progressCallback({ tool: "context", data: contextResults });
70
+ }
71
+ result.context = contextResults.sort((a, b) => {
72
+ const severityDiff = (severityOrder[b.severity] || 0) - (severityOrder[a.severity] || 0);
73
+ if (severityDiff !== 0) return severityDiff;
74
+ if (a.tokenCost !== b.tokenCost) return b.tokenCost - a.tokenCost;
75
+ return b.fragmentationScore - a.fragmentationScore;
76
+ });
77
+ result.summary.totalIssues += result.context?.length || 0;
78
+ }
79
+ if (tools.includes("consistency")) {
80
+ const consistencyOptions = {
81
+ rootDir: options.rootDir,
82
+ include: options.include,
83
+ exclude: options.exclude,
84
+ ...options.consistency || {}
85
+ };
86
+ const report = await analyzeConsistency(consistencyOptions);
87
+ if (options.progressCallback) {
88
+ options.progressCallback({ tool: "consistency", data: report });
89
+ }
90
+ if (report.results) {
91
+ report.results = sortBySeverity(report.results);
92
+ }
93
+ result.consistency = report;
94
+ result.summary.totalIssues += report.summary.totalIssues;
95
+ }
96
+ if (tools.includes("doc-drift")) {
97
+ const { analyzeDocDrift } = await import("@aiready/doc-drift");
98
+ const report = await analyzeDocDrift({
99
+ rootDir: options.rootDir,
100
+ include: options.include,
101
+ exclude: options.exclude,
102
+ onProgress: options.onProgress
103
+ });
104
+ if (options.progressCallback) {
105
+ options.progressCallback({ tool: "doc-drift", data: report });
106
+ }
107
+ result.docDrift = report;
108
+ result.summary.totalIssues += report.issues?.length || 0;
109
+ }
110
+ if (tools.includes("deps-health")) {
111
+ const { analyzeDeps } = await import("@aiready/deps");
112
+ const report = await analyzeDeps({
113
+ rootDir: options.rootDir,
114
+ include: options.include,
115
+ exclude: options.exclude,
116
+ onProgress: options.onProgress
117
+ });
118
+ if (options.progressCallback) {
119
+ options.progressCallback({ tool: "deps-health", data: report });
120
+ }
121
+ result.deps = report;
122
+ result.summary.totalIssues += report.issues?.length || 0;
123
+ }
124
+ if (tools.includes("aiSignalClarity")) {
125
+ const { analyzeAiSignalClarity } = await import("@aiready/ai-signal-clarity");
126
+ const report = await analyzeAiSignalClarity({
127
+ rootDir: options.rootDir,
128
+ include: options.include,
129
+ exclude: options.exclude,
130
+ onProgress: options.onProgress
131
+ });
132
+ if (options.progressCallback) {
133
+ options.progressCallback({ tool: "aiSignalClarity", data: report });
134
+ }
135
+ result.aiSignalClarity = report;
136
+ result.summary.totalIssues += report.results?.reduce(
137
+ (sum, r) => sum + (r.issues?.length || 0),
138
+ 0
139
+ ) || 0;
140
+ }
141
+ if (tools.includes("grounding")) {
142
+ const { analyzeAgentGrounding } = await import("@aiready/agent-grounding");
143
+ const report = await analyzeAgentGrounding({
144
+ rootDir: options.rootDir,
145
+ include: options.include,
146
+ exclude: options.exclude,
147
+ onProgress: options.onProgress
148
+ });
149
+ if (options.progressCallback) {
150
+ options.progressCallback({ tool: "grounding", data: report });
151
+ }
152
+ result.grounding = report;
153
+ result.summary.totalIssues += report.issues?.length || 0;
154
+ }
155
+ if (tools.includes("testability")) {
156
+ const { analyzeTestability } = await import("@aiready/testability");
157
+ const report = await analyzeTestability({
158
+ rootDir: options.rootDir,
159
+ include: options.include,
160
+ exclude: options.exclude,
161
+ onProgress: options.onProgress
162
+ });
163
+ if (options.progressCallback) {
164
+ options.progressCallback({ tool: "testability", data: report });
165
+ }
166
+ result.testability = report;
167
+ result.summary.totalIssues += report.issues?.length || 0;
168
+ }
169
+ if (tools.includes("changeAmplification")) {
170
+ const { analyzeChangeAmplification } = await import("@aiready/change-amplification");
171
+ const report = await analyzeChangeAmplification({
172
+ rootDir: options.rootDir,
173
+ include: options.include,
174
+ exclude: options.exclude,
175
+ onProgress: options.onProgress
176
+ });
177
+ if (options.progressCallback) {
178
+ options.progressCallback({ tool: "changeAmplification", data: report });
179
+ }
180
+ result.changeAmplification = report;
181
+ result.summary.totalIssues += report.summary?.totalIssues || 0;
182
+ }
183
+ result.summary.executionTime = Date.now() - startTime;
184
+ return result;
185
+ }
186
+ function generateUnifiedSummary(result) {
187
+ const { summary } = result;
188
+ let output = `\u{1F680} AIReady Analysis Complete
189
+
190
+ `;
191
+ output += `\u{1F4CA} Summary:
192
+ `;
193
+ output += ` Tools run: ${summary.toolsRun.join(", ")}
194
+ `;
195
+ output += ` Total issues found: ${summary.totalIssues}
196
+ `;
197
+ output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
198
+
199
+ `;
200
+ if (result.patterns) {
201
+ output += `\u{1F50D} Pattern Analysis: ${result.patterns.length} issues
202
+ `;
203
+ }
204
+ if (result.context) {
205
+ output += `\u{1F9E0} Context Analysis: ${result.context.length} issues
206
+ `;
207
+ }
208
+ if (result.consistency) {
209
+ output += `\u{1F3F7}\uFE0F Consistency Analysis: ${result.consistency.summary.totalIssues} issues
210
+ `;
211
+ }
212
+ if (result.docDrift) {
213
+ output += `\u{1F4DD} Doc Drift Analysis: ${result.docDrift.issues?.length || 0} issues
214
+ `;
215
+ }
216
+ if (result.deps) {
217
+ output += `\u{1F4E6} Dependency Health: ${result.deps.issues?.length || 0} issues
218
+ `;
219
+ }
220
+ if (result.aiSignalClarity) {
221
+ output += `\u{1F9E0} AI Signal Clarity: ${result.aiSignalClarity.summary?.totalSignals || 0} signals
222
+ `;
223
+ }
224
+ if (result.grounding) {
225
+ output += `\u{1F9ED} Agent Grounding: ${result.grounding.issues?.length || 0} issues
226
+ `;
227
+ }
228
+ if (result.testability) {
229
+ output += `\u{1F9EA} Testability Index: ${result.testability.issues?.length || 0} issues
230
+ `;
231
+ }
232
+ if (result.changeAmplification) {
233
+ output += `\u{1F4A5} Change Amplification: ${result.changeAmplification.summary?.totalIssues || 0} cascading risks
234
+ `;
235
+ }
236
+ return output;
237
+ }
238
+
239
+ export {
240
+ __require,
241
+ analyzeUnified,
242
+ generateUnifiedSummary
243
+ };