@aiready/cli 0.12.1 → 0.12.4

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.12.0 build /Users/pengcao/projects/aiready/packages/cli
3
+ > @aiready/cli@0.12.3 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
-  WARN  ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta] 10:34:27 am
13
+  WARN  ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta] 11:12:15 am
14
14
 
15
15
  src/cli.ts:25:31:
16
16
   25 │ return dirname(fileURLToPath(import.meta.url));
@@ -20,10 +20,10 @@
20
20
 
21
21
 
22
22
 
23
- CJS dist/cli.js 66.96 KB
24
- CJS dist/index.js 8.21 KB
25
- CJS ⚡️ Build success in 87ms
26
- ESM dist/index.mjs 170.00 B
23
+ CJS dist/cli.js 67.18 KB
24
+ CJS dist/index.js 8.42 KB
25
+ CJS ⚡️ Build success in 28ms
27
26
  ESM dist/cli.mjs 56.79 KB
28
- ESM dist/chunk-LTUQDJPO.mjs 7.08 KB
29
- ESM ⚡️ Build success in 87ms
27
+ ESM dist/index.mjs 170.00 B
28
+ ESM dist/chunk-7K3CNS6C.mjs 7.29 KB
29
+ ESM ⚡️ Build success in 28ms
@@ -1,55 +1,55 @@
1
1
 
2
2
  
3
- > @aiready/cli@0.12.0 test /Users/pengcao/projects/aiready/packages/cli
3
+ > @aiready/cli@0.12.3 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
9
  stdout | src/__tests__/cli.test.ts
10
- [ToolRegistry#0.43273800284035346] Registering tool: pattern-detect (patterns, duplicates, duplication)
10
+ [ToolRegistry#0.657519876473521] Registering tool: pattern-detect (patterns, duplicates, duplication)
11
11
 
12
12
  stdout | src/__tests__/cli.test.ts
13
- [ToolRegistry#0.43273800284035346] Registering tool: context-analyzer (context, fragmentation, budget)
13
+ [ToolRegistry#0.657519876473521] Registering tool: context-analyzer (context, fragmentation, budget)
14
14
 
15
15
  stdout | src/__tests__/cli.test.ts
16
- [ToolRegistry#0.43273800284035346] Registering tool: naming-consistency (consistency, naming, standards)
16
+ [ToolRegistry#0.657519876473521] Registering tool: naming-consistency (consistency, naming, standards)
17
17
 
18
18
  stdout | src/__tests__/cli.test.ts
19
- [ToolRegistry#0.43273800284035346] Registering tool: ai-signal-clarity (ai-signal, clarity, hallucination)
19
+ [ToolRegistry#0.657519876473521] Registering tool: ai-signal-clarity (ai-signal, clarity, hallucination)
20
20
 
21
21
  stdout | src/__tests__/cli.test.ts
22
- [ToolRegistry#0.43273800284035346] Registering tool: agent-grounding (agent-grounding, grounding, navigation)
22
+ [ToolRegistry#0.657519876473521] Registering tool: agent-grounding (agent-grounding, grounding, navigation)
23
23
 
24
24
  stdout | src/__tests__/cli.test.ts
25
- [ToolRegistry#0.43273800284035346] Registering tool: testability-index (testability, tests, verification)
25
+ [ToolRegistry#0.657519876473521] Registering tool: testability-index (testability, tests, verification)
26
26
 
27
27
  stdout | src/__tests__/cli.test.ts
28
- [ToolRegistry#0.43273800284035346] Registering tool: doc-drift (doc-drift, docs, jsdoc)
28
+ [ToolRegistry#0.657519876473521] Registering tool: doc-drift (doc-drift, docs, jsdoc)
29
29
 
30
30
  stdout | src/__tests__/cli.test.ts
31
- [ToolRegistry#0.43273800284035346] Registering tool: dependency-health (deps, deps-health, packages)
31
+ [ToolRegistry#0.657519876473521] Registering tool: dependency-health (deps, deps-health, packages)
32
32
 
33
33
  stdout | src/__tests__/cli.test.ts
34
- [ToolRegistry#0.43273800284035346] Registering tool: change-amplification (change-amp, change-amplification, coupling)
34
+ [ToolRegistry#0.657519876473521] Registering tool: change-amplification (change-amp, change-amplification, coupling)
35
35
 
36
36
  stdout | src/__tests__/cli.test.ts > CLI Unified Analysis > should run unified analysis with both tools
37
- [ToolRegistry#0.43273800284035346] Registering tool: pattern-detect (patterns)
38
- [ToolRegistry#0.43273800284035346] Registering tool: context-analyzer (context)
37
+ [ToolRegistry#0.657519876473521] Registering tool: pattern-detect (patterns)
38
+ [ToolRegistry#0.657519876473521] Registering tool: context-analyzer (context)
39
39
 
40
40
  stdout | src/__tests__/cli.test.ts > CLI Unified Analysis > should run analysis with only patterns tool
41
- [ToolRegistry#0.43273800284035346] Registering tool: pattern-detect (patterns)
42
- [ToolRegistry#0.43273800284035346] Registering tool: context-analyzer (context)
41
+ [ToolRegistry#0.657519876473521] Registering tool: pattern-detect (patterns)
42
+ [ToolRegistry#0.657519876473521] Registering tool: context-analyzer (context)
43
43
 
44
44
  stdout | src/__tests__/cli.test.ts > CLI Unified Analysis > should run analysis with only context tool
45
- [ToolRegistry#0.43273800284035346] Registering tool: pattern-detect (patterns)
46
- [ToolRegistry#0.43273800284035346] Registering tool: context-analyzer (context)
45
+ [ToolRegistry#0.657519876473521] Registering tool: pattern-detect (patterns)
46
+ [ToolRegistry#0.657519876473521] Registering tool: context-analyzer (context)
47
47
 
48
48
  ✓ src/__tests__/cli.test.ts (3 tests) 3ms
49
49
 
50
50
   Test Files  1 passed (1)
51
51
   Tests  3 passed (3)
52
-  Start at  10:34:45
53
-  Duration  536ms (transform 205ms, setup 0ms, import 411ms, tests 3ms, environment 0ms)
52
+  Start at  11:12:33
53
+  Duration  443ms (transform 116ms, setup 0ms, import 321ms, tests 3ms, environment 0ms)
54
54
 
55
55
  [?25h
@@ -0,0 +1,234 @@
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 {
10
+ ToolRegistry,
11
+ ToolName,
12
+ calculateOverallScore,
13
+ calculateTokenBudget
14
+ } from "@aiready/core";
15
+ import "@aiready/pattern-detect";
16
+ import "@aiready/context-analyzer";
17
+ import "@aiready/consistency";
18
+ import "@aiready/ai-signal-clarity";
19
+ import "@aiready/agent-grounding";
20
+ import "@aiready/testability";
21
+ import "@aiready/doc-drift";
22
+ import "@aiready/deps";
23
+ import "@aiready/change-amplification";
24
+ var TOOL_PACKAGE_MAP = {
25
+ [ToolName.PatternDetect]: "@aiready/pattern-detect",
26
+ [ToolName.ContextAnalyzer]: "@aiready/context-analyzer",
27
+ [ToolName.NamingConsistency]: "@aiready/consistency",
28
+ [ToolName.AiSignalClarity]: "@aiready/ai-signal-clarity",
29
+ [ToolName.AgentGrounding]: "@aiready/agent-grounding",
30
+ [ToolName.TestabilityIndex]: "@aiready/testability",
31
+ [ToolName.DocDrift]: "@aiready/doc-drift",
32
+ [ToolName.DependencyHealth]: "@aiready/deps",
33
+ [ToolName.ChangeAmplification]: "@aiready/change-amplification",
34
+ // Aliases handled by registry
35
+ patterns: "@aiready/pattern-detect",
36
+ duplicates: "@aiready/pattern-detect",
37
+ context: "@aiready/context-analyzer",
38
+ fragmentation: "@aiready/context-analyzer",
39
+ consistency: "@aiready/consistency",
40
+ "naming-consistency": "@aiready/consistency",
41
+ "ai-signal": "@aiready/ai-signal-clarity",
42
+ "ai-signal-clarity": "@aiready/ai-signal-clarity",
43
+ grounding: "@aiready/agent-grounding",
44
+ "agent-grounding": "@aiready/agent-grounding",
45
+ testability: "@aiready/testability",
46
+ "testability-index": "@aiready/testability",
47
+ "doc-drift": "@aiready/doc-drift",
48
+ "deps-health": "@aiready/deps",
49
+ "dependency-health": "@aiready/deps",
50
+ "change-amp": "@aiready/change-amplification",
51
+ "change-amplification": "@aiready/change-amplification"
52
+ };
53
+ async function analyzeUnified(options) {
54
+ const startTime = Date.now();
55
+ const requestedTools = options.tools || [
56
+ "patterns",
57
+ "context",
58
+ "consistency"
59
+ ];
60
+ const result = {
61
+ summary: {
62
+ totalIssues: 0,
63
+ totalFiles: 0,
64
+ toolsRun: [],
65
+ executionTime: 0
66
+ }
67
+ };
68
+ for (const toolName of requestedTools) {
69
+ let provider = ToolRegistry.find(toolName);
70
+ if (!provider) {
71
+ const packageName = TOOL_PACKAGE_MAP[toolName] || (toolName.startsWith("@aiready/") ? toolName : `@aiready/${toolName}`);
72
+ try {
73
+ await import(packageName);
74
+ provider = ToolRegistry.find(toolName);
75
+ if (provider) {
76
+ console.log(
77
+ `\u2705 Successfully loaded tool provider: ${toolName} from ${packageName}`
78
+ );
79
+ } else {
80
+ console.log(
81
+ `\u26A0\uFE0F Loaded ${packageName} but provider ${toolName} still not found in registry.`
82
+ );
83
+ }
84
+ } catch (err) {
85
+ console.log(
86
+ `\u274C Failed to dynamically load tool ${toolName} (${packageName}):`,
87
+ err.message
88
+ );
89
+ }
90
+ }
91
+ if (!provider) {
92
+ console.warn(
93
+ `\u26A0\uFE0F Warning: Tool provider for '${toolName}' not found. Skipping.`
94
+ );
95
+ continue;
96
+ }
97
+ try {
98
+ const output = await provider.analyze({
99
+ ...options,
100
+ onProgress: (processed, total, message) => {
101
+ if (options.progressCallback) {
102
+ options.progressCallback({
103
+ tool: provider.id,
104
+ processed,
105
+ total,
106
+ message
107
+ });
108
+ }
109
+ }
110
+ });
111
+ if (options.progressCallback) {
112
+ options.progressCallback({ tool: provider.id, data: output });
113
+ }
114
+ result[provider.id] = output;
115
+ result.summary.toolsRun.push(provider.id);
116
+ const toolFiles = output.summary?.totalFiles || output.summary?.filesAnalyzed || 0;
117
+ if (toolFiles > result.summary.totalFiles) {
118
+ result.summary.totalFiles = toolFiles;
119
+ }
120
+ const issueCount = output.results.reduce(
121
+ (sum, file) => sum + (file.issues?.length || 0),
122
+ 0
123
+ );
124
+ result.summary.totalIssues += issueCount;
125
+ if (provider.alias && Array.isArray(provider.alias)) {
126
+ for (const alias of provider.alias) {
127
+ if (!result[alias]) {
128
+ result[alias] = output;
129
+ }
130
+ }
131
+ }
132
+ const camelCaseId = provider.id.replace(
133
+ /-([a-z])/g,
134
+ (g) => g[1].toUpperCase()
135
+ );
136
+ if (camelCaseId !== provider.id && !result[camelCaseId]) {
137
+ result[camelCaseId] = output;
138
+ }
139
+ } catch (err) {
140
+ console.error(`\u274C Error running tool '${provider.id}':`, err);
141
+ }
142
+ }
143
+ result.summary.executionTime = Date.now() - startTime;
144
+ return result;
145
+ }
146
+ async function scoreUnified(results, options) {
147
+ const toolScores = /* @__PURE__ */ new Map();
148
+ for (const toolId of results.summary.toolsRun) {
149
+ const provider = ToolRegistry.get(toolId);
150
+ if (!provider) continue;
151
+ const output = results[toolId];
152
+ if (!output) continue;
153
+ try {
154
+ const toolScore = provider.score(output, options);
155
+ if (!toolScore.tokenBudget) {
156
+ if (toolId === ToolName.PatternDetect && output.duplicates) {
157
+ const wastedTokens = output.duplicates.reduce(
158
+ (sum, d) => sum + (d.tokenCost || 0),
159
+ 0
160
+ );
161
+ toolScore.tokenBudget = calculateTokenBudget({
162
+ totalContextTokens: wastedTokens * 2,
163
+ wastedTokens: {
164
+ duplication: wastedTokens,
165
+ fragmentation: 0,
166
+ chattiness: 0
167
+ }
168
+ });
169
+ } else if (toolId === ToolName.ContextAnalyzer && output.summary) {
170
+ toolScore.tokenBudget = calculateTokenBudget({
171
+ totalContextTokens: output.summary.totalTokens,
172
+ wastedTokens: {
173
+ duplication: 0,
174
+ fragmentation: output.summary.totalPotentialSavings || 0,
175
+ chattiness: 0
176
+ }
177
+ });
178
+ }
179
+ }
180
+ toolScores.set(toolId, toolScore);
181
+ } catch (err) {
182
+ console.error(`\u274C Error scoring tool '${toolId}':`, err);
183
+ }
184
+ }
185
+ if (toolScores.size === 0) {
186
+ return {
187
+ overall: 0,
188
+ rating: "Critical",
189
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
190
+ toolsUsed: [],
191
+ breakdown: [],
192
+ calculation: {
193
+ formula: "0 / 0 = 0",
194
+ weights: {},
195
+ normalized: "0 / 0 = 0"
196
+ }
197
+ };
198
+ }
199
+ return calculateOverallScore(toolScores, options, void 0);
200
+ }
201
+ function generateUnifiedSummary(result) {
202
+ const { summary } = result;
203
+ let output = `\u{1F680} AIReady Analysis Complete
204
+
205
+ `;
206
+ output += `\u{1F4CA} Summary:
207
+ `;
208
+ output += ` Tools run: ${summary.toolsRun.join(", ")}
209
+ `;
210
+ output += ` Total issues found: ${summary.totalIssues}
211
+ `;
212
+ output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
213
+
214
+ `;
215
+ for (const provider of ToolRegistry.getAll()) {
216
+ const toolResult = result[provider.id];
217
+ if (toolResult) {
218
+ const issueCount = toolResult.results.reduce(
219
+ (sum, r) => sum + (r.issues?.length || 0),
220
+ 0
221
+ );
222
+ output += `\u2022 ${provider.id}: ${issueCount} issues
223
+ `;
224
+ }
225
+ }
226
+ return output;
227
+ }
228
+
229
+ export {
230
+ __require,
231
+ analyzeUnified,
232
+ scoreUnified,
233
+ generateUnifiedSummary
234
+ };
package/dist/cli.js CHANGED
@@ -85,6 +85,7 @@ async function analyzeUnified(options) {
85
85
  const result = {
86
86
  summary: {
87
87
  totalIssues: 0,
88
+ totalFiles: 0,
88
89
  toolsRun: [],
89
90
  executionTime: 0
90
91
  }
@@ -137,6 +138,10 @@ async function analyzeUnified(options) {
137
138
  }
138
139
  result[provider.id] = output;
139
140
  result.summary.toolsRun.push(provider.id);
141
+ const toolFiles = output.summary?.totalFiles || output.summary?.filesAnalyzed || 0;
142
+ if (toolFiles > result.summary.totalFiles) {
143
+ result.summary.totalFiles = toolFiles;
144
+ }
140
145
  const issueCount = output.results.reduce(
141
146
  (sum, file) => sum + (file.issues?.length || 0),
142
147
  0
package/dist/cli.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  __require,
4
4
  analyzeUnified,
5
5
  scoreUnified
6
- } from "./chunk-LTUQDJPO.mjs";
6
+ } from "./chunk-7K3CNS6C.mjs";
7
7
 
8
8
  // src/cli.ts
9
9
  import { Command } from "commander";
package/dist/index.js CHANGED
@@ -74,6 +74,7 @@ async function analyzeUnified(options) {
74
74
  const result = {
75
75
  summary: {
76
76
  totalIssues: 0,
77
+ totalFiles: 0,
77
78
  toolsRun: [],
78
79
  executionTime: 0
79
80
  }
@@ -126,6 +127,10 @@ async function analyzeUnified(options) {
126
127
  }
127
128
  result[provider.id] = output;
128
129
  result.summary.toolsRun.push(provider.id);
130
+ const toolFiles = output.summary?.totalFiles || output.summary?.filesAnalyzed || 0;
131
+ if (toolFiles > result.summary.totalFiles) {
132
+ result.summary.totalFiles = toolFiles;
133
+ }
129
134
  const issueCount = output.results.reduce(
130
135
  (sum, file) => sum + (file.issues?.length || 0),
131
136
  0
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  analyzeUnified,
3
3
  generateUnifiedSummary,
4
4
  scoreUnified
5
- } from "./chunk-LTUQDJPO.mjs";
5
+ } from "./chunk-7K3CNS6C.mjs";
6
6
  export {
7
7
  analyzeUnified,
8
8
  generateUnifiedSummary,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/cli",
3
- "version": "0.12.1",
3
+ "version": "0.12.4",
4
4
  "description": "Unified CLI for AIReady analysis tools",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -11,17 +11,17 @@
11
11
  "dependencies": {
12
12
  "chalk": "^5.3.0",
13
13
  "commander": "^14.0.0",
14
- "@aiready/agent-grounding": "0.11.1",
15
- "@aiready/consistency": "0.18.1",
16
- "@aiready/context-analyzer": "0.19.1",
17
- "@aiready/deps": "0.11.1",
18
- "@aiready/core": "0.21.1",
19
- "@aiready/testability": "0.4.1",
20
- "@aiready/pattern-detect": "0.14.1",
21
- "@aiready/visualizer": "0.4.1",
22
- "@aiready/change-amplification": "0.11.1",
23
- "@aiready/ai-signal-clarity": "0.11.1",
24
- "@aiready/doc-drift": "0.11.1"
14
+ "@aiready/agent-grounding": "0.11.4",
15
+ "@aiready/consistency": "0.18.4",
16
+ "@aiready/context-analyzer": "0.19.4",
17
+ "@aiready/core": "0.21.4",
18
+ "@aiready/deps": "0.11.4",
19
+ "@aiready/doc-drift": "0.11.4",
20
+ "@aiready/ai-signal-clarity": "0.11.4",
21
+ "@aiready/pattern-detect": "0.14.4",
22
+ "@aiready/change-amplification": "0.11.4",
23
+ "@aiready/visualizer": "0.4.4",
24
+ "@aiready/testability": "0.4.4"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/node": "^24.0.0",