@aiready/cli 0.14.6 → 0.14.8

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,250 +0,0 @@
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
- "ai-signal": "@aiready/ai-signal-clarity",
41
- grounding: "@aiready/agent-grounding",
42
- testability: "@aiready/testability",
43
- "deps-health": "@aiready/deps",
44
- "change-amp": "@aiready/change-amplification"
45
- };
46
- async function analyzeUnified(options) {
47
- const startTime = Date.now();
48
- const requestedTools = options.tools || [
49
- "patterns",
50
- "context",
51
- "consistency"
52
- ];
53
- const result = {
54
- summary: {
55
- totalIssues: 0,
56
- criticalIssues: 0,
57
- // Added as per instruction
58
- majorIssues: 0,
59
- // Added as per instruction
60
- totalFiles: 0,
61
- toolsRun: [],
62
- executionTime: 0,
63
- config: options,
64
- toolConfigs: {}
65
- }
66
- };
67
- for (const toolName of requestedTools) {
68
- let provider = ToolRegistry.find(toolName);
69
- if (!provider) {
70
- const packageName = TOOL_PACKAGE_MAP[toolName] || (toolName.startsWith("@aiready/") ? toolName : `@aiready/${toolName}`);
71
- try {
72
- await import(packageName);
73
- provider = ToolRegistry.find(toolName);
74
- if (provider) {
75
- console.log(
76
- `\u2705 Successfully loaded tool provider: ${toolName} from ${packageName}`
77
- );
78
- } else {
79
- console.log(
80
- `\u26A0\uFE0F Loaded ${packageName} but provider ${toolName} still not found in registry.`
81
- );
82
- }
83
- } catch (err) {
84
- console.log(
85
- `\u274C Failed to dynamically load tool ${toolName} (${packageName}):`,
86
- err.message
87
- );
88
- }
89
- }
90
- if (!provider) {
91
- console.warn(
92
- `\u26A0\uFE0F Warning: Tool provider for '${toolName}' not found. Skipping.`
93
- );
94
- continue;
95
- }
96
- try {
97
- const sanitizedConfig = { ...options };
98
- delete sanitizedConfig.onProgress;
99
- delete sanitizedConfig.progressCallback;
100
- const toolOptions = {
101
- ...options,
102
- ...options.toolConfigs?.[provider.id] || {},
103
- onProgress: (processed, total, message) => {
104
- if (options.progressCallback) {
105
- options.progressCallback({
106
- tool: provider.id,
107
- processed,
108
- total,
109
- message
110
- });
111
- }
112
- }
113
- };
114
- const output = await provider.analyze(toolOptions);
115
- if (output.metadata) {
116
- output.metadata.config = sanitizedConfig;
117
- }
118
- if (options.progressCallback) {
119
- options.progressCallback({ tool: provider.id, data: output });
120
- }
121
- result[provider.id] = output;
122
- result.summary.toolsRun.push(provider.id);
123
- if (output.summary?.config) {
124
- result.summary.toolConfigs[provider.id] = output.summary.config;
125
- } else if (output.metadata?.config) {
126
- result.summary.toolConfigs[provider.id] = output.metadata.config;
127
- }
128
- const toolFiles = output.summary?.totalFiles || output.summary?.filesAnalyzed || 0;
129
- if (toolFiles > result.summary.totalFiles) {
130
- result.summary.totalFiles = toolFiles;
131
- }
132
- const issueCount = output.results.reduce(
133
- (sum, file) => sum + (file.issues?.length || 0),
134
- 0
135
- );
136
- result.summary.totalIssues += issueCount;
137
- if (provider.alias && Array.isArray(provider.alias)) {
138
- for (const alias of provider.alias) {
139
- if (!result[alias]) {
140
- result[alias] = output;
141
- }
142
- }
143
- }
144
- const camelCaseId = provider.id.replace(
145
- /-([a-z])/g,
146
- (g) => g[1].toUpperCase()
147
- );
148
- if (camelCaseId !== provider.id && !result[camelCaseId]) {
149
- result[camelCaseId] = output;
150
- }
151
- } catch (err) {
152
- console.error(`\u274C Error running tool '${provider.id}':`, err);
153
- }
154
- }
155
- result.summary.config = {
156
- ...options,
157
- toolConfigs: result.summary.toolConfigs
158
- };
159
- result.summary.executionTime = Date.now() - startTime;
160
- return result;
161
- }
162
- async function scoreUnified(results, options) {
163
- const toolScores = /* @__PURE__ */ new Map();
164
- for (const toolId of results.summary.toolsRun) {
165
- const provider = ToolRegistry.get(toolId);
166
- if (!provider) continue;
167
- const output = results[toolId];
168
- if (!output) continue;
169
- try {
170
- const toolScore = provider.score(output, options);
171
- if (!toolScore.tokenBudget) {
172
- if (toolId === ToolName.PatternDetect && output.duplicates) {
173
- const wastedTokens = output.duplicates.reduce(
174
- (sum, d) => sum + (d.tokenCost || 0),
175
- 0
176
- );
177
- toolScore.tokenBudget = calculateTokenBudget({
178
- totalContextTokens: wastedTokens * 2,
179
- wastedTokens: {
180
- duplication: wastedTokens,
181
- fragmentation: 0,
182
- chattiness: 0
183
- }
184
- });
185
- } else if (toolId === ToolName.ContextAnalyzer && output.summary) {
186
- toolScore.tokenBudget = calculateTokenBudget({
187
- totalContextTokens: output.summary.totalTokens,
188
- wastedTokens: {
189
- duplication: 0,
190
- fragmentation: output.summary.totalPotentialSavings || 0,
191
- chattiness: 0
192
- }
193
- });
194
- }
195
- }
196
- toolScores.set(toolId, toolScore);
197
- } catch (err) {
198
- console.error(`\u274C Error scoring tool '${toolId}':`, err);
199
- }
200
- }
201
- if (toolScores.size === 0) {
202
- return {
203
- overall: 0,
204
- rating: "Critical",
205
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
206
- toolsUsed: [],
207
- breakdown: [],
208
- calculation: {
209
- formula: "0 / 0 = 0",
210
- weights: {},
211
- normalized: "0 / 0 = 0"
212
- }
213
- };
214
- }
215
- return calculateOverallScore(toolScores, options, void 0);
216
- }
217
- function generateUnifiedSummary(result) {
218
- const { summary } = result;
219
- let output = `\u{1F680} AIReady Analysis Complete
220
-
221
- `;
222
- output += `\u{1F4CA} Summary:
223
- `;
224
- output += ` Tools run: ${summary.toolsRun.join(", ")}
225
- `;
226
- output += ` Total issues found: ${summary.totalIssues}
227
- `;
228
- output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
229
-
230
- `;
231
- for (const provider of ToolRegistry.getAll()) {
232
- const toolResult = result[provider.id];
233
- if (toolResult) {
234
- const issueCount = toolResult.results.reduce(
235
- (sum, r) => sum + (r.issues?.length || 0),
236
- 0
237
- );
238
- output += `\u2022 ${provider.id}: ${issueCount} issues
239
- `;
240
- }
241
- }
242
- return output;
243
- }
244
-
245
- export {
246
- __require,
247
- analyzeUnified,
248
- scoreUnified,
249
- generateUnifiedSummary
250
- };
@@ -1,239 +0,0 @@
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
- "ai-signal": "@aiready/ai-signal-clarity",
41
- grounding: "@aiready/agent-grounding",
42
- testability: "@aiready/testability",
43
- "deps-health": "@aiready/deps",
44
- "change-amp": "@aiready/change-amplification"
45
- };
46
- async function analyzeUnified(options) {
47
- const startTime = Date.now();
48
- const requestedTools = options.tools || [
49
- "patterns",
50
- "context",
51
- "consistency"
52
- ];
53
- const result = {
54
- summary: {
55
- totalIssues: 0,
56
- criticalIssues: 0,
57
- // Added as per instruction
58
- majorIssues: 0,
59
- // Added as per instruction
60
- totalFiles: 0,
61
- toolsRun: [],
62
- executionTime: 0,
63
- config: options
64
- // Added as per instruction
65
- }
66
- };
67
- for (const toolName of requestedTools) {
68
- let provider = ToolRegistry.find(toolName);
69
- if (!provider) {
70
- const packageName = TOOL_PACKAGE_MAP[toolName] || (toolName.startsWith("@aiready/") ? toolName : `@aiready/${toolName}`);
71
- try {
72
- await import(packageName);
73
- provider = ToolRegistry.find(toolName);
74
- if (provider) {
75
- console.log(
76
- `\u2705 Successfully loaded tool provider: ${toolName} from ${packageName}`
77
- );
78
- } else {
79
- console.log(
80
- `\u26A0\uFE0F Loaded ${packageName} but provider ${toolName} still not found in registry.`
81
- );
82
- }
83
- } catch (err) {
84
- console.log(
85
- `\u274C Failed to dynamically load tool ${toolName} (${packageName}):`,
86
- err.message
87
- );
88
- }
89
- }
90
- if (!provider) {
91
- console.warn(
92
- `\u26A0\uFE0F Warning: Tool provider for '${toolName}' not found. Skipping.`
93
- );
94
- continue;
95
- }
96
- try {
97
- const sanitizedConfig = { ...options };
98
- delete sanitizedConfig.onProgress;
99
- delete sanitizedConfig.progressCallback;
100
- const output = await provider.analyze({
101
- ...options,
102
- onProgress: (processed, total, message) => {
103
- if (options.progressCallback) {
104
- options.progressCallback({
105
- tool: provider.id,
106
- processed,
107
- total,
108
- message
109
- });
110
- }
111
- }
112
- });
113
- if (output.metadata) {
114
- output.metadata.config = sanitizedConfig;
115
- }
116
- if (options.progressCallback) {
117
- options.progressCallback({ tool: provider.id, data: output });
118
- }
119
- result[provider.id] = output;
120
- result.summary.toolsRun.push(provider.id);
121
- const toolFiles = output.summary?.totalFiles || output.summary?.filesAnalyzed || 0;
122
- if (toolFiles > result.summary.totalFiles) {
123
- result.summary.totalFiles = toolFiles;
124
- }
125
- const issueCount = output.results.reduce(
126
- (sum, file) => sum + (file.issues?.length || 0),
127
- 0
128
- );
129
- result.summary.totalIssues += issueCount;
130
- if (provider.alias && Array.isArray(provider.alias)) {
131
- for (const alias of provider.alias) {
132
- if (!result[alias]) {
133
- result[alias] = output;
134
- }
135
- }
136
- }
137
- const camelCaseId = provider.id.replace(
138
- /-([a-z])/g,
139
- (g) => g[1].toUpperCase()
140
- );
141
- if (camelCaseId !== provider.id && !result[camelCaseId]) {
142
- result[camelCaseId] = output;
143
- }
144
- } catch (err) {
145
- console.error(`\u274C Error running tool '${provider.id}':`, err);
146
- }
147
- }
148
- result.summary.executionTime = Date.now() - startTime;
149
- return result;
150
- }
151
- async function scoreUnified(results, options) {
152
- const toolScores = /* @__PURE__ */ new Map();
153
- for (const toolId of results.summary.toolsRun) {
154
- const provider = ToolRegistry.get(toolId);
155
- if (!provider) continue;
156
- const output = results[toolId];
157
- if (!output) continue;
158
- try {
159
- const toolScore = provider.score(output, options);
160
- if (!toolScore.tokenBudget) {
161
- if (toolId === ToolName.PatternDetect && output.duplicates) {
162
- const wastedTokens = output.duplicates.reduce(
163
- (sum, d) => sum + (d.tokenCost || 0),
164
- 0
165
- );
166
- toolScore.tokenBudget = calculateTokenBudget({
167
- totalContextTokens: wastedTokens * 2,
168
- wastedTokens: {
169
- duplication: wastedTokens,
170
- fragmentation: 0,
171
- chattiness: 0
172
- }
173
- });
174
- } else if (toolId === ToolName.ContextAnalyzer && output.summary) {
175
- toolScore.tokenBudget = calculateTokenBudget({
176
- totalContextTokens: output.summary.totalTokens,
177
- wastedTokens: {
178
- duplication: 0,
179
- fragmentation: output.summary.totalPotentialSavings || 0,
180
- chattiness: 0
181
- }
182
- });
183
- }
184
- }
185
- toolScores.set(toolId, toolScore);
186
- } catch (err) {
187
- console.error(`\u274C Error scoring tool '${toolId}':`, err);
188
- }
189
- }
190
- if (toolScores.size === 0) {
191
- return {
192
- overall: 0,
193
- rating: "Critical",
194
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
195
- toolsUsed: [],
196
- breakdown: [],
197
- calculation: {
198
- formula: "0 / 0 = 0",
199
- weights: {},
200
- normalized: "0 / 0 = 0"
201
- }
202
- };
203
- }
204
- return calculateOverallScore(toolScores, options, void 0);
205
- }
206
- function generateUnifiedSummary(result) {
207
- const { summary } = result;
208
- let output = `\u{1F680} AIReady Analysis Complete
209
-
210
- `;
211
- output += `\u{1F4CA} Summary:
212
- `;
213
- output += ` Tools run: ${summary.toolsRun.join(", ")}
214
- `;
215
- output += ` Total issues found: ${summary.totalIssues}
216
- `;
217
- output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
218
-
219
- `;
220
- for (const provider of ToolRegistry.getAll()) {
221
- const toolResult = result[provider.id];
222
- if (toolResult) {
223
- const issueCount = toolResult.results.reduce(
224
- (sum, r) => sum + (r.issues?.length || 0),
225
- 0
226
- );
227
- output += `\u2022 ${provider.id}: ${issueCount} issues
228
- `;
229
- }
230
- }
231
- return output;
232
- }
233
-
234
- export {
235
- __require,
236
- analyzeUnified,
237
- scoreUnified,
238
- generateUnifiedSummary
239
- };