@aiready/doc-drift 0.13.22 → 0.14.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 +8 -8
- package/.turbo/turbo-test.log +6 -6
- package/dist/cli.js +10 -16
- package/dist/cli.mjs +10 -16
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -38
- package/dist/index.mjs +15 -39
- package/package.json +2 -2
- package/src/cli.ts +10 -16
- package/src/scoring.ts +16 -51
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @aiready/doc-drift@0.
|
|
2
|
+
> @aiready/doc-drift@0.14.0 build /Users/pengcao/projects/aiready/packages/doc-drift
|
|
3
3
|
> tsup src/index.ts src/cli.ts --format cjs,esm --dts
|
|
4
4
|
|
|
5
5
|
CLI Building entry: src/cli.ts, src/index.ts
|
|
@@ -8,15 +8,15 @@ CLI tsup v8.5.1
|
|
|
8
8
|
CLI Target: es2020
|
|
9
9
|
CJS Build start
|
|
10
10
|
ESM Build start
|
|
11
|
-
ESM dist/cli.mjs 1.39 KB
|
|
12
11
|
ESM dist/chunk-GZDN7B4K.mjs 4.40 KB
|
|
13
|
-
ESM dist/
|
|
14
|
-
ESM
|
|
15
|
-
|
|
16
|
-
CJS dist/
|
|
17
|
-
CJS
|
|
12
|
+
ESM dist/cli.mjs 1.07 KB
|
|
13
|
+
ESM dist/index.mjs 1.87 KB
|
|
14
|
+
ESM ⚡️ Build success in 217ms
|
|
15
|
+
CJS dist/cli.js 6.71 KB
|
|
16
|
+
CJS dist/index.js 6.98 KB
|
|
17
|
+
CJS ⚡️ Build success in 219ms
|
|
18
18
|
DTS Build start
|
|
19
|
-
DTS ⚡️ Build success in
|
|
19
|
+
DTS ⚡️ Build success in 6867ms
|
|
20
20
|
DTS dist/cli.d.ts 108.00 B
|
|
21
21
|
DTS dist/index.d.ts 2.83 KB
|
|
22
22
|
DTS dist/cli.d.mts 108.00 B
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
|
|
2
|
-
> @aiready/doc-drift@0.13.
|
|
2
|
+
> @aiready/doc-drift@0.13.23 test /Users/pengcao/projects/aiready/packages/doc-drift
|
|
3
3
|
> vitest run
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
[1m[46m RUN [49m[22m [36mv4.0.18 [39m[90m/Users/pengcao/projects/aiready/packages/doc-drift[39m
|
|
7
7
|
|
|
8
|
-
[32m✓[39m src/__tests__/
|
|
9
|
-
[32m✓[39m src/__tests__/
|
|
10
|
-
[32m✓[39m src/__tests__/analyzer.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
8
|
+
[32m✓[39m src/__tests__/provider.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
9
|
+
[32m✓[39m src/__tests__/scoring.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 2[2mms[22m[39m
|
|
10
|
+
[32m✓[39m src/__tests__/analyzer.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 71[2mms[22m[39m
|
|
11
11
|
|
|
12
12
|
[2m Test Files [22m [1m[32m3 passed[39m[22m[90m (3)[39m
|
|
13
13
|
[2m Tests [22m [1m[32m5 passed[39m[22m[90m (5)[39m
|
|
14
|
-
[2m Start at [22m
|
|
15
|
-
[2m Duration [22m
|
|
14
|
+
[2m Start at [22m 15:17:51
|
|
15
|
+
[2m Duration [22m 2.73s[2m (transform 880ms, setup 0ms, import 6.70s, tests 85ms, environment 0ms)[22m
|
|
16
16
|
|
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
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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-
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
226
|
-
|
|
227
|
-
|
|
194
|
+
rawData,
|
|
195
|
+
dimensions: riskResult.dimensions,
|
|
196
|
+
dimensionNames: {
|
|
197
|
+
undocumentedComplexityScore: "Undocumented Complexity",
|
|
198
|
+
outdatedCommentsScore: "Outdated/Incomplete Comments",
|
|
199
|
+
uncommentedExportsScore: "Uncommented Exports"
|
|
228
200
|
},
|
|
229
|
-
|
|
230
|
-
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
57
|
+
rawData,
|
|
58
|
+
dimensions: riskResult.dimensions,
|
|
59
|
+
dimensionNames: {
|
|
60
|
+
undocumentedComplexityScore: "Undocumented Complexity",
|
|
61
|
+
outdatedCommentsScore: "Outdated/Incomplete Comments",
|
|
62
|
+
uncommentedExportsScore: "Uncommented Exports"
|
|
87
63
|
},
|
|
88
|
-
|
|
89
|
-
|
|
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.
|
|
3
|
+
"version": "0.14.0",
|
|
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.
|
|
13
|
+
"@aiready/core": "0.24.0"
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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 {
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
33
|
+
rawData,
|
|
34
|
+
dimensions: riskResult.dimensions,
|
|
35
|
+
dimensionNames: {
|
|
36
|
+
undocumentedComplexityScore: 'Undocumented Complexity',
|
|
37
|
+
outdatedCommentsScore: 'Outdated/Incomplete Comments',
|
|
38
|
+
uncommentedExportsScore: 'Uncommented Exports',
|
|
74
39
|
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
};
|
|
40
|
+
recommendations: riskResult.recommendations,
|
|
41
|
+
rating: summary.rating,
|
|
42
|
+
});
|
|
78
43
|
}
|