@aiready/cli 0.10.4 → 0.12.0
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 +7 -7
- package/.turbo/turbo-lint.log +9 -1
- package/.turbo/turbo-test.log +16 -4
- package/dist/chunk-N56YAZVN.mjs +194 -0
- package/dist/chunk-YBZKPKW3.mjs +161 -0
- package/dist/cli.js +198 -892
- package/dist/cli.mjs +87 -582
- package/dist/index.js +116 -353
- package/dist/index.mjs +1 -1
- package/package.json +12 -12
- package/src/.aiready/aiready-report-20260306-213155.json +24657 -0
- package/src/.aiready/aiready-report-20260306-213925.json +24657 -0
- package/src/.aiready/aiready-report-20260307-092852.json +50609 -0
- package/src/.aiready/aiready-report-20260307-094301.json +50609 -0
- package/src/__tests__/cli.test.ts +55 -29
- package/src/commands/scan.ts +108 -698
- package/src/index.ts +154 -436
- package/dist/chunk-EQ2HQSTJ.mjs +0 -414
- package/dist/chunk-R3O7QPKD.mjs +0 -419
- package/dist/chunk-VUCNUYI7.mjs +0 -417
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/cli@0.
|
|
3
|
+
> @aiready/cli@0.11.0 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
|
-
[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]
|
|
13
|
+
[90m[[90m9:32:48 AM[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:25:31:
|
|
16
16
|
[37m 25 │ return dirname(fileURLToPath([32mimport.meta[37m.url));
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
[32mCJS[39m [1mdist/cli.js [22m[32m93.97 KB[39m
|
|
24
|
-
[32mCJS[39m [1mdist/index.js [22m[32m15.13 KB[39m
|
|
25
|
-
[32mCJS[39m ⚡️ Build success in 29ms
|
|
26
23
|
[32mESM[39m [1mdist/index.mjs [22m[32m170.00 B[39m
|
|
27
|
-
[32mESM[39m [1mdist/cli.mjs [22m[
|
|
28
|
-
[32mESM[39m [1mdist/chunk-
|
|
24
|
+
[32mESM[39m [1mdist/cli.mjs [22m[32m56.63 KB[39m
|
|
25
|
+
[32mESM[39m [1mdist/chunk-N56YAZVN.mjs [22m[32m5.89 KB[39m
|
|
29
26
|
[32mESM[39m ⚡️ Build success in 29ms
|
|
27
|
+
[32mCJS[39m [1mdist/index.js [22m[32m6.76 KB[39m
|
|
28
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m65.35 KB[39m
|
|
29
|
+
[32mCJS[39m ⚡️ Build success in 29ms
|
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/cli@0.
|
|
3
|
+
> @aiready/cli@0.10.6 lint /Users/pengcao/projects/aiready/packages/cli
|
|
4
4
|
> eslint src
|
|
5
5
|
|
|
6
|
+
[0m
|
|
7
|
+
[4m/Users/pengcao/projects/aiready/packages/cli/src/commands/scan.ts[24m
|
|
8
|
+
[2m15:3[22m [33mwarning[39m 'calculateOverallScore' is defined but never used [2m@typescript-eslint/no-unused-vars[22m
|
|
9
|
+
[2m23:3[22m [33mwarning[39m 'parseWeightString' is defined but never used [2m@typescript-eslint/no-unused-vars[22m
|
|
10
|
+
[2m28:8[22m [33mwarning[39m 'ToolScoringOutput' is defined but never used [2m@typescript-eslint/no-unused-vars[22m
|
|
11
|
+
|
|
12
|
+
[33m[1m✖ 3 problems (0 errors, 3 warnings)[22m[39m
|
|
13
|
+
[0m
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/cli@0.
|
|
3
|
+
> @aiready/cli@0.11.0 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
|
-
|
|
9
|
+
[90mstdout[2m | src/__tests__/cli.test.ts[2m > [22m[2mCLI Unified Analysis[2m > [22m[2mshould run unified analysis with both tools
|
|
10
|
+
[22m[39m[ToolRegistry#0.13203462306633074] Registering tool: pattern-detect (patterns)
|
|
11
|
+
[ToolRegistry#0.13203462306633074] Registering tool: context-analyzer (context)
|
|
12
|
+
|
|
13
|
+
[90mstdout[2m | src/__tests__/cli.test.ts[2m > [22m[2mCLI Unified Analysis[2m > [22m[2mshould run analysis with only patterns tool
|
|
14
|
+
[22m[39m[ToolRegistry#0.13203462306633074] Registering tool: pattern-detect (patterns)
|
|
15
|
+
[ToolRegistry#0.13203462306633074] Registering tool: context-analyzer (context)
|
|
16
|
+
|
|
17
|
+
[90mstdout[2m | src/__tests__/cli.test.ts[2m > [22m[2mCLI Unified Analysis[2m > [22m[2mshould run analysis with only context tool
|
|
18
|
+
[22m[39m[ToolRegistry#0.13203462306633074] Registering tool: pattern-detect (patterns)
|
|
19
|
+
[ToolRegistry#0.13203462306633074] Registering tool: context-analyzer (context)
|
|
20
|
+
|
|
21
|
+
[32m✓[39m src/__tests__/cli.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
10
22
|
|
|
11
23
|
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
12
24
|
[2m Tests [22m [1m[32m3 passed[39m[22m[90m (3)[39m
|
|
13
|
-
[2m Start at [22m
|
|
14
|
-
[2m Duration [22m
|
|
25
|
+
[2m Start at [22m 09:33:05
|
|
26
|
+
[2m Duration [22m 352ms[2m (transform 64ms, setup 0ms, import 238ms, tests 4ms, environment 0ms)[22m
|
|
15
27
|
|
|
16
28
|
[?25h
|
|
@@ -0,0 +1,194 @@
|
|
|
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
|
+
var TOOL_PACKAGE_MAP = {
|
|
16
|
+
[ToolName.PatternDetect]: "@aiready/pattern-detect",
|
|
17
|
+
[ToolName.ContextAnalyzer]: "@aiready/context-analyzer",
|
|
18
|
+
[ToolName.NamingConsistency]: "@aiready/consistency",
|
|
19
|
+
[ToolName.AiSignalClarity]: "@aiready/ai-signal-clarity",
|
|
20
|
+
[ToolName.AgentGrounding]: "@aiready/agent-grounding",
|
|
21
|
+
[ToolName.TestabilityIndex]: "@aiready/testability",
|
|
22
|
+
[ToolName.DocDrift]: "@aiready/doc-drift",
|
|
23
|
+
[ToolName.DependencyHealth]: "@aiready/deps",
|
|
24
|
+
[ToolName.ChangeAmplification]: "@aiready/change-amplification",
|
|
25
|
+
// Aliases handled by registry
|
|
26
|
+
patterns: "@aiready/pattern-detect",
|
|
27
|
+
context: "@aiready/context-analyzer",
|
|
28
|
+
consistency: "@aiready/consistency"
|
|
29
|
+
};
|
|
30
|
+
async function analyzeUnified(options) {
|
|
31
|
+
const startTime = Date.now();
|
|
32
|
+
const requestedTools = options.tools || [
|
|
33
|
+
"patterns",
|
|
34
|
+
"context",
|
|
35
|
+
"consistency"
|
|
36
|
+
];
|
|
37
|
+
const result = {
|
|
38
|
+
summary: {
|
|
39
|
+
totalIssues: 0,
|
|
40
|
+
toolsRun: [],
|
|
41
|
+
executionTime: 0
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
for (const toolName of requestedTools) {
|
|
45
|
+
let provider = ToolRegistry.find(toolName);
|
|
46
|
+
if (!provider) {
|
|
47
|
+
const packageName = TOOL_PACKAGE_MAP[toolName] || (toolName.startsWith("@aiready/") ? toolName : `@aiready/${toolName}`);
|
|
48
|
+
try {
|
|
49
|
+
await import(packageName);
|
|
50
|
+
provider = ToolRegistry.find(toolName);
|
|
51
|
+
if (provider) {
|
|
52
|
+
console.log(
|
|
53
|
+
`\u2705 Successfully loaded tool provider: ${toolName} from ${packageName}`
|
|
54
|
+
);
|
|
55
|
+
} else {
|
|
56
|
+
console.log(
|
|
57
|
+
`\u26A0\uFE0F Loaded ${packageName} but provider ${toolName} still not found in registry.`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
} catch (err) {
|
|
61
|
+
console.log(
|
|
62
|
+
`\u274C Failed to dynamically load tool ${toolName} (${packageName}):`,
|
|
63
|
+
err.message
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (!provider) {
|
|
68
|
+
console.warn(
|
|
69
|
+
`\u26A0\uFE0F Warning: Tool provider for '${toolName}' not found. Skipping.`
|
|
70
|
+
);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
const output = await provider.analyze(options);
|
|
75
|
+
if (options.progressCallback) {
|
|
76
|
+
options.progressCallback({ tool: provider.id, data: output });
|
|
77
|
+
}
|
|
78
|
+
result[provider.id] = output;
|
|
79
|
+
result.summary.toolsRun.push(provider.id);
|
|
80
|
+
const issueCount = output.results.reduce(
|
|
81
|
+
(sum, file) => sum + (file.issues?.length || 0),
|
|
82
|
+
0
|
|
83
|
+
);
|
|
84
|
+
result.summary.totalIssues += issueCount;
|
|
85
|
+
if (provider.alias && Array.isArray(provider.alias)) {
|
|
86
|
+
for (const alias of provider.alias) {
|
|
87
|
+
if (!result[alias]) {
|
|
88
|
+
result[alias] = output;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const camelCaseId = provider.id.replace(
|
|
93
|
+
/-([a-z])/g,
|
|
94
|
+
(g) => g[1].toUpperCase()
|
|
95
|
+
);
|
|
96
|
+
if (camelCaseId !== provider.id && !result[camelCaseId]) {
|
|
97
|
+
result[camelCaseId] = output;
|
|
98
|
+
}
|
|
99
|
+
} catch (err) {
|
|
100
|
+
console.error(`\u274C Error running tool '${provider.id}':`, err);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
result.summary.executionTime = Date.now() - startTime;
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
async function scoreUnified(results, options) {
|
|
107
|
+
const toolScores = /* @__PURE__ */ new Map();
|
|
108
|
+
for (const toolId of results.summary.toolsRun) {
|
|
109
|
+
const provider = ToolRegistry.get(toolId);
|
|
110
|
+
if (!provider) continue;
|
|
111
|
+
const output = results[toolId];
|
|
112
|
+
if (!output) continue;
|
|
113
|
+
try {
|
|
114
|
+
const toolScore = provider.score(output, options);
|
|
115
|
+
if (!toolScore.tokenBudget) {
|
|
116
|
+
if (toolId === ToolName.PatternDetect && output.duplicates) {
|
|
117
|
+
const wastedTokens = output.duplicates.reduce(
|
|
118
|
+
(sum, d) => sum + (d.tokenCost || 0),
|
|
119
|
+
0
|
|
120
|
+
);
|
|
121
|
+
toolScore.tokenBudget = calculateTokenBudget({
|
|
122
|
+
totalContextTokens: wastedTokens * 2,
|
|
123
|
+
wastedTokens: {
|
|
124
|
+
duplication: wastedTokens,
|
|
125
|
+
fragmentation: 0,
|
|
126
|
+
chattiness: 0
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
} else if (toolId === ToolName.ContextAnalyzer && output.summary) {
|
|
130
|
+
toolScore.tokenBudget = calculateTokenBudget({
|
|
131
|
+
totalContextTokens: output.summary.totalTokens,
|
|
132
|
+
wastedTokens: {
|
|
133
|
+
duplication: 0,
|
|
134
|
+
fragmentation: output.summary.totalPotentialSavings || 0,
|
|
135
|
+
chattiness: 0
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
toolScores.set(toolId, toolScore);
|
|
141
|
+
} catch (err) {
|
|
142
|
+
console.error(`\u274C Error scoring tool '${toolId}':`, err);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (toolScores.size === 0) {
|
|
146
|
+
return {
|
|
147
|
+
overall: 0,
|
|
148
|
+
rating: "Critical",
|
|
149
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
150
|
+
toolsUsed: [],
|
|
151
|
+
breakdown: [],
|
|
152
|
+
calculation: {
|
|
153
|
+
formula: "0 / 0 = 0",
|
|
154
|
+
weights: {},
|
|
155
|
+
normalized: "0 / 0 = 0"
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return calculateOverallScore(toolScores, options, void 0);
|
|
160
|
+
}
|
|
161
|
+
function generateUnifiedSummary(result) {
|
|
162
|
+
const { summary } = result;
|
|
163
|
+
let output = `\u{1F680} AIReady Analysis Complete
|
|
164
|
+
|
|
165
|
+
`;
|
|
166
|
+
output += `\u{1F4CA} Summary:
|
|
167
|
+
`;
|
|
168
|
+
output += ` Tools run: ${summary.toolsRun.join(", ")}
|
|
169
|
+
`;
|
|
170
|
+
output += ` Total issues found: ${summary.totalIssues}
|
|
171
|
+
`;
|
|
172
|
+
output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
|
|
173
|
+
|
|
174
|
+
`;
|
|
175
|
+
for (const provider of ToolRegistry.getAll()) {
|
|
176
|
+
const toolResult = result[provider.id];
|
|
177
|
+
if (toolResult) {
|
|
178
|
+
const issueCount = toolResult.results.reduce(
|
|
179
|
+
(sum, r) => sum + (r.issues?.length || 0),
|
|
180
|
+
0
|
|
181
|
+
);
|
|
182
|
+
output += `\u2022 ${provider.id}: ${issueCount} issues
|
|
183
|
+
`;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return output;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export {
|
|
190
|
+
__require,
|
|
191
|
+
analyzeUnified,
|
|
192
|
+
scoreUnified,
|
|
193
|
+
generateUnifiedSummary
|
|
194
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
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
|
+
var TOOL_PACKAGE_MAP = {
|
|
16
|
+
[ToolName.PatternDetect]: "@aiready/pattern-detect",
|
|
17
|
+
[ToolName.ContextAnalyzer]: "@aiready/context-analyzer",
|
|
18
|
+
[ToolName.NamingConsistency]: "@aiready/consistency",
|
|
19
|
+
[ToolName.AiSignalClarity]: "@aiready/ai-signal-clarity",
|
|
20
|
+
[ToolName.AgentGrounding]: "@aiready/agent-grounding",
|
|
21
|
+
[ToolName.TestabilityIndex]: "@aiready/testability",
|
|
22
|
+
[ToolName.DocDrift]: "@aiready/doc-drift",
|
|
23
|
+
[ToolName.DependencyHealth]: "@aiready/deps",
|
|
24
|
+
[ToolName.ChangeAmplification]: "@aiready/change-amplification",
|
|
25
|
+
// Aliases handled by registry
|
|
26
|
+
"patterns": "@aiready/pattern-detect",
|
|
27
|
+
"context": "@aiready/context-analyzer",
|
|
28
|
+
"consistency": "@aiready/consistency"
|
|
29
|
+
};
|
|
30
|
+
async function analyzeUnified(options) {
|
|
31
|
+
const startTime = Date.now();
|
|
32
|
+
const requestedTools = options.tools || ["patterns", "context", "consistency"];
|
|
33
|
+
const result = {
|
|
34
|
+
summary: {
|
|
35
|
+
totalIssues: 0,
|
|
36
|
+
toolsRun: [],
|
|
37
|
+
executionTime: 0
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
for (const toolName of requestedTools) {
|
|
41
|
+
let provider = ToolRegistry.find(toolName);
|
|
42
|
+
if (!provider) {
|
|
43
|
+
const packageName = TOOL_PACKAGE_MAP[toolName] || (toolName.startsWith("@aiready/") ? toolName : `@aiready/${toolName}`);
|
|
44
|
+
try {
|
|
45
|
+
await import(packageName);
|
|
46
|
+
provider = ToolRegistry.find(toolName);
|
|
47
|
+
if (provider) {
|
|
48
|
+
console.log(`\u2705 Successfully loaded tool provider: ${toolName} from ${packageName}`);
|
|
49
|
+
} else {
|
|
50
|
+
console.log(`\u26A0\uFE0F Loaded ${packageName} but provider ${toolName} still not found in registry.`);
|
|
51
|
+
}
|
|
52
|
+
} catch (err) {
|
|
53
|
+
console.log(`\u274C Failed to dynamically load tool ${toolName} (${packageName}):`, err.message);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (!provider) {
|
|
57
|
+
console.warn(`\u26A0\uFE0F Warning: Tool provider for '${toolName}' not found. Skipping.`);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
const output = await provider.analyze(options);
|
|
62
|
+
if (options.progressCallback) {
|
|
63
|
+
options.progressCallback({ tool: provider.id, data: output });
|
|
64
|
+
}
|
|
65
|
+
result[provider.id] = output;
|
|
66
|
+
result.summary.toolsRun.push(provider.id);
|
|
67
|
+
const issueCount = output.results.reduce(
|
|
68
|
+
(sum, file) => sum + (file.issues?.length || 0),
|
|
69
|
+
0
|
|
70
|
+
);
|
|
71
|
+
result.summary.totalIssues += issueCount;
|
|
72
|
+
if (provider.id === ToolName.PatternDetect) result.patternDetect = output;
|
|
73
|
+
if (provider.id === ToolName.ContextAnalyzer) result.contextAnalyzer = output;
|
|
74
|
+
} catch (err) {
|
|
75
|
+
console.error(`\u274C Error running tool '${provider.id}':`, err);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
result.summary.executionTime = Date.now() - startTime;
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
async function scoreUnified(results, options) {
|
|
82
|
+
const toolScores = /* @__PURE__ */ new Map();
|
|
83
|
+
for (const toolId of results.summary.toolsRun) {
|
|
84
|
+
const provider = ToolRegistry.get(toolId);
|
|
85
|
+
if (!provider) continue;
|
|
86
|
+
const output = results[toolId];
|
|
87
|
+
if (!output) continue;
|
|
88
|
+
try {
|
|
89
|
+
const toolScore = provider.score(output, options);
|
|
90
|
+
if (!toolScore.tokenBudget) {
|
|
91
|
+
if (toolId === ToolName.PatternDetect && output.duplicates) {
|
|
92
|
+
const wastedTokens = output.duplicates.reduce(
|
|
93
|
+
(sum, d) => sum + (d.tokenCost || 0),
|
|
94
|
+
0
|
|
95
|
+
);
|
|
96
|
+
toolScore.tokenBudget = calculateTokenBudget({
|
|
97
|
+
totalContextTokens: wastedTokens * 2,
|
|
98
|
+
wastedTokens: { duplication: wastedTokens, fragmentation: 0, chattiness: 0 }
|
|
99
|
+
});
|
|
100
|
+
} else if (toolId === ToolName.ContextAnalyzer && output.summary) {
|
|
101
|
+
toolScore.tokenBudget = calculateTokenBudget({
|
|
102
|
+
totalContextTokens: output.summary.totalTokens,
|
|
103
|
+
wastedTokens: { duplication: 0, fragmentation: output.summary.totalPotentialSavings || 0, chattiness: 0 }
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
toolScores.set(toolId, toolScore);
|
|
108
|
+
} catch (err) {
|
|
109
|
+
console.error(`\u274C Error scoring tool '${toolId}':`, err);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (toolScores.size === 0) {
|
|
113
|
+
return {
|
|
114
|
+
overall: 0,
|
|
115
|
+
rating: "Critical",
|
|
116
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
117
|
+
toolsUsed: [],
|
|
118
|
+
breakdown: [],
|
|
119
|
+
calculation: {
|
|
120
|
+
formula: "0 / 0 = 0",
|
|
121
|
+
weights: {},
|
|
122
|
+
normalized: "0 / 0 = 0"
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
return calculateOverallScore(toolScores, options, void 0);
|
|
127
|
+
}
|
|
128
|
+
function generateUnifiedSummary(result) {
|
|
129
|
+
const { summary } = result;
|
|
130
|
+
let output = `\u{1F680} AIReady Analysis Complete
|
|
131
|
+
|
|
132
|
+
`;
|
|
133
|
+
output += `\u{1F4CA} Summary:
|
|
134
|
+
`;
|
|
135
|
+
output += ` Tools run: ${summary.toolsRun.join(", ")}
|
|
136
|
+
`;
|
|
137
|
+
output += ` Total issues found: ${summary.totalIssues}
|
|
138
|
+
`;
|
|
139
|
+
output += ` Execution time: ${(summary.executionTime / 1e3).toFixed(2)}s
|
|
140
|
+
|
|
141
|
+
`;
|
|
142
|
+
for (const provider of ToolRegistry.getAll()) {
|
|
143
|
+
const toolResult = result[provider.id];
|
|
144
|
+
if (toolResult) {
|
|
145
|
+
const issueCount = toolResult.results.reduce(
|
|
146
|
+
(sum, r) => sum + (r.issues?.length || 0),
|
|
147
|
+
0
|
|
148
|
+
);
|
|
149
|
+
output += `\u2022 ${provider.id}: ${issueCount} issues
|
|
150
|
+
`;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return output;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export {
|
|
157
|
+
__require,
|
|
158
|
+
analyzeUnified,
|
|
159
|
+
scoreUnified,
|
|
160
|
+
generateUnifiedSummary
|
|
161
|
+
};
|