@aiready/doc-drift 0.9.5 → 0.11.1

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.9.4 build /Users/pengcao/projects/aiready/packages/doc-drift
3
+ > @aiready/doc-drift@0.11.0 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,58 +9,16 @@
9
9
  CLI Target: es2020
10
10
  CJS Build start
11
11
  ESM Build start
12
-
13
-  WARN  ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json] 9:38:41 pm
14
-
15
- package.json:33:6:
16
-  33 │ "types": "./dist/index.d.ts"
17
- ╵ ~~~~~~~
18
-
19
- The "import" condition comes earlier and will be used for all "import" statements:
20
-
21
- package.json:31:6:
22
-  31 │ "import": "./dist/index.mjs",
23
- ╵ ~~~~~~~~
24
-
25
- The "require" condition comes earlier and will be used for all "require" calls:
26
-
27
- package.json:32:6:
28
-  32 │ "require": "./dist/index.js",
29
- ╵ ~~~~~~~~~
30
-
31
-
32
-
33
-
34
-  WARN  ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json] 9:38:41 pm
35
-
36
- package.json:33:6:
37
-  33 │ "types": "./dist/index.d.ts"
38
- ╵ ~~~~~~~
39
-
40
- The "import" condition comes earlier and will be used for all "import" statements:
41
-
42
- package.json:31:6:
43
-  31 │ "import": "./dist/index.mjs",
44
- ╵ ~~~~~~~~
45
-
46
- The "require" condition comes earlier and will be used for all "require" calls:
47
-
48
- package.json:32:6:
49
-  32 │ "require": "./dist/index.js",
50
- ╵ ~~~~~~~~~
51
-
52
-
53
-
54
- CJS dist/index.js 5.57 KB
55
12
  CJS dist/cli.js 7.60 KB
56
- CJS ⚡️ Build success in 92ms
57
- ESM dist/chunk-CGSYYULO.mjs 4.85 KB
58
- ESM dist/index.mjs 88.00 B
13
+ CJS dist/index.js 7.21 KB
14
+ CJS ⚡️ Build success in 39ms
59
15
  ESM dist/cli.mjs 1.39 KB
60
- ESM ⚡️ Build success in 92ms
16
+ ESM dist/chunk-CGSYYULO.mjs 4.85 KB
17
+ ESM dist/index.mjs 1.63 KB
18
+ ESM ⚡️ Build success in 40ms
61
19
  DTS Build start
62
- DTS ⚡️ Build success in 3989ms
20
+ DTS ⚡️ Build success in 3460ms
63
21
  DTS dist/cli.d.ts 108.00 B
64
- DTS dist/index.d.ts 968.00 B
22
+ DTS dist/index.d.ts 1.07 KB
65
23
  DTS dist/cli.d.mts 108.00 B
66
- DTS dist/index.d.mts 968.00 B
24
+ DTS dist/index.d.mts 1.07 KB
@@ -1,5 +1,5 @@
1
1
 
2
2
  
3
- > @aiready/doc-drift@0.1.6 lint /Users/pengcao/projects/aiready/packages/doc-drift
3
+ > @aiready/doc-drift@0.9.5 lint /Users/pengcao/projects/aiready/packages/doc-drift
4
4
  > eslint src --ext .ts
5
5
 
@@ -1,16 +1,16 @@
1
1
 
2
2
  
3
- > @aiready/doc-drift@0.9.4 test /Users/pengcao/projects/aiready/packages/doc-drift
3
+ > @aiready/doc-drift@0.11.0 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
- ✓ src/__tests__/analyzer.test.ts (1 test) 141ms
9
+ ✓ src/__tests__/analyzer.test.ts (1 test) 115ms
10
10
 
11
11
   Test Files  1 passed (1)
12
12
   Tests  1 passed (1)
13
-  Start at  21:39:02
14
-  Duration  1.20s (transform 184ms, setup 0ms, import 739ms, tests 141ms, environment 0ms)
13
+  Start at  10:34:43
14
+  Duration  1.30s (transform 232ms, setup 0ms, import 936ms, tests 115ms, environment 0ms)
15
15
 
16
16
  [?25h
package/dist/index.d.mts CHANGED
@@ -1,4 +1,9 @@
1
- import { Issue, IssueType, ScanOptions } from '@aiready/core';
1
+ import { ToolProvider, Issue, IssueType, ScanOptions } from '@aiready/core';
2
+
3
+ /**
4
+ * Documentation Drift Tool Provider
5
+ */
6
+ declare const DocDriftProvider: ToolProvider;
2
7
 
3
8
  interface DocDriftOptions extends ScanOptions {
4
9
  /** Maximum commit distance to check for drift */
@@ -28,4 +33,4 @@ interface DocDriftReport {
28
33
 
29
34
  declare function analyzeDocDrift(options: DocDriftOptions): Promise<DocDriftReport>;
30
35
 
31
- export { type DocDriftIssue, type DocDriftOptions, type DocDriftReport, analyzeDocDrift };
36
+ export { type DocDriftIssue, type DocDriftOptions, DocDriftProvider, type DocDriftReport, analyzeDocDrift };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,9 @@
1
- import { Issue, IssueType, ScanOptions } from '@aiready/core';
1
+ import { ToolProvider, Issue, IssueType, ScanOptions } from '@aiready/core';
2
+
3
+ /**
4
+ * Documentation Drift Tool Provider
5
+ */
6
+ declare const DocDriftProvider: ToolProvider;
2
7
 
3
8
  interface DocDriftOptions extends ScanOptions {
4
9
  /** Maximum commit distance to check for drift */
@@ -28,4 +33,4 @@ interface DocDriftReport {
28
33
 
29
34
  declare function analyzeDocDrift(options: DocDriftOptions): Promise<DocDriftReport>;
30
35
 
31
- export { type DocDriftIssue, type DocDriftOptions, type DocDriftReport, analyzeDocDrift };
36
+ export { type DocDriftIssue, type DocDriftOptions, DocDriftProvider, type DocDriftReport, analyzeDocDrift };
package/dist/index.js CHANGED
@@ -20,9 +20,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ DocDriftProvider: () => DocDriftProvider,
23
24
  analyzeDocDrift: () => analyzeDocDrift
24
25
  });
25
26
  module.exports = __toCommonJS(index_exports);
27
+ var import_core3 = require("@aiready/core");
28
+
29
+ // src/provider.ts
30
+ var import_core2 = require("@aiready/core");
26
31
 
27
32
  // src/analyzer.ts
28
33
  var import_core = require("@aiready/core");
@@ -150,7 +155,64 @@ async function analyzeDocDrift(options) {
150
155
  recommendations: riskResult.recommendations
151
156
  };
152
157
  }
158
+
159
+ // src/provider.ts
160
+ var DocDriftProvider = {
161
+ id: import_core2.ToolName.DocDrift,
162
+ alias: ["doc-drift", "docs", "jsdoc"],
163
+ async analyze(options) {
164
+ const report = await analyzeDocDrift(options);
165
+ const fileIssuesMap = /* @__PURE__ */ new Map();
166
+ for (const issue of report.issues) {
167
+ const file = issue.location.file;
168
+ if (!fileIssuesMap.has(file)) fileIssuesMap.set(file, []);
169
+ fileIssuesMap.get(file).push(issue);
170
+ }
171
+ const results = Array.from(fileIssuesMap.entries()).map(
172
+ ([fileName, issues]) => ({
173
+ fileName,
174
+ issues,
175
+ metrics: {}
176
+ })
177
+ );
178
+ return import_core2.SpokeOutputSchema.parse({
179
+ results,
180
+ summary: report.summary,
181
+ metadata: {
182
+ toolName: import_core2.ToolName.DocDrift,
183
+ version: "0.9.5",
184
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
185
+ rawData: report.rawData
186
+ }
187
+ });
188
+ },
189
+ score(output, options) {
190
+ const summary = output.summary;
191
+ const rawData = output.metadata?.rawData || {};
192
+ return {
193
+ toolName: import_core2.ToolName.DocDrift,
194
+ score: summary.score || 0,
195
+ rawMetrics: {
196
+ ...summary,
197
+ ...rawData
198
+ },
199
+ factors: [],
200
+ recommendations: (summary.recommendations || []).map(
201
+ (action) => ({
202
+ action,
203
+ estimatedImpact: 5,
204
+ priority: "medium"
205
+ })
206
+ )
207
+ };
208
+ },
209
+ defaultWeight: 8
210
+ };
211
+
212
+ // src/index.ts
213
+ import_core3.ToolRegistry.register(DocDriftProvider);
153
214
  // Annotate the CommonJS export names for ESM import in node:
154
215
  0 && (module.exports = {
216
+ DocDriftProvider,
155
217
  analyzeDocDrift
156
218
  });
package/dist/index.mjs CHANGED
@@ -1,6 +1,70 @@
1
1
  import {
2
2
  analyzeDocDrift
3
3
  } from "./chunk-CGSYYULO.mjs";
4
+
5
+ // src/index.ts
6
+ import { ToolRegistry } from "@aiready/core";
7
+
8
+ // src/provider.ts
9
+ import {
10
+ ToolName,
11
+ SpokeOutputSchema
12
+ } from "@aiready/core";
13
+ var DocDriftProvider = {
14
+ id: ToolName.DocDrift,
15
+ 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
+ });
41
+ },
42
+ score(output, options) {
43
+ const summary = output.summary;
44
+ 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
+ };
64
+
65
+ // src/index.ts
66
+ ToolRegistry.register(DocDriftProvider);
4
67
  export {
68
+ DocDriftProvider,
5
69
  analyzeDocDrift
6
70
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/doc-drift",
3
- "version": "0.9.5",
3
+ "version": "0.11.1",
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.19.5"
13
+ "@aiready/core": "0.21.1"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@types/node": "^24.0.0",
@@ -21,9 +21,9 @@
21
21
  },
22
22
  "exports": {
23
23
  ".": {
24
+ "types": "./dist/index.d.ts",
24
25
  "import": "./dist/index.mjs",
25
- "require": "./dist/index.js",
26
- "types": "./dist/index.d.ts"
26
+ "require": "./dist/index.js"
27
27
  }
28
28
  },
29
29
  "scripts": {
package/src/index.ts CHANGED
@@ -1,2 +1,9 @@
1
+ import { ToolRegistry } from '@aiready/core';
2
+ import { DocDriftProvider } from './provider';
3
+
4
+ // Register with global registry
5
+ ToolRegistry.register(DocDriftProvider);
6
+
1
7
  export * from './types';
2
8
  export * from './analyzer';
9
+ export { DocDriftProvider };
@@ -0,0 +1,74 @@
1
+ import {
2
+ ToolProvider,
3
+ ToolName,
4
+ SpokeOutput,
5
+ ScanOptions,
6
+ ToolScoringOutput,
7
+ AnalysisResult,
8
+ SpokeOutputSchema,
9
+ } from '@aiready/core';
10
+ import { analyzeDocDrift } from './analyzer';
11
+ import { DocDriftOptions, DocDriftIssue } from './types';
12
+
13
+ /**
14
+ * Documentation Drift Tool Provider
15
+ */
16
+ export const DocDriftProvider: ToolProvider = {
17
+ id: ToolName.DocDrift,
18
+ 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
+ });
49
+ },
50
+
51
+ score(output: SpokeOutput, options: ScanOptions): ToolScoringOutput {
52
+ const summary = output.summary as any;
53
+ 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
+ };
71
+ },
72
+
73
+ defaultWeight: 8,
74
+ };