@driftdev/cli 1.5.0 → 1.5.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.
- package/dist/drift.js +24 -14
- package/package.json +2 -2
package/dist/drift.js
CHANGED
|
@@ -2998,6 +2998,9 @@ import * as path21 from "node:path";
|
|
|
2998
2998
|
import { getExport, listExports } from "@openpkg-ts/sdk";
|
|
2999
2999
|
|
|
3000
3000
|
// src/formatters/get.ts
|
|
3001
|
+
function col(text, width) {
|
|
3002
|
+
return padRight(text, Math.max(width, text.length + 2));
|
|
3003
|
+
}
|
|
3001
3004
|
function renderGet(data) {
|
|
3002
3005
|
const lines = [""];
|
|
3003
3006
|
const exp = data.export;
|
|
@@ -3021,7 +3024,7 @@ function renderGet(data) {
|
|
|
3021
3024
|
const req = p.required ? "required" : "optional";
|
|
3022
3025
|
const type = p.type ?? "unknown";
|
|
3023
3026
|
const desc = p.description ? ` ${c.dim(JSON.stringify(p.description))}` : "";
|
|
3024
|
-
lines.push(indent(` ${
|
|
3027
|
+
lines.push(indent(` ${col(p.name ?? "", 16)}${col(type, 24)}${c.gray(req)}${desc}`));
|
|
3025
3028
|
}
|
|
3026
3029
|
lines.push("");
|
|
3027
3030
|
}
|
|
@@ -3039,7 +3042,7 @@ function renderGet(data) {
|
|
|
3039
3042
|
for (const m of shown) {
|
|
3040
3043
|
const req = m.required ? "required" : "optional";
|
|
3041
3044
|
const type = m.type ?? "";
|
|
3042
|
-
lines.push(indent(` ${
|
|
3045
|
+
lines.push(indent(` ${col(m.name ?? "", 20)}${col(type, 20)}${c.gray(req)}`));
|
|
3043
3046
|
}
|
|
3044
3047
|
if (remaining > 0) {
|
|
3045
3048
|
lines.push(indent(c.gray(` ... ${remaining} more`)));
|
|
@@ -3265,22 +3268,29 @@ function registerGetCommand(program) {
|
|
|
3265
3268
|
}
|
|
3266
3269
|
});
|
|
3267
3270
|
}
|
|
3268
|
-
function schemaTypeString(schema) {
|
|
3271
|
+
function schemaTypeString(schema, depth = 0) {
|
|
3269
3272
|
if (schema === undefined || schema === null)
|
|
3270
3273
|
return;
|
|
3271
3274
|
if (typeof schema === "string")
|
|
3272
3275
|
return schema;
|
|
3273
|
-
if (typeof schema
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3276
|
+
if (typeof schema !== "object" || depth > 3)
|
|
3277
|
+
return;
|
|
3278
|
+
const s = schema;
|
|
3279
|
+
if (typeof s.$ref === "string")
|
|
3280
|
+
return s.$ref.split("/").pop();
|
|
3281
|
+
const composite = s.oneOf ?? s.anyOf;
|
|
3282
|
+
if (Array.isArray(composite)) {
|
|
3283
|
+
const arms = composite.map((arm) => schemaTypeString(arm, depth + 1) ?? "unknown").filter((v, i, a) => a.indexOf(v) === i);
|
|
3284
|
+
return arms.join(" | ");
|
|
3285
|
+
}
|
|
3286
|
+
if (s.type === "array") {
|
|
3287
|
+
const item = schemaTypeString(s.items, depth + 1);
|
|
3288
|
+
return item ? `${item}[]` : "array";
|
|
3289
|
+
}
|
|
3290
|
+
if (typeof s.title === "string" && (s.type === "object" || s.type === undefined))
|
|
3291
|
+
return s.title;
|
|
3292
|
+
if (typeof s.type === "string")
|
|
3293
|
+
return s.type;
|
|
3284
3294
|
return;
|
|
3285
3295
|
}
|
|
3286
3296
|
function renderNotFound(exportName, suggestions, startTime, version) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@driftdev/cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Drift CLI - detect when your docs drift from your code",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@driftdev/clarity-adapter": "^1.0.1",
|
|
48
|
-
"@driftdev/openapi-adapter": "^1.0.
|
|
48
|
+
"@driftdev/openapi-adapter": "^1.0.1",
|
|
49
49
|
"@driftdev/sdk": "^1.4.0",
|
|
50
50
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
51
51
|
"@openpkg-ts/sdk": "^0.38.0",
|