@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.
@@ -1,6 +1,6 @@
1
1
 
2
2
  
3
- > @aiready/change-amplification@0.13.0 build /Users/pengcao/projects/aiready/packages/change-amplification
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
  CLI Building entry: src/cli.ts, src/index.ts
@@ -9,16 +9,16 @@
9
9
  CLI Target: es2020
10
10
  CJS Build start
11
11
  ESM Build start
12
- ESM dist/chunk-OBBL7HKE.mjs 4.82 KB
13
- ESM dist/index.mjs 2.07 KB
12
+ CJS dist/index.js 7.93 KB
13
+ CJS dist/cli.js 9.02 KB
14
+ CJS ⚡️ Build success in 30ms
15
+ ESM dist/index.mjs 1.72 KB
14
16
  ESM dist/cli.mjs 2.78 KB
15
- ESM ⚡️ Build success in 152ms
16
- CJS dist/index.js 8.30 KB
17
- CJS dist/cli.js 9.01 KB
18
- CJS ⚡️ Build success in 153ms
17
+ ESM dist/chunk-OBBL7HKE.mjs 4.82 KB
18
+ ESM ⚡️ Build success in 30ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 3183ms
20
+ DTS ⚡️ Build success in 1328ms
21
21
  DTS dist/cli.d.ts 152.00 B
22
- DTS dist/index.d.ts 1.28 KB
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.28 KB
24
+ DTS dist/index.d.mts 1.14 KB
@@ -1,6 +1,10 @@
1
-
2
- 
3
- > @aiready/change-amplification@0.11.18 lint /Users/pengcao/projects/aiready/packages/change-amplification
4
- > eslint src --ext .ts
5
-
6
-  ELIFECYCLE  Command failed.
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
+
@@ -1,70 +1,24 @@
1
1
 
2
2
  
3
- > @aiready/change-amplification@0.13.0 test /Users/pengcao/projects/aiready/packages/change-amplification
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
   RUN  v4.0.18 /Users/pengcao/projects/aiready/packages/change-amplification
8
8
 
9
- [?2026h
10
-  ❯ src/__tests__/cli.test.ts [queued]
11
-
12
-  Test Files 0 passed (5)
13
-  Tests 0 passed (0)
14
-  Start at 17:20:12
15
-  Duration 697ms
16
- [?2026l[?2026h
17
-  ❯ src/__tests__/analyzer.test.ts [queued]
18
-  ❯ src/__tests__/cli.test.ts [queued]
19
-  ❯ src/__tests__/provider.test.ts [queued]
20
-  ❯ src/__tests__/scoring.test.ts [queued]
21
-
22
-  Test Files 0 passed (5)
23
-  Tests 0 passed (0)
24
-  Start at 17:20:12
25
-  Duration 839ms
26
- [?2026l[?2026h
27
-  ❯ src/__tests__/analyzer.test.ts [queued]
28
-  ❯ src/__tests__/cli.test.ts 0/2
29
-  ❯ src/__tests__/dummy.test.ts [queued]
30
-  ❯ src/__tests__/provider.test.ts [queued]
31
-  ❯ src/__tests__/scoring.test.ts [queued]
32
-
33
-  Test Files 0 passed (5)
34
-  Tests 0 passed (2)
35
-  Start at 17:20:12
36
-  Duration 1.25s
37
- [?2026l[?2026h ✓ src/__tests__/dummy.test.ts (1 test) 3ms
9
+ ✓ src/__tests__/dummy.test.ts (1 test) 14ms
38
10
  ✓ src/__tests__/cli.test.ts (2 tests) 4ms
39
-
40
-  ❯ src/__tests__/analyzer.test.ts [queued]
41
-  ❯ src/__tests__/provider.test.ts [queued]
42
-  ❯ src/__tests__/scoring.test.ts [queued]
43
-
44
-  Test Files 2 passed (5)
45
-  Tests 3 passed (3)
46
-  Start at 17:20:12
47
-  Duration 1.97s
48
- [?2026l[?2026h
49
-  ❯ src/__tests__/analyzer.test.ts [queued]
50
-  ❯ src/__tests__/provider.test.ts [queued]
51
-  ❯ src/__tests__/scoring.test.ts 0/2
52
-
53
-  Test Files 2 passed (5)
54
-  Tests 3 passed (5)
55
-  Start at 17:20:12
56
-  Duration 2.18s
57
- [?2026l ✓ src/__tests__/scoring.test.ts (2 tests) 2ms
58
11
  stdout | src/__tests__/analyzer.test.ts > analyzeChangeAmplification reproduction > should see how it gets to 0
59
12
  Resulting score for highly coupled: 27
60
13
  Rating: explosive
61
14
 
62
- ✓ src/__tests__/analyzer.test.ts (2 tests) 5ms
63
- ✓ src/__tests__/provider.test.ts (2 tests) 14ms
15
+ ✓ src/__tests__/analyzer.test.ts (2 tests) 4ms
16
+ ✓ src/__tests__/provider.test.ts (2 tests) 2ms
17
+ ✓ src/__tests__/scoring.test.ts (2 tests) 20ms
64
18
 
65
19
   Test Files  5 passed (5)
66
20
   Tests  9 passed (9)
67
-  Start at  17:20:12
68
-  Duration  2.30s (transform 1.22s, setup 0ms, import 4.72s, tests 28ms, environment 0ms)
21
+  Start at  22:20:40
22
+  Duration  2.98s (transform 1.22s, setup 0ms, import 5.77s, tests 45ms, environment 0ms)
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 { ToolProvider, Issue, IssueType, ScanOptions, AnalysisResult, ToolScoringOutput } from '@aiready/core';
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 { ToolProvider, Issue, IssueType, ScanOptions, AnalysisResult, ToolScoringOutput } from '@aiready/core';
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
- async analyze(options) {
177
- const report = await analyzeChangeAmplification(
178
- options
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
- score(output, options) {
191
- const summary = output.summary;
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
- defaultWeight: 8
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
- SpokeOutputSchema
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
- async analyze(options) {
17
- const report = await analyzeChangeAmplification(
18
- options
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
- score(output, options) {
31
- const summary = output.summary;
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
- defaultWeight: 8
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.1",
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.1"
13
+ "@aiready/core": "0.23.3"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@types/node": "^24.0.0",
@@ -1,6 +1,5 @@
1
1
  import { describe, it, expect, vi } from 'vitest';
2
2
  import { changeAmplificationAction } from '../cli';
3
- import * as analyzer from '../analyzer';
4
3
  import * as fs from 'fs';
5
4
 
6
5
  vi.mock('../analyzer', () => ({
@@ -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.toolName).toBe('change-amplification');
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
- ToolProvider,
2
+ createProvider,
3
3
  ToolName,
4
- SpokeOutput,
5
4
  ScanOptions,
6
- ToolScoringOutput,
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: ToolProvider = {
13
+ export const ChangeAmplificationProvider = createProvider({
20
14
  id: ToolName.ChangeAmplification,
21
15
  alias: ['change-amp', 'change-amplification', 'coupling'],
22
-
23
- async analyze(options: ScanOptions): Promise<SpokeOutput> {
24
- const report = await analyzeChangeAmplification(
25
- options as ChangeAmplificationOptions
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
- score(output: SpokeOutput, options: ScanOptions): ToolScoringOutput {
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
- defaultWeight: 8,
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 type {
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
  }