@aiready/doc-drift 0.13.22 → 0.13.23

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,23 +1,24 @@
1
-
2
- > @aiready/doc-drift@0.13.22 build /Users/pengcao/projects/aiready/packages/doc-drift
3
- > tsup src/index.ts src/cli.ts --format cjs,esm --dts
4
-
5
- CLI Building entry: src/cli.ts, src/index.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.5.1
8
- CLI Target: es2020
9
- CJS Build start
10
- ESM Build start
11
- ESM dist/cli.mjs 1.39 KB
12
- ESM dist/chunk-GZDN7B4K.mjs 4.40 KB
13
- ESM dist/index.mjs 2.59 KB
14
- ESM ⚡️ Build success in 53ms
15
- CJS dist/cli.js 7.11 KB
16
- CJS dist/index.js 7.71 KB
17
- CJS ⚡️ Build success in 53ms
18
- DTS Build start
19
- DTS ⚡️ Build success in 2579ms
20
- DTS dist/cli.d.ts 108.00 B
21
- DTS dist/index.d.ts 2.83 KB
22
- DTS dist/cli.d.mts 108.00 B
23
- DTS dist/index.d.mts 2.83 KB
1
+
2
+ 
3
+ > @aiready/doc-drift@0.13.23 build /Users/pengcao/projects/aiready/packages/doc-drift
4
+ > tsup src/index.ts src/cli.ts --format cjs,esm --dts
5
+
6
+ CLI Building entry: src/cli.ts, src/index.ts
7
+ CLI Using tsconfig: tsconfig.json
8
+ CLI tsup v8.5.1
9
+ CLI Target: es2020
10
+ CJS Build start
11
+ ESM Build start
12
+ CJS dist/index.js 6.98 KB
13
+ CJS dist/cli.js 6.71 KB
14
+ CJS ⚡️ Build success in 104ms
15
+ ESM dist/chunk-GZDN7B4K.mjs 4.40 KB
16
+ ESM dist/cli.mjs 1.07 KB
17
+ ESM dist/index.mjs 1.87 KB
18
+ ESM ⚡️ Build success in 105ms
19
+ DTS Build start
20
+ DTS ⚡️ Build success in 1180ms
21
+ DTS dist/cli.d.ts 108.00 B
22
+ DTS dist/index.d.ts 2.83 KB
23
+ DTS dist/cli.d.mts 108.00 B
24
+ DTS dist/index.d.mts 2.83 KB
@@ -1,16 +1,18 @@
1
-
2
- > @aiready/doc-drift@0.13.21 test /Users/pengcao/projects/aiready/packages/doc-drift
3
- > vitest run
4
-
5
-
6
-  RUN  v4.0.18 /Users/pengcao/projects/aiready/packages/doc-drift
7
-
8
- ✓ src/__tests__/scoring.test.ts (2 tests) 4ms
9
- ✓ src/__tests__/provider.test.ts (2 tests) 8ms
10
- ✓ src/__tests__/analyzer.test.ts (1 test) 94ms
11
-
12
-  Test Files  3 passed (3)
13
-  Tests  5 passed (5)
14
-  Start at  19:39:18
15
-  Duration  3.04s (transform 1.88s, setup 0ms, import 6.70s, tests 106ms, environment 0ms)
16
-
1
+
2
+ 
3
+ > @aiready/doc-drift@0.13.22 test /Users/pengcao/projects/aiready/packages/doc-drift
4
+ > vitest run
5
+
6
+ [?25l
7
+  RUN  v4.0.18 /Users/pengcao/projects/aiready/packages/doc-drift
8
+
9
+ ✓ src/__tests__/provider.test.ts (2 tests) 4ms
10
+ ✓ src/__tests__/scoring.test.ts (2 tests) 2ms
11
+ ✓ src/__tests__/analyzer.test.ts (1 test) 40ms
12
+
13
+  Test Files  3 passed (3)
14
+  Tests  5 passed (5)
15
+  Start at  01:33:55
16
+  Duration  5.24s (transform 5.44s, setup 0ms, import 10.70s, tests 46ms, environment 0ms)
17
+
18
+ [?25h
package/dist/cli.js CHANGED
@@ -158,6 +158,7 @@ async function analyzeDocDrift(options) {
158
158
  }
159
159
 
160
160
  // src/cli.ts
161
+ var import_core2 = require("@aiready/core");
161
162
  var import_picocolors = __toESM(require("picocolors"));
162
163
  function createCommand() {
163
164
  const program = new import_commander.Command("doc-drift").description(
@@ -167,23 +168,16 @@ function createCommand() {
167
168
  "Months before a comment is considered potentially outdated",
168
169
  "6"
169
170
  ).action(async (options) => {
170
- console.log(import_picocolors.default.cyan("Analyzing documentation drift..."));
171
- const report = await analyzeDocDrift({
172
- rootDir: process.cwd(),
173
- include: options.include,
174
- exclude: options.exclude,
175
- staleMonths: parseInt(options.staleMonths, 10)
176
- });
177
- console.log(import_picocolors.default.bold("Doc Drift Analysis Results:"));
178
- console.log(
179
- `Rating: ${report.summary.rating.toUpperCase()} (Score: ${report.summary.score})`
171
+ await (0, import_core2.executeSpokeCli)(
172
+ "Doc Drift",
173
+ "documentation drift",
174
+ {
175
+ include: options.include,
176
+ exclude: options.exclude,
177
+ staleMonths: parseInt(options.staleMonths, 10)
178
+ },
179
+ analyzeDocDrift
180
180
  );
181
- if (report.issues.length > 0) {
182
- console.log(import_picocolors.default.red(`
183
- Found ${report.issues.length} drift issues.`));
184
- } else {
185
- console.log(import_picocolors.default.green("\nNo documentation drift detected."));
186
- }
187
181
  });
188
182
  return program;
189
183
  }
package/dist/cli.mjs CHANGED
@@ -5,6 +5,7 @@ import {
5
5
 
6
6
  // src/cli.ts
7
7
  import { Command } from "commander";
8
+ import { executeSpokeCli } from "@aiready/core";
8
9
  import pc from "picocolors";
9
10
  function createCommand() {
10
11
  const program = new Command("doc-drift").description(
@@ -14,23 +15,16 @@ function createCommand() {
14
15
  "Months before a comment is considered potentially outdated",
15
16
  "6"
16
17
  ).action(async (options) => {
17
- console.log(pc.cyan("Analyzing documentation drift..."));
18
- const report = await analyzeDocDrift({
19
- rootDir: process.cwd(),
20
- include: options.include,
21
- exclude: options.exclude,
22
- staleMonths: parseInt(options.staleMonths, 10)
23
- });
24
- console.log(pc.bold("Doc Drift Analysis Results:"));
25
- console.log(
26
- `Rating: ${report.summary.rating.toUpperCase()} (Score: ${report.summary.score})`
18
+ await executeSpokeCli(
19
+ "Doc Drift",
20
+ "documentation drift",
21
+ {
22
+ include: options.include,
23
+ exclude: options.exclude,
24
+ staleMonths: parseInt(options.staleMonths, 10)
25
+ },
26
+ analyzeDocDrift
27
27
  );
28
- if (report.issues.length > 0) {
29
- console.log(pc.red(`
30
- Found ${report.issues.length} drift issues.`));
31
- } else {
32
- console.log(pc.green("\nNo documentation drift detected."));
33
- }
34
28
  });
35
29
  return program;
36
30
  }
package/dist/index.d.mts CHANGED
@@ -73,7 +73,7 @@ declare function analyzeDocDrift(options: DocDriftOptions): Promise<DocDriftRepo
73
73
  *
74
74
  * @param report - The detailed doc-drift report including raw metrics.
75
75
  * @returns Standardized scoring and risk factor breakdown.
76
- * @lastUpdated 2026-03-18
76
+ * @lastUpdated 2026-03-24
77
77
  */
78
78
  declare function calculateDocDriftScore(report: DocDriftReport): ToolScoringOutput;
79
79
 
package/dist/index.d.ts CHANGED
@@ -73,7 +73,7 @@ declare function analyzeDocDrift(options: DocDriftOptions): Promise<DocDriftRepo
73
73
  *
74
74
  * @param report - The detailed doc-drift report including raw metrics.
75
75
  * @returns Standardized scoring and risk factor breakdown.
76
- * @lastUpdated 2026-03-18
76
+ * @lastUpdated 2026-03-24
77
77
  */
78
78
  declare function calculateDocDriftScore(report: DocDriftReport): ToolScoringOutput;
79
79
 
package/dist/index.js CHANGED
@@ -188,47 +188,19 @@ function calculateDocDriftScore(report) {
188
188
  undocumentedComplexity: rawData.undocumentedComplexity,
189
189
  actualDrift: rawData.actualDrift
190
190
  });
191
- const factors = [
192
- {
193
- name: "Undocumented Complexity",
194
- impact: -Math.min(
195
- 50,
196
- rawData.undocumentedComplexity / Math.max(1, rawData.totalExports) / 0.2 * 100 * 0.5
197
- ),
198
- description: `${rawData.undocumentedComplexity} complex functions lack docs (high risk)`
199
- },
200
- {
201
- name: "Outdated/Incomplete Comments",
202
- impact: -Math.min(
203
- 30,
204
- rawData.outdatedComments / Math.max(1, rawData.totalExports) / 0.4 * 100 * 0.3
205
- ),
206
- description: `${rawData.outdatedComments} functions with parameter-mismatch in docs`
207
- },
208
- {
209
- name: "Uncommented Exports",
210
- impact: -Math.min(
211
- 20,
212
- rawData.uncommentedExports / Math.max(1, rawData.totalExports) / 0.8 * 100 * 0.2
213
- ),
214
- description: `${rawData.uncommentedExports} uncommented exports`
215
- }
216
- ];
217
- const recommendations = riskResult.recommendations.map((rec) => ({
218
- action: rec,
219
- estimatedImpact: 8,
220
- priority: summary.score < 50 ? "high" : "medium"
221
- }));
222
- return {
191
+ return (0, import_core3.buildStandardToolScore)({
223
192
  toolName: import_core3.ToolName.DocDrift,
224
193
  score: summary.score,
225
- rawMetrics: {
226
- ...rawData,
227
- rating: summary.rating
194
+ rawData,
195
+ dimensions: riskResult.dimensions,
196
+ dimensionNames: {
197
+ undocumentedComplexityScore: "Undocumented Complexity",
198
+ outdatedCommentsScore: "Outdated/Incomplete Comments",
199
+ uncommentedExportsScore: "Uncommented Exports"
228
200
  },
229
- factors,
230
- recommendations
231
- };
201
+ recommendations: riskResult.recommendations,
202
+ rating: summary.rating
203
+ });
232
204
  }
233
205
 
234
206
  // src/index.ts
package/dist/index.mjs CHANGED
@@ -37,7 +37,11 @@ var DocDriftProvider = createProvider({
37
37
  });
38
38
 
39
39
  // src/scoring.ts
40
- import { calculateDocDrift, ToolName as ToolName2 } from "@aiready/core";
40
+ import {
41
+ calculateDocDrift,
42
+ ToolName as ToolName2,
43
+ buildStandardToolScore
44
+ } from "@aiready/core";
41
45
  function calculateDocDriftScore(report) {
42
46
  const { rawData, summary } = report;
43
47
  const riskResult = calculateDocDrift({
@@ -47,47 +51,19 @@ function calculateDocDriftScore(report) {
47
51
  undocumentedComplexity: rawData.undocumentedComplexity,
48
52
  actualDrift: rawData.actualDrift
49
53
  });
50
- const factors = [
51
- {
52
- name: "Undocumented Complexity",
53
- impact: -Math.min(
54
- 50,
55
- rawData.undocumentedComplexity / Math.max(1, rawData.totalExports) / 0.2 * 100 * 0.5
56
- ),
57
- description: `${rawData.undocumentedComplexity} complex functions lack docs (high risk)`
58
- },
59
- {
60
- name: "Outdated/Incomplete Comments",
61
- impact: -Math.min(
62
- 30,
63
- rawData.outdatedComments / Math.max(1, rawData.totalExports) / 0.4 * 100 * 0.3
64
- ),
65
- description: `${rawData.outdatedComments} functions with parameter-mismatch in docs`
66
- },
67
- {
68
- name: "Uncommented Exports",
69
- impact: -Math.min(
70
- 20,
71
- rawData.uncommentedExports / Math.max(1, rawData.totalExports) / 0.8 * 100 * 0.2
72
- ),
73
- description: `${rawData.uncommentedExports} uncommented exports`
74
- }
75
- ];
76
- const recommendations = riskResult.recommendations.map((rec) => ({
77
- action: rec,
78
- estimatedImpact: 8,
79
- priority: summary.score < 50 ? "high" : "medium"
80
- }));
81
- return {
54
+ return buildStandardToolScore({
82
55
  toolName: ToolName2.DocDrift,
83
56
  score: summary.score,
84
- rawMetrics: {
85
- ...rawData,
86
- rating: summary.rating
57
+ rawData,
58
+ dimensions: riskResult.dimensions,
59
+ dimensionNames: {
60
+ undocumentedComplexityScore: "Undocumented Complexity",
61
+ outdatedCommentsScore: "Outdated/Incomplete Comments",
62
+ uncommentedExportsScore: "Uncommented Exports"
87
63
  },
88
- factors,
89
- recommendations
90
- };
64
+ recommendations: riskResult.recommendations,
65
+ rating: summary.rating
66
+ });
91
67
  }
92
68
 
93
69
  // src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/doc-drift",
3
- "version": "0.13.22",
3
+ "version": "0.13.23",
4
4
  "description": "AI-Readiness: Documentation Drift 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
  "picocolors": "^1.0.0",
13
- "@aiready/core": "0.23.23"
13
+ "@aiready/core": "0.23.24"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@types/node": "^24.0.0",
package/src/cli.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Command } from 'commander';
2
2
  import { analyzeDocDrift } from './analyzer';
3
+ import { executeSpokeCli } from '@aiready/core';
3
4
  import pc from 'picocolors';
4
5
 
5
6
  export function createCommand() {
@@ -15,23 +16,16 @@ export function createCommand() {
15
16
  '6'
16
17
  )
17
18
  .action(async (options) => {
18
- console.log(pc.cyan('Analyzing documentation drift...'));
19
- const report = await analyzeDocDrift({
20
- rootDir: process.cwd(),
21
- include: options.include,
22
- exclude: options.exclude,
23
- staleMonths: parseInt(options.staleMonths, 10),
24
- });
25
-
26
- console.log(pc.bold('Doc Drift Analysis Results:'));
27
- console.log(
28
- `Rating: ${report.summary.rating.toUpperCase()} (Score: ${report.summary.score})`
19
+ await executeSpokeCli(
20
+ 'Doc Drift',
21
+ 'documentation drift',
22
+ {
23
+ include: options.include,
24
+ exclude: options.exclude,
25
+ staleMonths: parseInt(options.staleMonths, 10),
26
+ },
27
+ analyzeDocDrift
29
28
  );
30
- if (report.issues.length > 0) {
31
- console.log(pc.red(`\nFound ${report.issues.length} drift issues.`));
32
- } else {
33
- console.log(pc.green('\nNo documentation drift detected.'));
34
- }
35
29
  });
36
30
 
37
31
  return program;
package/src/scoring.ts CHANGED
@@ -1,4 +1,8 @@
1
- import { calculateDocDrift, ToolName } from '@aiready/core';
1
+ import {
2
+ calculateDocDrift,
3
+ ToolName,
4
+ buildStandardToolScore,
5
+ } from '@aiready/core';
2
6
  import type { ToolScoringOutput } from '@aiready/core';
3
7
  import type { DocDriftReport } from './types';
4
8
 
@@ -7,7 +11,7 @@ import type { DocDriftReport } from './types';
7
11
  *
8
12
  * @param report - The detailed doc-drift report including raw metrics.
9
13
  * @returns Standardized scoring and risk factor breakdown.
10
- * @lastUpdated 2026-03-18
14
+ * @lastUpdated 2026-03-24
11
15
  */
12
16
  export function calculateDocDriftScore(
13
17
  report: DocDriftReport
@@ -23,56 +27,17 @@ export function calculateDocDriftScore(
23
27
  actualDrift: rawData.actualDrift,
24
28
  });
25
29
 
26
- const factors: ToolScoringOutput['factors'] = [
27
- {
28
- name: 'Undocumented Complexity',
29
- impact: -Math.min(
30
- 50,
31
- (rawData.undocumentedComplexity /
32
- Math.max(1, rawData.totalExports) /
33
- 0.2) *
34
- 100 *
35
- 0.5
36
- ),
37
- description: `${rawData.undocumentedComplexity} complex functions lack docs (high risk)`,
38
- },
39
- {
40
- name: 'Outdated/Incomplete Comments',
41
- impact: -Math.min(
42
- 30,
43
- (rawData.outdatedComments / Math.max(1, rawData.totalExports) / 0.4) *
44
- 100 *
45
- 0.3
46
- ),
47
- description: `${rawData.outdatedComments} functions with parameter-mismatch in docs`,
48
- },
49
- {
50
- name: 'Uncommented Exports',
51
- impact: -Math.min(
52
- 20,
53
- (rawData.uncommentedExports / Math.max(1, rawData.totalExports) / 0.8) *
54
- 100 *
55
- 0.2
56
- ),
57
- description: `${rawData.uncommentedExports} uncommented exports`,
58
- },
59
- ];
60
-
61
- const recommendations: ToolScoringOutput['recommendations'] =
62
- riskResult.recommendations.map((rec) => ({
63
- action: rec,
64
- estimatedImpact: 8,
65
- priority: summary.score < 50 ? 'high' : 'medium',
66
- }));
67
-
68
- return {
30
+ return buildStandardToolScore({
69
31
  toolName: ToolName.DocDrift,
70
32
  score: summary.score,
71
- rawMetrics: {
72
- ...rawData,
73
- rating: summary.rating,
33
+ rawData,
34
+ dimensions: riskResult.dimensions,
35
+ dimensionNames: {
36
+ undocumentedComplexityScore: 'Undocumented Complexity',
37
+ outdatedCommentsScore: 'Outdated/Incomplete Comments',
38
+ uncommentedExportsScore: 'Uncommented Exports',
74
39
  },
75
- factors,
76
- recommendations,
77
- };
40
+ recommendations: riskResult.recommendations,
41
+ rating: summary.rating,
42
+ });
78
43
  }