@kubb/cli 5.0.5 → 5.1.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/{Telemetry-DQOmn6aR.cjs → Telemetry-D-Jpt27O.cjs} +23 -1
- package/dist/Telemetry-D-Jpt27O.cjs.map +1 -0
- package/dist/{Telemetry-7z2tIqPm.js → Telemetry-Fiymfxez.js} +18 -2
- package/dist/Telemetry-Fiymfxez.js.map +1 -0
- package/dist/{generate-D8Z67HtU.cjs → generate-BO_Gv-vi.cjs} +10 -6
- package/dist/generate-BO_Gv-vi.cjs.map +1 -0
- package/dist/{generate-D5Yg2zc4.js → generate-HzSh9v2l.js} +11 -7
- package/dist/generate-HzSh9v2l.js.map +1 -0
- package/dist/gunshiDryRun-DdKJuVn1.js +2 -0
- package/dist/index.cjs +10 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/{init-BeU9JeAx.js → init-BslRoYhh.js} +12 -8
- package/dist/init-BslRoYhh.js.map +1 -0
- package/dist/{init-4xcSN_lk.cjs → init-EJOY4K6y.cjs} +12 -7
- package/dist/init-EJOY4K6y.cjs.map +1 -0
- package/dist/{mcp-V5-mVeaV.cjs → mcp-BIcX2H1u.cjs} +3 -3
- package/dist/{mcp-V5-mVeaV.cjs.map → mcp-BIcX2H1u.cjs.map} +1 -1
- package/dist/{mcp-BfUVBR6w.js → mcp-CtV0d0Dc.js} +3 -3
- package/dist/{mcp-BfUVBR6w.js.map → mcp-CtV0d0Dc.js.map} +1 -1
- package/dist/{package-CnPn2Vqo.cjs → package-CnUMuss9.cjs} +2 -2
- package/dist/package-CnUMuss9.cjs.map +1 -0
- package/dist/package-DiBDd6nT.js +6 -0
- package/dist/package-DiBDd6nT.js.map +1 -0
- package/dist/{run-31OgOcxn.cjs → run-BV2tMjuz.cjs} +2 -2
- package/dist/{run-31OgOcxn.cjs.map → run-BV2tMjuz.cjs.map} +1 -1
- package/dist/{run-DeN95aHZ.js → run-CLGgnrjg.js} +18 -10
- package/dist/run-CLGgnrjg.js.map +1 -0
- package/dist/{run-CaOjZRiQ.js → run-ChKPZlIB.js} +2 -2
- package/dist/{run-CaOjZRiQ.js.map → run-ChKPZlIB.js.map} +1 -1
- package/dist/{run-DEVBHfNr.cjs → run-Cs5FunVC.cjs} +2 -2
- package/dist/{run-DEVBHfNr.cjs.map → run-Cs5FunVC.cjs.map} +1 -1
- package/dist/{run-D7IaVOtD.cjs → run-DAGbErY0.cjs} +17 -9
- package/dist/run-DAGbErY0.cjs.map +1 -0
- package/dist/{run-DAHp52w3.js → run-DCfdTu52.js} +2 -2
- package/dist/{run-DAHp52w3.js.map → run-DCfdTu52.js.map} +1 -1
- package/dist/{run-Cea4Wfyp.js → run-DSgLksGj.js} +4 -4
- package/dist/run-DSgLksGj.js.map +1 -0
- package/dist/{run-BlWEfHq_.cjs → run-FPqeAEF4.cjs} +4 -4
- package/dist/run-FPqeAEF4.cjs.map +1 -0
- package/dist/{validate-D6yXCh_J.cjs → validate-BxCwQou-.cjs} +3 -3
- package/dist/{validate-D6yXCh_J.cjs.map → validate-BxCwQou-.cjs.map} +1 -1
- package/dist/{validate-CX_4mCn-.js → validate-DD2S9ffV.js} +3 -3
- package/dist/{validate-CX_4mCn-.js.map → validate-DD2S9ffV.js.map} +1 -1
- package/package.json +7 -5
- package/dist/Telemetry-7z2tIqPm.js.map +0 -1
- package/dist/Telemetry-DQOmn6aR.cjs.map +0 -1
- package/dist/generate-D5Yg2zc4.js.map +0 -1
- package/dist/generate-D8Z67HtU.cjs.map +0 -1
- package/dist/init-4xcSN_lk.cjs.map +0 -1
- package/dist/init-BeU9JeAx.js.map +0 -1
- package/dist/package-BYerj74G.js +0 -6
- package/dist/package-BYerj74G.js.map +0 -1
- package/dist/package-CnPn2Vqo.cjs.map +0 -1
- package/dist/run-BlWEfHq_.cjs.map +0 -1
- package/dist/run-Cea4Wfyp.js.map +0 -1
- package/dist/run-D7IaVOtD.cjs.map +0 -1
- package/dist/run-DeN95aHZ.js.map +0 -1
|
@@ -4,6 +4,7 @@ let node_os = require("node:os");
|
|
|
4
4
|
node_os = require_rolldown_runtime.__toESM(node_os, 1);
|
|
5
5
|
let node_process = require("node:process");
|
|
6
6
|
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
7
|
+
let gunshi_agent = require("gunshi/agent");
|
|
7
8
|
//#region ../../internals/utils/src/env.ts
|
|
8
9
|
/**
|
|
9
10
|
* Returns `true` when the process is running in a CI environment.
|
|
@@ -110,6 +111,16 @@ var Runtime = class {
|
|
|
110
111
|
*/
|
|
111
112
|
const runtime = new Runtime();
|
|
112
113
|
//#endregion
|
|
114
|
+
//#region src/agent.ts
|
|
115
|
+
/**
|
|
116
|
+
* Name of the AI coding agent driving this process, when one is detected (e.g. `'claude'`,
|
|
117
|
+
* `'cursor'`). `undefined` when run by a human or an unrecognized caller.
|
|
118
|
+
*/
|
|
119
|
+
function getAgentName() {
|
|
120
|
+
const profile = (0, gunshi_agent.getAgentProfile)();
|
|
121
|
+
return profile.isAgent ? profile.name : void 0;
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
113
124
|
//#region src/constants.ts
|
|
114
125
|
/**
|
|
115
126
|
* NPM registry endpoint used to check for @kubb/cli updates.
|
|
@@ -158,6 +169,7 @@ function buildTelemetryEvent(options) {
|
|
|
158
169
|
runtimeVersion: runtime.version.split(".")[0],
|
|
159
170
|
platform: node_os.default.platform(),
|
|
160
171
|
ci: isCIEnvironment(),
|
|
172
|
+
agent: getAgentName(),
|
|
161
173
|
plugins: options.plugins ?? [],
|
|
162
174
|
duration,
|
|
163
175
|
filesCreated: options.filesCreated ?? 0,
|
|
@@ -203,6 +215,10 @@ function buildOtlpPayload(event) {
|
|
|
203
215
|
key: "kubb.ci",
|
|
204
216
|
value: { boolValue: event.ci }
|
|
205
217
|
},
|
|
218
|
+
...event.agent ? [{
|
|
219
|
+
key: "kubb.agent",
|
|
220
|
+
value: { stringValue: event.agent }
|
|
221
|
+
}] : [],
|
|
206
222
|
{
|
|
207
223
|
key: "kubb.files_created",
|
|
208
224
|
value: { intValue: event.filesCreated }
|
|
@@ -315,6 +331,12 @@ Object.defineProperty(exports, "canUseTTY", {
|
|
|
315
331
|
return canUseTTY;
|
|
316
332
|
}
|
|
317
333
|
});
|
|
334
|
+
Object.defineProperty(exports, "getAgentName", {
|
|
335
|
+
enumerable: true,
|
|
336
|
+
get: function() {
|
|
337
|
+
return getAgentName;
|
|
338
|
+
}
|
|
339
|
+
});
|
|
318
340
|
Object.defineProperty(exports, "isDisabled", {
|
|
319
341
|
enumerable: true,
|
|
320
342
|
get: function() {
|
|
@@ -328,4 +350,4 @@ Object.defineProperty(exports, "sendTelemetry", {
|
|
|
328
350
|
}
|
|
329
351
|
});
|
|
330
352
|
|
|
331
|
-
//# sourceMappingURL=Telemetry-
|
|
353
|
+
//# sourceMappingURL=Telemetry-D-Jpt27O.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Telemetry-D-Jpt27O.cjs","names":["getAgentProfile","process","os","randomBytes"],"sources":["../../../internals/utils/src/env.ts","../../../internals/utils/src/runtime.ts","../src/agent.ts","../src/constants.ts","../src/Telemetry.ts"],"sourcesContent":["/**\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","/**\n * Name of the JavaScript runtime executing the current process.\n */\ntype RuntimeName = 'bun' | 'deno' | 'node'\n\n/**\n * Detects the JavaScript runtime executing the current process and exposes its name and version.\n *\n * Prefer the shared {@link runtime} instance over constructing your own.\n */\nclass Runtime {\n /**\n * `true` when the current process is running under Bun.\n *\n * Detection keys off the global `Bun` object rather than `process.versions`,\n * because Bun polyfills `process.versions.node` for Node compatibility and would\n * otherwise look like Node.\n *\n * @example\n * ```ts\n * if (runtime.isBun) {\n * await Bun.write(path, data)\n * }\n * ```\n */\n get isBun(): boolean {\n return typeof Bun !== 'undefined'\n }\n\n /**\n * `true` when the current process is running under Deno.\n */\n get isDeno(): boolean {\n return typeof (globalThis as { Deno?: unknown }).Deno !== 'undefined'\n }\n\n /**\n * `true` when the current process is running under Node.\n *\n * Bun and Deno are excluded first so a polyfilled `process` does not register as Node.\n */\n get isNode(): boolean {\n return !this.isBun && !this.isDeno && typeof process !== 'undefined' && process.versions?.node != null\n }\n\n /**\n * Name of the runtime executing the current process.\n *\n * @example\n * ```ts\n * runtime.name // 'bun' when run with `bun kubb`, 'node' otherwise\n * ```\n */\n get name(): RuntimeName {\n if (this.isBun) return 'bun'\n if (this.isDeno) return 'deno'\n\n return 'node'\n }\n\n /**\n * Version of the active runtime, or an empty string when it cannot be read.\n *\n * @example\n * ```ts\n * runtime.version // '1.3.11' under Bun, '22.22.2' under Node\n * ```\n */\n get version(): string {\n if (this.isBun) return process.versions.bun ?? ''\n if (this.isDeno) return (globalThis as { Deno?: { version?: { deno?: string } } }).Deno?.version?.deno ?? ''\n\n return process.versions?.node ?? ''\n }\n}\n\n/**\n * Shared {@link Runtime} instance describing the JavaScript runtime executing the current process.\n */\nexport const runtime = new Runtime()\n","import { getAgentProfile } from 'gunshi/agent'\n\n/**\n * Name of the AI coding agent driving this process, when one is detected (e.g. `'claude'`,\n * `'cursor'`). `undefined` when run by a human or an unrecognized caller.\n */\nexport function getAgentName(): string | undefined {\n const profile = getAgentProfile()\n return profile.isAgent ? profile.name : undefined\n}\n","/**\n * NPM registry endpoint used to check for @kubb/cli updates.\n */\nexport const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const\n\n/**\n * OpenTelemetry ingestion endpoint for anonymous usage telemetry.\n */\nexport const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const\n\n/**\n * Glob pattern for paths the file watcher ignores.\n */\nexport const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/**\n * Quiet window in milliseconds that collapses a burst of watcher events (an editor save emits\n * several) into a single rebuild.\n */\nexport const WATCHER_DEBOUNCE_MS = 100\n\n/**\n * Upper bound in milliseconds for the npm update check, so a slow registry never stalls a run.\n */\nexport const UPDATE_CHECK_TIMEOUT_MS = 3_000\n\n/**\n * Flags that short-circuit execution (help and version). The telemetry notice is suppressed for these.\n */\nexport const QUIET_FLAGS = new Set<string>(['--help', '-h', '--version', '-v'])\n","import { randomBytes } from 'node:crypto'\nimport os from 'node:os'\nimport process from 'node:process'\nimport { isCIEnvironment, runtime } from '@internals/utils'\nimport { getAgentName } from './agent.ts'\nimport { OTLP_ENDPOINT } from './constants.ts'\n\ntype OtlpKeyValue = {\n key: string\n value:\n | { stringValue: string }\n | { boolValue: boolean }\n | { intValue: number }\n | { arrayValue: { values: Array<{ kvlistValue: { values: Array<OtlpKeyValue> } }> } }\n | { kvlistValue: { values: Array<OtlpKeyValue> } }\n}\n\ntype OtlpSpan = {\n traceId: string\n spanId: string\n name: string\n kind: 1\n startTimeUnixNano: string\n endTimeUnixNano: string\n attributes: Array<OtlpKeyValue>\n status: { code: 1 | 2 }\n}\n\ntype OtlpExportTraceServiceRequest = {\n resourceSpans: Array<{\n resource: { attributes: Array<OtlpKeyValue> }\n scopeSpans: Array<{\n scope: { name: string; version: string }\n spans: Array<OtlpSpan>\n }>\n }>\n}\n\n/**\n * Anonymous plugin name and options snapshot sent with each telemetry event.\n */\nexport type TelemetryPlugin = {\n /**\n * Plugin name as registered in the Kubb config, e.g. `'@kubb/plugin-ts'`.\n */\n name: string\n /**\n * Anonymized snapshot of the plugin options. Values are included but cannot be traced back to a user.\n */\n options: Record<string, unknown>\n}\n\n/**\n * Anonymous snapshot of a single Kubb run, built by {@link buildTelemetryEvent} and sent by {@link sendTelemetry}.\n */\nexport type TelemetryEvent = {\n command: string\n kubbVersion: string\n /**\n * Major version of Node that executed the run, e.g. `'22'`.\n */\n nodeVersion: string\n /**\n * Name of the JavaScript runtime that executed the run, `'bun'`, `'deno'`, or `'node'`.\n */\n runtime: string\n /**\n * Major version of the active runtime, e.g. `'1'` under Bun or `'22'` under Node.\n */\n runtimeVersion: string\n platform: string\n ci: boolean\n /**\n * Name of the detected AI coding agent (e.g. `'claude'`, `'cursor'`), when the CLI is invoked\n * by one. `undefined` when run by a human or an unrecognized caller.\n */\n agent?: string\n plugins: Array<TelemetryPlugin>\n duration: number\n filesCreated: number\n status: 'success' | 'failed'\n}\n\n/**\n * Returns `true` when telemetry is disabled via `DO_NOT_TRACK` or `KUBB_DISABLE_TELEMETRY`.\n */\nexport function isDisabled(): 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 * Build an anonymous telemetry payload from a completed generation run.\n */\nexport function buildTelemetryEvent(options: {\n command: 'generate' | 'mcp' | 'validate'\n kubbVersion: string\n plugins?: Array<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 runtime: runtime.name,\n runtimeVersion: runtime.version.split('.')[0] as string,\n platform: os.platform(),\n ci: isCIEnvironment(),\n agent: getAgentName(),\n plugins: options.plugins ?? [],\n duration,\n filesCreated: options.filesCreated ?? 0,\n status: options.status,\n }\n}\n\n/**\n * Convert a {@link TelemetryEvent} into an OTLP-compatible JSON trace payload.\n *\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: Array<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.runtime', value: { stringValue: event.runtime } },\n { key: 'kubb.runtime_version', value: { stringValue: event.runtimeVersion } },\n { key: 'kubb.platform', value: { stringValue: event.platform } },\n { key: 'kubb.ci', value: { boolValue: event.ci } },\n ...(event.agent ? [{ key: 'kubb.agent', value: { stringValue: event.agent } }] : []),\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((p) => ({\n kvlistValue: {\n values: [\n { key: 'name', value: { stringValue: p.name } },\n {\n key: 'options',\n value: {\n stringValue: JSON.stringify({\n ...p.options,\n usedEnumNames: undefined,\n }),\n },\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-core' } },\n {\n key: 'service.version',\n value: { stringValue: event.kubbVersion },\n },\n { key: 'telemetry.sdk.language', value: { stringValue: 'nodejs' } },\n ],\n },\n scopeSpans: [\n {\n scope: { name: 'kubb-core', version: event.kubbVersion },\n spans: [\n {\n traceId,\n spanId,\n name: event.command,\n kind: 1,\n startTimeUnixNano: String(startTimeNs),\n endTimeUnixNano: String(endTimeNs),\n attributes,\n status: {\n code: event.status === 'success' ? 1 : 2,\n },\n },\n ],\n },\n ],\n },\n ],\n }\n}\n\n/**\n * Send an anonymous telemetry event to the Kubb OTLP endpoint. Respects `DO_NOT_TRACK` and\n * `KUBB_DISABLE_TELEMETRY`, and fails silently so telemetry never interrupts a run. No file\n * paths, OpenAPI specs, or secrets are sent.\n */\nexport async function sendTelemetry(event: TelemetryEvent): Promise<void> {\n if (isDisabled()) {\n return\n }\n\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-core',\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 run\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAYA,SAAgB,kBAA2B;CACzC,OAAO,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;AAEhB;;;;;;;;;;;;;;;;;AAkBA,SAAgB,YAAqB;CACnC,OAAO,QAAQ,OAAO,UAAU,Q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;CACH,SAAS,IAAI,CAEb;AACF"}
|
|
@@ -2,6 +2,7 @@ import "./rolldown-runtime-C0LytTxp.js";
|
|
|
2
2
|
import { randomBytes } from "node:crypto";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import process$1 from "node:process";
|
|
5
|
+
import { getAgentProfile } from "gunshi/agent";
|
|
5
6
|
//#region ../../internals/utils/src/env.ts
|
|
6
7
|
/**
|
|
7
8
|
* Returns `true` when the process is running in a CI environment.
|
|
@@ -108,6 +109,16 @@ var Runtime = class {
|
|
|
108
109
|
*/
|
|
109
110
|
const runtime = new Runtime();
|
|
110
111
|
//#endregion
|
|
112
|
+
//#region src/agent.ts
|
|
113
|
+
/**
|
|
114
|
+
* Name of the AI coding agent driving this process, when one is detected (e.g. `'claude'`,
|
|
115
|
+
* `'cursor'`). `undefined` when run by a human or an unrecognized caller.
|
|
116
|
+
*/
|
|
117
|
+
function getAgentName() {
|
|
118
|
+
const profile = getAgentProfile();
|
|
119
|
+
return profile.isAgent ? profile.name : void 0;
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
111
122
|
//#region src/constants.ts
|
|
112
123
|
/**
|
|
113
124
|
* NPM registry endpoint used to check for @kubb/cli updates.
|
|
@@ -156,6 +167,7 @@ function buildTelemetryEvent(options) {
|
|
|
156
167
|
runtimeVersion: runtime.version.split(".")[0],
|
|
157
168
|
platform: os.platform(),
|
|
158
169
|
ci: isCIEnvironment(),
|
|
170
|
+
agent: getAgentName(),
|
|
159
171
|
plugins: options.plugins ?? [],
|
|
160
172
|
duration,
|
|
161
173
|
filesCreated: options.filesCreated ?? 0,
|
|
@@ -201,6 +213,10 @@ function buildOtlpPayload(event) {
|
|
|
201
213
|
key: "kubb.ci",
|
|
202
214
|
value: { boolValue: event.ci }
|
|
203
215
|
},
|
|
216
|
+
...event.agent ? [{
|
|
217
|
+
key: "kubb.agent",
|
|
218
|
+
value: { stringValue: event.agent }
|
|
219
|
+
}] : [],
|
|
204
220
|
{
|
|
205
221
|
key: "kubb.files_created",
|
|
206
222
|
value: { intValue: event.filesCreated }
|
|
@@ -277,6 +293,6 @@ async function sendTelemetry(event) {
|
|
|
277
293
|
} catch (_e) {}
|
|
278
294
|
}
|
|
279
295
|
//#endregion
|
|
280
|
-
export { QUIET_FLAGS as a,
|
|
296
|
+
export { QUIET_FLAGS as a, getAgentName as c, KUBB_NPM_PACKAGE_URL as i, canUseTTY as l, isDisabled as n, UPDATE_CHECK_TIMEOUT_MS as o, sendTelemetry as r, WATCHER_IGNORED_PATHS as s, buildTelemetryEvent as t };
|
|
281
297
|
|
|
282
|
-
//# sourceMappingURL=Telemetry-
|
|
298
|
+
//# sourceMappingURL=Telemetry-Fiymfxez.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Telemetry-Fiymfxez.js","names":["process"],"sources":["../../../internals/utils/src/env.ts","../../../internals/utils/src/runtime.ts","../src/agent.ts","../src/constants.ts","../src/Telemetry.ts"],"sourcesContent":["/**\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","/**\n * Name of the JavaScript runtime executing the current process.\n */\ntype RuntimeName = 'bun' | 'deno' | 'node'\n\n/**\n * Detects the JavaScript runtime executing the current process and exposes its name and version.\n *\n * Prefer the shared {@link runtime} instance over constructing your own.\n */\nclass Runtime {\n /**\n * `true` when the current process is running under Bun.\n *\n * Detection keys off the global `Bun` object rather than `process.versions`,\n * because Bun polyfills `process.versions.node` for Node compatibility and would\n * otherwise look like Node.\n *\n * @example\n * ```ts\n * if (runtime.isBun) {\n * await Bun.write(path, data)\n * }\n * ```\n */\n get isBun(): boolean {\n return typeof Bun !== 'undefined'\n }\n\n /**\n * `true` when the current process is running under Deno.\n */\n get isDeno(): boolean {\n return typeof (globalThis as { Deno?: unknown }).Deno !== 'undefined'\n }\n\n /**\n * `true` when the current process is running under Node.\n *\n * Bun and Deno are excluded first so a polyfilled `process` does not register as Node.\n */\n get isNode(): boolean {\n return !this.isBun && !this.isDeno && typeof process !== 'undefined' && process.versions?.node != null\n }\n\n /**\n * Name of the runtime executing the current process.\n *\n * @example\n * ```ts\n * runtime.name // 'bun' when run with `bun kubb`, 'node' otherwise\n * ```\n */\n get name(): RuntimeName {\n if (this.isBun) return 'bun'\n if (this.isDeno) return 'deno'\n\n return 'node'\n }\n\n /**\n * Version of the active runtime, or an empty string when it cannot be read.\n *\n * @example\n * ```ts\n * runtime.version // '1.3.11' under Bun, '22.22.2' under Node\n * ```\n */\n get version(): string {\n if (this.isBun) return process.versions.bun ?? ''\n if (this.isDeno) return (globalThis as { Deno?: { version?: { deno?: string } } }).Deno?.version?.deno ?? ''\n\n return process.versions?.node ?? ''\n }\n}\n\n/**\n * Shared {@link Runtime} instance describing the JavaScript runtime executing the current process.\n */\nexport const runtime = new Runtime()\n","import { getAgentProfile } from 'gunshi/agent'\n\n/**\n * Name of the AI coding agent driving this process, when one is detected (e.g. `'claude'`,\n * `'cursor'`). `undefined` when run by a human or an unrecognized caller.\n */\nexport function getAgentName(): string | undefined {\n const profile = getAgentProfile()\n return profile.isAgent ? profile.name : undefined\n}\n","/**\n * NPM registry endpoint used to check for @kubb/cli updates.\n */\nexport const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const\n\n/**\n * OpenTelemetry ingestion endpoint for anonymous usage telemetry.\n */\nexport const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const\n\n/**\n * Glob pattern for paths the file watcher ignores.\n */\nexport const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/**\n * Quiet window in milliseconds that collapses a burst of watcher events (an editor save emits\n * several) into a single rebuild.\n */\nexport const WATCHER_DEBOUNCE_MS = 100\n\n/**\n * Upper bound in milliseconds for the npm update check, so a slow registry never stalls a run.\n */\nexport const UPDATE_CHECK_TIMEOUT_MS = 3_000\n\n/**\n * Flags that short-circuit execution (help and version). The telemetry notice is suppressed for these.\n */\nexport const QUIET_FLAGS = new Set<string>(['--help', '-h', '--version', '-v'])\n","import { randomBytes } from 'node:crypto'\nimport os from 'node:os'\nimport process from 'node:process'\nimport { isCIEnvironment, runtime } from '@internals/utils'\nimport { getAgentName } from './agent.ts'\nimport { OTLP_ENDPOINT } from './constants.ts'\n\ntype OtlpKeyValue = {\n key: string\n value:\n | { stringValue: string }\n | { boolValue: boolean }\n | { intValue: number }\n | { arrayValue: { values: Array<{ kvlistValue: { values: Array<OtlpKeyValue> } }> } }\n | { kvlistValue: { values: Array<OtlpKeyValue> } }\n}\n\ntype OtlpSpan = {\n traceId: string\n spanId: string\n name: string\n kind: 1\n startTimeUnixNano: string\n endTimeUnixNano: string\n attributes: Array<OtlpKeyValue>\n status: { code: 1 | 2 }\n}\n\ntype OtlpExportTraceServiceRequest = {\n resourceSpans: Array<{\n resource: { attributes: Array<OtlpKeyValue> }\n scopeSpans: Array<{\n scope: { name: string; version: string }\n spans: Array<OtlpSpan>\n }>\n }>\n}\n\n/**\n * Anonymous plugin name and options snapshot sent with each telemetry event.\n */\nexport type TelemetryPlugin = {\n /**\n * Plugin name as registered in the Kubb config, e.g. `'@kubb/plugin-ts'`.\n */\n name: string\n /**\n * Anonymized snapshot of the plugin options. Values are included but cannot be traced back to a user.\n */\n options: Record<string, unknown>\n}\n\n/**\n * Anonymous snapshot of a single Kubb run, built by {@link buildTelemetryEvent} and sent by {@link sendTelemetry}.\n */\nexport type TelemetryEvent = {\n command: string\n kubbVersion: string\n /**\n * Major version of Node that executed the run, e.g. `'22'`.\n */\n nodeVersion: string\n /**\n * Name of the JavaScript runtime that executed the run, `'bun'`, `'deno'`, or `'node'`.\n */\n runtime: string\n /**\n * Major version of the active runtime, e.g. `'1'` under Bun or `'22'` under Node.\n */\n runtimeVersion: string\n platform: string\n ci: boolean\n /**\n * Name of the detected AI coding agent (e.g. `'claude'`, `'cursor'`), when the CLI is invoked\n * by one. `undefined` when run by a human or an unrecognized caller.\n */\n agent?: string\n plugins: Array<TelemetryPlugin>\n duration: number\n filesCreated: number\n status: 'success' | 'failed'\n}\n\n/**\n * Returns `true` when telemetry is disabled via `DO_NOT_TRACK` or `KUBB_DISABLE_TELEMETRY`.\n */\nexport function isDisabled(): 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 * Build an anonymous telemetry payload from a completed generation run.\n */\nexport function buildTelemetryEvent(options: {\n command: 'generate' | 'mcp' | 'validate'\n kubbVersion: string\n plugins?: Array<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 runtime: runtime.name,\n runtimeVersion: runtime.version.split('.')[0] as string,\n platform: os.platform(),\n ci: isCIEnvironment(),\n agent: getAgentName(),\n plugins: options.plugins ?? [],\n duration,\n filesCreated: options.filesCreated ?? 0,\n status: options.status,\n }\n}\n\n/**\n * Convert a {@link TelemetryEvent} into an OTLP-compatible JSON trace payload.\n *\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: Array<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.runtime', value: { stringValue: event.runtime } },\n { key: 'kubb.runtime_version', value: { stringValue: event.runtimeVersion } },\n { key: 'kubb.platform', value: { stringValue: event.platform } },\n { key: 'kubb.ci', value: { boolValue: event.ci } },\n ...(event.agent ? [{ key: 'kubb.agent', value: { stringValue: event.agent } }] : []),\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((p) => ({\n kvlistValue: {\n values: [\n { key: 'name', value: { stringValue: p.name } },\n {\n key: 'options',\n value: {\n stringValue: JSON.stringify({\n ...p.options,\n usedEnumNames: undefined,\n }),\n },\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-core' } },\n {\n key: 'service.version',\n value: { stringValue: event.kubbVersion },\n },\n { key: 'telemetry.sdk.language', value: { stringValue: 'nodejs' } },\n ],\n },\n scopeSpans: [\n {\n scope: { name: 'kubb-core', version: event.kubbVersion },\n spans: [\n {\n traceId,\n spanId,\n name: event.command,\n kind: 1,\n startTimeUnixNano: String(startTimeNs),\n endTimeUnixNano: String(endTimeNs),\n attributes,\n status: {\n code: event.status === 'success' ? 1 : 2,\n },\n },\n ],\n },\n ],\n },\n ],\n }\n}\n\n/**\n * Send an anonymous telemetry event to the Kubb OTLP endpoint. Respects `DO_NOT_TRACK` and\n * `KUBB_DISABLE_TELEMETRY`, and fails silently so telemetry never interrupts a run. No file\n * paths, OpenAPI specs, or secrets are sent.\n */\nexport async function sendTelemetry(event: TelemetryEvent): Promise<void> {\n if (isDisabled()) {\n return\n }\n\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-core',\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 run\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAYA,SAAgB,kBAA2B;CACzC,OAAO,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;AAEhB;;;;;;;;;;;;;;;;;AAkBA,SAAgB,YAAqB;CACnC,OAAO,QAAQ,OAAO,UAAU,QAAQ,OAAO,WAAW,KAAK,KAAK,CAAC,gBAAgB;AACvF;;;;;;;;ACnCA,IAAM,UAAN,MAAc;;;;;;;;;;;;;;;CAeZ,IAAI,QAAiB;EACnB,OAAO,OAAO,QAAQ;CACxB;;;;CAKA,IAAI,SAAkB;EACpB,OAAO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,EAAE,KAAK;GAAE,GAC9C;IACE,KAAK;IACL,OAAO,EACL,aAAa,KAAK,UAAU;KAC1B,GAAG,EAAE;KACL,eAAe,KAAA;IACjB,CAAC,EACH;GACF,CACF,EACF,EACF,EAAE,EACJ,EACF;EACF;CACF;CAEA,OAAO,EACL,eAAe,CACb;EACE,UAAU,EACR,YAAY;GACV;IAAE,KAAK;IAAgB,OAAO,EAAE,aAAa,YAAY;GAAE;GAC3D;IACE,KAAK;IACL,OAAO,EAAE,aAAa,MAAM,YAAY;GAC1C;GACA;IAAE,KAAK;IAA0B,OAAO,EAAE,aAAa,SAAS;GAAE;EACpE,EACF;EACA,YAAY,CACV;GACE,OAAO;IAAE,MAAM;IAAa,SAAS,MAAM;GAAY;GACvD,OAAO,CACL;IACE;IACA;IACA,MAAM,MAAM;IACZ,MAAM;IACN,mBAAmB,OAAO,WAAW;IACrC,iBAAiB,OAAO,SAAS;IACjC;IACA,QAAQ,EACN,MAAM,MAAM,WAAW,YAAY,IAAI,EACzC;GACF,CACF;EACF,CACF;CACF,CACF,EACF;AACF;;;;;;AAOA,eAAsB,cAAc,OAAsC;CACxE,IAAI,WAAW,GACb;CAGF,IAAI;EACF,MAAM,MAAM,GAAG,cAAc,aAAa;GACxC,QAAQ;GACR,SAAS;IACP,gBAAgB;IAChB,0BAA0B;IAC1B,yBAAyB;GAC3B;GACA,MAAM,KAAK,UAAU,iBAAiB,KAAK,CAAC;GAC5C,QAAQ,YAAY,QAAQ,GAAK;EACnC,CAAC;CACH,SAAS,IAAI,CAEb;AACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require("./rolldown-runtime-qbf5tadS.cjs");
|
|
2
2
|
let gunshi = require("gunshi");
|
|
3
|
+
let _gunshi_plugin_dryrun = require("@gunshi/plugin-dryrun");
|
|
3
4
|
//#region src/commands/generate.ts
|
|
4
5
|
const REPORTER_NAMES = [
|
|
5
6
|
"cli",
|
|
@@ -22,14 +23,15 @@ function resolveLogLevel({ verbose, silent, logLevel }) {
|
|
|
22
23
|
if (silent) return "silent";
|
|
23
24
|
return logLevel;
|
|
24
25
|
}
|
|
25
|
-
const command = (0, gunshi.
|
|
26
|
+
const command = (0, gunshi.defineWithTypes)()({
|
|
26
27
|
name: "generate",
|
|
27
28
|
description: "Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.",
|
|
28
29
|
examples: [
|
|
29
30
|
"kubb generate",
|
|
30
31
|
"kubb generate ./openapi.yaml",
|
|
31
32
|
"kubb generate --config kubb.config.ts",
|
|
32
|
-
"kubb generate --watch"
|
|
33
|
+
"kubb generate --watch",
|
|
34
|
+
"kubb generate --dryRun"
|
|
33
35
|
].join("\n"),
|
|
34
36
|
args: {
|
|
35
37
|
input: {
|
|
@@ -77,19 +79,21 @@ const command = (0, gunshi.define)({
|
|
|
77
79
|
parse: parseReporters
|
|
78
80
|
}
|
|
79
81
|
},
|
|
80
|
-
async run(
|
|
82
|
+
async run(ctx) {
|
|
83
|
+
const { values } = ctx;
|
|
81
84
|
const logLevel = resolveLogLevel(values);
|
|
82
|
-
const { run } = await Promise.resolve().then(() => require("./run-
|
|
85
|
+
const { run } = await Promise.resolve().then(() => require("./run-DAGbErY0.cjs"));
|
|
83
86
|
await run({
|
|
84
87
|
input: values.input,
|
|
85
88
|
configPath: values.config,
|
|
86
89
|
logLevel,
|
|
87
90
|
watch: values.watch,
|
|
88
|
-
reporters: values.reporter
|
|
91
|
+
reporters: values.reporter,
|
|
92
|
+
dryRun: ctx.extensions[_gunshi_plugin_dryrun.pluginId].enabled
|
|
89
93
|
});
|
|
90
94
|
}
|
|
91
95
|
});
|
|
92
96
|
//#endregion
|
|
93
97
|
exports.command = command;
|
|
94
98
|
|
|
95
|
-
//# sourceMappingURL=generate-
|
|
99
|
+
//# sourceMappingURL=generate-BO_Gv-vi.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-BO_Gv-vi.cjs","names":["defineWithTypes","dryRunId"],"sources":["../src/commands/generate.ts"],"sourcesContent":["import { defineWithTypes } from 'gunshi'\nimport type { ReporterName } from '@kubb/core'\nimport { dryRunId } from '../gunshiDryRun.ts'\nimport type { DryRunExtensions } from '../gunshiDryRun.ts'\n\nconst REPORTER_NAMES: Array<ReporterName> = ['cli', 'json', 'file']\n\n/**\n * Splits and validates the comma-separated `--reporter` value against the known reporter names.\n */\nfunction parseReporters(value: string): Array<ReporterName> {\n const names = value\n .split(',')\n .map((name) => name.trim())\n .filter(Boolean)\n\n for (const name of names) {\n if (!REPORTER_NAMES.includes(name as ReporterName)) {\n throw new Error(`must be one of cli, json, file (got \"${name}\")`)\n }\n }\n\n return names as Array<ReporterName>\n}\n\n/**\n * Resolves the effective log level, letting the `--verbose` and `--silent` flags win over `--logLevel`.\n */\nfunction resolveLogLevel({ verbose, silent, logLevel }: { verbose: boolean; silent: boolean; logLevel: string }): string {\n if (verbose) return 'verbose'\n if (silent) return 'silent'\n return logLevel\n}\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'generate',\n description:\n 'Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.',\n examples: ['kubb generate', 'kubb generate ./openapi.yaml', 'kubb generate --config kubb.config.ts', 'kubb generate --watch', 'kubb generate --dryRun'].join(\n '\\n',\n ),\n args: {\n input: {\n type: 'positional',\n required: false,\n description: 'Path to the OpenAPI specification, overriding the config',\n },\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n logLevel: {\n type: 'enum',\n choices: ['silent', 'info', 'verbose'] as const,\n description: 'Info, silent or verbose',\n short: 'l',\n default: 'info',\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n short: 'w',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n reporter: {\n type: 'custom',\n description: 'Reporters that render the run, comma-separated. Overrides config.reporters',\n metavar: 'cli|json|file',\n parse: parseReporters,\n },\n },\n async run(ctx) {\n const { values } = ctx\n const logLevel = resolveLogLevel(values)\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: values.input,\n configPath: values.config,\n logLevel,\n watch: values.watch,\n reporters: values.reporter,\n dryRun: ctx.extensions[dryRunId].enabled,\n })\n },\n})\n"],"mappings":";;;;AAKA,MAAM,iBAAsC;CAAC;CAAO;CAAQ;AAAM;;;;AAKlE,SAAS,eAAe,OAAoC;CAC1D,MAAM,QAAQ,MACX,MAAM,GAAG,CAAC,CACV,KAAK,SAAS,KAAK,KAAK,CAAC,CAAC,CAC1B,OAAO,OAAO;CAEjB,KAAK,MAAM,QAAQ,OACjB,IAAI,CAAC,eAAe,SAAS,IAAoB,GAC/C,MAAM,IAAI,MAAM,wCAAwC,KAAK,GAAG;CAIpE,OAAO;AACT;;;;AAKA,SAAS,gBAAgB,EAAE,SAAS,QAAQ,YAA6E;CACvH,IAAI,SAAS,OAAO;CACpB,IAAI,QAAQ,OAAO;CACnB,OAAO;AACT;AAEA,MAAa,WAAA,GAAUA,OAAAA,gBAAAA,CAAkD,CAAC,CAAC;CACzE,MAAM;CACN,aACE;CACF,UAAU;EAAC;EAAiB;EAAgC;EAAyC;EAAyB;CAAwB,CAAC,CAAC,KACtJ,IACF;CACA,MAAM;EACJ,OAAO;GACL,MAAM;GACN,UAAU;GACV,aAAa;EACf;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;EACT;EACA,UAAU;GACR,MAAM;GACN,SAAS;IAAC;IAAU;IAAQ;GAAS;GACrC,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,SAAS;GACP,MAAM;GACN,aAAa;GACb,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,UAAU;GACR,MAAM;GACN,aAAa;GACb,SAAS;GACT,OAAO;EACT;CACF;CACA,MAAM,IAAI,KAAK;EACb,MAAM,EAAE,WAAW;EACnB,MAAM,WAAW,gBAAgB,MAAM;EACvC,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;EAEtB,MAAM,IAAI;GACR,OAAO,OAAO;GACd,YAAY,OAAO;GACnB;GACA,OAAO,OAAO;GACd,WAAW,OAAO;GAClB,QAAQ,IAAI,WAAWC,sBAAAA,SAAS,CAAC;EACnC,CAAC;CACH;AACF,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import {
|
|
2
|
+
import { t as dryRunId } from "./gunshiDryRun-DdKJuVn1.js";
|
|
3
|
+
import { defineWithTypes } from "gunshi";
|
|
3
4
|
//#region src/commands/generate.ts
|
|
4
5
|
const REPORTER_NAMES = [
|
|
5
6
|
"cli",
|
|
@@ -22,14 +23,15 @@ function resolveLogLevel({ verbose, silent, logLevel }) {
|
|
|
22
23
|
if (silent) return "silent";
|
|
23
24
|
return logLevel;
|
|
24
25
|
}
|
|
25
|
-
const command =
|
|
26
|
+
const command = defineWithTypes()({
|
|
26
27
|
name: "generate",
|
|
27
28
|
description: "Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.",
|
|
28
29
|
examples: [
|
|
29
30
|
"kubb generate",
|
|
30
31
|
"kubb generate ./openapi.yaml",
|
|
31
32
|
"kubb generate --config kubb.config.ts",
|
|
32
|
-
"kubb generate --watch"
|
|
33
|
+
"kubb generate --watch",
|
|
34
|
+
"kubb generate --dryRun"
|
|
33
35
|
].join("\n"),
|
|
34
36
|
args: {
|
|
35
37
|
input: {
|
|
@@ -77,19 +79,21 @@ const command = define({
|
|
|
77
79
|
parse: parseReporters
|
|
78
80
|
}
|
|
79
81
|
},
|
|
80
|
-
async run(
|
|
82
|
+
async run(ctx) {
|
|
83
|
+
const { values } = ctx;
|
|
81
84
|
const logLevel = resolveLogLevel(values);
|
|
82
|
-
const { run } = await import("./run-
|
|
85
|
+
const { run } = await import("./run-CLGgnrjg.js");
|
|
83
86
|
await run({
|
|
84
87
|
input: values.input,
|
|
85
88
|
configPath: values.config,
|
|
86
89
|
logLevel,
|
|
87
90
|
watch: values.watch,
|
|
88
|
-
reporters: values.reporter
|
|
91
|
+
reporters: values.reporter,
|
|
92
|
+
dryRun: ctx.extensions[dryRunId].enabled
|
|
89
93
|
});
|
|
90
94
|
}
|
|
91
95
|
});
|
|
92
96
|
//#endregion
|
|
93
97
|
export { command };
|
|
94
98
|
|
|
95
|
-
//# sourceMappingURL=generate-
|
|
99
|
+
//# sourceMappingURL=generate-HzSh9v2l.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-HzSh9v2l.js","names":[],"sources":["../src/commands/generate.ts"],"sourcesContent":["import { defineWithTypes } from 'gunshi'\nimport type { ReporterName } from '@kubb/core'\nimport { dryRunId } from '../gunshiDryRun.ts'\nimport type { DryRunExtensions } from '../gunshiDryRun.ts'\n\nconst REPORTER_NAMES: Array<ReporterName> = ['cli', 'json', 'file']\n\n/**\n * Splits and validates the comma-separated `--reporter` value against the known reporter names.\n */\nfunction parseReporters(value: string): Array<ReporterName> {\n const names = value\n .split(',')\n .map((name) => name.trim())\n .filter(Boolean)\n\n for (const name of names) {\n if (!REPORTER_NAMES.includes(name as ReporterName)) {\n throw new Error(`must be one of cli, json, file (got \"${name}\")`)\n }\n }\n\n return names as Array<ReporterName>\n}\n\n/**\n * Resolves the effective log level, letting the `--verbose` and `--silent` flags win over `--logLevel`.\n */\nfunction resolveLogLevel({ verbose, silent, logLevel }: { verbose: boolean; silent: boolean; logLevel: string }): string {\n if (verbose) return 'verbose'\n if (silent) return 'silent'\n return logLevel\n}\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'generate',\n description:\n 'Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.',\n examples: ['kubb generate', 'kubb generate ./openapi.yaml', 'kubb generate --config kubb.config.ts', 'kubb generate --watch', 'kubb generate --dryRun'].join(\n '\\n',\n ),\n args: {\n input: {\n type: 'positional',\n required: false,\n description: 'Path to the OpenAPI specification, overriding the config',\n },\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n logLevel: {\n type: 'enum',\n choices: ['silent', 'info', 'verbose'] as const,\n description: 'Info, silent or verbose',\n short: 'l',\n default: 'info',\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n short: 'w',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n reporter: {\n type: 'custom',\n description: 'Reporters that render the run, comma-separated. Overrides config.reporters',\n metavar: 'cli|json|file',\n parse: parseReporters,\n },\n },\n async run(ctx) {\n const { values } = ctx\n const logLevel = resolveLogLevel(values)\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: values.input,\n configPath: values.config,\n logLevel,\n watch: values.watch,\n reporters: values.reporter,\n dryRun: ctx.extensions[dryRunId].enabled,\n })\n },\n})\n"],"mappings":";;;;AAKA,MAAM,iBAAsC;CAAC;CAAO;CAAQ;AAAM;;;;AAKlE,SAAS,eAAe,OAAoC;CAC1D,MAAM,QAAQ,MACX,MAAM,GAAG,CAAC,CACV,KAAK,SAAS,KAAK,KAAK,CAAC,CAAC,CAC1B,OAAO,OAAO;CAEjB,KAAK,MAAM,QAAQ,OACjB,IAAI,CAAC,eAAe,SAAS,IAAoB,GAC/C,MAAM,IAAI,MAAM,wCAAwC,KAAK,GAAG;CAIpE,OAAO;AACT;;;;AAKA,SAAS,gBAAgB,EAAE,SAAS,QAAQ,YAA6E;CACvH,IAAI,SAAS,OAAO;CACpB,IAAI,QAAQ,OAAO;CACnB,OAAO;AACT;AAEA,MAAa,UAAU,gBAAkD,CAAC,CAAC;CACzE,MAAM;CACN,aACE;CACF,UAAU;EAAC;EAAiB;EAAgC;EAAyC;EAAyB;CAAwB,CAAC,CAAC,KACtJ,IACF;CACA,MAAM;EACJ,OAAO;GACL,MAAM;GACN,UAAU;GACV,aAAa;EACf;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;EACT;EACA,UAAU;GACR,MAAM;GACN,SAAS;IAAC;IAAU;IAAQ;GAAS;GACrC,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,SAAS;GACP,MAAM;GACN,aAAa;GACb,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,UAAU;GACR,MAAM;GACN,aAAa;GACb,SAAS;GACT,OAAO;EACT;CACF;CACA,MAAM,IAAI,KAAK;EACb,MAAM,EAAE,WAAW;EACnB,MAAM,WAAW,gBAAgB,MAAM;EACvC,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GACR,OAAO,OAAO;GACd,YAAY,OAAO;GACnB;GACA,OAAO,OAAO;GACd,WAAW,OAAO;GAClB,QAAQ,IAAI,WAAW,SAAS,CAAC;EACnC,CAAC;CACH;AACF,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("./rolldown-runtime-qbf5tadS.cjs");
|
|
3
|
-
const require_Telemetry = require("./Telemetry-
|
|
4
|
-
const require_package = require("./package-
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-qbf5tadS.cjs");
|
|
3
|
+
const require_Telemetry = require("./Telemetry-D-Jpt27O.cjs");
|
|
4
|
+
const require_package = require("./package-CnUMuss9.cjs");
|
|
5
5
|
let node_util = require("node:util");
|
|
6
|
+
let _gunshi_plugin_dryrun = require("@gunshi/plugin-dryrun");
|
|
7
|
+
_gunshi_plugin_dryrun = require_rolldown_runtime.__toESM(_gunshi_plugin_dryrun, 1);
|
|
6
8
|
let gunshi = require("gunshi");
|
|
7
9
|
//#region src/index.ts
|
|
8
10
|
/**
|
|
@@ -22,10 +24,10 @@ function stripExecArgs(argv) {
|
|
|
22
24
|
async function run(argv = process.argv) {
|
|
23
25
|
const isQuietFlag = argv.some((arg) => require_Telemetry.QUIET_FLAGS.has(arg));
|
|
24
26
|
if (!require_Telemetry.isDisabled() && !isQuietFlag) console.log(`${(0, node_util.styleText)("yellow", "Notice:")} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \nTo disable, set ${(0, node_util.styleText)("cyan", "KUBB_DISABLE_TELEMETRY=1")}.\n`);
|
|
25
|
-
const { command: generateCommand } = await Promise.resolve().then(() => require("./generate-
|
|
26
|
-
const { command: validateCommand } = await Promise.resolve().then(() => require("./validate-
|
|
27
|
-
const { command: mcpCommand } = await Promise.resolve().then(() => require("./mcp-
|
|
28
|
-
const { command: initCommand } = await Promise.resolve().then(() => require("./init-
|
|
27
|
+
const { command: generateCommand } = await Promise.resolve().then(() => require("./generate-BO_Gv-vi.cjs"));
|
|
28
|
+
const { command: validateCommand } = await Promise.resolve().then(() => require("./validate-BxCwQou-.cjs"));
|
|
29
|
+
const { command: mcpCommand } = await Promise.resolve().then(() => require("./mcp-BIcX2H1u.cjs"));
|
|
30
|
+
const { command: initCommand } = await Promise.resolve().then(() => require("./init-EJOY4K6y.cjs"));
|
|
29
31
|
await (0, gunshi.cli)(stripExecArgs(argv), generateCommand, {
|
|
30
32
|
name: "kubb",
|
|
31
33
|
version: require_package.version,
|
|
@@ -38,6 +40,7 @@ async function run(argv = process.argv) {
|
|
|
38
40
|
},
|
|
39
41
|
fallbackToEntry: true,
|
|
40
42
|
strict: true,
|
|
43
|
+
plugins: [(0, _gunshi_plugin_dryrun.default)()],
|
|
41
44
|
onErrorCommand: async (_ctx, error) => {
|
|
42
45
|
process.exitCode = 1;
|
|
43
46
|
console.error(error);
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["QUIET_FLAGS","isTelemetryDisabled","styleText","cli"],"sources":["../src/index.ts"],"sourcesContent":["import { styleText } from 'node:util'\nimport { cli } from 'gunshi'\nimport { isDisabled as isTelemetryDisabled } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { QUIET_FLAGS } from './constants.ts'\n\n/**\n * Strips the leading executable + script entries when `process.argv` is passed directly.\n * Handles Node.js (`/usr/bin/node`), Bun (`/usr/local/bin/bun`), Deno, tsx, etc. All runtime\n * executable paths contain a path separator; bare command names do not.\n */\nfunction stripExecArgs(argv: Array<string>): Array<string> {\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n return argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n}\n\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the generate, validate, mcp, and init commands. Defaults to\n * `generate` when no command is given.\n */\nexport async function run(argv: Array<string> = process.argv): Promise<void> {\n const isQuietFlag = argv.some((arg) => QUIET_FLAGS.has(arg))\n\n if (!isTelemetryDisabled() && !isQuietFlag) {\n console.log(\n `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \\nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\\n`,\n )\n }\n\n const { command: generateCommand } = await import('./commands/generate.ts')\n const { command: validateCommand } = await import('./commands/validate.ts')\n const { command: mcpCommand } = await import('./commands/mcp.ts')\n const { command: initCommand } = await import('./commands/init.ts')\n\n await cli(stripExecArgs(argv), generateCommand, {\n name: 'kubb',\n version,\n description: generateCommand.description,\n subCommands: {\n generate: generateCommand,\n init: initCommand,\n validate: validateCommand,\n mcp: mcpCommand,\n },\n fallbackToEntry: true,\n strict: true,\n onErrorCommand: async (_ctx, error) => {\n process.exitCode = 1\n console.error(error)\n },\n })\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["QUIET_FLAGS","isTelemetryDisabled","styleText","cli","dryrun"],"sources":["../src/index.ts"],"sourcesContent":["import { styleText } from 'node:util'\nimport dryrun from '@gunshi/plugin-dryrun'\nimport { cli } from 'gunshi'\nimport { isDisabled as isTelemetryDisabled } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { QUIET_FLAGS } from './constants.ts'\n\n/**\n * Strips the leading executable + script entries when `process.argv` is passed directly.\n * Handles Node.js (`/usr/bin/node`), Bun (`/usr/local/bin/bun`), Deno, tsx, etc. All runtime\n * executable paths contain a path separator; bare command names do not.\n */\nfunction stripExecArgs(argv: Array<string>): Array<string> {\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n return argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n}\n\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the generate, validate, mcp, and init commands. Defaults to\n * `generate` when no command is given.\n */\nexport async function run(argv: Array<string> = process.argv): Promise<void> {\n const isQuietFlag = argv.some((arg) => QUIET_FLAGS.has(arg))\n\n if (!isTelemetryDisabled() && !isQuietFlag) {\n console.log(\n `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \\nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\\n`,\n )\n }\n\n const { command: generateCommand } = await import('./commands/generate.ts')\n const { command: validateCommand } = await import('./commands/validate.ts')\n const { command: mcpCommand } = await import('./commands/mcp.ts')\n const { command: initCommand } = await import('./commands/init.ts')\n\n await cli(stripExecArgs(argv), generateCommand, {\n name: 'kubb',\n version,\n description: generateCommand.description,\n subCommands: {\n generate: generateCommand,\n init: initCommand,\n validate: validateCommand,\n mcp: mcpCommand,\n },\n fallbackToEntry: true,\n strict: true,\n plugins: [dryrun()],\n onErrorCommand: async (_ctx, error) => {\n process.exitCode = 1\n console.error(error)\n },\n })\n}\n"],"mappings":";;;;;;;;;;;;;;AAYA,SAAS,cAAc,MAAoC;CACzD,MAAM,4BAA4B,KAAK,EAAE,EAAE,SAAS,GAAG,KAAK,KAAK,EAAE,EAAE,SAAS,IAAI,MAAM;CACxF,OAAO,KAAK,UAAU,KAAK,2BAA2B,KAAK,MAAM,CAAC,IAAI;AACxE;;;;;;AAOA,eAAsB,IAAI,OAAsB,QAAQ,MAAqB;CAC3E,MAAM,cAAc,KAAK,MAAM,QAAQA,kBAAAA,YAAY,IAAI,GAAG,CAAC;CAE3D,IAAI,CAACC,kBAAAA,WAAoB,KAAK,CAAC,aAC7B,QAAQ,IACN,IAAA,GAAGC,UAAAA,UAAAA,CAAU,UAAU,SAAS,EAAE,wIAAA,GAAuIA,UAAAA,UAAAA,CAAU,QAAQ,0BAA0B,EAAE,IACzN;CAGF,MAAM,EAAE,SAAS,oBAAoB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,yBAAA,CAAA;CAC3C,MAAM,EAAE,SAAS,oBAAoB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,yBAAA,CAAA;CAC3C,MAAM,EAAE,SAAS,eAAe,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;CACtC,MAAM,EAAE,SAAS,gBAAgB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,qBAAA,CAAA;CAEvC,OAAA,GAAMC,OAAAA,IAAAA,CAAI,cAAc,IAAI,GAAG,iBAAiB;EAC9C,MAAM;EACN,SAAA,gBAAA;EACA,aAAa,gBAAgB;EAC7B,aAAa;GACX,UAAU;GACV,MAAM;GACN,UAAU;GACV,KAAK;EACP;EACA,iBAAiB;EACjB,QAAQ;EACR,SAAS,EAAA,GAACC,sBAAAA,QAAAA,CAAO,CAAC;EAClB,gBAAgB,OAAO,MAAM,UAAU;GACrC,QAAQ,WAAW;GACnB,QAAQ,MAAM,KAAK;EACrB;CACF,CAAC;AACH"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import { a as QUIET_FLAGS, n as isDisabled } from "./Telemetry-
|
|
3
|
-
import { t as version } from "./package-
|
|
2
|
+
import { a as QUIET_FLAGS, n as isDisabled } from "./Telemetry-Fiymfxez.js";
|
|
3
|
+
import { t as version } from "./package-DiBDd6nT.js";
|
|
4
4
|
import { styleText } from "node:util";
|
|
5
|
+
import dryrun from "@gunshi/plugin-dryrun";
|
|
5
6
|
import { cli } from "gunshi";
|
|
6
7
|
//#region src/index.ts
|
|
7
8
|
/**
|
|
@@ -21,10 +22,10 @@ function stripExecArgs(argv) {
|
|
|
21
22
|
async function run(argv = process.argv) {
|
|
22
23
|
const isQuietFlag = argv.some((arg) => QUIET_FLAGS.has(arg));
|
|
23
24
|
if (!isDisabled() && !isQuietFlag) console.log(`${styleText("yellow", "Notice:")} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \nTo disable, set ${styleText("cyan", "KUBB_DISABLE_TELEMETRY=1")}.\n`);
|
|
24
|
-
const { command: generateCommand } = await import("./generate-
|
|
25
|
-
const { command: validateCommand } = await import("./validate-
|
|
26
|
-
const { command: mcpCommand } = await import("./mcp-
|
|
27
|
-
const { command: initCommand } = await import("./init-
|
|
25
|
+
const { command: generateCommand } = await import("./generate-HzSh9v2l.js");
|
|
26
|
+
const { command: validateCommand } = await import("./validate-DD2S9ffV.js");
|
|
27
|
+
const { command: mcpCommand } = await import("./mcp-CtV0d0Dc.js");
|
|
28
|
+
const { command: initCommand } = await import("./init-BslRoYhh.js");
|
|
28
29
|
await cli(stripExecArgs(argv), generateCommand, {
|
|
29
30
|
name: "kubb",
|
|
30
31
|
version,
|
|
@@ -37,6 +38,7 @@ async function run(argv = process.argv) {
|
|
|
37
38
|
},
|
|
38
39
|
fallbackToEntry: true,
|
|
39
40
|
strict: true,
|
|
41
|
+
plugins: [dryrun()],
|
|
40
42
|
onErrorCommand: async (_ctx, error) => {
|
|
41
43
|
process.exitCode = 1;
|
|
42
44
|
console.error(error);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["isTelemetryDisabled"],"sources":["../src/index.ts"],"sourcesContent":["import { styleText } from 'node:util'\nimport { cli } from 'gunshi'\nimport { isDisabled as isTelemetryDisabled } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { QUIET_FLAGS } from './constants.ts'\n\n/**\n * Strips the leading executable + script entries when `process.argv` is passed directly.\n * Handles Node.js (`/usr/bin/node`), Bun (`/usr/local/bin/bun`), Deno, tsx, etc. All runtime\n * executable paths contain a path separator; bare command names do not.\n */\nfunction stripExecArgs(argv: Array<string>): Array<string> {\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n return argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n}\n\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the generate, validate, mcp, and init commands. Defaults to\n * `generate` when no command is given.\n */\nexport async function run(argv: Array<string> = process.argv): Promise<void> {\n const isQuietFlag = argv.some((arg) => QUIET_FLAGS.has(arg))\n\n if (!isTelemetryDisabled() && !isQuietFlag) {\n console.log(\n `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \\nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\\n`,\n )\n }\n\n const { command: generateCommand } = await import('./commands/generate.ts')\n const { command: validateCommand } = await import('./commands/validate.ts')\n const { command: mcpCommand } = await import('./commands/mcp.ts')\n const { command: initCommand } = await import('./commands/init.ts')\n\n await cli(stripExecArgs(argv), generateCommand, {\n name: 'kubb',\n version,\n description: generateCommand.description,\n subCommands: {\n generate: generateCommand,\n init: initCommand,\n validate: validateCommand,\n mcp: mcpCommand,\n },\n fallbackToEntry: true,\n strict: true,\n onErrorCommand: async (_ctx, error) => {\n process.exitCode = 1\n console.error(error)\n },\n })\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["isTelemetryDisabled"],"sources":["../src/index.ts"],"sourcesContent":["import { styleText } from 'node:util'\nimport dryrun from '@gunshi/plugin-dryrun'\nimport { cli } from 'gunshi'\nimport { isDisabled as isTelemetryDisabled } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { QUIET_FLAGS } from './constants.ts'\n\n/**\n * Strips the leading executable + script entries when `process.argv` is passed directly.\n * Handles Node.js (`/usr/bin/node`), Bun (`/usr/local/bin/bun`), Deno, tsx, etc. All runtime\n * executable paths contain a path separator; bare command names do not.\n */\nfunction stripExecArgs(argv: Array<string>): Array<string> {\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n return argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n}\n\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the generate, validate, mcp, and init commands. Defaults to\n * `generate` when no command is given.\n */\nexport async function run(argv: Array<string> = process.argv): Promise<void> {\n const isQuietFlag = argv.some((arg) => QUIET_FLAGS.has(arg))\n\n if (!isTelemetryDisabled() && !isQuietFlag) {\n console.log(\n `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \\nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\\n`,\n )\n }\n\n const { command: generateCommand } = await import('./commands/generate.ts')\n const { command: validateCommand } = await import('./commands/validate.ts')\n const { command: mcpCommand } = await import('./commands/mcp.ts')\n const { command: initCommand } = await import('./commands/init.ts')\n\n await cli(stripExecArgs(argv), generateCommand, {\n name: 'kubb',\n version,\n description: generateCommand.description,\n subCommands: {\n generate: generateCommand,\n init: initCommand,\n validate: validateCommand,\n mcp: mcpCommand,\n },\n fallbackToEntry: true,\n strict: true,\n plugins: [dryrun()],\n onErrorCommand: async (_ctx, error) => {\n process.exitCode = 1\n console.error(error)\n },\n })\n}\n"],"mappings":";;;;;;;;;;;;AAYA,SAAS,cAAc,MAAoC;CACzD,MAAM,4BAA4B,KAAK,EAAE,EAAE,SAAS,GAAG,KAAK,KAAK,EAAE,EAAE,SAAS,IAAI,MAAM;CACxF,OAAO,KAAK,UAAU,KAAK,2BAA2B,KAAK,MAAM,CAAC,IAAI;AACxE;;;;;;AAOA,eAAsB,IAAI,OAAsB,QAAQ,MAAqB;CAC3E,MAAM,cAAc,KAAK,MAAM,QAAQ,YAAY,IAAI,GAAG,CAAC;CAE3D,IAAI,CAACA,WAAoB,KAAK,CAAC,aAC7B,QAAQ,IACN,GAAG,UAAU,UAAU,SAAS,EAAE,uIAAuI,UAAU,QAAQ,0BAA0B,EAAE,IACzN;CAGF,MAAM,EAAE,SAAS,oBAAoB,MAAM,OAAO;CAClD,MAAM,EAAE,SAAS,oBAAoB,MAAM,OAAO;CAClD,MAAM,EAAE,SAAS,eAAe,MAAM,OAAO;CAC7C,MAAM,EAAE,SAAS,gBAAgB,MAAM,OAAO;CAE9C,MAAM,IAAI,cAAc,IAAI,GAAG,iBAAiB;EAC9C,MAAM;EACN;EACA,aAAa,gBAAgB;EAC7B,aAAa;GACX,UAAU;GACV,MAAM;GACN,UAAU;GACV,KAAK;EACP;EACA,iBAAiB;EACjB,QAAQ;EACR,SAAS,CAAC,OAAO,CAAC;EAClB,gBAAgB,OAAO,MAAM,UAAU;GACrC,QAAQ,WAAW;GACnB,QAAQ,MAAM,KAAK;EACrB;CACF,CAAC;AACH"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import { t as version } from "./package-
|
|
3
|
-
import {
|
|
2
|
+
import { t as version } from "./package-DiBDd6nT.js";
|
|
3
|
+
import { t as dryRunId } from "./gunshiDryRun-DdKJuVn1.js";
|
|
4
|
+
import { defineWithTypes } from "gunshi";
|
|
4
5
|
//#region src/commands/init.ts
|
|
5
|
-
const command =
|
|
6
|
+
const command = defineWithTypes()({
|
|
6
7
|
name: "init",
|
|
7
8
|
description: "Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.",
|
|
8
9
|
examples: [
|
|
9
10
|
"kubb init",
|
|
10
11
|
"kubb init --yes",
|
|
11
12
|
"kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod",
|
|
12
|
-
"kubb init --plugins plugin-ts,plugin-axios,plugin-react-query"
|
|
13
|
+
"kubb init --plugins plugin-ts,plugin-axios,plugin-react-query",
|
|
14
|
+
"kubb init --yes --dryRun"
|
|
13
15
|
].join("\n"),
|
|
14
16
|
args: {
|
|
15
17
|
yes: {
|
|
@@ -36,18 +38,20 @@ const command = define({
|
|
|
36
38
|
metavar: "plugin-ts,plugin-zod,..."
|
|
37
39
|
}
|
|
38
40
|
},
|
|
39
|
-
async run(
|
|
40
|
-
const {
|
|
41
|
+
async run(ctx) {
|
|
42
|
+
const { values } = ctx;
|
|
43
|
+
const { run } = await import("./run-DSgLksGj.js");
|
|
41
44
|
await run({
|
|
42
45
|
yes: values.yes,
|
|
43
46
|
version,
|
|
44
47
|
input: values.input,
|
|
45
48
|
output: values.output,
|
|
46
|
-
plugins: values.plugins
|
|
49
|
+
plugins: values.plugins,
|
|
50
|
+
dryRun: ctx.extensions[dryRunId]
|
|
47
51
|
});
|
|
48
52
|
}
|
|
49
53
|
});
|
|
50
54
|
//#endregion
|
|
51
55
|
export { command };
|
|
52
56
|
|
|
53
|
-
//# sourceMappingURL=init-
|
|
57
|
+
//# sourceMappingURL=init-BslRoYhh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-BslRoYhh.js","names":[],"sources":["../src/commands/init.ts"],"sourcesContent":["import { defineWithTypes } from 'gunshi'\nimport { dryRunId } from '../gunshiDryRun.ts'\nimport type { DryRunExtensions } from '../gunshiDryRun.ts'\nimport { version } from '../../package.json'\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'init',\n description:\n 'Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --plugins plugin-ts,plugin-axios,plugin-react-query',\n 'kubb init --yes --dryRun',\n ].join('\\n'),\n args: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use default options',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n metavar: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n metavar: 'path',\n },\n plugins: {\n type: 'string',\n description:\n 'Comma-separated list of plugins to use (plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)',\n metavar: 'plugin-ts,plugin-zod,...',\n },\n },\n async run(ctx) {\n const { values } = ctx\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n dryRun: ctx.extensions[dryRunId],\n })\n },\n})\n"],"mappings":";;;;;AAKA,MAAa,UAAU,gBAAkD,CAAC,CAAC;CACzE,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CACX,MAAM;EACJ,KAAK;GACH,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,SAAS;GACP,MAAM;GACN,aACE;GACF,SAAS;EACX;CACF;CACA,MAAM,IAAI,KAAK;EACb,MAAM,EAAE,WAAW;EACnB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GACR,KAAK,OAAO;GACZ;GACA,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,SAAS,OAAO;GAChB,QAAQ,IAAI,WAAW;EACzB,CAAC;CACH;AACF,CAAC"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
require("./rolldown-runtime-qbf5tadS.cjs");
|
|
2
|
-
const require_package = require("./package-
|
|
2
|
+
const require_package = require("./package-CnUMuss9.cjs");
|
|
3
|
+
let gunshi = require("gunshi");
|
|
4
|
+
let _gunshi_plugin_dryrun = require("@gunshi/plugin-dryrun");
|
|
3
5
|
//#region src/commands/init.ts
|
|
4
|
-
const command = (0,
|
|
6
|
+
const command = (0, gunshi.defineWithTypes)()({
|
|
5
7
|
name: "init",
|
|
6
8
|
description: "Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.",
|
|
7
9
|
examples: [
|
|
8
10
|
"kubb init",
|
|
9
11
|
"kubb init --yes",
|
|
10
12
|
"kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod",
|
|
11
|
-
"kubb init --plugins plugin-ts,plugin-axios,plugin-react-query"
|
|
13
|
+
"kubb init --plugins plugin-ts,plugin-axios,plugin-react-query",
|
|
14
|
+
"kubb init --yes --dryRun"
|
|
12
15
|
].join("\n"),
|
|
13
16
|
args: {
|
|
14
17
|
yes: {
|
|
@@ -35,18 +38,20 @@ const command = (0, require("gunshi").define)({
|
|
|
35
38
|
metavar: "plugin-ts,plugin-zod,..."
|
|
36
39
|
}
|
|
37
40
|
},
|
|
38
|
-
async run(
|
|
39
|
-
const {
|
|
41
|
+
async run(ctx) {
|
|
42
|
+
const { values } = ctx;
|
|
43
|
+
const { run } = await Promise.resolve().then(() => require("./run-FPqeAEF4.cjs"));
|
|
40
44
|
await run({
|
|
41
45
|
yes: values.yes,
|
|
42
46
|
version: require_package.version,
|
|
43
47
|
input: values.input,
|
|
44
48
|
output: values.output,
|
|
45
|
-
plugins: values.plugins
|
|
49
|
+
plugins: values.plugins,
|
|
50
|
+
dryRun: ctx.extensions[_gunshi_plugin_dryrun.pluginId]
|
|
46
51
|
});
|
|
47
52
|
}
|
|
48
53
|
});
|
|
49
54
|
//#endregion
|
|
50
55
|
exports.command = command;
|
|
51
56
|
|
|
52
|
-
//# sourceMappingURL=init-
|
|
57
|
+
//# sourceMappingURL=init-EJOY4K6y.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-EJOY4K6y.cjs","names":["defineWithTypes","dryRunId"],"sources":["../src/commands/init.ts"],"sourcesContent":["import { defineWithTypes } from 'gunshi'\nimport { dryRunId } from '../gunshiDryRun.ts'\nimport type { DryRunExtensions } from '../gunshiDryRun.ts'\nimport { version } from '../../package.json'\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'init',\n description:\n 'Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --plugins plugin-ts,plugin-axios,plugin-react-query',\n 'kubb init --yes --dryRun',\n ].join('\\n'),\n args: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use default options',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n metavar: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n metavar: 'path',\n },\n plugins: {\n type: 'string',\n description:\n 'Comma-separated list of plugins to use (plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)',\n metavar: 'plugin-ts,plugin-zod,...',\n },\n },\n async run(ctx) {\n const { values } = ctx\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n dryRun: ctx.extensions[dryRunId],\n })\n },\n})\n"],"mappings":";;;;;AAKA,MAAa,WAAA,GAAUA,OAAAA,gBAAAA,CAAkD,CAAC,CAAC;CACzE,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CACX,MAAM;EACJ,KAAK;GACH,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,SAAS;GACP,MAAM;GACN,aACE;GACF,SAAS;EACX;CACF;CACA,MAAM,IAAI,KAAK;EACb,MAAM,EAAE,WAAW;EACnB,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;EAEtB,MAAM,IAAI;GACR,KAAK,OAAO;GACZ,SAAA,gBAAA;GACA,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,SAAS,OAAO;GAChB,QAAQ,IAAI,WAAWC,sBAAAA;EACzB,CAAC;CACH;AACF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require("./rolldown-runtime-qbf5tadS.cjs");
|
|
2
|
-
const require_package = require("./package-
|
|
2
|
+
const require_package = require("./package-CnUMuss9.cjs");
|
|
3
3
|
//#region src/commands/mcp.ts
|
|
4
4
|
const command = (0, require("gunshi").define)({
|
|
5
5
|
name: "mcp",
|
|
@@ -10,11 +10,11 @@ const command = (0, require("gunshi").define)({
|
|
|
10
10
|
"# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }"
|
|
11
11
|
].join("\n"),
|
|
12
12
|
async run() {
|
|
13
|
-
const { run } = await Promise.resolve().then(() => require("./run-
|
|
13
|
+
const { run } = await Promise.resolve().then(() => require("./run-Cs5FunVC.cjs"));
|
|
14
14
|
await run({ version: require_package.version });
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
//#endregion
|
|
18
18
|
exports.command = command;
|
|
19
19
|
|
|
20
|
-
//# sourceMappingURL=mcp-
|
|
20
|
+
//# sourceMappingURL=mcp-BIcX2H1u.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-
|
|
1
|
+
{"version":3,"file":"mcp-BIcX2H1u.cjs","names":["define"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { define } from 'gunshi'\nimport { version } from '../../package.json'\n\nexport const command = define({\n name: 'mcp',\n description:\n 'Start a Model Context Protocol (MCP) server that exposes Kubb code generation as tools for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect to it — the assistant can then call kubb generate directly without leaving the chat.',\n examples: ['kubb mcp', '# Then add to your MCP client config:', '# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }'].join('\\n'),\n async run() {\n const { run } = await import('../runners/mcp/run.ts')\n\n await run({ version })\n },\n})\n"],"mappings":";;;AAGA,MAAa,WAAA,mBAAUA,CAAAA,CAAAA,OAAAA,CAAO;CAC5B,MAAM;CACN,aACE;CACF,UAAU;EAAC;EAAY;EAAyC;CAA+E,CAAC,CAAC,KAAK,IAAI;CAC1J,MAAM,MAAM;EACV,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;EAEtB,MAAM,IAAI,EAAE,SAAA,gBAAA,QAAQ,CAAC;CACvB;AACF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import { t as version } from "./package-
|
|
2
|
+
import { t as version } from "./package-DiBDd6nT.js";
|
|
3
3
|
import { define } from "gunshi";
|
|
4
4
|
//#region src/commands/mcp.ts
|
|
5
5
|
const command = define({
|
|
@@ -11,11 +11,11 @@ const command = define({
|
|
|
11
11
|
"# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }"
|
|
12
12
|
].join("\n"),
|
|
13
13
|
async run() {
|
|
14
|
-
const { run } = await import("./run-
|
|
14
|
+
const { run } = await import("./run-DCfdTu52.js");
|
|
15
15
|
await run({ version });
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
//#endregion
|
|
19
19
|
export { command };
|
|
20
20
|
|
|
21
|
-
//# sourceMappingURL=mcp-
|
|
21
|
+
//# sourceMappingURL=mcp-CtV0d0Dc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-
|
|
1
|
+
{"version":3,"file":"mcp-CtV0d0Dc.js","names":[],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { define } from 'gunshi'\nimport { version } from '../../package.json'\n\nexport const command = define({\n name: 'mcp',\n description:\n 'Start a Model Context Protocol (MCP) server that exposes Kubb code generation as tools for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect to it — the assistant can then call kubb generate directly without leaving the chat.',\n examples: ['kubb mcp', '# Then add to your MCP client config:', '# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }'].join('\\n'),\n async run() {\n const { run } = await import('../runners/mcp/run.ts')\n\n await run({ version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,OAAO;CAC5B,MAAM;CACN,aACE;CACF,UAAU;EAAC;EAAY;EAAyC;CAA+E,CAAC,CAAC,KAAK,IAAI;CAC1J,MAAM,MAAM;EACV,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI,EAAE,QAAQ,CAAC;CACvB;AACF,CAAC"}
|