@aiready/change-amplification 0.13.1 → 0.13.3
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 +10 -10
- package/.turbo/turbo-lint.log +10 -6
- package/.turbo/turbo-test.log +7 -53
- package/dist/cli.js +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +4 -12
- package/dist/index.d.ts +4 -12
- package/dist/index.js +21 -35
- package/dist/index.mjs +23 -36
- package/package.json +2 -2
- package/src/__tests__/cli.test.ts +0 -1
- package/src/__tests__/provider.test.ts +1 -1
- package/src/cli.ts +1 -1
- package/src/provider.ts +20 -45
- package/src/scoring.ts +5 -5
- package/src/types.ts +3 -11
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/change-amplification@0.13.
|
|
3
|
+
> @aiready/change-amplification@0.13.3 build /Users/pengcao/projects/aiready/packages/change-amplification
|
|
4
4
|
> tsup src/index.ts src/cli.ts --format cjs,esm --dts
|
|
5
5
|
|
|
6
6
|
[34mCLI[39m Building entry: src/cli.ts, src/index.ts
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
[34mCLI[39m Target: es2020
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[
|
|
13
|
-
[
|
|
12
|
+
[32mCJS[39m [1mdist/index.js [22m[32m7.93 KB[39m
|
|
13
|
+
[32mCJS[39m [1mdist/cli.js [22m[32m9.02 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 30ms
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m1.72 KB[39m
|
|
14
16
|
[32mESM[39m [1mdist/cli.mjs [22m[32m2.78 KB[39m
|
|
15
|
-
[32mESM[39m
|
|
16
|
-
[
|
|
17
|
-
[32mCJS[39m [1mdist/cli.js [22m[32m9.01 KB[39m
|
|
18
|
-
[32mCJS[39m ⚡️ Build success in 153ms
|
|
17
|
+
[32mESM[39m [1mdist/chunk-OBBL7HKE.mjs [22m[32m4.82 KB[39m
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 30ms
|
|
19
19
|
DTS Build start
|
|
20
|
-
DTS ⚡️ Build success in
|
|
20
|
+
DTS ⚡️ Build success in 1328ms
|
|
21
21
|
DTS dist/cli.d.ts 152.00 B
|
|
22
|
-
DTS dist/index.d.ts 1.
|
|
22
|
+
DTS dist/index.d.ts 1.14 KB
|
|
23
23
|
DTS dist/cli.d.mts 152.00 B
|
|
24
|
-
DTS dist/index.d.mts 1.
|
|
24
|
+
DTS dist/index.d.mts 1.14 KB
|
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
|
|
2
|
+
> @aiready/change-amplification@0.13.2 lint /Users/pengcao/projects/aiready/packages/change-amplification
|
|
3
|
+
> eslint src --ext .ts
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/Users/pengcao/projects/aiready/packages/change-amplification/src/__tests__/cli.test.ts
|
|
7
|
+
3:13 warning 'analyzer' is defined but never used @typescript-eslint/no-unused-vars
|
|
8
|
+
|
|
9
|
+
✖ 1 problem (0 errors, 1 warning)
|
|
10
|
+
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,70 +1,24 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/change-amplification@0.13.
|
|
3
|
+
> @aiready/change-amplification@0.13.2 test /Users/pengcao/projects/aiready/packages/change-amplification
|
|
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/change-amplification[39m
|
|
8
8
|
|
|
9
|
-
[
|
|
10
|
-
[1m[33m ❯ [39m[22msrc/__tests__/cli.test.ts[2m [queued][22m
|
|
11
|
-
|
|
12
|
-
[2m Test Files [22m[1m[32m0 passed[39m[22m[90m (5)[39m
|
|
13
|
-
[2m Tests [22m[1m[32m0 passed[39m[22m[90m (0)[39m
|
|
14
|
-
[2m Start at [22m17:20:12
|
|
15
|
-
[2m Duration [22m697ms
|
|
16
|
-
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K
|
|
17
|
-
[1m[33m ❯ [39m[22msrc/__tests__/analyzer.test.ts[2m [queued][22m
|
|
18
|
-
[1m[33m ❯ [39m[22msrc/__tests__/cli.test.ts[2m [queued][22m
|
|
19
|
-
[1m[33m ❯ [39m[22msrc/__tests__/provider.test.ts[2m [queued][22m
|
|
20
|
-
[1m[33m ❯ [39m[22msrc/__tests__/scoring.test.ts[2m [queued][22m
|
|
21
|
-
|
|
22
|
-
[2m Test Files [22m[1m[32m0 passed[39m[22m[90m (5)[39m
|
|
23
|
-
[2m Tests [22m[1m[32m0 passed[39m[22m[90m (0)[39m
|
|
24
|
-
[2m Start at [22m17:20:12
|
|
25
|
-
[2m Duration [22m839ms
|
|
26
|
-
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K
|
|
27
|
-
[1m[33m ❯ [39m[22msrc/__tests__/analyzer.test.ts[2m [queued][22m
|
|
28
|
-
[1m[33m ❯ [39m[22msrc/__tests__/cli.test.ts[2m 0/2[22m
|
|
29
|
-
[1m[33m ❯ [39m[22msrc/__tests__/dummy.test.ts[2m [queued][22m
|
|
30
|
-
[1m[33m ❯ [39m[22msrc/__tests__/provider.test.ts[2m [queued][22m
|
|
31
|
-
[1m[33m ❯ [39m[22msrc/__tests__/scoring.test.ts[2m [queued][22m
|
|
32
|
-
|
|
33
|
-
[2m Test Files [22m[1m[32m0 passed[39m[22m[90m (5)[39m
|
|
34
|
-
[2m Tests [22m[1m[32m0 passed[39m[22m[90m (2)[39m
|
|
35
|
-
[2m Start at [22m17:20:12
|
|
36
|
-
[2m Duration [22m1.25s
|
|
37
|
-
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K [32m✓[39m src/__tests__/dummy.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
9
|
+
[32m✓[39m src/__tests__/dummy.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 14[2mms[22m[39m
|
|
38
10
|
[32m✓[39m src/__tests__/cli.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
39
|
-
|
|
40
|
-
[1m[33m ❯ [39m[22msrc/__tests__/analyzer.test.ts[2m [queued][22m
|
|
41
|
-
[1m[33m ❯ [39m[22msrc/__tests__/provider.test.ts[2m [queued][22m
|
|
42
|
-
[1m[33m ❯ [39m[22msrc/__tests__/scoring.test.ts[2m [queued][22m
|
|
43
|
-
|
|
44
|
-
[2m Test Files [22m[1m[32m2 passed[39m[22m[90m (5)[39m
|
|
45
|
-
[2m Tests [22m[1m[32m3 passed[39m[22m[90m (3)[39m
|
|
46
|
-
[2m Start at [22m17:20:12
|
|
47
|
-
[2m Duration [22m1.97s
|
|
48
|
-
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K
|
|
49
|
-
[1m[33m ❯ [39m[22msrc/__tests__/analyzer.test.ts[2m [queued][22m
|
|
50
|
-
[1m[33m ❯ [39m[22msrc/__tests__/provider.test.ts[2m [queued][22m
|
|
51
|
-
[1m[33m ❯ [39m[22msrc/__tests__/scoring.test.ts[2m 0/2[22m
|
|
52
|
-
|
|
53
|
-
[2m Test Files [22m[1m[32m2 passed[39m[22m[90m (5)[39m
|
|
54
|
-
[2m Tests [22m[1m[32m3 passed[39m[22m[90m (5)[39m
|
|
55
|
-
[2m Start at [22m17:20:12
|
|
56
|
-
[2m Duration [22m2.18s
|
|
57
|
-
[?2026l[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K [32m✓[39m src/__tests__/scoring.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 2[2mms[22m[39m
|
|
58
11
|
[90mstdout[2m | src/__tests__/analyzer.test.ts[2m > [22m[2manalyzeChangeAmplification reproduction[2m > [22m[2mshould see how it gets to 0
|
|
59
12
|
[22m[39mResulting score for highly coupled: [33m27[39m
|
|
60
13
|
Rating: explosive
|
|
61
14
|
|
|
62
|
-
[32m✓[39m src/__tests__/analyzer.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
63
|
-
[32m✓[39m src/__tests__/provider.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
15
|
+
[32m✓[39m src/__tests__/analyzer.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
16
|
+
[32m✓[39m src/__tests__/provider.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 2[2mms[22m[39m
|
|
17
|
+
[32m✓[39m src/__tests__/scoring.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 20[2mms[22m[39m
|
|
64
18
|
|
|
65
19
|
[2m Test Files [22m [1m[32m5 passed[39m[22m[90m (5)[39m
|
|
66
20
|
[2m Tests [22m [1m[32m9 passed[39m[22m[90m (9)[39m
|
|
67
|
-
[2m Start at [22m
|
|
68
|
-
[2m Duration [22m 2.
|
|
21
|
+
[2m Start at [22m 22:20:40
|
|
22
|
+
[2m Duration [22m 2.98s[2m (transform 1.22s, setup 0ms, import 5.77s, tests 45ms, environment 0ms)[22m
|
|
69
23
|
|
|
70
24
|
[?25h
|
package/dist/cli.js
CHANGED
|
@@ -185,7 +185,7 @@ var changeAmplificationAction = async (directory, options) => {
|
|
|
185
185
|
}
|
|
186
186
|
console.log(import_chalk.default.bold("\n\u{1F310} Change Amplification Analysis\n"));
|
|
187
187
|
console.log(`Rating: ${import_chalk.default.bold(report.summary.rating)}`);
|
|
188
|
-
console.log(`Score: ${Math.round(report.summary.score)}/100`);
|
|
188
|
+
console.log(`Score: ${Math.round(report.summary.score ?? 0)}/100`);
|
|
189
189
|
console.log(`Critical Issues: ${report.summary.criticalIssues}`);
|
|
190
190
|
console.log(`Major Issues: ${report.summary.majorIssues}`);
|
|
191
191
|
if (report.summary.recommendations.length > 0) {
|
package/dist/cli.mjs
CHANGED
|
@@ -25,7 +25,7 @@ var changeAmplificationAction = async (directory, options) => {
|
|
|
25
25
|
}
|
|
26
26
|
console.log(chalk.bold("\n\u{1F310} Change Amplification Analysis\n"));
|
|
27
27
|
console.log(`Rating: ${chalk.bold(report.summary.rating)}`);
|
|
28
|
-
console.log(`Score: ${Math.round(report.summary.score)}/100`);
|
|
28
|
+
console.log(`Score: ${Math.round(report.summary.score ?? 0)}/100`);
|
|
29
29
|
console.log(`Critical Issues: ${report.summary.criticalIssues}`);
|
|
30
30
|
console.log(`Major Issues: ${report.summary.majorIssues}`);
|
|
31
31
|
if (report.summary.recommendations.length > 0) {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _aiready_core from '@aiready/core';
|
|
2
|
+
import { Issue, IssueType, ScanOptions, SpokeOutput, AnalysisResult, ToolScoringOutput } from '@aiready/core';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Change Amplification Tool Provider
|
|
5
6
|
*/
|
|
6
|
-
declare const ChangeAmplificationProvider: ToolProvider;
|
|
7
|
+
declare const ChangeAmplificationProvider: _aiready_core.ToolProvider;
|
|
7
8
|
|
|
8
9
|
type ChangeAmplificationOptions = ScanOptions;
|
|
9
10
|
interface ChangeAmplificationIssue extends Issue {
|
|
@@ -12,16 +13,7 @@ interface ChangeAmplificationIssue extends Issue {
|
|
|
12
13
|
interface FileChangeAmplificationResult extends AnalysisResult {
|
|
13
14
|
issues: ChangeAmplificationIssue[];
|
|
14
15
|
}
|
|
15
|
-
interface ChangeAmplificationReport {
|
|
16
|
-
summary: {
|
|
17
|
-
totalFiles: number;
|
|
18
|
-
totalIssues: number;
|
|
19
|
-
criticalIssues: number;
|
|
20
|
-
majorIssues: number;
|
|
21
|
-
score: number;
|
|
22
|
-
rating: string;
|
|
23
|
-
recommendations: string[];
|
|
24
|
-
};
|
|
16
|
+
interface ChangeAmplificationReport extends SpokeOutput {
|
|
25
17
|
results: FileChangeAmplificationResult[];
|
|
26
18
|
}
|
|
27
19
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _aiready_core from '@aiready/core';
|
|
2
|
+
import { Issue, IssueType, ScanOptions, SpokeOutput, AnalysisResult, ToolScoringOutput } from '@aiready/core';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Change Amplification Tool Provider
|
|
5
6
|
*/
|
|
6
|
-
declare const ChangeAmplificationProvider: ToolProvider;
|
|
7
|
+
declare const ChangeAmplificationProvider: _aiready_core.ToolProvider;
|
|
7
8
|
|
|
8
9
|
type ChangeAmplificationOptions = ScanOptions;
|
|
9
10
|
interface ChangeAmplificationIssue extends Issue {
|
|
@@ -12,16 +13,7 @@ interface ChangeAmplificationIssue extends Issue {
|
|
|
12
13
|
interface FileChangeAmplificationResult extends AnalysisResult {
|
|
13
14
|
issues: ChangeAmplificationIssue[];
|
|
14
15
|
}
|
|
15
|
-
interface ChangeAmplificationReport {
|
|
16
|
-
summary: {
|
|
17
|
-
totalFiles: number;
|
|
18
|
-
totalIssues: number;
|
|
19
|
-
criticalIssues: number;
|
|
20
|
-
majorIssues: number;
|
|
21
|
-
score: number;
|
|
22
|
-
rating: string;
|
|
23
|
-
recommendations: string[];
|
|
24
|
-
};
|
|
16
|
+
interface ChangeAmplificationReport extends SpokeOutput {
|
|
25
17
|
results: FileChangeAmplificationResult[];
|
|
26
18
|
}
|
|
27
19
|
|
package/dist/index.js
CHANGED
|
@@ -170,41 +170,27 @@ async function analyzeChangeAmplification(options) {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
// src/provider.ts
|
|
173
|
-
var ChangeAmplificationProvider = {
|
|
173
|
+
var ChangeAmplificationProvider = (0, import_core2.createProvider)({
|
|
174
174
|
id: import_core2.ToolName.ChangeAmplification,
|
|
175
175
|
alias: ["change-amp", "change-amplification", "coupling"],
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
);
|
|
180
|
-
return import_core2.SpokeOutputSchema.parse({
|
|
181
|
-
results: report.results,
|
|
182
|
-
summary: report.summary,
|
|
183
|
-
metadata: {
|
|
184
|
-
toolName: import_core2.ToolName.ChangeAmplification,
|
|
185
|
-
version: "0.9.5",
|
|
186
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
187
|
-
}
|
|
188
|
-
});
|
|
176
|
+
version: "0.9.5",
|
|
177
|
+
defaultWeight: 8,
|
|
178
|
+
async analyzeReport(options) {
|
|
179
|
+
return analyzeChangeAmplification(options);
|
|
189
180
|
},
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
return {
|
|
193
|
-
toolName: import_core2.ToolName.ChangeAmplification,
|
|
194
|
-
score: summary.score || 0,
|
|
195
|
-
rawMetrics: summary,
|
|
196
|
-
factors: [],
|
|
197
|
-
recommendations: (summary.recommendations || []).map(
|
|
198
|
-
(action) => ({
|
|
199
|
-
action,
|
|
200
|
-
estimatedImpact: 5,
|
|
201
|
-
priority: "medium"
|
|
202
|
-
})
|
|
203
|
-
)
|
|
204
|
-
};
|
|
181
|
+
getResults(report) {
|
|
182
|
+
return report.results;
|
|
205
183
|
},
|
|
206
|
-
|
|
207
|
-
|
|
184
|
+
getSummary(report) {
|
|
185
|
+
return report.summary;
|
|
186
|
+
},
|
|
187
|
+
score(output) {
|
|
188
|
+
return (0, import_core2.buildSimpleProviderScore)(
|
|
189
|
+
import_core2.ToolName.ChangeAmplification,
|
|
190
|
+
output.summary
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
208
194
|
|
|
209
195
|
// src/scoring.ts
|
|
210
196
|
var import_core3 = require("@aiready/core");
|
|
@@ -213,18 +199,18 @@ function calculateChangeAmplificationScore(report) {
|
|
|
213
199
|
const factors = [
|
|
214
200
|
{
|
|
215
201
|
name: "Graph Stability",
|
|
216
|
-
impact: Math.round(summary.score - 50),
|
|
217
|
-
description: summary.score < 30 ? "High coupling detected in core modules" : "Stable dependency structure"
|
|
202
|
+
impact: Math.round((summary.score ?? 0) - 50),
|
|
203
|
+
description: (summary.score ?? 0) < 30 ? "High coupling detected in core modules" : "Stable dependency structure"
|
|
218
204
|
}
|
|
219
205
|
];
|
|
220
206
|
const recommendations = summary.recommendations.map((rec) => ({
|
|
221
207
|
action: rec,
|
|
222
208
|
estimatedImpact: 10,
|
|
223
|
-
priority: summary.score < 50 ? "high" : "medium"
|
|
209
|
+
priority: (summary.score ?? 0) < 50 ? "high" : "medium"
|
|
224
210
|
}));
|
|
225
211
|
return {
|
|
226
212
|
toolName: import_core3.ToolName.ChangeAmplification,
|
|
227
|
-
score: summary.score,
|
|
213
|
+
score: summary.score ?? 0,
|
|
228
214
|
rawMetrics: {
|
|
229
215
|
totalFiles: summary.totalFiles,
|
|
230
216
|
totalIssues: summary.totalIssues,
|
package/dist/index.mjs
CHANGED
|
@@ -7,44 +7,31 @@ import { ToolRegistry } from "@aiready/core";
|
|
|
7
7
|
|
|
8
8
|
// src/provider.ts
|
|
9
9
|
import {
|
|
10
|
+
createProvider,
|
|
10
11
|
ToolName,
|
|
11
|
-
|
|
12
|
+
buildSimpleProviderScore
|
|
12
13
|
} from "@aiready/core";
|
|
13
|
-
var ChangeAmplificationProvider = {
|
|
14
|
+
var ChangeAmplificationProvider = createProvider({
|
|
14
15
|
id: ToolName.ChangeAmplification,
|
|
15
16
|
alias: ["change-amp", "change-amplification", "coupling"],
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
);
|
|
20
|
-
return SpokeOutputSchema.parse({
|
|
21
|
-
results: report.results,
|
|
22
|
-
summary: report.summary,
|
|
23
|
-
metadata: {
|
|
24
|
-
toolName: ToolName.ChangeAmplification,
|
|
25
|
-
version: "0.9.5",
|
|
26
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
27
|
-
}
|
|
28
|
-
});
|
|
17
|
+
version: "0.9.5",
|
|
18
|
+
defaultWeight: 8,
|
|
19
|
+
async analyzeReport(options) {
|
|
20
|
+
return analyzeChangeAmplification(options);
|
|
29
21
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
toolName: ToolName.ChangeAmplification,
|
|
34
|
-
score: summary.score || 0,
|
|
35
|
-
rawMetrics: summary,
|
|
36
|
-
factors: [],
|
|
37
|
-
recommendations: (summary.recommendations || []).map(
|
|
38
|
-
(action) => ({
|
|
39
|
-
action,
|
|
40
|
-
estimatedImpact: 5,
|
|
41
|
-
priority: "medium"
|
|
42
|
-
})
|
|
43
|
-
)
|
|
44
|
-
};
|
|
22
|
+
getResults(report) {
|
|
23
|
+
return report.results;
|
|
45
24
|
},
|
|
46
|
-
|
|
47
|
-
|
|
25
|
+
getSummary(report) {
|
|
26
|
+
return report.summary;
|
|
27
|
+
},
|
|
28
|
+
score(output) {
|
|
29
|
+
return buildSimpleProviderScore(
|
|
30
|
+
ToolName.ChangeAmplification,
|
|
31
|
+
output.summary
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
48
35
|
|
|
49
36
|
// src/scoring.ts
|
|
50
37
|
import { ToolName as ToolName2 } from "@aiready/core";
|
|
@@ -53,18 +40,18 @@ function calculateChangeAmplificationScore(report) {
|
|
|
53
40
|
const factors = [
|
|
54
41
|
{
|
|
55
42
|
name: "Graph Stability",
|
|
56
|
-
impact: Math.round(summary.score - 50),
|
|
57
|
-
description: summary.score < 30 ? "High coupling detected in core modules" : "Stable dependency structure"
|
|
43
|
+
impact: Math.round((summary.score ?? 0) - 50),
|
|
44
|
+
description: (summary.score ?? 0) < 30 ? "High coupling detected in core modules" : "Stable dependency structure"
|
|
58
45
|
}
|
|
59
46
|
];
|
|
60
47
|
const recommendations = summary.recommendations.map((rec) => ({
|
|
61
48
|
action: rec,
|
|
62
49
|
estimatedImpact: 10,
|
|
63
|
-
priority: summary.score < 50 ? "high" : "medium"
|
|
50
|
+
priority: (summary.score ?? 0) < 50 ? "high" : "medium"
|
|
64
51
|
}));
|
|
65
52
|
return {
|
|
66
53
|
toolName: ToolName2.ChangeAmplification,
|
|
67
|
-
score: summary.score,
|
|
54
|
+
score: summary.score ?? 0,
|
|
68
55
|
rawMetrics: {
|
|
69
56
|
totalFiles: summary.totalFiles,
|
|
70
57
|
totalIssues: summary.totalIssues,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/change-amplification",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.3",
|
|
4
4
|
"description": "AI-Readiness: Change Amplification Detection",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"commander": "^14.0.0",
|
|
11
11
|
"glob": "^13.0.0",
|
|
12
12
|
"chalk": "^5.3.0",
|
|
13
|
-
"@aiready/core": "0.23.
|
|
13
|
+
"@aiready/core": "0.23.3"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/node": "^24.0.0",
|
|
@@ -24,7 +24,7 @@ describe('Change Amplification Provider', () => {
|
|
|
24
24
|
const output = await ChangeAmplificationProvider.analyze({ rootDir: '.' });
|
|
25
25
|
|
|
26
26
|
expect(output.summary.totalFiles).toBe(1);
|
|
27
|
-
expect(output.metadata
|
|
27
|
+
expect(output.metadata!.toolName).toBe('change-amplification');
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
it('should score an output', () => {
|
package/src/cli.ts
CHANGED
|
@@ -29,7 +29,7 @@ export const changeAmplificationAction = async (
|
|
|
29
29
|
|
|
30
30
|
console.log(chalk.bold('\n🌐 Change Amplification Analysis\n'));
|
|
31
31
|
console.log(`Rating: ${chalk.bold(report.summary.rating)}`);
|
|
32
|
-
console.log(`Score: ${Math.round(report.summary.score)}/100`);
|
|
32
|
+
console.log(`Score: ${Math.round(report.summary.score ?? 0)}/100`);
|
|
33
33
|
console.log(`Critical Issues: ${report.summary.criticalIssues}`);
|
|
34
34
|
console.log(`Major Issues: ${report.summary.majorIssues}`);
|
|
35
35
|
|
package/src/provider.ts
CHANGED
|
@@ -1,58 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
createProvider,
|
|
3
3
|
ToolName,
|
|
4
|
-
SpokeOutput,
|
|
5
4
|
ScanOptions,
|
|
6
|
-
|
|
7
|
-
AnalysisResult,
|
|
8
|
-
SpokeOutputSchema,
|
|
5
|
+
buildSimpleProviderScore,
|
|
9
6
|
} from '@aiready/core';
|
|
10
7
|
import { analyzeChangeAmplification } from './analyzer';
|
|
11
|
-
import {
|
|
12
|
-
ChangeAmplificationOptions,
|
|
13
|
-
FileChangeAmplificationResult,
|
|
14
|
-
} from './types';
|
|
8
|
+
import { ChangeAmplificationOptions } from './types';
|
|
15
9
|
|
|
16
10
|
/**
|
|
17
11
|
* Change Amplification Tool Provider
|
|
18
12
|
*/
|
|
19
|
-
export const ChangeAmplificationProvider
|
|
13
|
+
export const ChangeAmplificationProvider = createProvider({
|
|
20
14
|
id: ToolName.ChangeAmplification,
|
|
21
15
|
alias: ['change-amp', 'change-amplification', 'coupling'],
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
return SpokeOutputSchema.parse({
|
|
29
|
-
results: report.results as AnalysisResult[],
|
|
30
|
-
summary: report.summary,
|
|
31
|
-
metadata: {
|
|
32
|
-
toolName: ToolName.ChangeAmplification,
|
|
33
|
-
version: '0.9.5',
|
|
34
|
-
timestamp: new Date().toISOString(),
|
|
35
|
-
},
|
|
36
|
-
});
|
|
16
|
+
version: '0.9.5',
|
|
17
|
+
defaultWeight: 8,
|
|
18
|
+
async analyzeReport(options: ScanOptions) {
|
|
19
|
+
return analyzeChangeAmplification(options as ChangeAmplificationOptions);
|
|
37
20
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const summary = output.summary as any;
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
toolName: ToolName.ChangeAmplification,
|
|
44
|
-
score: summary.score || 0,
|
|
45
|
-
rawMetrics: summary,
|
|
46
|
-
factors: [],
|
|
47
|
-
recommendations: (summary.recommendations || []).map(
|
|
48
|
-
(action: string) => ({
|
|
49
|
-
action,
|
|
50
|
-
estimatedImpact: 5,
|
|
51
|
-
priority: 'medium',
|
|
52
|
-
})
|
|
53
|
-
),
|
|
54
|
-
};
|
|
21
|
+
getResults(report) {
|
|
22
|
+
return report.results as any;
|
|
55
23
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
24
|
+
getSummary(report) {
|
|
25
|
+
return report.summary;
|
|
26
|
+
},
|
|
27
|
+
score(output) {
|
|
28
|
+
return buildSimpleProviderScore(
|
|
29
|
+
ToolName.ChangeAmplification,
|
|
30
|
+
output.summary as any
|
|
31
|
+
);
|
|
32
|
+
},
|
|
33
|
+
});
|
package/src/scoring.ts
CHANGED
|
@@ -13,24 +13,24 @@ export function calculateChangeAmplificationScore(
|
|
|
13
13
|
const factors: ToolScoringOutput['factors'] = [
|
|
14
14
|
{
|
|
15
15
|
name: 'Graph Stability',
|
|
16
|
-
impact: Math.round(summary.score - 50),
|
|
16
|
+
impact: Math.round((summary.score ?? 0) - 50),
|
|
17
17
|
description:
|
|
18
|
-
summary.score < 30
|
|
18
|
+
(summary.score ?? 0) < 30
|
|
19
19
|
? 'High coupling detected in core modules'
|
|
20
20
|
: 'Stable dependency structure',
|
|
21
21
|
},
|
|
22
22
|
];
|
|
23
23
|
|
|
24
24
|
const recommendations: ToolScoringOutput['recommendations'] =
|
|
25
|
-
summary.recommendations.map((rec) => ({
|
|
25
|
+
summary.recommendations.map((rec: string) => ({
|
|
26
26
|
action: rec,
|
|
27
27
|
estimatedImpact: 10,
|
|
28
|
-
priority: summary.score < 50 ? 'high' : 'medium',
|
|
28
|
+
priority: (summary.score ?? 0) < 50 ? 'high' : 'medium',
|
|
29
29
|
}));
|
|
30
30
|
|
|
31
31
|
return {
|
|
32
32
|
toolName: ToolName.ChangeAmplification,
|
|
33
|
-
score: summary.score,
|
|
33
|
+
score: summary.score ?? 0,
|
|
34
34
|
rawMetrics: {
|
|
35
35
|
totalFiles: summary.totalFiles,
|
|
36
36
|
totalIssues: summary.totalIssues,
|
package/src/types.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
2
|
ScanOptions,
|
|
3
3
|
AnalysisResult,
|
|
4
4
|
Issue,
|
|
5
5
|
IssueType,
|
|
6
|
+
SpokeOutput,
|
|
6
7
|
} from '@aiready/core';
|
|
7
8
|
|
|
8
9
|
export type ChangeAmplificationOptions = ScanOptions;
|
|
@@ -15,15 +16,6 @@ export interface FileChangeAmplificationResult extends AnalysisResult {
|
|
|
15
16
|
issues: ChangeAmplificationIssue[];
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
export interface ChangeAmplificationReport {
|
|
19
|
-
summary: {
|
|
20
|
-
totalFiles: number;
|
|
21
|
-
totalIssues: number;
|
|
22
|
-
criticalIssues: number;
|
|
23
|
-
majorIssues: number;
|
|
24
|
-
score: number;
|
|
25
|
-
rating: string;
|
|
26
|
-
recommendations: string[];
|
|
27
|
-
};
|
|
19
|
+
export interface ChangeAmplificationReport extends SpokeOutput {
|
|
28
20
|
results: FileChangeAmplificationResult[];
|
|
29
21
|
}
|