@kubb/cli 5.0.0-alpha.34 → 5.0.0-alpha.35
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/{agent-DG5HV-tW.cjs → agent-BLXyRIQn.cjs} +3 -3
- package/dist/{agent-DG5HV-tW.cjs.map → agent-BLXyRIQn.cjs.map} +1 -1
- package/dist/{agent-C5na5bbz.cjs → agent-CRQdwSar.cjs} +6 -6
- package/dist/{agent-C5na5bbz.cjs.map → agent-CRQdwSar.cjs.map} +1 -1
- package/dist/{agent-DmErNHkG.js → agent-DeM_wyAN.js} +2 -2
- package/dist/{agent-DmErNHkG.js.map → agent-DeM_wyAN.js.map} +1 -1
- package/dist/{generate-CUJnCnIQ.js → generate-CNQWSc3E.js} +2 -2
- package/dist/{generate-CUJnCnIQ.js.map → generate-CNQWSc3E.js.map} +1 -1
- package/dist/{generate-B4tku_7i.cjs → generate-CWPwtauL.cjs} +173 -154
- package/dist/generate-CWPwtauL.cjs.map +1 -0
- package/dist/{generate-XrHYSmsI.js → generate-DctgMAfY.js} +169 -150
- package/dist/generate-DctgMAfY.js.map +1 -0
- package/dist/{generate-DUL1xmJg.cjs → generate-gdilbmRQ.cjs} +2 -2
- package/dist/{generate-DUL1xmJg.cjs.map → generate-gdilbmRQ.cjs.map} +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.js +6 -6
- package/dist/{init-CrlY2xYZ.js → init-BI-1RkgG.js} +3 -3
- package/dist/{init-CrlY2xYZ.js.map → init-BI-1RkgG.js.map} +1 -1
- package/dist/{init-BlriFVH6.cjs → init-cAbMOLut.cjs} +6 -6
- package/dist/init-cAbMOLut.cjs.map +1 -0
- package/dist/{init-V5FRBsV7.cjs → init-hVxzq-Kh.cjs} +3 -3
- package/dist/{init-V5FRBsV7.cjs.map → init-hVxzq-Kh.cjs.map} +1 -1
- package/dist/{init-Y1TNCdzh.js → init-hcm7zvPn.js} +2 -2
- package/dist/init-hcm7zvPn.js.map +1 -0
- package/dist/{mcp-jMZ56bqT.cjs → mcp-9yURBP26.cjs} +3 -3
- package/dist/{mcp-jMZ56bqT.cjs.map → mcp-9yURBP26.cjs.map} +1 -1
- package/dist/{mcp-CAeC6a-k.js → mcp-Bdtcfk55.js} +2 -2
- package/dist/{mcp-CAeC6a-k.js.map → mcp-Bdtcfk55.js.map} +1 -1
- package/dist/{mcp-J47QdVFi.cjs → mcp-DMOLm4FN.cjs} +3 -3
- package/dist/{mcp-J47QdVFi.cjs.map → mcp-DMOLm4FN.cjs.map} +1 -1
- package/dist/{package-Dh1zBdCJ.cjs → package-B9cAxfxL.cjs} +2 -2
- package/dist/package-B9cAxfxL.cjs.map +1 -0
- package/dist/package-CYS1_pd_.js +6 -0
- package/dist/package-CYS1_pd_.js.map +1 -0
- package/dist/{telemetry-YO-uwAbf.cjs → telemetry-D_Bi2E3I.cjs} +3 -3
- package/dist/{telemetry-YO-uwAbf.cjs.map → telemetry-D_Bi2E3I.cjs.map} +1 -1
- package/dist/{validate-gCh1hrgS.js → validate--mbofqde.js} +2 -2
- package/dist/{validate-gCh1hrgS.js.map → validate--mbofqde.js.map} +1 -1
- package/dist/{validate-B-LfVNlS.cjs → validate-DIKeUU8K.cjs} +3 -3
- package/dist/{validate-B-LfVNlS.cjs.map → validate-DIKeUU8K.cjs.map} +1 -1
- package/dist/{validate-CbcHhnj0.cjs → validate-b-ccrtPU.cjs} +3 -3
- package/dist/{validate-CbcHhnj0.cjs.map → validate-b-ccrtPU.cjs.map} +1 -1
- package/package.json +5 -5
- package/src/loggers/clackLogger.ts +24 -24
- package/src/loggers/fileSystemLogger.ts +10 -10
- package/src/loggers/githubActionsLogger.ts +22 -22
- package/src/loggers/plainLogger.ts +21 -21
- package/src/runners/generate.ts +53 -65
- package/src/runners/init.ts +1 -1
- package/src/utils/executeHooks.ts +11 -11
- package/src/utils/getConfig.ts +10 -0
- package/src/utils/getCosmiConfig.ts +2 -2
- package/src/utils/runHook.ts +9 -9
- package/dist/generate-B4tku_7i.cjs.map +0 -1
- package/dist/generate-XrHYSmsI.js.map +0 -1
- package/dist/init-BlriFVH6.cjs.map +0 -1
- package/dist/init-Y1TNCdzh.js.map +0 -1
- package/dist/package-CTCPKXJv.js +0 -6
- package/dist/package-CTCPKXJv.js.map +0 -1
- package/dist/package-Dh1zBdCJ.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-
|
|
1
|
+
{"version":3,"file":"mcp-9yURBP26.cjs","names":["jiti","process","sendTelemetry","buildTelemetryEvent","getErrorMessage"],"sources":["../src/runners/mcp.ts"],"sourcesContent":["import process from 'node:process'\nimport { styleText } from 'node:util'\nimport { getErrorMessage } from '@internals/utils'\nimport type * as McpModule from '@kubb/mcp'\nimport { jiti } from '../utils/jiti.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype McpOptions = {\n version: string\n}\n\nexport async function runMcp({ version }: McpOptions): Promise<void> {\n let mod: typeof McpModule\n try {\n mod = (await jiti.import('@kubb/mcp', { default: true })) as typeof McpModule\n } catch (_e) {\n console.error(`Import of '@kubb/mcp' is required to start the MCP server`)\n process.exit(1)\n }\n\n const { run } = mod\n const hrStart = process.hrtime()\n try {\n console.log('⏳ Starting MCP server...')\n console.warn(styleText('yellow', 'This feature is still under development — use with caution'))\n run()\n await sendTelemetry(buildTelemetryEvent({ command: 'mcp', kubbVersion: version, hrStart, status: 'success' }))\n } catch (error) {\n await sendTelemetry(buildTelemetryEvent({ command: 'mcp', kubbVersion: version, hrStart, status: 'failed' }))\n console.error(getErrorMessage(error))\n }\n}\n"],"mappings":";;;;;;;;AAWA,eAAsB,OAAO,EAAE,WAAsC;CACnE,IAAI;AACJ,KAAI;AACF,QAAO,MAAMA,aAAAA,KAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;UACjD,IAAI;AACX,UAAQ,MAAM,4DAA4D;AAC1E,eAAA,QAAQ,KAAK,EAAE;;CAGjB,MAAM,EAAE,QAAQ;CAChB,MAAM,UAAUC,aAAAA,QAAQ,QAAQ;AAChC,KAAI;AACF,UAAQ,IAAI,2BAA2B;AACvC,UAAQ,MAAA,GAAA,UAAA,WAAe,UAAU,6DAA6D,CAAC;AAC/F,OAAK;AACL,QAAMC,kBAAAA,cAAcC,kBAAAA,oBAAoB;GAAE,SAAS;GAAO,aAAa;GAAS;GAAS,QAAQ;GAAW,CAAC,CAAC;UACvG,OAAO;AACd,QAAMD,kBAAAA,cAAcC,kBAAAA,oBAAoB;GAAE,SAAS;GAAO,aAAa;GAAS;GAAS,QAAQ;GAAU,CAAC,CAAC;AAC7G,UAAQ,MAAMC,eAAAA,gBAAgB,MAAM,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./chunk--u3MIqq1.js";
|
|
2
2
|
import { n as defineCommand } from "./define-Ctii4bel.js";
|
|
3
|
-
import { t as version } from "./package-
|
|
3
|
+
import { t as version } from "./package-CYS1_pd_.js";
|
|
4
4
|
//#region src/commands/mcp.ts
|
|
5
5
|
const command = defineCommand({
|
|
6
6
|
name: "mcp",
|
|
@@ -13,4 +13,4 @@ const command = defineCommand({
|
|
|
13
13
|
//#endregion
|
|
14
14
|
export { command };
|
|
15
15
|
|
|
16
|
-
//# sourceMappingURL=mcp-
|
|
16
|
+
//# sourceMappingURL=mcp-Bdtcfk55.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-
|
|
1
|
+
{"version":3,"file":"mcp-Bdtcfk55.js","names":[],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'mcp',\n description: 'Start the server to enable the MCP client to interact with the LLM.',\n async run() {\n const { runMcp } = await import('../runners/mcp.ts')\n\n await runMcp({ version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,MAAM,MAAM;EACV,MAAM,EAAE,WAAW,MAAM,OAAO;AAEhC,QAAM,OAAO,EAAE,SAAS,CAAC;;CAE5B,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
require("./chunk-ByKO4r7w.cjs");
|
|
2
2
|
const require_define = require("./define-Bdn8j5VM.cjs");
|
|
3
|
-
const require_package = require("./package-
|
|
3
|
+
const require_package = require("./package-B9cAxfxL.cjs");
|
|
4
4
|
//#region src/commands/mcp.ts
|
|
5
5
|
const command = require_define.defineCommand({
|
|
6
6
|
name: "mcp",
|
|
7
7
|
description: "Start the server to enable the MCP client to interact with the LLM.",
|
|
8
8
|
async run() {
|
|
9
|
-
const { runMcp } = await Promise.resolve().then(() => require("./mcp-
|
|
9
|
+
const { runMcp } = await Promise.resolve().then(() => require("./mcp-9yURBP26.cjs"));
|
|
10
10
|
await runMcp({ version: require_package.version });
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
//#endregion
|
|
14
14
|
exports.command = command;
|
|
15
15
|
|
|
16
|
-
//# sourceMappingURL=mcp-
|
|
16
|
+
//# sourceMappingURL=mcp-DMOLm4FN.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-
|
|
1
|
+
{"version":3,"file":"mcp-DMOLm4FN.cjs","names":["defineCommand"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'mcp',\n description: 'Start the server to enable the MCP client to interact with the LLM.',\n async run() {\n const { runMcp } = await import('../runners/mcp.ts')\n\n await runMcp({ version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,MAAM,MAAM;EACV,MAAM,EAAE,WAAW,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,qBAAA,CAAA;AAEzB,QAAM,OAAO,EAAE,SAAA,gBAAA,SAAS,CAAC;;CAE5B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region package.json
|
|
2
|
-
var version = "5.0.0-alpha.
|
|
2
|
+
var version = "5.0.0-alpha.35";
|
|
3
3
|
//#endregion
|
|
4
4
|
Object.defineProperty(exports, "version", {
|
|
5
5
|
enumerable: true,
|
|
@@ -8,4 +8,4 @@ Object.defineProperty(exports, "version", {
|
|
|
8
8
|
}
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
//# sourceMappingURL=package-
|
|
11
|
+
//# sourceMappingURL=package-B9cAxfxL.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-B9cAxfxL.cjs","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-CYS1_pd_.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
|
|
@@ -3,9 +3,9 @@ const require_constants = require("./constants-D0XHAHeZ.cjs");
|
|
|
3
3
|
let node_crypto = require("node:crypto");
|
|
4
4
|
let node_dns = require("node:dns");
|
|
5
5
|
let node_os = require("node:os");
|
|
6
|
-
node_os = require_chunk.__toESM(node_os);
|
|
6
|
+
node_os = require_chunk.__toESM(node_os, 1);
|
|
7
7
|
let node_process = require("node:process");
|
|
8
|
-
node_process = require_chunk.__toESM(node_process);
|
|
8
|
+
node_process = require_chunk.__toESM(node_process, 1);
|
|
9
9
|
//#region ../../internals/utils/src/env.ts
|
|
10
10
|
/**
|
|
11
11
|
* Returns `true` when running inside a GitHub Actions workflow.
|
|
@@ -279,4 +279,4 @@ Object.defineProperty(exports, "sendTelemetry", {
|
|
|
279
279
|
}
|
|
280
280
|
});
|
|
281
281
|
|
|
282
|
-
//# sourceMappingURL=telemetry-
|
|
282
|
+
//# sourceMappingURL=telemetry-D_Bi2E3I.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry-YO-uwAbf.cjs","names":["dnsPromises","process","OTLP_ENDPOINT","os"],"sources":["../../../internals/utils/src/env.ts","../../../internals/utils/src/network.ts","../src/utils/telemetry.ts"],"sourcesContent":["/**\n * Returns `true` when running inside a GitHub Actions workflow.\n *\n * @example\n * ```ts\n * if (isGitHubActions()) {\n * core.setOutput('result', 'ok')\n * }\n * ```\n */\nexport function isGitHubActions(): boolean {\n return !!process.env.GITHUB_ACTIONS\n}\n\n/**\n * Returns `true` when the process is running in a CI environment.\n * Covers GitHub Actions, GitLab CI, CircleCI, Travis CI, Jenkins, Bitbucket,\n * TeamCity, Buildkite, and Azure Pipelines.\n *\n * @example\n * ```ts\n * if (isCIEnvironment()) {\n * logger.level = 'error'\n * }\n * ```\n */\nexport function isCIEnvironment(): boolean {\n return !!(\n process.env.CI ||\n process.env.GITHUB_ACTIONS ||\n process.env.GITLAB_CI ||\n process.env.BITBUCKET_BUILD_NUMBER ||\n process.env.JENKINS_URL ||\n process.env.CIRCLECI ||\n process.env.TRAVIS ||\n process.env.TEAMCITY_VERSION ||\n process.env.BUILDKITE ||\n process.env.TF_BUILD\n )\n}\n\n/**\n * Returns `true` when the process has an interactive TTY with a valid terminal\n * width and is not running in CI.\n *\n * Some IDE-embedded terminals report `isTTY = true` but set `columns` to `0`,\n * which breaks clack's box-drawing helpers (they call `String.prototype.repeat`\n * with a negative count and throw a `RangeError`). We therefore require a\n * positive column count before declaring the TTY usable.\n *\n * @example\n * ```ts\n * if (canUseTTY()) {\n * renderProgressBar()\n * }\n * ```\n */\nexport function canUseTTY(): boolean {\n return !!process.stdout.isTTY && (process.stdout.columns ?? 0) > 0 && !isCIEnvironment()\n}\n","import { promises as dnsPromises } from 'node:dns'\n\n/**\n * Well-known stable domains used as DNS probes to check internet connectivity.\n */\nconst TEST_DOMAINS = ['dns.google.com', 'cloudflare.com', 'one.one.one.one'] as const\n\n/**\n * Returns `true` when the system has internet connectivity.\n * Probes DNS resolution against well-known stable domains.\n *\n * @example\n * ```ts\n * if (await isOnline()) {\n * await fetchLatestVersion()\n * }\n * ```\n */\nexport async function isOnline(): Promise<boolean> {\n for (const domain of TEST_DOMAINS) {\n try {\n await dnsPromises.resolve(domain)\n return true\n } catch {\n // Try next domain\n }\n }\n\n return false\n}\n\n/**\n * Executes `fn` only when the system is online. Returns `null` when offline or on error.\n *\n * @example\n * ```ts\n * const version = await executeIfOnline(() => fetchLatestVersion('kubb'))\n * // null when offline\n * ```\n */\nexport async function executeIfOnline<T>(fn: () => Promise<T>): Promise<T | null> {\n if (!(await isOnline())) return null\n\n try {\n return await fn()\n } catch {\n return null\n }\n}\n","import { randomBytes } from 'node:crypto'\nimport os from 'node:os'\nimport process from 'node:process'\nimport { executeIfOnline, isCIEnvironment } from '@internals/utils'\nimport { OTLP_ENDPOINT } from '../constants.ts'\n\n// OpenTelemetry OTLP JSON types\n// https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto\n// https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/common/v1/common.proto\n\ntype OtlpStringValue = { stringValue: string }\ntype OtlpBoolValue = { boolValue: boolean }\ntype OtlpIntValue = { intValue: number }\ntype OtlpDoubleValue = { doubleValue: number }\ntype OtlpBytesValue = { bytesValue: string }\ntype OtlpArrayValue = { arrayValue: { values: OtlpAnyValue[] } }\ntype OtlpKvListValue = { kvlistValue: { values: OtlpKeyValue[] } }\n\ntype OtlpAnyValue = OtlpStringValue | OtlpBoolValue | OtlpIntValue | OtlpDoubleValue | OtlpBytesValue | OtlpArrayValue | OtlpKvListValue\n\ntype OtlpKeyValue = {\n key: string\n value: OtlpAnyValue\n}\n\ntype OtlpResource = {\n attributes: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpInstrumentationScope = {\n name: string\n version?: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\n/** https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto#L103 */\ntype OtlpSpanKind = 0 | 1 | 2 | 3 | 4 | 5\n\n/** 0 = STATUS_CODE_UNSET, 1 = STATUS_CODE_OK, 2 = STATUS_CODE_ERROR */\ntype OtlpStatusCode = 0 | 1 | 2\n\ntype OtlpStatus = {\n code: OtlpStatusCode\n message?: string\n}\n\ntype OtlpSpan = {\n traceId: string\n spanId: string\n traceState?: string\n parentSpanId?: string\n name: string\n kind: OtlpSpanKind\n startTimeUnixNano: string\n endTimeUnixNano: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n events?: OtlpSpanEvent[]\n droppedEventsCount?: number\n links?: OtlpSpanLink[]\n droppedLinksCount?: number\n status?: OtlpStatus\n}\n\ntype OtlpSpanEvent = {\n timeUnixNano: string\n name: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpSpanLink = {\n traceId: string\n spanId: string\n traceState?: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpScopeSpans = {\n scope: OtlpInstrumentationScope\n spans: OtlpSpan[]\n schemaUrl?: string\n}\n\ntype OtlpResourceSpans = {\n resource: OtlpResource\n scopeSpans: OtlpScopeSpans[]\n schemaUrl?: string\n}\n\n/** Root payload sent to POST /v1/traces */\ntype OtlpExportTraceServiceRequest = {\n resourceSpans: OtlpResourceSpans[]\n}\n\nexport type TelemetryPlugin = {\n name: string\n options: Record<string, unknown>\n}\n\ntype TelemetryEvent = {\n command: string\n kubbVersion: string\n nodeVersion: string\n platform: string\n ci: boolean\n plugins: TelemetryPlugin[]\n duration: number\n filesCreated: number\n status: 'success' | 'failed'\n}\n\n/**\n * Detect whether the current process is running inside a CI environment.\n * Delegates to the canonical isCIEnvironment() from envDetection.\n */\nexport function isCi(): boolean {\n return isCIEnvironment()\n}\n\n/**\n * Check if telemetry is disabled via DO_NOT_TRACK or KUBB_DISABLE_TELEMETRY.\n * Respects the standard DO_NOT_TRACK convention used across development tools.\n */\nexport function isTelemetryDisabled(): boolean {\n return (\n process.env['DO_NOT_TRACK'] === '1' ||\n process.env['DO_NOT_TRACK'] === 'true' ||\n process.env['KUBB_DISABLE_TELEMETRY'] === '1' ||\n process.env['KUBB_DISABLE_TELEMETRY'] === 'true'\n )\n}\n\n/**\n * Convert a TelemetryEvent into an OTLP-compatible JSON trace payload.\n * See https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/\n */\nexport function buildOtlpPayload(event: TelemetryEvent): OtlpExportTraceServiceRequest {\n const traceId = randomBytes(16).toString('hex')\n const spanId = randomBytes(8).toString('hex')\n const endTimeNs = BigInt(Date.now()) * 1_000_000n\n const startTimeNs = endTimeNs - BigInt(event.duration) * 1_000_000n\n\n const attributes: OtlpKeyValue[] = [\n { key: 'kubb.command', value: { stringValue: event.command } },\n { key: 'kubb.version', value: { stringValue: event.kubbVersion } },\n { key: 'kubb.node_version', value: { stringValue: event.nodeVersion } },\n { key: 'kubb.platform', value: { stringValue: event.platform } },\n { key: 'kubb.ci', value: { boolValue: event.ci } },\n { key: 'kubb.files_created', value: { intValue: event.filesCreated } },\n { key: 'kubb.status', value: { stringValue: event.status } },\n {\n key: 'kubb.plugins',\n value: {\n arrayValue: {\n values: event.plugins.map(\n (p): OtlpKvListValue => ({\n kvlistValue: {\n values: [\n { key: 'name', value: { stringValue: p.name } },\n { key: 'options', value: { stringValue: JSON.stringify({ ...p.options, usedEnumNames: undefined }) } },\n ],\n },\n }),\n ),\n },\n },\n },\n ]\n\n return {\n resourceSpans: [\n {\n resource: {\n attributes: [\n { key: 'service.name', value: { stringValue: 'kubb-cli' } },\n { key: 'service.version', value: { stringValue: event.kubbVersion } },\n { key: 'telemetry.sdk.language', value: { stringValue: 'nodejs' } },\n ],\n },\n scopeSpans: [\n {\n scope: { name: 'kubb-cli', version: event.kubbVersion },\n spans: [\n {\n traceId,\n spanId,\n name: event.command,\n kind: 1 satisfies OtlpSpanKind,\n startTimeUnixNano: String(startTimeNs),\n endTimeUnixNano: String(endTimeNs),\n attributes,\n status: { code: (event.status === 'success' ? 1 : 2) satisfies OtlpStatusCode },\n },\n ],\n },\n ],\n },\n ],\n }\n}\n\n/**\n * Send an anonymous telemetry event to the Kubb OTLP endpoint.\n * Respects DO_NOT_TRACK and KUBB_DISABLE_TELEMETRY environment variables.\n * Fails silently to never interrupt the generation process.\n */\nexport async function sendTelemetry(event: TelemetryEvent): Promise<void> {\n if (isTelemetryDisabled()) {\n return\n }\n\n await executeIfOnline(async () => {\n try {\n await fetch(`${OTLP_ENDPOINT}/v1/traces`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Kubb-Telemetry-Version': '1',\n 'Kubb-Telemetry-Source': 'kubb-cli',\n },\n body: JSON.stringify(buildOtlpPayload(event)),\n signal: AbortSignal.timeout(5_000),\n })\n } catch (_e) {\n // Fail silently – telemetry must never break the CLI\n }\n })\n}\n\n/**\n * Build an anonymous telemetry payload from a completed generation run.\n * No file paths, OpenAPI specs, or secrets are included.\n */\nexport function buildTelemetryEvent(options: {\n command: 'generate' | 'mcp' | 'validate' | 'agent'\n kubbVersion: string\n plugins?: TelemetryPlugin[]\n hrStart: [number, number]\n filesCreated?: number\n status: 'success' | 'failed'\n}): TelemetryEvent {\n const [seconds, nanoseconds] = process.hrtime(options.hrStart)\n const duration = Math.round(seconds * 1000 + nanoseconds / 1e6)\n\n return {\n command: options.command,\n kubbVersion: options.kubbVersion,\n nodeVersion: process.versions.node.split('.')[0] as string,\n platform: os.platform(),\n ci: isCi(),\n plugins: options.plugins ?? [],\n duration,\n filesCreated: options.filesCreated ?? 0,\n status: options.status,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,SAAgB,kBAA2B;AACzC,QAAO,CAAC,CAAC,QAAQ,IAAI;;;;;;;;;;;;;;AAevB,SAAgB,kBAA2B;AACzC,QAAO,CAAC,EACN,QAAQ,IAAI,MACZ,QAAQ,IAAI,kBACZ,QAAQ,IAAI,aACZ,QAAQ,IAAI,0BACZ,QAAQ,IAAI,eACZ,QAAQ,IAAI,YACZ,QAAQ,IAAI,UACZ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B;KAC1B,yBAAyB;KAC1B;IACD,MAAM,KAAK,UAAU,iBAAiB,MAAM,CAAC;IAC7C,QAAQ,YAAY,QAAQ,IAAM;IACnC,CAAC;WACK,IAAI;GAGb;;;;;;AAOJ,SAAgB,oBAAoB,SAOjB;CACjB,MAAM,CAAC,SAAS,eAAeD,aAAAA,QAAQ,OAAO,QAAQ,QAAQ;CAC9D,MAAM,WAAW,KAAK,MAAM,UAAU,MAAO,cAAc,IAAI;AAE/D,QAAO;EACL,SAAS,QAAQ;EACjB,aAAa,QAAQ;EACrB,aAAaA,aAAAA,QAAQ,SAAS,KAAK,MAAM,IAAI,CAAC;EAC9C,UAAUE,QAAAA,QAAG,UAAU;EACvB,IAAI,MAAM;EACV,SAAS,QAAQ,WAAW,EAAE;EAC9B;EACA,cAAc,QAAQ,gBAAgB;EACtC,QAAQ,QAAQ;EACjB"}
|
|
1
|
+
{"version":3,"file":"telemetry-D_Bi2E3I.cjs","names":["dnsPromises","process","OTLP_ENDPOINT","os"],"sources":["../../../internals/utils/src/env.ts","../../../internals/utils/src/network.ts","../src/utils/telemetry.ts"],"sourcesContent":["/**\n * Returns `true` when running inside a GitHub Actions workflow.\n *\n * @example\n * ```ts\n * if (isGitHubActions()) {\n * core.setOutput('result', 'ok')\n * }\n * ```\n */\nexport function isGitHubActions(): boolean {\n return !!process.env.GITHUB_ACTIONS\n}\n\n/**\n * Returns `true` when the process is running in a CI environment.\n * Covers GitHub Actions, GitLab CI, CircleCI, Travis CI, Jenkins, Bitbucket,\n * TeamCity, Buildkite, and Azure Pipelines.\n *\n * @example\n * ```ts\n * if (isCIEnvironment()) {\n * logger.level = 'error'\n * }\n * ```\n */\nexport function isCIEnvironment(): boolean {\n return !!(\n process.env.CI ||\n process.env.GITHUB_ACTIONS ||\n process.env.GITLAB_CI ||\n process.env.BITBUCKET_BUILD_NUMBER ||\n process.env.JENKINS_URL ||\n process.env.CIRCLECI ||\n process.env.TRAVIS ||\n process.env.TEAMCITY_VERSION ||\n process.env.BUILDKITE ||\n process.env.TF_BUILD\n )\n}\n\n/**\n * Returns `true` when the process has an interactive TTY with a valid terminal\n * width and is not running in CI.\n *\n * Some IDE-embedded terminals report `isTTY = true` but set `columns` to `0`,\n * which breaks clack's box-drawing helpers (they call `String.prototype.repeat`\n * with a negative count and throw a `RangeError`). We therefore require a\n * positive column count before declaring the TTY usable.\n *\n * @example\n * ```ts\n * if (canUseTTY()) {\n * renderProgressBar()\n * }\n * ```\n */\nexport function canUseTTY(): boolean {\n return !!process.stdout.isTTY && (process.stdout.columns ?? 0) > 0 && !isCIEnvironment()\n}\n","import { promises as dnsPromises } from 'node:dns'\n\n/**\n * Well-known stable domains used as DNS probes to check internet connectivity.\n */\nconst TEST_DOMAINS = ['dns.google.com', 'cloudflare.com', 'one.one.one.one'] as const\n\n/**\n * Returns `true` when the system has internet connectivity.\n * Probes DNS resolution against well-known stable domains.\n *\n * @example\n * ```ts\n * if (await isOnline()) {\n * await fetchLatestVersion()\n * }\n * ```\n */\nexport async function isOnline(): Promise<boolean> {\n for (const domain of TEST_DOMAINS) {\n try {\n await dnsPromises.resolve(domain)\n return true\n } catch {\n // Try next domain\n }\n }\n\n return false\n}\n\n/**\n * Executes `fn` only when the system is online. Returns `null` when offline or on error.\n *\n * @example\n * ```ts\n * const version = await executeIfOnline(() => fetchLatestVersion('kubb'))\n * // null when offline\n * ```\n */\nexport async function executeIfOnline<T>(fn: () => Promise<T>): Promise<T | null> {\n if (!(await isOnline())) return null\n\n try {\n return await fn()\n } catch {\n return null\n }\n}\n","import { randomBytes } from 'node:crypto'\nimport os from 'node:os'\nimport process from 'node:process'\nimport { executeIfOnline, isCIEnvironment } from '@internals/utils'\nimport { OTLP_ENDPOINT } from '../constants.ts'\n\n// OpenTelemetry OTLP JSON types\n// https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto\n// https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/common/v1/common.proto\n\ntype OtlpStringValue = { stringValue: string }\ntype OtlpBoolValue = { boolValue: boolean }\ntype OtlpIntValue = { intValue: number }\ntype OtlpDoubleValue = { doubleValue: number }\ntype OtlpBytesValue = { bytesValue: string }\ntype OtlpArrayValue = { arrayValue: { values: OtlpAnyValue[] } }\ntype OtlpKvListValue = { kvlistValue: { values: OtlpKeyValue[] } }\n\ntype OtlpAnyValue = OtlpStringValue | OtlpBoolValue | OtlpIntValue | OtlpDoubleValue | OtlpBytesValue | OtlpArrayValue | OtlpKvListValue\n\ntype OtlpKeyValue = {\n key: string\n value: OtlpAnyValue\n}\n\ntype OtlpResource = {\n attributes: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpInstrumentationScope = {\n name: string\n version?: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\n/** https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto#L103 */\ntype OtlpSpanKind = 0 | 1 | 2 | 3 | 4 | 5\n\n/** 0 = STATUS_CODE_UNSET, 1 = STATUS_CODE_OK, 2 = STATUS_CODE_ERROR */\ntype OtlpStatusCode = 0 | 1 | 2\n\ntype OtlpStatus = {\n code: OtlpStatusCode\n message?: string\n}\n\ntype OtlpSpan = {\n traceId: string\n spanId: string\n traceState?: string\n parentSpanId?: string\n name: string\n kind: OtlpSpanKind\n startTimeUnixNano: string\n endTimeUnixNano: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n events?: OtlpSpanEvent[]\n droppedEventsCount?: number\n links?: OtlpSpanLink[]\n droppedLinksCount?: number\n status?: OtlpStatus\n}\n\ntype OtlpSpanEvent = {\n timeUnixNano: string\n name: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpSpanLink = {\n traceId: string\n spanId: string\n traceState?: string\n attributes?: OtlpKeyValue[]\n droppedAttributesCount?: number\n}\n\ntype OtlpScopeSpans = {\n scope: OtlpInstrumentationScope\n spans: OtlpSpan[]\n schemaUrl?: string\n}\n\ntype OtlpResourceSpans = {\n resource: OtlpResource\n scopeSpans: OtlpScopeSpans[]\n schemaUrl?: string\n}\n\n/** Root payload sent to POST /v1/traces */\ntype OtlpExportTraceServiceRequest = {\n resourceSpans: OtlpResourceSpans[]\n}\n\nexport type TelemetryPlugin = {\n name: string\n options: Record<string, unknown>\n}\n\ntype TelemetryEvent = {\n command: string\n kubbVersion: string\n nodeVersion: string\n platform: string\n ci: boolean\n plugins: TelemetryPlugin[]\n duration: number\n filesCreated: number\n status: 'success' | 'failed'\n}\n\n/**\n * Detect whether the current process is running inside a CI environment.\n * Delegates to the canonical isCIEnvironment() from envDetection.\n */\nexport function isCi(): boolean {\n return isCIEnvironment()\n}\n\n/**\n * Check if telemetry is disabled via DO_NOT_TRACK or KUBB_DISABLE_TELEMETRY.\n * Respects the standard DO_NOT_TRACK convention used across development tools.\n */\nexport function isTelemetryDisabled(): boolean {\n return (\n process.env['DO_NOT_TRACK'] === '1' ||\n process.env['DO_NOT_TRACK'] === 'true' ||\n process.env['KUBB_DISABLE_TELEMETRY'] === '1' ||\n process.env['KUBB_DISABLE_TELEMETRY'] === 'true'\n )\n}\n\n/**\n * Convert a TelemetryEvent into an OTLP-compatible JSON trace payload.\n * See https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/\n */\nexport function buildOtlpPayload(event: TelemetryEvent): OtlpExportTraceServiceRequest {\n const traceId = randomBytes(16).toString('hex')\n const spanId = randomBytes(8).toString('hex')\n const endTimeNs = BigInt(Date.now()) * 1_000_000n\n const startTimeNs = endTimeNs - BigInt(event.duration) * 1_000_000n\n\n const attributes: OtlpKeyValue[] = [\n { key: 'kubb.command', value: { stringValue: event.command } },\n { key: 'kubb.version', value: { stringValue: event.kubbVersion } },\n { key: 'kubb.node_version', value: { stringValue: event.nodeVersion } },\n { key: 'kubb.platform', value: { stringValue: event.platform } },\n { key: 'kubb.ci', value: { boolValue: event.ci } },\n { key: 'kubb.files_created', value: { intValue: event.filesCreated } },\n { key: 'kubb.status', value: { stringValue: event.status } },\n {\n key: 'kubb.plugins',\n value: {\n arrayValue: {\n values: event.plugins.map(\n (p): OtlpKvListValue => ({\n kvlistValue: {\n values: [\n { key: 'name', value: { stringValue: p.name } },\n { key: 'options', value: { stringValue: JSON.stringify({ ...p.options, usedEnumNames: undefined }) } },\n ],\n },\n }),\n ),\n },\n },\n },\n ]\n\n return {\n resourceSpans: [\n {\n resource: {\n attributes: [\n { key: 'service.name', value: { stringValue: 'kubb-cli' } },\n { key: 'service.version', value: { stringValue: event.kubbVersion } },\n { key: 'telemetry.sdk.language', value: { stringValue: 'nodejs' } },\n ],\n },\n scopeSpans: [\n {\n scope: { name: 'kubb-cli', version: event.kubbVersion },\n spans: [\n {\n traceId,\n spanId,\n name: event.command,\n kind: 1 satisfies OtlpSpanKind,\n startTimeUnixNano: String(startTimeNs),\n endTimeUnixNano: String(endTimeNs),\n attributes,\n status: { code: (event.status === 'success' ? 1 : 2) satisfies OtlpStatusCode },\n },\n ],\n },\n ],\n },\n ],\n }\n}\n\n/**\n * Send an anonymous telemetry event to the Kubb OTLP endpoint.\n * Respects DO_NOT_TRACK and KUBB_DISABLE_TELEMETRY environment variables.\n * Fails silently to never interrupt the generation process.\n */\nexport async function sendTelemetry(event: TelemetryEvent): Promise<void> {\n if (isTelemetryDisabled()) {\n return\n }\n\n await executeIfOnline(async () => {\n try {\n await fetch(`${OTLP_ENDPOINT}/v1/traces`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Kubb-Telemetry-Version': '1',\n 'Kubb-Telemetry-Source': 'kubb-cli',\n },\n body: JSON.stringify(buildOtlpPayload(event)),\n signal: AbortSignal.timeout(5_000),\n })\n } catch (_e) {\n // Fail silently – telemetry must never break the CLI\n }\n })\n}\n\n/**\n * Build an anonymous telemetry payload from a completed generation run.\n * No file paths, OpenAPI specs, or secrets are included.\n */\nexport function buildTelemetryEvent(options: {\n command: 'generate' | 'mcp' | 'validate' | 'agent'\n kubbVersion: string\n plugins?: TelemetryPlugin[]\n hrStart: [number, number]\n filesCreated?: number\n status: 'success' | 'failed'\n}): TelemetryEvent {\n const [seconds, nanoseconds] = process.hrtime(options.hrStart)\n const duration = Math.round(seconds * 1000 + nanoseconds / 1e6)\n\n return {\n command: options.command,\n kubbVersion: options.kubbVersion,\n nodeVersion: process.versions.node.split('.')[0] as string,\n platform: os.platform(),\n ci: isCi(),\n plugins: options.plugins ?? [],\n duration,\n filesCreated: options.filesCreated ?? 0,\n status: options.status,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,SAAgB,kBAA2B;AACzC,QAAO,CAAC,CAAC,QAAQ,IAAI;;;;;;;;;;;;;;AAevB,SAAgB,kBAA2B;AACzC,QAAO,CAAC,EACN,QAAQ,IAAI,MACZ,QAAQ,IAAI,kBACZ,QAAQ,IAAI,aACZ,QAAQ,IAAI,0BACZ,QAAQ,IAAI,eACZ,QAAQ,IAAI,YACZ,QAAQ,IAAI,UACZ,QAAQ,IAAI,oBACZ,QAAQ,IAAI,aACZ,QAAQ,IAAI;;;;;;;;;;;;;;;;;;AAoBhB,SAAgB,YAAqB;AACnC,QAAO,CAAC,CAAC,QAAQ,OAAO,UAAU,QAAQ,OAAO,WAAW,KAAK,KAAK,CAAC,iBAAiB;;;;;;;ACrD1F,MAAM,eAAe;CAAC;CAAkB;CAAkB;CAAkB;;;;;;;;;;;;AAa5E,eAAsB,WAA6B;AACjD,MAAK,MAAM,UAAU,aACnB,KAAI;AACF,QAAMA,SAAAA,SAAY,QAAQ,OAAO;AACjC,SAAO;SACD;AAKV,QAAO;;;;;;;;;;;AAYT,eAAsB,gBAAmB,IAAyC;AAChF,KAAI,CAAE,MAAM,UAAU,CAAG,QAAO;AAEhC,KAAI;AACF,SAAO,MAAM,IAAI;SACX;AACN,SAAO;;;;;;;;;ACyEX,SAAgB,OAAgB;AAC9B,QAAO,iBAAiB;;;;;;AAO1B,SAAgB,sBAA+B;AAC7C,QACEC,aAAAA,QAA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Command } from "./define-Ctii4bel.js";
|
|
3
|
-
import { t as version } from "./package-
|
|
3
|
+
import { t as version } from "./package-CYS1_pd_.js";
|
|
4
4
|
//#region src/commands/validate.ts
|
|
5
5
|
const command = defineCommand({
|
|
6
6
|
name: "validate",
|
|
@@ -22,4 +22,4 @@ const command = defineCommand({
|
|
|
22
22
|
//#endregion
|
|
23
23
|
export { command };
|
|
24
24
|
|
|
25
|
-
//# sourceMappingURL=validate
|
|
25
|
+
//# sourceMappingURL=validate--mbofqde.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate
|
|
1
|
+
{"version":3,"file":"validate--mbofqde.js","names":[],"sources":["../src/commands/validate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'validate',\n description: 'Validate a Swagger/OpenAPI file',\n options: {\n input: { type: 'string', description: 'Path to Swagger/OpenAPI file', short: 'i', required: true },\n },\n async run({ values }) {\n const { runValidate } = await import('../runners/validate.ts')\n\n await runValidate({ input: values.input, version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,SAAS,EACP,OAAO;EAAE,MAAM;EAAU,aAAa;EAAgC,OAAO;EAAK,UAAU;EAAM,EACnG;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,gBAAgB,MAAM,OAAO;AAErC,QAAM,YAAY;GAAE,OAAO,OAAO;GAAO;GAAS,CAAC;;CAEtD,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-ByKO4r7w.cjs");
|
|
2
2
|
const require_errors = require("./errors-CLCjoSg0.cjs");
|
|
3
|
-
const require_telemetry = require("./telemetry-
|
|
3
|
+
const require_telemetry = require("./telemetry-D_Bi2E3I.cjs");
|
|
4
4
|
const require_jiti = require("./jiti-Cd3S0xwr.cjs");
|
|
5
5
|
let node_process = require("node:process");
|
|
6
|
-
node_process = require_chunk.__toESM(node_process);
|
|
6
|
+
node_process = require_chunk.__toESM(node_process, 1);
|
|
7
7
|
//#region src/runners/validate.ts
|
|
8
8
|
async function runValidate({ input, version }) {
|
|
9
9
|
let mod;
|
|
@@ -39,4 +39,4 @@ async function runValidate({ input, version }) {
|
|
|
39
39
|
//#endregion
|
|
40
40
|
exports.runValidate = runValidate;
|
|
41
41
|
|
|
42
|
-
//# sourceMappingURL=validate-
|
|
42
|
+
//# sourceMappingURL=validate-DIKeUU8K.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-
|
|
1
|
+
{"version":3,"file":"validate-DIKeUU8K.cjs","names":["jiti","process","sendTelemetry","buildTelemetryEvent","getErrorMessage"],"sources":["../src/runners/validate.ts"],"sourcesContent":["import process from 'node:process'\nimport { getErrorMessage } from '@internals/utils'\nimport type * as OasModule from '@kubb/oas'\nimport { jiti } from '../utils/jiti.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype ValidateOptions = {\n input: string\n version: string\n}\n\nexport async function runValidate({ input, version }: ValidateOptions): Promise<void> {\n let mod: typeof OasModule\n try {\n mod = (await jiti.import('@kubb/oas', { default: true })) as typeof OasModule\n } catch (_e) {\n console.error(`Import of '@kubb/oas' is required to do validation`)\n process.exit(1)\n }\n\n const { parse } = mod\n const hrStart = process.hrtime()\n try {\n const oas = await parse(input)\n await oas.validate()\n\n await sendTelemetry(buildTelemetryEvent({ command: 'validate', kubbVersion: version, hrStart, status: 'success' }))\n console.log('✅ Validation success')\n } catch (error) {\n await sendTelemetry(buildTelemetryEvent({ command: 'validate', kubbVersion: version, hrStart, status: 'failed' }))\n console.error('❌ Validation failed')\n console.error(getErrorMessage(error))\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;AAWA,eAAsB,YAAY,EAAE,OAAO,WAA2C;CACpF,IAAI;AACJ,KAAI;AACF,QAAO,MAAMA,aAAAA,KAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;UACjD,IAAI;AACX,UAAQ,MAAM,qDAAqD;AACnE,eAAA,QAAQ,KAAK,EAAE;;CAGjB,MAAM,EAAE,UAAU;CAClB,MAAM,UAAUC,aAAAA,QAAQ,QAAQ;AAChC,KAAI;AAEF,SADY,MAAM,MAAM,MAAM,EACpB,UAAU;AAEpB,QAAMC,kBAAAA,cAAcC,kBAAAA,oBAAoB;GAAE,SAAS;GAAY,aAAa;GAAS;GAAS,QAAQ;GAAW,CAAC,CAAC;AACnH,UAAQ,IAAI,uBAAuB;UAC5B,OAAO;AACd,QAAMD,kBAAAA,cAAcC,kBAAAA,oBAAoB;GAAE,SAAS;GAAY,aAAa;GAAS;GAAS,QAAQ;GAAU,CAAC,CAAC;AAClH,UAAQ,MAAM,sBAAsB;AACpC,UAAQ,MAAMC,eAAAA,gBAAgB,MAAM,CAAC;AACrC,eAAA,QAAQ,KAAK,EAAE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require("./chunk-ByKO4r7w.cjs");
|
|
2
2
|
const require_define = require("./define-Bdn8j5VM.cjs");
|
|
3
|
-
const require_package = require("./package-
|
|
3
|
+
const require_package = require("./package-B9cAxfxL.cjs");
|
|
4
4
|
//#region src/commands/validate.ts
|
|
5
5
|
const command = require_define.defineCommand({
|
|
6
6
|
name: "validate",
|
|
@@ -12,7 +12,7 @@ const command = require_define.defineCommand({
|
|
|
12
12
|
required: true
|
|
13
13
|
} },
|
|
14
14
|
async run({ values }) {
|
|
15
|
-
const { runValidate } = await Promise.resolve().then(() => require("./validate-
|
|
15
|
+
const { runValidate } = await Promise.resolve().then(() => require("./validate-DIKeUU8K.cjs"));
|
|
16
16
|
await runValidate({
|
|
17
17
|
input: values.input,
|
|
18
18
|
version: require_package.version
|
|
@@ -22,4 +22,4 @@ const command = require_define.defineCommand({
|
|
|
22
22
|
//#endregion
|
|
23
23
|
exports.command = command;
|
|
24
24
|
|
|
25
|
-
//# sourceMappingURL=validate-
|
|
25
|
+
//# sourceMappingURL=validate-b-ccrtPU.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-
|
|
1
|
+
{"version":3,"file":"validate-b-ccrtPU.cjs","names":["defineCommand"],"sources":["../src/commands/validate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'validate',\n description: 'Validate a Swagger/OpenAPI file',\n options: {\n input: { type: 'string', description: 'Path to Swagger/OpenAPI file', short: 'i', required: true },\n },\n async run({ values }) {\n const { runValidate } = await import('../runners/validate.ts')\n\n await runValidate({ input: values.input, version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,SAAS,EACP,OAAO;EAAE,MAAM;EAAU,aAAa;EAAgC,OAAO;EAAK,UAAU;EAAM,EACnG;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,gBAAgB,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,0BAAA,CAAA;AAE9B,QAAM,YAAY;GAAE,OAAO,OAAO;GAAO,SAAA,gBAAA;GAAS,CAAC;;CAEtD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/cli",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.35",
|
|
4
4
|
"description": "Command-line interface for Kubb, enabling easy generation of TypeScript, React-Query, Zod, and other code from OpenAPI specifications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -58,14 +58,14 @@
|
|
|
58
58
|
"cosmiconfig": "^9.0.1",
|
|
59
59
|
"jiti": "2.5.1",
|
|
60
60
|
"tinyexec": "^1.1.1",
|
|
61
|
-
"@kubb/core": "5.0.0-alpha.
|
|
61
|
+
"@kubb/core": "5.0.0-alpha.35"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"source-map-support": "^0.5.21",
|
|
65
65
|
"@internals/utils": "0.0.0",
|
|
66
|
-
"@kubb/agent": "5.0.0-alpha.
|
|
67
|
-
"@kubb/mcp": "5.0.0-alpha.
|
|
68
|
-
"@kubb/oas": "5.0.0-alpha.
|
|
66
|
+
"@kubb/agent": "5.0.0-alpha.35",
|
|
67
|
+
"@kubb/mcp": "5.0.0-alpha.35",
|
|
68
|
+
"@kubb/oas": "5.0.0-alpha.35"
|
|
69
69
|
},
|
|
70
70
|
"engines": {
|
|
71
71
|
"node": ">=22"
|
|
@@ -73,7 +73,7 @@ export const clackLogger = defineLogger({
|
|
|
73
73
|
state.isSpinning = false
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
context.on('info', (message, info = '') => {
|
|
76
|
+
context.on('kubb:info', (message, info = '') => {
|
|
77
77
|
if (logLevel <= logLevelMap.silent) {
|
|
78
78
|
return
|
|
79
79
|
}
|
|
@@ -87,7 +87,7 @@ export const clackLogger = defineLogger({
|
|
|
87
87
|
}
|
|
88
88
|
})
|
|
89
89
|
|
|
90
|
-
context.on('success', (message, info = '') => {
|
|
90
|
+
context.on('kubb:success', (message, info = '') => {
|
|
91
91
|
if (logLevel <= logLevelMap.silent) {
|
|
92
92
|
return
|
|
93
93
|
}
|
|
@@ -101,7 +101,7 @@ export const clackLogger = defineLogger({
|
|
|
101
101
|
}
|
|
102
102
|
})
|
|
103
103
|
|
|
104
|
-
context.on('warn', (message, info) => {
|
|
104
|
+
context.on('kubb:warn', (message, info) => {
|
|
105
105
|
if (logLevel < logLevelMap.warn) {
|
|
106
106
|
return
|
|
107
107
|
}
|
|
@@ -113,7 +113,7 @@ export const clackLogger = defineLogger({
|
|
|
113
113
|
clack.log.warn(text)
|
|
114
114
|
})
|
|
115
115
|
|
|
116
|
-
context.on('error', (error) => {
|
|
116
|
+
context.on('kubb:error', (error) => {
|
|
117
117
|
const caused = toCause(error)
|
|
118
118
|
|
|
119
119
|
const text = [styleText('red', '✗'), error.message].join(' ')
|
|
@@ -142,7 +142,7 @@ export const clackLogger = defineLogger({
|
|
|
142
142
|
}
|
|
143
143
|
})
|
|
144
144
|
|
|
145
|
-
context.on('version:new', (version, latestVersion) => {
|
|
145
|
+
context.on('kubb:version:new', (version, latestVersion) => {
|
|
146
146
|
if (logLevel <= logLevelMap.silent) {
|
|
147
147
|
return
|
|
148
148
|
}
|
|
@@ -167,13 +167,13 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
167
167
|
}
|
|
168
168
|
})
|
|
169
169
|
|
|
170
|
-
context.on('lifecycle:start', async (version) => {
|
|
170
|
+
context.on('kubb:lifecycle:start', async (version) => {
|
|
171
171
|
console.log(`\n${getIntro({ title: 'The ultimate toolkit for working with APIs', description: 'Ready to start', version, areEyesOpen: true })}\n`)
|
|
172
172
|
|
|
173
173
|
reset()
|
|
174
174
|
})
|
|
175
175
|
|
|
176
|
-
context.on('config:start', () => {
|
|
176
|
+
context.on('kubb:config:start', () => {
|
|
177
177
|
if (logLevel <= logLevelMap.silent) {
|
|
178
178
|
return
|
|
179
179
|
}
|
|
@@ -184,7 +184,7 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
184
184
|
startSpinner(getMessage('Configuration loading'))
|
|
185
185
|
})
|
|
186
186
|
|
|
187
|
-
context.on('config:end', (_configs) => {
|
|
187
|
+
context.on('kubb:config:end', (_configs) => {
|
|
188
188
|
if (logLevel <= logLevelMap.silent) {
|
|
189
189
|
return
|
|
190
190
|
}
|
|
@@ -194,7 +194,7 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
194
194
|
clack.outro(text)
|
|
195
195
|
})
|
|
196
196
|
|
|
197
|
-
context.on('generation:start', (config) => {
|
|
197
|
+
context.on('kubb:generation:start', (config) => {
|
|
198
198
|
reset()
|
|
199
199
|
|
|
200
200
|
// Initialize progress tracking for this generation
|
|
@@ -205,7 +205,7 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
205
205
|
clack.intro(text)
|
|
206
206
|
})
|
|
207
207
|
|
|
208
|
-
context.on('plugin:start', (plugin) => {
|
|
208
|
+
context.on('kubb:plugin:start', (plugin) => {
|
|
209
209
|
if (logLevel <= logLevelMap.silent) {
|
|
210
210
|
return
|
|
211
211
|
}
|
|
@@ -227,7 +227,7 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
227
227
|
state.activeProgress.set(plugin.name, { progressBar, interval })
|
|
228
228
|
})
|
|
229
229
|
|
|
230
|
-
context.on('plugin:end', (plugin, { duration, success }) => {
|
|
230
|
+
context.on('kubb:plugin:end', (plugin, { duration, success }) => {
|
|
231
231
|
stopSpinner()
|
|
232
232
|
|
|
233
233
|
const active = state.activeProgress.get(plugin.name)
|
|
@@ -258,7 +258,7 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
258
258
|
showProgressStep()
|
|
259
259
|
})
|
|
260
260
|
|
|
261
|
-
context.on('files:processing:start', (files) => {
|
|
261
|
+
context.on('kubb:files:processing:start', (files) => {
|
|
262
262
|
if (logLevel <= logLevelMap.silent) {
|
|
263
263
|
return
|
|
264
264
|
}
|
|
@@ -275,12 +275,12 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
275
275
|
size: 30,
|
|
276
276
|
})
|
|
277
277
|
|
|
278
|
-
context.emit('info', text)
|
|
278
|
+
context.emit('kubb:info', text)
|
|
279
279
|
progressBar.start(getMessage(text))
|
|
280
280
|
state.activeProgress.set('files', { progressBar })
|
|
281
281
|
})
|
|
282
282
|
|
|
283
|
-
context.on('file:processing:update', ({ file, config }) => {
|
|
283
|
+
context.on('kubb:file:processing:update', ({ file, config }) => {
|
|
284
284
|
if (logLevel <= logLevelMap.silent) {
|
|
285
285
|
return
|
|
286
286
|
}
|
|
@@ -298,7 +298,7 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
298
298
|
|
|
299
299
|
active.progressBar.advance(undefined, text)
|
|
300
300
|
})
|
|
301
|
-
context.on('files:processing:end', () => {
|
|
301
|
+
context.on('kubb:files:processing:end', () => {
|
|
302
302
|
if (logLevel <= logLevelMap.silent) {
|
|
303
303
|
return
|
|
304
304
|
}
|
|
@@ -319,13 +319,13 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
319
319
|
showProgressStep()
|
|
320
320
|
})
|
|
321
321
|
|
|
322
|
-
context.on('generation:end', (config) => {
|
|
322
|
+
context.on('kubb:generation:end', (config) => {
|
|
323
323
|
const text = getMessage(config.name ? `Generation completed for ${styleText('dim', config.name)}` : 'Generation completed')
|
|
324
324
|
|
|
325
325
|
clack.outro(text)
|
|
326
326
|
})
|
|
327
327
|
|
|
328
|
-
context.on('format:start', () => {
|
|
328
|
+
context.on('kubb:format:start', () => {
|
|
329
329
|
if (logLevel <= logLevelMap.silent) {
|
|
330
330
|
return
|
|
331
331
|
}
|
|
@@ -335,7 +335,7 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
335
335
|
clack.intro(text)
|
|
336
336
|
})
|
|
337
337
|
|
|
338
|
-
context.on('format:end', () => {
|
|
338
|
+
context.on('kubb:format:end', () => {
|
|
339
339
|
if (logLevel <= logLevelMap.silent) {
|
|
340
340
|
return
|
|
341
341
|
}
|
|
@@ -345,7 +345,7 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
345
345
|
clack.outro(text)
|
|
346
346
|
})
|
|
347
347
|
|
|
348
|
-
context.on('lint:start', () => {
|
|
348
|
+
context.on('kubb:lint:start', () => {
|
|
349
349
|
if (logLevel <= logLevelMap.silent) {
|
|
350
350
|
return
|
|
351
351
|
}
|
|
@@ -355,7 +355,7 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
355
355
|
clack.intro(text)
|
|
356
356
|
})
|
|
357
357
|
|
|
358
|
-
context.on('lint:end', () => {
|
|
358
|
+
context.on('kubb:lint:end', () => {
|
|
359
359
|
if (logLevel <= logLevelMap.silent) {
|
|
360
360
|
return
|
|
361
361
|
}
|
|
@@ -365,7 +365,7 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
365
365
|
clack.outro(text)
|
|
366
366
|
})
|
|
367
367
|
|
|
368
|
-
context.on('hook:start', async ({ id, command, args }) => {
|
|
368
|
+
context.on('kubb:hook:start', async ({ id, command, args }) => {
|
|
369
369
|
const commandWithArgs = formatCommandWithArgs(command, args)
|
|
370
370
|
const text = getMessage(`Hook ${styleText('dim', commandWithArgs)} started`)
|
|
371
371
|
|
|
@@ -412,7 +412,7 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
412
412
|
})
|
|
413
413
|
})
|
|
414
414
|
|
|
415
|
-
context.on('hook:end', ({ command, args }) => {
|
|
415
|
+
context.on('kubb:hook:end', ({ command, args }) => {
|
|
416
416
|
if (logLevel <= logLevelMap.silent) {
|
|
417
417
|
return
|
|
418
418
|
}
|
|
@@ -423,7 +423,7 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
423
423
|
clack.outro(text)
|
|
424
424
|
})
|
|
425
425
|
|
|
426
|
-
context.on('generation:summary', (config, { pluginTimings, failedPlugins, filesCreated, status, hrStart }) => {
|
|
426
|
+
context.on('kubb:generation:summary', (config, { pluginTimings, failedPlugins, filesCreated, status, hrStart }) => {
|
|
427
427
|
const summary = getSummary({
|
|
428
428
|
failedPlugins,
|
|
429
429
|
filesCreated,
|
|
@@ -452,7 +452,7 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
452
452
|
}
|
|
453
453
|
})
|
|
454
454
|
|
|
455
|
-
context.on('lifecycle:end', () => {
|
|
455
|
+
context.on('kubb:lifecycle:end', () => {
|
|
456
456
|
reset()
|
|
457
457
|
})
|
|
458
458
|
},
|
|
@@ -57,49 +57,49 @@ export const fileSystemLogger = defineLogger({
|
|
|
57
57
|
return Object.keys(files)
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
context.on('info', (message, info) => {
|
|
60
|
+
context.on('kubb:info', (message, info) => {
|
|
61
61
|
state.cachedLogs.add({
|
|
62
62
|
date: new Date(),
|
|
63
63
|
logs: [`ℹ ${message} ${info}`],
|
|
64
64
|
})
|
|
65
65
|
})
|
|
66
66
|
|
|
67
|
-
context.on('success', (message, info) => {
|
|
67
|
+
context.on('kubb:success', (message, info) => {
|
|
68
68
|
state.cachedLogs.add({
|
|
69
69
|
date: new Date(),
|
|
70
70
|
logs: [`✓ ${message} ${info}`],
|
|
71
71
|
})
|
|
72
72
|
})
|
|
73
73
|
|
|
74
|
-
context.on('warn', (message, info) => {
|
|
74
|
+
context.on('kubb:warn', (message, info) => {
|
|
75
75
|
state.cachedLogs.add({
|
|
76
76
|
date: new Date(),
|
|
77
77
|
logs: [`⚠ ${message} ${info}`],
|
|
78
78
|
})
|
|
79
79
|
})
|
|
80
80
|
|
|
81
|
-
context.on('error', (error) => {
|
|
81
|
+
context.on('kubb:error', (error) => {
|
|
82
82
|
state.cachedLogs.add({
|
|
83
83
|
date: new Date(),
|
|
84
84
|
logs: [`✗ ${error.message}`, error.stack || 'unknown stack'],
|
|
85
85
|
})
|
|
86
86
|
})
|
|
87
87
|
|
|
88
|
-
context.on('debug', (message) => {
|
|
88
|
+
context.on('kubb:debug', (message) => {
|
|
89
89
|
state.cachedLogs.add({
|
|
90
90
|
date: new Date(),
|
|
91
91
|
logs: message.logs,
|
|
92
92
|
})
|
|
93
93
|
})
|
|
94
94
|
|
|
95
|
-
context.on('plugin:start', (plugin) => {
|
|
95
|
+
context.on('kubb:plugin:start', (plugin) => {
|
|
96
96
|
state.cachedLogs.add({
|
|
97
97
|
date: new Date(),
|
|
98
98
|
logs: [`Generating ${plugin.name}`],
|
|
99
99
|
})
|
|
100
100
|
})
|
|
101
101
|
|
|
102
|
-
context.on('plugin:end', (plugin, { duration, success }) => {
|
|
102
|
+
context.on('kubb:plugin:end', (plugin, { duration, success }) => {
|
|
103
103
|
const durationStr = formatMs(duration)
|
|
104
104
|
|
|
105
105
|
state.cachedLogs.add({
|
|
@@ -108,18 +108,18 @@ export const fileSystemLogger = defineLogger({
|
|
|
108
108
|
})
|
|
109
109
|
})
|
|
110
110
|
|
|
111
|
-
context.on('files:processing:start', (files) => {
|
|
111
|
+
context.on('kubb:files:processing:start', (files) => {
|
|
112
112
|
state.cachedLogs.add({
|
|
113
113
|
date: new Date(),
|
|
114
114
|
logs: [`Start ${files.length} writing:`, ...files.map((file) => file.path)],
|
|
115
115
|
})
|
|
116
116
|
})
|
|
117
117
|
|
|
118
|
-
context.on('generation:end', async (config) => {
|
|
118
|
+
context.on('kubb:generation:end', async (config) => {
|
|
119
119
|
const writtenFilePaths = await writeLogs(config.name)
|
|
120
120
|
if (writtenFilePaths.length > 0) {
|
|
121
121
|
const files = writtenFilePaths.map((f) => relative(process.cwd(), f))
|
|
122
|
-
await context.emit('info', 'Debug files written to:', files.join(', '))
|
|
122
|
+
await context.emit('kubb:info', 'Debug files written to:', files.join(', '))
|
|
123
123
|
}
|
|
124
124
|
reset()
|
|
125
125
|
})
|