@aiready/doc-drift 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 +8 -8
- package/.turbo/turbo-lint.log +10 -6
- package/.turbo/turbo-test.log +6 -57
- package/dist/index.d.mts +26 -3
- package/dist/index.d.ts +26 -3
- package/dist/index.js +18 -46
- package/dist/index.mjs +21 -47
- package/package.json +2 -2
- package/src/__tests__/provider.test.ts +1 -1
- package/src/__tests__/scoring.test.ts +1 -1
- package/src/analyzer.ts +0 -1
- package/src/provider.ts +21 -59
- package/src/types.ts +29 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/doc-drift@0.13.
|
|
3
|
+
> @aiready/doc-drift@0.13.3 build /Users/pengcao/projects/aiready/packages/doc-drift
|
|
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
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
12
|
+
[32mCJS[39m [1mdist/index.js [22m[32m6.86 KB[39m
|
|
13
13
|
[32mCJS[39m [1mdist/cli.js [22m[32m6.48 KB[39m
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 66ms
|
|
15
15
|
[32mESM[39m [1mdist/cli.mjs [22m[32m1.39 KB[39m
|
|
16
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m2.37 KB[39m
|
|
17
17
|
[32mESM[39m [1mdist/chunk-5BGWZWHD.mjs [22m[32m3.81 KB[39m
|
|
18
|
-
[32mESM[39m ⚡️ Build success in
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 66ms
|
|
19
19
|
DTS Build start
|
|
20
|
-
DTS ⚡️ Build success in
|
|
20
|
+
DTS ⚡️ Build success in 3596ms
|
|
21
21
|
DTS dist/cli.d.ts 108.00 B
|
|
22
|
-
DTS dist/index.d.ts
|
|
22
|
+
DTS dist/index.d.ts 2.12 KB
|
|
23
23
|
DTS dist/cli.d.mts 108.00 B
|
|
24
|
-
DTS dist/index.d.mts
|
|
24
|
+
DTS dist/index.d.mts 2.12 KB
|
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
|
|
2
|
+
> @aiready/doc-drift@0.13.2 lint /Users/pengcao/projects/aiready/packages/doc-drift
|
|
3
|
+
> eslint src --ext .ts
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/Users/pengcao/projects/aiready/packages/doc-drift/src/analyzer.ts
|
|
7
|
+
10:3 warning 'Language' 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,69 +1,18 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/doc-drift@0.13.
|
|
3
|
+
> @aiready/doc-drift@0.13.2 test /Users/pengcao/projects/aiready/packages/doc-drift
|
|
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/doc-drift[39m
|
|
8
8
|
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
|
|
12
|
-
[2m Test Files [22m[1m[32m0 passed[39m[22m[90m (3)[39m
|
|
13
|
-
[2m Tests [22m[1m[32m0 passed[39m[22m[90m (0)[39m
|
|
14
|
-
[2m Start at [22m17:20:11
|
|
15
|
-
[2m Duration [22m787ms
|
|
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__/provider.test.ts[2m [queued][22m
|
|
19
|
-
[1m[33m ❯ [39m[22msrc/__tests__/scoring.test.ts[2m [queued][22m
|
|
20
|
-
|
|
21
|
-
[2m Test Files [22m[1m[32m0 passed[39m[22m[90m (3)[39m
|
|
22
|
-
[2m Tests [22m[1m[32m0 passed[39m[22m[90m (0)[39m
|
|
23
|
-
[2m Start at [22m17:20:11
|
|
24
|
-
[2m Duration [22m972ms
|
|
25
|
-
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K
|
|
26
|
-
[1m[33m ❯ [39m[22msrc/__tests__/analyzer.test.ts[2m [queued][22m
|
|
27
|
-
[1m[33m ❯ [39m[22msrc/__tests__/provider.test.ts[2m [queued][22m
|
|
28
|
-
[1m[33m ❯ [39m[22msrc/__tests__/scoring.test.ts[2m [queued][22m
|
|
29
|
-
|
|
30
|
-
[2m Test Files [22m[1m[32m0 passed[39m[22m[90m (3)[39m
|
|
31
|
-
[2m Tests [22m[1m[32m0 passed[39m[22m[90m (0)[39m
|
|
32
|
-
[2m Start at [22m17:20:11
|
|
33
|
-
[2m Duration [22m2.21s
|
|
34
|
-
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K
|
|
35
|
-
[1m[33m ❯ [39m[22msrc/__tests__/analyzer.test.ts[2m [queued][22m
|
|
36
|
-
[1m[33m ❯ [39m[22msrc/__tests__/provider.test.ts[2m [queued][22m
|
|
37
|
-
[1m[33m ❯ [39m[22msrc/__tests__/scoring.test.ts[2m [queued][22m
|
|
38
|
-
|
|
39
|
-
[2m Test Files [22m[1m[32m0 passed[39m[22m[90m (3)[39m
|
|
40
|
-
[2m Tests [22m[1m[32m0 passed[39m[22m[90m (0)[39m
|
|
41
|
-
[2m Start at [22m17:20:11
|
|
42
|
-
[2m Duration [22m3.13s
|
|
43
|
-
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K
|
|
44
|
-
[1m[33m ❯ [39m[22msrc/__tests__/analyzer.test.ts[2m 0/1[22m
|
|
45
|
-
[1m[33m ❯ [39m[22msrc/__tests__/provider.test.ts[2m [queued][22m
|
|
46
|
-
[1m[33m ❯ [39m[22msrc/__tests__/scoring.test.ts[2m [queued][22m
|
|
47
|
-
|
|
48
|
-
[2m Test Files [22m[1m[32m0 passed[39m[22m[90m (3)[39m
|
|
49
|
-
[2m Tests [22m[1m[32m0 passed[39m[22m[90m (1)[39m
|
|
50
|
-
[2m Start at [22m17:20:11
|
|
51
|
-
[2m Duration [22m3.44s
|
|
52
|
-
[?2026l[?2026h[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 1[2mms[22m[39m
|
|
53
|
-
|
|
54
|
-
[1m[33m ❯ [39m[22msrc/__tests__/analyzer.test.ts[2m 0/1[22m
|
|
55
|
-
[1m[33m ❯ [39m[22msrc/__tests__/provider.test.ts[2m 0/2[22m
|
|
56
|
-
|
|
57
|
-
[2m Test Files [22m[1m[32m1 passed[39m[22m[90m (3)[39m
|
|
58
|
-
[2m Tests [22m[1m[32m2 passed[39m[22m[90m (5)[39m
|
|
59
|
-
[2m Start at [22m17:20:11
|
|
60
|
-
[2m Duration [22m3.54s
|
|
61
|
-
[?2026l[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K [32m✓[39m src/__tests__/provider.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
62
|
-
[32m✓[39m src/__tests__/analyzer.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 208[2mms[22m[39m
|
|
9
|
+
[32m✓[39m src/__tests__/scoring.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
10
|
+
[32m✓[39m src/__tests__/provider.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
11
|
+
[32m✓[39m src/__tests__/analyzer.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 143[2mms[22m[39m
|
|
63
12
|
|
|
64
13
|
[2m Test Files [22m [1m[32m3 passed[39m[22m[90m (3)[39m
|
|
65
14
|
[2m Tests [22m [1m[32m5 passed[39m[22m[90m (5)[39m
|
|
66
|
-
[2m Start at [22m
|
|
67
|
-
[2m Duration [22m
|
|
15
|
+
[2m Start at [22m 22:20:40
|
|
16
|
+
[2m Duration [22m 2.77s[2m (transform 914ms, setup 0ms, import 3.95s, tests 150ms, environment 0ms)[22m
|
|
68
17
|
|
|
69
18
|
[?25h
|
package/dist/index.d.mts
CHANGED
|
@@ -1,33 +1,56 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _aiready_core from '@aiready/core';
|
|
2
|
+
import { Issue, IssueType, ScanOptions, DocDriftRisk, ToolScoringOutput } from '@aiready/core';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Documentation Drift Tool Provider
|
|
5
6
|
*/
|
|
6
|
-
declare const DocDriftProvider: ToolProvider;
|
|
7
|
+
declare const DocDriftProvider: _aiready_core.ToolProvider;
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Options for documentation drift analysis
|
|
11
|
+
*/
|
|
8
12
|
interface DocDriftOptions extends ScanOptions {
|
|
9
13
|
/** Maximum commit distance to check for drift */
|
|
10
14
|
maxCommits?: number;
|
|
11
15
|
/** Consider comments older than this many months as outdated */
|
|
12
16
|
staleMonths?: number;
|
|
13
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Documentation drift specific issue
|
|
20
|
+
*/
|
|
14
21
|
interface DocDriftIssue extends Issue {
|
|
22
|
+
/** Type identifier for doc-drift issues */
|
|
15
23
|
type: IssueType.DocDrift;
|
|
16
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Comprehensive report for doc-drift analysis
|
|
27
|
+
*/
|
|
17
28
|
interface DocDriftReport {
|
|
29
|
+
/** High-level summary of the drift status */
|
|
18
30
|
summary: {
|
|
31
|
+
/** Total number of files checked */
|
|
19
32
|
filesAnalyzed: number;
|
|
33
|
+
/** Total number of exported functions/classes checked */
|
|
20
34
|
functionsAnalyzed: number;
|
|
35
|
+
/** Final doc-drift score (0-100) */
|
|
21
36
|
score: number;
|
|
22
|
-
rating
|
|
37
|
+
/** Qualitative rating (minimal to severe) */
|
|
38
|
+
rating: DocDriftRisk['rating'];
|
|
23
39
|
};
|
|
40
|
+
/** List of detected drift points */
|
|
24
41
|
issues: DocDriftIssue[];
|
|
42
|
+
/** Detailed counts for the three drift dimensions */
|
|
25
43
|
rawData: {
|
|
44
|
+
/** Number of exports without JSDoc/comments */
|
|
26
45
|
uncommentedExports: number;
|
|
46
|
+
/** Total number of exports in the analyzed set */
|
|
27
47
|
totalExports: number;
|
|
48
|
+
/** Number of comments considered stale/outdated */
|
|
28
49
|
outdatedComments: number;
|
|
50
|
+
/** Count of complex functions without sufficient documentation */
|
|
29
51
|
undocumentedComplexity: number;
|
|
30
52
|
};
|
|
53
|
+
/** AI-generated remediation advice */
|
|
31
54
|
recommendations: string[];
|
|
32
55
|
}
|
|
33
56
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,33 +1,56 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _aiready_core from '@aiready/core';
|
|
2
|
+
import { Issue, IssueType, ScanOptions, DocDriftRisk, ToolScoringOutput } from '@aiready/core';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Documentation Drift Tool Provider
|
|
5
6
|
*/
|
|
6
|
-
declare const DocDriftProvider: ToolProvider;
|
|
7
|
+
declare const DocDriftProvider: _aiready_core.ToolProvider;
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Options for documentation drift analysis
|
|
11
|
+
*/
|
|
8
12
|
interface DocDriftOptions extends ScanOptions {
|
|
9
13
|
/** Maximum commit distance to check for drift */
|
|
10
14
|
maxCommits?: number;
|
|
11
15
|
/** Consider comments older than this many months as outdated */
|
|
12
16
|
staleMonths?: number;
|
|
13
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Documentation drift specific issue
|
|
20
|
+
*/
|
|
14
21
|
interface DocDriftIssue extends Issue {
|
|
22
|
+
/** Type identifier for doc-drift issues */
|
|
15
23
|
type: IssueType.DocDrift;
|
|
16
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Comprehensive report for doc-drift analysis
|
|
27
|
+
*/
|
|
17
28
|
interface DocDriftReport {
|
|
29
|
+
/** High-level summary of the drift status */
|
|
18
30
|
summary: {
|
|
31
|
+
/** Total number of files checked */
|
|
19
32
|
filesAnalyzed: number;
|
|
33
|
+
/** Total number of exported functions/classes checked */
|
|
20
34
|
functionsAnalyzed: number;
|
|
35
|
+
/** Final doc-drift score (0-100) */
|
|
21
36
|
score: number;
|
|
22
|
-
rating
|
|
37
|
+
/** Qualitative rating (minimal to severe) */
|
|
38
|
+
rating: DocDriftRisk['rating'];
|
|
23
39
|
};
|
|
40
|
+
/** List of detected drift points */
|
|
24
41
|
issues: DocDriftIssue[];
|
|
42
|
+
/** Detailed counts for the three drift dimensions */
|
|
25
43
|
rawData: {
|
|
44
|
+
/** Number of exports without JSDoc/comments */
|
|
26
45
|
uncommentedExports: number;
|
|
46
|
+
/** Total number of exports in the analyzed set */
|
|
27
47
|
totalExports: number;
|
|
48
|
+
/** Number of comments considered stale/outdated */
|
|
28
49
|
outdatedComments: number;
|
|
50
|
+
/** Count of complex functions without sufficient documentation */
|
|
29
51
|
undocumentedComplexity: number;
|
|
30
52
|
};
|
|
53
|
+
/** AI-generated remediation advice */
|
|
31
54
|
recommendations: string[];
|
|
32
55
|
}
|
|
33
56
|
|
package/dist/index.js
CHANGED
|
@@ -141,57 +141,29 @@ async function analyzeDocDrift(options) {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
// src/provider.ts
|
|
144
|
-
var DocDriftProvider = {
|
|
144
|
+
var DocDriftProvider = (0, import_core2.createProvider)({
|
|
145
145
|
id: import_core2.ToolName.DocDrift,
|
|
146
146
|
alias: ["doc-drift", "docs", "jsdoc"],
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
fileName,
|
|
158
|
-
issues,
|
|
159
|
-
metrics: {}
|
|
160
|
-
})
|
|
161
|
-
);
|
|
162
|
-
return import_core2.SpokeOutputSchema.parse({
|
|
163
|
-
results,
|
|
164
|
-
summary: report.summary,
|
|
165
|
-
metadata: {
|
|
166
|
-
toolName: import_core2.ToolName.DocDrift,
|
|
167
|
-
version: "0.9.5",
|
|
168
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
169
|
-
rawData: report.rawData
|
|
170
|
-
}
|
|
171
|
-
});
|
|
147
|
+
version: "0.9.5",
|
|
148
|
+
defaultWeight: 8,
|
|
149
|
+
async analyzeReport(options) {
|
|
150
|
+
return analyzeDocDrift(options);
|
|
151
|
+
},
|
|
152
|
+
getResults(report) {
|
|
153
|
+
return (0, import_core2.groupIssuesByFile)(report.issues);
|
|
154
|
+
},
|
|
155
|
+
getSummary(report) {
|
|
156
|
+
return report.summary;
|
|
172
157
|
},
|
|
173
|
-
|
|
158
|
+
getMetadata(report) {
|
|
159
|
+
return { rawData: report.rawData };
|
|
160
|
+
},
|
|
161
|
+
score(output) {
|
|
174
162
|
const summary = output.summary;
|
|
175
163
|
const rawData = output.metadata?.rawData || {};
|
|
176
|
-
return
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
rawMetrics: {
|
|
180
|
-
...summary,
|
|
181
|
-
...rawData
|
|
182
|
-
},
|
|
183
|
-
factors: [],
|
|
184
|
-
recommendations: (summary.recommendations || []).map(
|
|
185
|
-
(action) => ({
|
|
186
|
-
action,
|
|
187
|
-
estimatedImpact: 5,
|
|
188
|
-
priority: "medium"
|
|
189
|
-
})
|
|
190
|
-
)
|
|
191
|
-
};
|
|
192
|
-
},
|
|
193
|
-
defaultWeight: 8
|
|
194
|
-
};
|
|
164
|
+
return (0, import_core2.buildSimpleProviderScore)(import_core2.ToolName.DocDrift, summary, rawData);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
195
167
|
|
|
196
168
|
// src/scoring.ts
|
|
197
169
|
var import_core3 = require("@aiready/core");
|
package/dist/index.mjs
CHANGED
|
@@ -7,60 +7,34 @@ import { ToolRegistry } from "@aiready/core";
|
|
|
7
7
|
|
|
8
8
|
// src/provider.ts
|
|
9
9
|
import {
|
|
10
|
+
createProvider,
|
|
10
11
|
ToolName,
|
|
11
|
-
|
|
12
|
+
groupIssuesByFile,
|
|
13
|
+
buildSimpleProviderScore
|
|
12
14
|
} from "@aiready/core";
|
|
13
|
-
var DocDriftProvider = {
|
|
15
|
+
var DocDriftProvider = createProvider({
|
|
14
16
|
id: ToolName.DocDrift,
|
|
15
17
|
alias: ["doc-drift", "docs", "jsdoc"],
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
fileName,
|
|
27
|
-
issues,
|
|
28
|
-
metrics: {}
|
|
29
|
-
})
|
|
30
|
-
);
|
|
31
|
-
return SpokeOutputSchema.parse({
|
|
32
|
-
results,
|
|
33
|
-
summary: report.summary,
|
|
34
|
-
metadata: {
|
|
35
|
-
toolName: ToolName.DocDrift,
|
|
36
|
-
version: "0.9.5",
|
|
37
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
38
|
-
rawData: report.rawData
|
|
39
|
-
}
|
|
40
|
-
});
|
|
18
|
+
version: "0.9.5",
|
|
19
|
+
defaultWeight: 8,
|
|
20
|
+
async analyzeReport(options) {
|
|
21
|
+
return analyzeDocDrift(options);
|
|
22
|
+
},
|
|
23
|
+
getResults(report) {
|
|
24
|
+
return groupIssuesByFile(report.issues);
|
|
25
|
+
},
|
|
26
|
+
getSummary(report) {
|
|
27
|
+
return report.summary;
|
|
41
28
|
},
|
|
42
|
-
|
|
29
|
+
getMetadata(report) {
|
|
30
|
+
return { rawData: report.rawData };
|
|
31
|
+
},
|
|
32
|
+
score(output) {
|
|
43
33
|
const summary = output.summary;
|
|
44
34
|
const rawData = output.metadata?.rawData || {};
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
rawMetrics: {
|
|
49
|
-
...summary,
|
|
50
|
-
...rawData
|
|
51
|
-
},
|
|
52
|
-
factors: [],
|
|
53
|
-
recommendations: (summary.recommendations || []).map(
|
|
54
|
-
(action) => ({
|
|
55
|
-
action,
|
|
56
|
-
estimatedImpact: 5,
|
|
57
|
-
priority: "medium"
|
|
58
|
-
})
|
|
59
|
-
)
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
defaultWeight: 8
|
|
63
|
-
};
|
|
35
|
+
return buildSimpleProviderScore(ToolName.DocDrift, summary, rawData);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
64
38
|
|
|
65
39
|
// src/scoring.ts
|
|
66
40
|
import { calculateDocDrift, ToolName as ToolName2 } from "@aiready/core";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/doc-drift",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.3",
|
|
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.
|
|
13
|
+
"@aiready/core": "0.23.3"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/node": "^24.0.0",
|
|
@@ -28,7 +28,7 @@ describe('Doc Drift Provider', () => {
|
|
|
28
28
|
const output = await DocDriftProvider.analyze({ rootDir: '.' });
|
|
29
29
|
|
|
30
30
|
expect(output.summary.filesAnalyzed).toBe(1);
|
|
31
|
-
expect(output.metadata
|
|
31
|
+
expect(output.metadata!.toolName).toBe('doc-drift');
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
it('should score an output', () => {
|
package/src/analyzer.ts
CHANGED
package/src/provider.ts
CHANGED
|
@@ -1,74 +1,36 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
createProvider,
|
|
3
3
|
ToolName,
|
|
4
|
-
SpokeOutput,
|
|
5
4
|
ScanOptions,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
SpokeOutputSchema,
|
|
5
|
+
groupIssuesByFile,
|
|
6
|
+
buildSimpleProviderScore,
|
|
9
7
|
} from '@aiready/core';
|
|
10
8
|
import { analyzeDocDrift } from './analyzer';
|
|
11
|
-
import { DocDriftOptions
|
|
9
|
+
import { DocDriftOptions } from './types';
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
12
|
* Documentation Drift Tool Provider
|
|
15
13
|
*/
|
|
16
|
-
export const DocDriftProvider
|
|
14
|
+
export const DocDriftProvider = createProvider({
|
|
17
15
|
id: ToolName.DocDrift,
|
|
18
16
|
alias: ['doc-drift', 'docs', 'jsdoc'],
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// Group issues by file for AnalysisResult format
|
|
24
|
-
const fileIssuesMap = new Map<string, DocDriftIssue[]>();
|
|
25
|
-
for (const issue of report.issues) {
|
|
26
|
-
const file = issue.location.file;
|
|
27
|
-
if (!fileIssuesMap.has(file)) fileIssuesMap.set(file, []);
|
|
28
|
-
fileIssuesMap.get(file)!.push(issue);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const results: AnalysisResult[] = Array.from(fileIssuesMap.entries()).map(
|
|
32
|
-
([fileName, issues]) => ({
|
|
33
|
-
fileName,
|
|
34
|
-
issues: issues as any[],
|
|
35
|
-
metrics: {},
|
|
36
|
-
})
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
return SpokeOutputSchema.parse({
|
|
40
|
-
results,
|
|
41
|
-
summary: report.summary,
|
|
42
|
-
metadata: {
|
|
43
|
-
toolName: ToolName.DocDrift,
|
|
44
|
-
version: '0.9.5',
|
|
45
|
-
timestamp: new Date().toISOString(),
|
|
46
|
-
rawData: report.rawData,
|
|
47
|
-
},
|
|
48
|
-
});
|
|
17
|
+
version: '0.9.5',
|
|
18
|
+
defaultWeight: 8,
|
|
19
|
+
async analyzeReport(options: ScanOptions) {
|
|
20
|
+
return analyzeDocDrift(options as DocDriftOptions);
|
|
49
21
|
},
|
|
50
|
-
|
|
51
|
-
|
|
22
|
+
getResults(report) {
|
|
23
|
+
return groupIssuesByFile(report.issues);
|
|
24
|
+
},
|
|
25
|
+
getSummary(report) {
|
|
26
|
+
return report.summary;
|
|
27
|
+
},
|
|
28
|
+
getMetadata(report) {
|
|
29
|
+
return { rawData: report.rawData };
|
|
30
|
+
},
|
|
31
|
+
score(output) {
|
|
52
32
|
const summary = output.summary as any;
|
|
53
33
|
const rawData = (output.metadata as any)?.rawData || {};
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
toolName: ToolName.DocDrift,
|
|
57
|
-
score: summary.score || 0,
|
|
58
|
-
rawMetrics: {
|
|
59
|
-
...summary,
|
|
60
|
-
...rawData,
|
|
61
|
-
},
|
|
62
|
-
factors: [],
|
|
63
|
-
recommendations: (summary.recommendations || []).map(
|
|
64
|
-
(action: string) => ({
|
|
65
|
-
action,
|
|
66
|
-
estimatedImpact: 5,
|
|
67
|
-
priority: 'medium',
|
|
68
|
-
})
|
|
69
|
-
),
|
|
70
|
-
};
|
|
34
|
+
return buildSimpleProviderScore(ToolName.DocDrift, summary, rawData);
|
|
71
35
|
},
|
|
72
|
-
|
|
73
|
-
defaultWeight: 8,
|
|
74
|
-
};
|
|
36
|
+
});
|
package/src/types.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ScanOptions,
|
|
3
|
+
Issue,
|
|
4
|
+
IssueType,
|
|
5
|
+
DocDriftRisk,
|
|
6
|
+
} from '@aiready/core';
|
|
2
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Options for documentation drift analysis
|
|
10
|
+
*/
|
|
3
11
|
export interface DocDriftOptions extends ScanOptions {
|
|
4
12
|
/** Maximum commit distance to check for drift */
|
|
5
13
|
maxCommits?: number;
|
|
@@ -7,23 +15,42 @@ export interface DocDriftOptions extends ScanOptions {
|
|
|
7
15
|
staleMonths?: number;
|
|
8
16
|
}
|
|
9
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Documentation drift specific issue
|
|
20
|
+
*/
|
|
10
21
|
export interface DocDriftIssue extends Issue {
|
|
22
|
+
/** Type identifier for doc-drift issues */
|
|
11
23
|
type: IssueType.DocDrift;
|
|
12
24
|
}
|
|
13
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Comprehensive report for doc-drift analysis
|
|
28
|
+
*/
|
|
14
29
|
export interface DocDriftReport {
|
|
30
|
+
/** High-level summary of the drift status */
|
|
15
31
|
summary: {
|
|
32
|
+
/** Total number of files checked */
|
|
16
33
|
filesAnalyzed: number;
|
|
34
|
+
/** Total number of exported functions/classes checked */
|
|
17
35
|
functionsAnalyzed: number;
|
|
36
|
+
/** Final doc-drift score (0-100) */
|
|
18
37
|
score: number;
|
|
19
|
-
rating
|
|
38
|
+
/** Qualitative rating (minimal to severe) */
|
|
39
|
+
rating: DocDriftRisk['rating'];
|
|
20
40
|
};
|
|
41
|
+
/** List of detected drift points */
|
|
21
42
|
issues: DocDriftIssue[];
|
|
43
|
+
/** Detailed counts for the three drift dimensions */
|
|
22
44
|
rawData: {
|
|
45
|
+
/** Number of exports without JSDoc/comments */
|
|
23
46
|
uncommentedExports: number;
|
|
47
|
+
/** Total number of exports in the analyzed set */
|
|
24
48
|
totalExports: number;
|
|
49
|
+
/** Number of comments considered stale/outdated */
|
|
25
50
|
outdatedComments: number;
|
|
51
|
+
/** Count of complex functions without sufficient documentation */
|
|
26
52
|
undocumentedComplexity: number;
|
|
27
53
|
};
|
|
54
|
+
/** AI-generated remediation advice */
|
|
28
55
|
recommendations: string[];
|
|
29
56
|
}
|