@doccov/cli 0.16.0 → 0.18.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.
@@ -1,12 +1,12 @@
1
1
  import { z } from "zod";
2
- import { CheckConfig, DocCovConfig, DocsConfig, QualityRulesConfig } from "@doccov/sdk";
2
+ import { CheckConfig, DocCovConfig, DocsConfig, PolicyConfig, QualityRulesConfig } from "@doccov/sdk";
3
3
  declare const stringList: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
4
4
  /**
5
5
  * Docs configuration schema
6
6
  */
7
7
  declare const docsConfigSchema: z.ZodObject<{
8
- include: z.ZodOptional<typeof stringList>
9
- exclude: z.ZodOptional<typeof stringList>
8
+ include: z.ZodOptional<typeof stringList>;
9
+ exclude: z.ZodOptional<typeof stringList>;
10
10
  }>;
11
11
  /** Quality rule severity levels */
12
12
  declare const severitySchema: z.ZodEnum<["error", "warn", "off"]>;
@@ -18,30 +18,40 @@ declare const exampleModesSchema: z.ZodUnion<[typeof exampleModeSchema, z.ZodArr
18
18
  * Check command configuration schema.
19
19
  */
20
20
  declare const checkConfigSchema: z.ZodObject<{
21
- examples: z.ZodOptional<typeof exampleModesSchema>
22
- minCoverage: z.ZodOptional<z.ZodNumber>
23
- maxDrift: z.ZodOptional<z.ZodNumber>
21
+ examples: z.ZodOptional<typeof exampleModesSchema>;
22
+ minCoverage: z.ZodOptional<z.ZodNumber>;
23
+ maxDrift: z.ZodOptional<z.ZodNumber>;
24
24
  }>;
25
25
  /**
26
26
  * Quality rules configuration schema
27
27
  */
28
28
  declare const qualityConfigSchema: z.ZodObject<{
29
- rules: z.ZodOptional<z.ZodRecord<z.ZodString, typeof severitySchema>>
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>;
30
39
  }>;
31
40
  declare const docCovConfigSchema: z.ZodObject<{
32
- include: z.ZodOptional<typeof stringList>
33
- exclude: z.ZodOptional<typeof stringList>
34
- plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown>>
35
- docs: z.ZodOptional<typeof docsConfigSchema>
36
- check: z.ZodOptional<typeof checkConfigSchema>
37
- quality: z.ZodOptional<typeof qualityConfigSchema>
41
+ include: z.ZodOptional<typeof stringList>;
42
+ exclude: z.ZodOptional<typeof stringList>;
43
+ plugins: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
44
+ docs: z.ZodOptional<typeof docsConfigSchema>;
45
+ check: z.ZodOptional<typeof checkConfigSchema>;
46
+ quality: z.ZodOptional<typeof qualityConfigSchema>;
47
+ policies: z.ZodOptional<z.ZodArray<typeof policyConfigSchema>>;
38
48
  }>;
39
49
  type DocCovConfigInput = z.infer<typeof docCovConfigSchema>;
40
50
  type NormalizedDocCovConfig = DocCovConfig;
41
- declare const DOCCOV_CONFIG_FILENAMES: readonly ["doccov.config.ts", "doccov.config.mts", "doccov.config.cts", "doccov.config.js", "doccov.config.mjs", "doccov.config.cjs"];
51
+ declare const DOCCOV_CONFIG_FILENAMES: readonly ["doccov.config.ts", "doccov.config.mts", "doccov.config.cts", "doccov.config.js", "doccov.config.mjs", "doccov.config.cjs", "doccov.yml", "doccov.yaml"];
42
52
  interface LoadedDocCovConfig extends NormalizedDocCovConfig {
43
53
  filePath: string;
44
54
  }
45
55
  declare const loadDocCovConfig: (cwd: string) => Promise<LoadedDocCovConfig | null>;
46
56
  declare const defineConfig: (config: DocCovConfigInput) => DocCovConfigInput;
47
- export { loadDocCovConfig, defineConfig, QualityRulesConfig, NormalizedDocCovConfig, LoadedDocCovConfig, DocsConfig, DocCovConfigInput, DOCCOV_CONFIG_FILENAMES, CheckConfig };
57
+ export { loadDocCovConfig, defineConfig, QualityRulesConfig, PolicyConfig, NormalizedDocCovConfig, LoadedDocCovConfig, DocsConfig, DocCovConfigInput, DOCCOV_CONFIG_FILENAMES, CheckConfig };
@@ -1,7 +1,8 @@
1
1
  // src/config/doccov-config.ts
2
- import { access } from "node:fs/promises";
2
+ import { access, readFile } 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";
5
6
 
6
7
  // src/config/schema.ts
7
8
  import { z } from "zod";
@@ -32,13 +33,20 @@ var checkConfigSchema = z.object({
32
33
  var qualityConfigSchema = z.object({
33
34
  rules: z.record(severitySchema).optional()
34
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
+ });
35
42
  var docCovConfigSchema = z.object({
36
43
  include: stringList.optional(),
37
44
  exclude: stringList.optional(),
38
45
  plugins: z.array(z.unknown()).optional(),
39
46
  docs: docsConfigSchema.optional(),
40
47
  check: checkConfigSchema.optional(),
41
- quality: qualityConfigSchema.optional()
48
+ quality: qualityConfigSchema.optional(),
49
+ policies: z.array(policyConfigSchema).optional()
42
50
  });
43
51
  var normalizeList = (value) => {
44
52
  if (!value) {
@@ -76,13 +84,15 @@ var normalizeConfig = (input) => {
76
84
  rules: input.quality.rules
77
85
  };
78
86
  }
87
+ const policies = input.policies;
79
88
  return {
80
89
  include,
81
90
  exclude,
82
91
  plugins: input.plugins,
83
92
  docs,
84
93
  check,
85
- quality
94
+ quality,
95
+ policies
86
96
  };
87
97
  };
88
98
 
@@ -93,7 +103,9 @@ var DOCCOV_CONFIG_FILENAMES = [
93
103
  "doccov.config.cts",
94
104
  "doccov.config.js",
95
105
  "doccov.config.mjs",
96
- "doccov.config.cjs"
106
+ "doccov.config.cjs",
107
+ "doccov.yml",
108
+ "doccov.yaml"
97
109
  ];
98
110
  var fileExists = async (filePath) => {
99
111
  try {
@@ -120,6 +132,11 @@ var findConfigFile = async (cwd) => {
120
132
  }
121
133
  };
122
134
  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
+ }
123
140
  const fileUrl = pathToFileURL(absolutePath);
124
141
  fileUrl.searchParams.set("t", Date.now().toString());
125
142
  const module = await import(fileUrl.href);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doccov/cli",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "description": "DocCov CLI - Documentation coverage and drift detection for TypeScript",
5
5
  "keywords": [
6
6
  "typescript",
@@ -48,14 +48,15 @@
48
48
  "dependencies": {
49
49
  "@ai-sdk/anthropic": "^1.0.0",
50
50
  "@ai-sdk/openai": "^1.0.0",
51
- "@doccov/sdk": "^0.15.1",
51
+ "@doccov/sdk": "^0.18.0",
52
52
  "@inquirer/prompts": "^7.8.0",
53
- "@openpkg-ts/spec": "^0.9.0",
53
+ "@openpkg-ts/spec": "^0.10.0",
54
54
  "ai": "^4.0.0",
55
55
  "chalk": "^5.4.1",
56
56
  "commander": "^14.0.0",
57
57
  "glob": "^11.0.0",
58
58
  "simple-git": "^3.27.0",
59
+ "yaml": "^2.8.2",
59
60
  "zod": "^3.25.0"
60
61
  },
61
62
  "devDependencies": {
package/dist/cli.d.ts DELETED
File without changes