@doccov/cli 0.18.0 → 0.20.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/dist/cli.js +448 -918
- package/dist/config/index.d.ts +3 -22
- package/dist/config/index.js +4 -35
- package/package.json +2 -2
package/dist/config/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { CheckConfig, DocCovConfig, DocsConfig
|
|
2
|
+
import { CheckConfig, DocCovConfig, DocsConfig } from "@doccov/sdk";
|
|
3
3
|
declare const stringList: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
4
4
|
/**
|
|
5
5
|
* Docs configuration schema
|
|
@@ -8,8 +8,6 @@ declare const docsConfigSchema: z.ZodObject<{
|
|
|
8
8
|
include: z.ZodOptional<typeof stringList>;
|
|
9
9
|
exclude: z.ZodOptional<typeof stringList>;
|
|
10
10
|
}>;
|
|
11
|
-
/** Quality rule severity levels */
|
|
12
|
-
declare const severitySchema: z.ZodEnum<["error", "warn", "off"]>;
|
|
13
11
|
/** Example validation mode */
|
|
14
12
|
declare const exampleModeSchema: z.ZodEnum<["presence", "typecheck", "run"]>;
|
|
15
13
|
/** Example validation modes - can be single, array, or comma-separated */
|
|
@@ -22,36 +20,19 @@ declare const checkConfigSchema: z.ZodObject<{
|
|
|
22
20
|
minCoverage: z.ZodOptional<z.ZodNumber>;
|
|
23
21
|
maxDrift: z.ZodOptional<z.ZodNumber>;
|
|
24
22
|
}>;
|
|
25
|
-
/**
|
|
26
|
-
* Quality rules configuration schema
|
|
27
|
-
*/
|
|
28
|
-
declare const qualityConfigSchema: z.ZodObject<{
|
|
29
|
-
rules: z.ZodOptional<z.ZodRecord<z.ZodString, typeof severitySchema>>;
|
|
30
|
-
}>;
|
|
31
|
-
/**
|
|
32
|
-
* Per-path policy configuration schema
|
|
33
|
-
*/
|
|
34
|
-
declare const policyConfigSchema: z.ZodObject<{
|
|
35
|
-
path: z.ZodString;
|
|
36
|
-
minCoverage: z.ZodOptional<z.ZodNumber>;
|
|
37
|
-
maxDrift: z.ZodOptional<z.ZodNumber>;
|
|
38
|
-
requireExamples: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
-
}>;
|
|
40
23
|
declare const docCovConfigSchema: z.ZodObject<{
|
|
41
24
|
include: z.ZodOptional<typeof stringList>;
|
|
42
25
|
exclude: z.ZodOptional<typeof stringList>;
|
|
43
26
|
plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
44
27
|
docs: z.ZodOptional<typeof docsConfigSchema>;
|
|
45
28
|
check: z.ZodOptional<typeof checkConfigSchema>;
|
|
46
|
-
quality: z.ZodOptional<typeof qualityConfigSchema>;
|
|
47
|
-
policies: z.ZodOptional<z.ZodArray<typeof policyConfigSchema>>;
|
|
48
29
|
}>;
|
|
49
30
|
type DocCovConfigInput = z.infer<typeof docCovConfigSchema>;
|
|
50
31
|
type NormalizedDocCovConfig = DocCovConfig;
|
|
51
|
-
declare const DOCCOV_CONFIG_FILENAMES: readonly ["doccov.config.ts", "doccov.config.mts", "doccov.config.
|
|
32
|
+
declare const DOCCOV_CONFIG_FILENAMES: readonly ["doccov.config.ts", "doccov.config.mts", "doccov.config.js", "doccov.config.mjs"];
|
|
52
33
|
interface LoadedDocCovConfig extends NormalizedDocCovConfig {
|
|
53
34
|
filePath: string;
|
|
54
35
|
}
|
|
55
36
|
declare const loadDocCovConfig: (cwd: string) => Promise<LoadedDocCovConfig | null>;
|
|
56
37
|
declare const defineConfig: (config: DocCovConfigInput) => DocCovConfigInput;
|
|
57
|
-
export { loadDocCovConfig, defineConfig,
|
|
38
|
+
export { loadDocCovConfig, defineConfig, NormalizedDocCovConfig, LoadedDocCovConfig, DocsConfig, DocCovConfigInput, DOCCOV_CONFIG_FILENAMES, CheckConfig };
|
package/dist/config/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// src/config/doccov-config.ts
|
|
2
|
-
import { access
|
|
2
|
+
import { access } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
-
import { parse as parseYaml } from "yaml";
|
|
6
5
|
|
|
7
6
|
// src/config/schema.ts
|
|
8
7
|
import { z } from "zod";
|
|
@@ -14,7 +13,6 @@ var docsConfigSchema = z.object({
|
|
|
14
13
|
include: stringList.optional(),
|
|
15
14
|
exclude: stringList.optional()
|
|
16
15
|
});
|
|
17
|
-
var severitySchema = z.enum(["error", "warn", "off"]);
|
|
18
16
|
var exampleModeSchema = z.enum([
|
|
19
17
|
"presence",
|
|
20
18
|
"typecheck",
|
|
@@ -30,23 +28,12 @@ var checkConfigSchema = z.object({
|
|
|
30
28
|
minCoverage: z.number().min(0).max(100).optional(),
|
|
31
29
|
maxDrift: z.number().min(0).max(100).optional()
|
|
32
30
|
});
|
|
33
|
-
var qualityConfigSchema = z.object({
|
|
34
|
-
rules: z.record(severitySchema).optional()
|
|
35
|
-
});
|
|
36
|
-
var policyConfigSchema = z.object({
|
|
37
|
-
path: z.string().min(1),
|
|
38
|
-
minCoverage: z.number().min(0).max(100).optional(),
|
|
39
|
-
maxDrift: z.number().min(0).max(100).optional(),
|
|
40
|
-
requireExamples: z.boolean().optional()
|
|
41
|
-
});
|
|
42
31
|
var docCovConfigSchema = z.object({
|
|
43
32
|
include: stringList.optional(),
|
|
44
33
|
exclude: stringList.optional(),
|
|
45
34
|
plugins: z.array(z.unknown()).optional(),
|
|
46
35
|
docs: docsConfigSchema.optional(),
|
|
47
|
-
check: checkConfigSchema.optional()
|
|
48
|
-
quality: qualityConfigSchema.optional(),
|
|
49
|
-
policies: z.array(policyConfigSchema).optional()
|
|
36
|
+
check: checkConfigSchema.optional()
|
|
50
37
|
});
|
|
51
38
|
var normalizeList = (value) => {
|
|
52
39
|
if (!value) {
|
|
@@ -78,21 +65,12 @@ var normalizeConfig = (input) => {
|
|
|
78
65
|
maxDrift: input.check.maxDrift
|
|
79
66
|
};
|
|
80
67
|
}
|
|
81
|
-
let quality;
|
|
82
|
-
if (input.quality) {
|
|
83
|
-
quality = {
|
|
84
|
-
rules: input.quality.rules
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
const policies = input.policies;
|
|
88
68
|
return {
|
|
89
69
|
include,
|
|
90
70
|
exclude,
|
|
91
71
|
plugins: input.plugins,
|
|
92
72
|
docs,
|
|
93
|
-
check
|
|
94
|
-
quality,
|
|
95
|
-
policies
|
|
73
|
+
check
|
|
96
74
|
};
|
|
97
75
|
};
|
|
98
76
|
|
|
@@ -100,12 +78,8 @@ var normalizeConfig = (input) => {
|
|
|
100
78
|
var DOCCOV_CONFIG_FILENAMES = [
|
|
101
79
|
"doccov.config.ts",
|
|
102
80
|
"doccov.config.mts",
|
|
103
|
-
"doccov.config.cts",
|
|
104
81
|
"doccov.config.js",
|
|
105
|
-
"doccov.config.mjs"
|
|
106
|
-
"doccov.config.cjs",
|
|
107
|
-
"doccov.yml",
|
|
108
|
-
"doccov.yaml"
|
|
82
|
+
"doccov.config.mjs"
|
|
109
83
|
];
|
|
110
84
|
var fileExists = async (filePath) => {
|
|
111
85
|
try {
|
|
@@ -132,11 +106,6 @@ var findConfigFile = async (cwd) => {
|
|
|
132
106
|
}
|
|
133
107
|
};
|
|
134
108
|
var importConfigModule = async (absolutePath) => {
|
|
135
|
-
const ext = path.extname(absolutePath);
|
|
136
|
-
if (ext === ".yml" || ext === ".yaml") {
|
|
137
|
-
const content = await readFile(absolutePath, "utf-8");
|
|
138
|
-
return parseYaml(content);
|
|
139
|
-
}
|
|
140
109
|
const fileUrl = pathToFileURL(absolutePath);
|
|
141
110
|
fileUrl.searchParams.set("t", Date.now().toString());
|
|
142
111
|
const module = await import(fileUrl.href);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doccov/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "DocCov CLI - Documentation coverage and drift detection for TypeScript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@ai-sdk/anthropic": "^1.0.0",
|
|
50
50
|
"@ai-sdk/openai": "^1.0.0",
|
|
51
|
-
"@doccov/sdk": "^0.
|
|
51
|
+
"@doccov/sdk": "^0.20.0",
|
|
52
52
|
"@inquirer/prompts": "^7.8.0",
|
|
53
53
|
"@openpkg-ts/spec": "^0.10.0",
|
|
54
54
|
"ai": "^4.0.0",
|