@aiready/doc-drift 0.13.1 → 0.13.2

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/doc-drift@0.13.0 build /Users/pengcao/projects/aiready/packages/doc-drift
3
+ > @aiready/doc-drift@0.13.2 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
  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
- CJS dist/index.js 7.57 KB
13
12
  CJS dist/cli.js 6.48 KB
14
- CJS ⚡️ Build success in 209ms
13
+ CJS dist/index.js 6.86 KB
14
+ CJS ⚡️ Build success in 58ms
15
+ ESM dist/index.mjs 2.37 KB
15
16
  ESM dist/cli.mjs 1.39 KB
16
- ESM dist/index.mjs 3.05 KB
17
17
  ESM dist/chunk-5BGWZWHD.mjs 3.81 KB
18
- ESM ⚡️ Build success in 211ms
18
+ ESM ⚡️ Build success in 60ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 2935ms
20
+ DTS ⚡️ Build success in 1820ms
21
21
  DTS dist/cli.d.ts 108.00 B
22
- DTS dist/index.d.ts 1.25 KB
22
+ DTS dist/index.d.ts 1.30 KB
23
23
  DTS dist/cli.d.mts 108.00 B
24
- DTS dist/index.d.mts 1.25 KB
24
+ DTS dist/index.d.mts 1.30 KB
@@ -1,69 +1,18 @@
1
1
 
2
2
  
3
- > @aiready/doc-drift@0.13.0 test /Users/pengcao/projects/aiready/packages/doc-drift
3
+ > @aiready/doc-drift@0.13.1 test /Users/pengcao/projects/aiready/packages/doc-drift
4
4
  > vitest run
5
5
 
6
6
  [?25l
7
7
   RUN  v4.0.18 /Users/pengcao/projects/aiready/packages/doc-drift
8
8
 
9
- [?2026h
10
-  ❯ src/__tests__/scoring.test.ts [queued]
11
-
12
-  Test Files 0 passed (3)
13
-  Tests 0 passed (0)
14
-  Start at 17:20:11
15
-  Duration 787ms
16
- [?2026l[?2026h
17
-  ❯ src/__tests__/analyzer.test.ts [queued]
18
-  ❯ src/__tests__/provider.test.ts [queued]
19
-  ❯ src/__tests__/scoring.test.ts [queued]
20
-
21
-  Test Files 0 passed (3)
22
-  Tests 0 passed (0)
23
-  Start at 17:20:11
24
-  Duration 972ms
25
- [?2026l[?2026h
26
-  ❯ src/__tests__/analyzer.test.ts [queued]
27
-  ❯ src/__tests__/provider.test.ts [queued]
28
-  ❯ src/__tests__/scoring.test.ts [queued]
29
-
30
-  Test Files 0 passed (3)
31
-  Tests 0 passed (0)
32
-  Start at 17:20:11
33
-  Duration 2.21s
34
- [?2026l[?2026h
35
-  ❯ src/__tests__/analyzer.test.ts [queued]
36
-  ❯ src/__tests__/provider.test.ts [queued]
37
-  ❯ src/__tests__/scoring.test.ts [queued]
38
-
39
-  Test Files 0 passed (3)
40
-  Tests 0 passed (0)
41
-  Start at 17:20:11
42
-  Duration 3.13s
43
- [?2026l[?2026h
44
-  ❯ src/__tests__/analyzer.test.ts 0/1
45
-  ❯ src/__tests__/provider.test.ts [queued]
46
-  ❯ src/__tests__/scoring.test.ts [queued]
47
-
48
-  Test Files 0 passed (3)
49
-  Tests 0 passed (1)
50
-  Start at 17:20:11
51
-  Duration 3.44s
52
- [?2026l[?2026h ✓ src/__tests__/scoring.test.ts (2 tests) 1ms
53
-
54
-  ❯ src/__tests__/analyzer.test.ts 0/1
55
-  ❯ src/__tests__/provider.test.ts 0/2
56
-
57
-  Test Files 1 passed (3)
58
-  Tests 2 passed (5)
59
-  Start at 17:20:11
60
-  Duration 3.54s
61
- [?2026l ✓ src/__tests__/provider.test.ts (2 tests) 4ms
62
- ✓ src/__tests__/analyzer.test.ts (1 test) 208ms
9
+ ✓ src/__tests__/scoring.test.ts (2 tests) 2ms
10
+ ✓ src/__tests__/provider.test.ts (2 tests) 41ms
11
+ ✓ src/__tests__/analyzer.test.ts (1 test) 173ms
63
12
 
64
13
   Test Files  3 passed (3)
65
14
   Tests  5 passed (5)
66
-  Start at  17:20:11
67
-  Duration  3.68s (transform 4.03s, setup 0ms, import 8.07s, tests 214ms, environment 0ms)
15
+  Start at  02:00:17
16
+  Duration  2.90s (transform 530ms, setup 0ms, import 5.10s, tests 216ms, environment 0ms)
68
17
 
69
18
  [?25h
package/dist/index.d.mts CHANGED
@@ -1,9 +1,10 @@
1
- import { ToolProvider, Issue, IssueType, ScanOptions, ToolScoringOutput } from '@aiready/core';
1
+ import * as _aiready_core from '@aiready/core';
2
+ import { Issue, IssueType, ScanOptions, 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
 
8
9
  interface DocDriftOptions extends ScanOptions {
9
10
  /** Maximum commit distance to check for drift */
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { ToolProvider, Issue, IssueType, ScanOptions, ToolScoringOutput } from '@aiready/core';
1
+ import * as _aiready_core from '@aiready/core';
2
+ import { Issue, IssueType, ScanOptions, 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
 
8
9
  interface DocDriftOptions extends ScanOptions {
9
10
  /** Maximum commit distance to check for drift */
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
- async analyze(options) {
148
- const report = await analyzeDocDrift(options);
149
- const fileIssuesMap = /* @__PURE__ */ new Map();
150
- for (const issue of report.issues) {
151
- const file = issue.location.file;
152
- if (!fileIssuesMap.has(file)) fileIssuesMap.set(file, []);
153
- fileIssuesMap.get(file).push(issue);
154
- }
155
- const results = Array.from(fileIssuesMap.entries()).map(
156
- ([fileName, issues]) => ({
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
- score(output, options) {
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
- toolName: import_core2.ToolName.DocDrift,
178
- score: summary.score || 0,
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
- SpokeOutputSchema
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
- async analyze(options) {
17
- const report = await analyzeDocDrift(options);
18
- const fileIssuesMap = /* @__PURE__ */ new Map();
19
- for (const issue of report.issues) {
20
- const file = issue.location.file;
21
- if (!fileIssuesMap.has(file)) fileIssuesMap.set(file, []);
22
- fileIssuesMap.get(file).push(issue);
23
- }
24
- const results = Array.from(fileIssuesMap.entries()).map(
25
- ([fileName, issues]) => ({
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
- score(output, options) {
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
- toolName: ToolName.DocDrift,
47
- score: summary.score || 0,
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.1",
3
+ "version": "0.13.2",
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.1"
13
+ "@aiready/core": "0.23.2"
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.toolName).toBe('doc-drift');
31
+ expect(output.metadata!.toolName).toBe('doc-drift');
32
32
  });
33
33
 
34
34
  it('should score an output', () => {
@@ -9,7 +9,7 @@ describe('Doc Drift Scoring', () => {
9
9
  filesAnalyzed: 10,
10
10
  functionsAnalyzed: 50,
11
11
  score: 70,
12
- rating: 'good',
12
+ rating: 'moderate',
13
13
  },
14
14
  issues: [],
15
15
  rawData: {
package/src/provider.ts CHANGED
@@ -1,74 +1,36 @@
1
1
  import {
2
- ToolProvider,
2
+ createProvider,
3
3
  ToolName,
4
- SpokeOutput,
5
4
  ScanOptions,
6
- ToolScoringOutput,
7
- AnalysisResult,
8
- SpokeOutputSchema,
5
+ groupIssuesByFile,
6
+ buildSimpleProviderScore,
9
7
  } from '@aiready/core';
10
8
  import { analyzeDocDrift } from './analyzer';
11
- import { DocDriftOptions, DocDriftIssue } from './types';
9
+ import { DocDriftOptions } from './types';
12
10
 
13
11
  /**
14
12
  * Documentation Drift Tool Provider
15
13
  */
16
- export const DocDriftProvider: ToolProvider = {
14
+ export const DocDriftProvider = createProvider({
17
15
  id: ToolName.DocDrift,
18
16
  alias: ['doc-drift', 'docs', 'jsdoc'],
19
-
20
- async analyze(options: ScanOptions): Promise<SpokeOutput> {
21
- const report = await analyzeDocDrift(options as DocDriftOptions);
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
- score(output: SpokeOutput, options: ScanOptions): ToolScoringOutput {
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
+ });