@doccov/cli 0.21.0 → 0.22.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 +28 -4
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -613,6 +613,22 @@ function renderHtml(stats, options = {}) {
|
|
|
613
613
|
</html>`;
|
|
614
614
|
}
|
|
615
615
|
// src/reports/pr-comment.ts
|
|
616
|
+
function extractReturnType(schema) {
|
|
617
|
+
if (!schema)
|
|
618
|
+
return "void";
|
|
619
|
+
if (typeof schema === "string")
|
|
620
|
+
return schema;
|
|
621
|
+
if (typeof schema === "object") {
|
|
622
|
+
const s = schema;
|
|
623
|
+
if (typeof s.type === "string")
|
|
624
|
+
return s.type;
|
|
625
|
+
if (typeof s.$ref === "string") {
|
|
626
|
+
const ref = s.$ref;
|
|
627
|
+
return ref.startsWith("#/types/") ? ref.slice("#/types/".length) : ref;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
return "unknown";
|
|
631
|
+
}
|
|
616
632
|
function renderPRComment(data, opts = {}) {
|
|
617
633
|
const { diff, headSpec } = data;
|
|
618
634
|
const limit = opts.limit ?? 10;
|
|
@@ -773,7 +789,7 @@ function formatExportSignature(exp) {
|
|
|
773
789
|
if (exp.kind === "function" && exp.signatures?.[0]) {
|
|
774
790
|
const sig = exp.signatures[0];
|
|
775
791
|
const params = sig.parameters?.map((p) => `${p.name}${p.required === false ? "?" : ""}`).join(", ") ?? "";
|
|
776
|
-
const ret = sig.returns?.
|
|
792
|
+
const ret = extractReturnType(sig.returns?.schema);
|
|
777
793
|
return `${prefix} ${exp.name}(${params}): ${ret}`;
|
|
778
794
|
}
|
|
779
795
|
if (exp.kind === "type" || exp.kind === "interface") {
|
|
@@ -795,7 +811,7 @@ function getMissingSignals(exp) {
|
|
|
795
811
|
if (undocParams.length > 0) {
|
|
796
812
|
missing.push(`\`@param ${undocParams.map((p) => p.name).join(", ")}\``);
|
|
797
813
|
}
|
|
798
|
-
if (!sig.returns?.description && sig.returns?.
|
|
814
|
+
if (!sig.returns?.description && extractReturnType(sig.returns?.schema) !== "void") {
|
|
799
815
|
missing.push("`@returns`");
|
|
800
816
|
}
|
|
801
817
|
}
|
|
@@ -2190,11 +2206,11 @@ var detectRepoInfo = (cwd, fileExists2, readFileSync4) => {
|
|
|
2190
2206
|
// src/commands/spec.ts
|
|
2191
2207
|
import * as fs5 from "node:fs";
|
|
2192
2208
|
import * as path7 from "node:path";
|
|
2193
|
-
import { DocCov as DocCov3, NodeFileSystem as NodeFileSystem3, renderApiSurface, resolveTarget as resolveTarget3 } from "@doccov/sdk";
|
|
2209
|
+
import { detectPackageManager, DocCov as DocCov3, NodeFileSystem as NodeFileSystem3, renderApiSurface, resolveTarget as resolveTarget3 } from "@doccov/sdk";
|
|
2194
2210
|
import { normalize, validateSpec } from "@openpkg-ts/spec";
|
|
2195
2211
|
import chalk8 from "chalk";
|
|
2196
2212
|
// package.json
|
|
2197
|
-
var version = "0.
|
|
2213
|
+
var version = "0.21.0";
|
|
2198
2214
|
|
|
2199
2215
|
// src/commands/spec.ts
|
|
2200
2216
|
var defaultDependencies4 = {
|
|
@@ -2303,6 +2319,14 @@ function registerSpecCommand(program, dependencies = {}) {
|
|
|
2303
2319
|
}
|
|
2304
2320
|
log(chalk8.gray(` ${getArrayLength(normalized.exports)} exports`));
|
|
2305
2321
|
log(chalk8.gray(` ${getArrayLength(normalized.types)} types`));
|
|
2322
|
+
const schemaExtraction = normalized.generation?.analysis?.schemaExtraction;
|
|
2323
|
+
if (options.runtime && (!schemaExtraction?.runtimeCount || schemaExtraction.runtimeCount === 0)) {
|
|
2324
|
+
const pm = await detectPackageManager(fileSystem);
|
|
2325
|
+
const buildCmd = pm.name === "npm" ? "npm run build" : `${pm.name} run build`;
|
|
2326
|
+
log("");
|
|
2327
|
+
log(chalk8.yellow("⚠ Runtime extraction requested but no schemas extracted."));
|
|
2328
|
+
log(chalk8.yellow(` Ensure project is built (${buildCmd}) and dist/ exists.`));
|
|
2329
|
+
}
|
|
2306
2330
|
if (options.verbose && normalized.generation) {
|
|
2307
2331
|
const gen = normalized.generation;
|
|
2308
2332
|
log("");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doccov/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "DocCov CLI - Documentation coverage and drift detection for TypeScript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -48,9 +48,9 @@
|
|
|
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.22.0",
|
|
52
52
|
"@inquirer/prompts": "^7.8.0",
|
|
53
|
-
"@openpkg-ts/spec": "^0.
|
|
53
|
+
"@openpkg-ts/spec": "^0.11.0",
|
|
54
54
|
"ai": "^4.0.0",
|
|
55
55
|
"chalk": "^5.4.1",
|
|
56
56
|
"commander": "^14.0.0",
|