@kubb/cli 5.1.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -0
- package/dist/{Telemetry-Fiymfxez.js → Telemetry-BCTY-Nzq.js} +3 -49
- package/dist/Telemetry-BCTY-Nzq.js.map +1 -0
- package/dist/{Telemetry-D-Jpt27O.cjs → Telemetry-DKfJQxnC.cjs} +8 -60
- package/dist/Telemetry-DKfJQxnC.cjs.map +1 -0
- package/dist/constants-CdxpgX3_.cjs +115 -0
- package/dist/constants-CdxpgX3_.cjs.map +1 -0
- package/dist/constants-DHRspBTo.js +92 -0
- package/dist/constants-DHRspBTo.js.map +1 -0
- package/dist/env-DHaFBZTX.cjs +82 -0
- package/dist/env-DHaFBZTX.cjs.map +1 -0
- package/dist/env-DqPKEL59.js +59 -0
- package/dist/env-DqPKEL59.js.map +1 -0
- package/dist/{errors-CZtH2dKk.cjs → errors-C-wEou02.cjs} +2 -19
- package/dist/errors-C-wEou02.cjs.map +1 -0
- package/dist/errors-C8yNfV7w.js +20 -0
- package/dist/errors-C8yNfV7w.js.map +1 -0
- package/dist/{generate-HzSh9v2l.js → generate-CEHA2OSd.js} +9 -6
- package/dist/generate-CEHA2OSd.js.map +1 -0
- package/dist/{generate-BO_Gv-vi.cjs → generate-P5PWAa7J.cjs} +9 -6
- package/dist/generate-P5PWAa7J.cjs.map +1 -0
- package/dist/index.cjs +14 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +15 -10
- package/dist/index.js.map +1 -1
- package/dist/{init-BslRoYhh.js → init-CgQnnwbc.js} +3 -3
- package/dist/{init-BslRoYhh.js.map → init-CgQnnwbc.js.map} +1 -1
- package/dist/{init-EJOY4K6y.cjs → init-_p5e5VuD.cjs} +3 -3
- package/dist/{init-EJOY4K6y.cjs.map → init-_p5e5VuD.cjs.map} +1 -1
- package/dist/{mcp-CtV0d0Dc.js → mcp-B-GxGgVr.js} +8 -10
- package/dist/mcp-B-GxGgVr.js.map +1 -0
- package/dist/{mcp-BIcX2H1u.cjs → mcp-B3B-rE7W.cjs} +8 -10
- package/dist/mcp-B3B-rE7W.cjs.map +1 -0
- package/dist/output-B2V2MN_C.cjs +137 -0
- package/dist/output-B2V2MN_C.cjs.map +1 -0
- package/dist/output-LZvrgF3z.js +89 -0
- package/dist/output-LZvrgF3z.js.map +1 -0
- package/dist/package-GR1Pi9JF.js +6 -0
- package/dist/package-GR1Pi9JF.js.map +1 -0
- package/dist/{package-CnUMuss9.cjs → package-vVVyiYqL.cjs} +2 -2
- package/dist/package-vVVyiYqL.cjs.map +1 -0
- package/dist/{run-DSgLksGj.js → run-BzvsJ0Ek.js} +80 -112
- package/dist/run-BzvsJ0Ek.js.map +1 -0
- package/dist/run-CH9jQeET.js +499 -0
- package/dist/run-CH9jQeET.js.map +1 -0
- package/dist/run-D-XYvWxQ.js +281 -0
- package/dist/run-D-XYvWxQ.js.map +1 -0
- package/dist/{run-BV2tMjuz.cjs → run-D6yr3HEE.cjs} +15 -4
- package/dist/run-D6yr3HEE.cjs.map +1 -0
- package/dist/{run-FPqeAEF4.cjs → run-DRBqVXX0.cjs} +93 -125
- package/dist/run-DRBqVXX0.cjs.map +1 -0
- package/dist/{run-DCfdTu52.js → run-DgV0unjs.js} +11 -4
- package/dist/run-DgV0unjs.js.map +1 -0
- package/dist/{run-Cs5FunVC.cjs → run-FLh61kzq.cjs} +11 -4
- package/dist/run-FLh61kzq.cjs.map +1 -0
- package/dist/run-Z_y-m4dQ.cjs +283 -0
- package/dist/run-Z_y-m4dQ.cjs.map +1 -0
- package/dist/{run-ChKPZlIB.js → run-n7yOll1q.js} +15 -4
- package/dist/run-n7yOll1q.js.map +1 -0
- package/dist/run-pPsQ2MsX.cjs +502 -0
- package/dist/run-pPsQ2MsX.cjs.map +1 -0
- package/dist/studio-DKv2YLJZ.js +77 -0
- package/dist/studio-DKv2YLJZ.js.map +1 -0
- package/dist/studio-PDMxqFN0.cjs +76 -0
- package/dist/studio-PDMxqFN0.cjs.map +1 -0
- package/dist/{run-DAGbErY0.cjs → utils-B0SrWoNh.cjs} +303 -323
- package/dist/utils-B0SrWoNh.cjs.map +1 -0
- package/dist/{run-CLGgnrjg.js → utils-CzoNURwq.js} +274 -364
- package/dist/utils-CzoNURwq.js.map +1 -0
- package/dist/{validate-BxCwQou-.cjs → validate-BcB0tFQ6.cjs} +8 -13
- package/dist/validate-BcB0tFQ6.cjs.map +1 -0
- package/dist/{validate-DD2S9ffV.js → validate-QpkCbIFJ.js} +8 -13
- package/dist/validate-QpkCbIFJ.js.map +1 -0
- package/package.json +18 -9
- package/dist/Telemetry-D-Jpt27O.cjs.map +0 -1
- package/dist/Telemetry-Fiymfxez.js.map +0 -1
- package/dist/errors-CMvLO2NE.js +0 -31
- package/dist/errors-CMvLO2NE.js.map +0 -1
- package/dist/errors-CZtH2dKk.cjs.map +0 -1
- package/dist/generate-BO_Gv-vi.cjs.map +0 -1
- package/dist/generate-HzSh9v2l.js.map +0 -1
- package/dist/mcp-BIcX2H1u.cjs.map +0 -1
- package/dist/mcp-CtV0d0Dc.js.map +0 -1
- package/dist/package-CnUMuss9.cjs.map +0 -1
- package/dist/package-DiBDd6nT.js +0 -6
- package/dist/package-DiBDd6nT.js.map +0 -1
- package/dist/run-BV2tMjuz.cjs.map +0 -1
- package/dist/run-CLGgnrjg.js.map +0 -1
- package/dist/run-ChKPZlIB.js.map +0 -1
- package/dist/run-Cs5FunVC.cjs.map +0 -1
- package/dist/run-DAGbErY0.cjs.map +0 -1
- package/dist/run-DCfdTu52.js.map +0 -1
- package/dist/run-DSgLksGj.js.map +0 -1
- package/dist/run-FPqeAEF4.cjs.map +0 -1
- package/dist/tools-DH1a7ZJH.js +0 -152
- package/dist/tools-DH1a7ZJH.js.map +0 -1
- package/dist/tools-bwKAf_r-.cjs +0 -175
- package/dist/tools-bwKAf_r-.cjs.map +0 -1
- package/dist/validate-BxCwQou-.cjs.map +0 -1
- package/dist/validate-DD2S9ffV.js.map +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
+
import { getAgentProfile } from "gunshi/agent";
|
|
3
|
+
//#region src/agent.ts
|
|
4
|
+
/**
|
|
5
|
+
* Name of the AI coding agent driving this process, when one is detected (e.g. `'claude'`,
|
|
6
|
+
* `'cursor'`). `undefined` when run by a human or an unrecognized caller.
|
|
7
|
+
*/
|
|
8
|
+
function getAgentName() {
|
|
9
|
+
const profile = getAgentProfile();
|
|
10
|
+
return profile.isAgent ? profile.name : void 0;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/utils/env.ts
|
|
14
|
+
/**
|
|
15
|
+
* Returns `true` when the process is running in a CI environment.
|
|
16
|
+
* Covers GitHub Actions, GitLab CI, CircleCI, Travis CI, Jenkins, Bitbucket,
|
|
17
|
+
* TeamCity, Buildkite, and Azure Pipelines.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* if (isCIEnvironment()) {
|
|
22
|
+
* logger.level = 'error'
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
function isCIEnvironment() {
|
|
27
|
+
return !!(process.env.CI || process.env.GITHUB_ACTIONS || process.env.GITLAB_CI || process.env.BITBUCKET_BUILD_NUMBER || process.env.JENKINS_URL || process.env.CIRCLECI || process.env.TRAVIS || process.env.TEAMCITY_VERSION || process.env.BUILDKITE || process.env.TF_BUILD);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Returns `true` when the process has an interactive TTY with a valid terminal
|
|
31
|
+
* width and is not running in CI.
|
|
32
|
+
*
|
|
33
|
+
* Some IDE-embedded terminals report `isTTY = true` but set `columns` to `0`,
|
|
34
|
+
* which breaks clack's box-drawing helpers (they call `String.prototype.repeat`
|
|
35
|
+
* with a negative count and throw a `RangeError`). A positive column count is
|
|
36
|
+
* required before the TTY counts as usable.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* if (canUseTTY()) {
|
|
41
|
+
* renderProgressBar()
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
function canUseTTY() {
|
|
46
|
+
return process.stdout.isTTY && (process.stdout.columns ?? 0) > 0 && !isCIEnvironment();
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns `true` when output can carry spinners and clack's gutter: an interactive TTY that no AI
|
|
50
|
+
* coding agent is reading. Cursor-movement escapes are hard for an agent to parse even over a
|
|
51
|
+
* pseudo-TTY, so it gets the plain writer.
|
|
52
|
+
*/
|
|
53
|
+
function isRichOutput() {
|
|
54
|
+
return canUseTTY() && !getAgentName();
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { getAgentName as i, isCIEnvironment as n, isRichOutput as r, canUseTTY as t };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=env-DqPKEL59.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-DqPKEL59.js","names":[],"sources":["../src/agent.ts","../src/utils/env.ts"],"sourcesContent":["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","import { getAgentName } from '../agent.ts'\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`). A positive column count is\n * required before the TTY counts as 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/**\n * Returns `true` when output can carry spinners and clack's gutter: an interactive TTY that no AI\n * coding agent is reading. Cursor-movement escapes are hard for an agent to parse even over a\n * pseudo-TTY, so it gets the plain writer.\n */\nexport function isRichOutput(): boolean {\n return canUseTTY() && !getAgentName()\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,eAAmC;CACjD,MAAM,UAAU,gBAAgB;CAChC,OAAO,QAAQ,UAAU,QAAQ,OAAO,KAAA;AAC1C;;;;;;;;;;;;;;;ACKA,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;;;;;;AAOA,SAAgB,eAAwB;CACtC,OAAO,UAAU,KAAK,CAAC,aAAa;AACtC"}
|
|
@@ -7,31 +7,14 @@ require("./rolldown-runtime-qbf5tadS.cjs");
|
|
|
7
7
|
* @example
|
|
8
8
|
* ```ts
|
|
9
9
|
* try { ... } catch(err) {
|
|
10
|
-
* throw new
|
|
10
|
+
* throw new Error('Build failed', { cause: toError(err) })
|
|
11
11
|
* }
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
function toError(value) {
|
|
15
15
|
return value instanceof Error ? value : new Error(String(value));
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Extracts the `.cause` of an `Error` as an `Error`, or `undefined` when absent or not an `Error`.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```ts
|
|
22
|
-
* const cause = toCause(buildError) // Error | undefined
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
function toCause(error) {
|
|
26
|
-
return error.cause instanceof Error ? error.cause : void 0;
|
|
27
|
-
}
|
|
28
17
|
//#endregion
|
|
29
|
-
Object.defineProperty(exports, "toCause", {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function() {
|
|
32
|
-
return toCause;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
18
|
Object.defineProperty(exports, "toError", {
|
|
36
19
|
enumerable: true,
|
|
37
20
|
get: function() {
|
|
@@ -39,4 +22,4 @@ Object.defineProperty(exports, "toError", {
|
|
|
39
22
|
}
|
|
40
23
|
});
|
|
41
24
|
|
|
42
|
-
//# sourceMappingURL=errors-
|
|
25
|
+
//# sourceMappingURL=errors-C-wEou02.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-C-wEou02.cjs","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/**\n * Coerces an unknown thrown value to an `Error` instance.\n * Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.\n *\n * @example\n * ```ts\n * try { ... } catch(err) {\n * throw new Error('Build failed', { cause: toError(err) })\n * }\n * ```\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Extracts a human-readable message from any thrown value.\n *\n * @example\n * ```ts\n * getErrorMessage(new Error('oops')) // 'oops'\n * getErrorMessage('plain string') // 'plain string'\n * ```\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,SAAgB,QAAQ,OAAuB;CAC7C,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;AACjE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
+
//#region ../../internals/utils/src/errors.ts
|
|
3
|
+
/**
|
|
4
|
+
* Coerces an unknown thrown value to an `Error` instance.
|
|
5
|
+
* Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* try { ... } catch(err) {
|
|
10
|
+
* throw new Error('Build failed', { cause: toError(err) })
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
function toError(value) {
|
|
15
|
+
return value instanceof Error ? value : new Error(String(value));
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { toError as t };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=errors-C8yNfV7w.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-C8yNfV7w.js","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/**\n * Coerces an unknown thrown value to an `Error` instance.\n * Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.\n *\n * @example\n * ```ts\n * try { ... } catch(err) {\n * throw new Error('Build failed', { cause: toError(err) })\n * }\n * ```\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Extracts a human-readable message from any thrown value.\n *\n * @example\n * ```ts\n * getErrorMessage(new Error('oops')) // 'oops'\n * getErrorMessage('plain string') // 'plain string'\n * ```\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,SAAgB,QAAQ,OAAuB;CAC7C,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;AACjE"}
|
|
@@ -27,11 +27,14 @@ const command = defineWithTypes()({
|
|
|
27
27
|
name: "generate",
|
|
28
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.",
|
|
29
29
|
examples: [
|
|
30
|
-
"kubb generate",
|
|
31
|
-
"kubb generate ./openapi.yaml",
|
|
30
|
+
"kubb generate # generate from kubb.config.ts",
|
|
31
|
+
"kubb generate ./openapi.yaml # generate from this spec instead of the config input",
|
|
32
32
|
"kubb generate --config kubb.config.ts",
|
|
33
|
-
"kubb generate --watch",
|
|
34
|
-
"kubb generate --dryRun"
|
|
33
|
+
"kubb generate --watch # regenerate whenever the spec changes",
|
|
34
|
+
"kubb generate --dryRun # preview the run without writing files",
|
|
35
|
+
"kubb studio # connect this project to Kubb Studio and generate from the browser",
|
|
36
|
+
"kubb studio --allowWrite # let Studio write the generated files to disk",
|
|
37
|
+
"kubb studio login # pair this machine with Studio without connecting"
|
|
35
38
|
].join("\n"),
|
|
36
39
|
args: {
|
|
37
40
|
input: {
|
|
@@ -82,7 +85,7 @@ const command = defineWithTypes()({
|
|
|
82
85
|
async run(ctx) {
|
|
83
86
|
const { values } = ctx;
|
|
84
87
|
const logLevel = resolveLogLevel(values);
|
|
85
|
-
const { run } = await import("./run-
|
|
88
|
+
const { run } = await import("./run-D-XYvWxQ.js");
|
|
86
89
|
await run({
|
|
87
90
|
input: values.input,
|
|
88
91
|
configPath: values.config,
|
|
@@ -96,4 +99,4 @@ const command = defineWithTypes()({
|
|
|
96
99
|
//#endregion
|
|
97
100
|
export { command };
|
|
98
101
|
|
|
99
|
-
//# sourceMappingURL=generate-
|
|
102
|
+
//# sourceMappingURL=generate-CEHA2OSd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-CEHA2OSd.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: [\n 'kubb generate # generate from kubb.config.ts',\n 'kubb generate ./openapi.yaml # generate from this spec instead of the config input',\n 'kubb generate --config kubb.config.ts',\n 'kubb generate --watch # regenerate whenever the spec changes',\n 'kubb generate --dryRun # preview the run without writing files',\n 'kubb studio # connect this project to Kubb Studio and generate from the browser',\n 'kubb studio --allowWrite # let Studio write the generated files to disk',\n 'kubb studio login # pair this machine with Studio without connecting',\n ].join('\\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;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CACX,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"}
|
|
@@ -27,11 +27,14 @@ const command = (0, gunshi.defineWithTypes)()({
|
|
|
27
27
|
name: "generate",
|
|
28
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.",
|
|
29
29
|
examples: [
|
|
30
|
-
"kubb generate",
|
|
31
|
-
"kubb generate ./openapi.yaml",
|
|
30
|
+
"kubb generate # generate from kubb.config.ts",
|
|
31
|
+
"kubb generate ./openapi.yaml # generate from this spec instead of the config input",
|
|
32
32
|
"kubb generate --config kubb.config.ts",
|
|
33
|
-
"kubb generate --watch",
|
|
34
|
-
"kubb generate --dryRun"
|
|
33
|
+
"kubb generate --watch # regenerate whenever the spec changes",
|
|
34
|
+
"kubb generate --dryRun # preview the run without writing files",
|
|
35
|
+
"kubb studio # connect this project to Kubb Studio and generate from the browser",
|
|
36
|
+
"kubb studio --allowWrite # let Studio write the generated files to disk",
|
|
37
|
+
"kubb studio login # pair this machine with Studio without connecting"
|
|
35
38
|
].join("\n"),
|
|
36
39
|
args: {
|
|
37
40
|
input: {
|
|
@@ -82,7 +85,7 @@ const command = (0, gunshi.defineWithTypes)()({
|
|
|
82
85
|
async run(ctx) {
|
|
83
86
|
const { values } = ctx;
|
|
84
87
|
const logLevel = resolveLogLevel(values);
|
|
85
|
-
const { run } = await Promise.resolve().then(() => require("./run-
|
|
88
|
+
const { run } = await Promise.resolve().then(() => require("./run-Z_y-m4dQ.cjs"));
|
|
86
89
|
await run({
|
|
87
90
|
input: values.input,
|
|
88
91
|
configPath: values.config,
|
|
@@ -96,4 +99,4 @@ const command = (0, gunshi.defineWithTypes)()({
|
|
|
96
99
|
//#endregion
|
|
97
100
|
exports.command = command;
|
|
98
101
|
|
|
99
|
-
//# sourceMappingURL=generate-
|
|
102
|
+
//# sourceMappingURL=generate-P5PWAa7J.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-P5PWAa7J.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: [\n 'kubb generate # generate from kubb.config.ts',\n 'kubb generate ./openapi.yaml # generate from this spec instead of the config input',\n 'kubb generate --config kubb.config.ts',\n 'kubb generate --watch # regenerate whenever the spec changes',\n 'kubb generate --dryRun # preview the run without writing files',\n 'kubb studio # connect this project to Kubb Studio and generate from the browser',\n 'kubb studio --allowWrite # let Studio write the generated files to disk',\n 'kubb studio login # pair this machine with Studio without connecting',\n ].join('\\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;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CACX,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"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("./rolldown-runtime-qbf5tadS.cjs");
|
|
3
|
-
const require_Telemetry = require("./Telemetry-
|
|
4
|
-
const require_package = require("./package-
|
|
3
|
+
const require_Telemetry = require("./Telemetry-DKfJQxnC.cjs");
|
|
4
|
+
const require_package = require("./package-vVVyiYqL.cjs");
|
|
5
5
|
let node_util = require("node:util");
|
|
6
6
|
let _gunshi_plugin_dryrun = require("@gunshi/plugin-dryrun");
|
|
7
7
|
_gunshi_plugin_dryrun = require_rolldown_runtime.__toESM(_gunshi_plugin_dryrun, 1);
|
|
@@ -18,25 +18,30 @@ function stripExecArgs(argv) {
|
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a
|
|
21
|
-
* quiet flag is passed, then runs the generate, validate, mcp, and init commands. Defaults to
|
|
21
|
+
* quiet flag is passed, then runs the generate, validate, mcp, studio, and init commands. Defaults to
|
|
22
22
|
* `generate` when no command is given.
|
|
23
23
|
*/
|
|
24
24
|
async function run(argv = process.argv) {
|
|
25
25
|
const isQuietFlag = argv.some((arg) => require_Telemetry.QUIET_FLAGS.has(arg));
|
|
26
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`);
|
|
27
|
-
const { command: generateCommand } = await Promise.resolve().then(() => require("./generate-
|
|
28
|
-
const { command:
|
|
29
|
-
const {
|
|
30
|
-
const
|
|
27
|
+
const { command: generateCommand } = await Promise.resolve().then(() => require("./generate-P5PWAa7J.cjs"));
|
|
28
|
+
const { command: initCommand } = await Promise.resolve().then(() => require("./init-_p5e5VuD.cjs"));
|
|
29
|
+
const { definition: validateDefinition } = await Promise.resolve().then(() => require("./validate-BcB0tFQ6.cjs"));
|
|
30
|
+
const validateCommand = (0, gunshi.lazy)(async () => (await Promise.resolve().then(() => require("./run-D6yr3HEE.cjs"))).runner, validateDefinition);
|
|
31
|
+
const { definition: mcpDefinition } = await Promise.resolve().then(() => require("./mcp-B3B-rE7W.cjs"));
|
|
32
|
+
const mcpCommand = (0, gunshi.lazy)(async () => (await Promise.resolve().then(() => require("./run-FLh61kzq.cjs"))).runner, mcpDefinition);
|
|
33
|
+
const { definition: studioDefinition } = await Promise.resolve().then(() => require("./studio-PDMxqFN0.cjs"));
|
|
34
|
+
const studioCommand = (0, gunshi.lazy)(async () => (await Promise.resolve().then(() => require("./run-pPsQ2MsX.cjs"))).runner, studioDefinition);
|
|
31
35
|
await (0, gunshi.cli)(stripExecArgs(argv), generateCommand, {
|
|
32
36
|
name: "kubb",
|
|
33
37
|
version: require_package.version,
|
|
34
|
-
description:
|
|
38
|
+
description: "Generate code from an OpenAPI specification, or connect the project to Kubb Studio.",
|
|
35
39
|
subCommands: {
|
|
36
40
|
generate: generateCommand,
|
|
37
41
|
init: initCommand,
|
|
38
42
|
validate: validateCommand,
|
|
39
|
-
mcp: mcpCommand
|
|
43
|
+
mcp: mcpCommand,
|
|
44
|
+
studio: studioCommand
|
|
40
45
|
},
|
|
41
46
|
fallbackToEntry: true,
|
|
42
47
|
strict: true,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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:
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["QUIET_FLAGS","isTelemetryDisabled","styleText","lazy","cli","dryrun"],"sources":["../src/index.ts"],"sourcesContent":["import { styleText } from 'node:util'\nimport dryrun from '@gunshi/plugin-dryrun'\nimport { cli, lazy } 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, studio, 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: initCommand } = await import('./commands/init.ts')\n // Each runner pulls in an optional peer (@kubb/adapter-oas, @kubb/mcp, @kubb/studio), so it\n // loads only when its command runs.\n const { definition: validateDefinition } = await import('./commands/validate.ts')\n const validateCommand = lazy(async () => (await import('./runners/validate/run.ts')).runner, validateDefinition)\n const { definition: mcpDefinition } = await import('./commands/mcp.ts')\n const mcpCommand = lazy(async () => (await import('./runners/mcp/run.ts')).runner, mcpDefinition)\n const { definition: studioDefinition } = await import('./commands/studio.ts')\n const studioCommand = lazy(async () => (await import('./runners/studio/run.ts')).runner, studioDefinition)\n\n await cli(stripExecArgs(argv), generateCommand, {\n name: 'kubb',\n version,\n // Not `generateCommand.description`: gunshi prints this on every subcommand's help too, so\n // `kubb studio --help` would open with a paragraph about generating types.\n description: 'Generate code from an OpenAPI specification, or connect the project to Kubb Studio.',\n subCommands: {\n generate: generateCommand,\n init: initCommand,\n validate: validateCommand,\n mcp: mcpCommand,\n studio: studioCommand,\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,gBAAgB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,qBAAA,CAAA;CAGvC,MAAM,EAAE,YAAY,uBAAuB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,yBAAA,CAAA;CACjD,MAAM,mBAAA,GAAkBC,OAAAA,KAAAA,CAAK,aAAa,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA,EAAA,CAAqC,QAAQ,kBAAkB;CAC/G,MAAM,EAAE,YAAY,kBAAkB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;CAC5C,MAAM,cAAA,GAAaA,OAAAA,KAAAA,CAAK,aAAa,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA,EAAA,CAAgC,QAAQ,aAAa;CAChG,MAAM,EAAE,YAAY,qBAAqB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,uBAAA,CAAA;CAC/C,MAAM,iBAAA,GAAgBA,OAAAA,KAAAA,CAAK,aAAa,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA,EAAA,CAAmC,QAAQ,gBAAgB;CAEzG,OAAA,GAAMC,OAAAA,IAAAA,CAAI,cAAc,IAAI,GAAG,iBAAiB;EAC9C,MAAM;EACN,SAAA,gBAAA;EAGA,aAAa;EACb,aAAa;GACX,UAAU;GACV,MAAM;GACN,UAAU;GACV,KAAK;GACL,QAAQ;EACV;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.d.ts
CHANGED
|
@@ -2,10 +2,9 @@ import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
|
|
|
2
2
|
//#region src/index.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a
|
|
5
|
-
* quiet flag is passed, then runs the generate, validate, mcp, and init commands. Defaults to
|
|
5
|
+
* quiet flag is passed, then runs the generate, validate, mcp, studio, and init commands. Defaults to
|
|
6
6
|
* `generate` when no command is given.
|
|
7
7
|
*/
|
|
8
|
-
declare function run(argv?: Array<string>): Promise<void>;
|
|
8
|
+
export declare function run(argv?: Array<string>): Promise<void>;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { run };
|
|
11
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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-BCTY-Nzq.js";
|
|
3
|
+
import { t as version } from "./package-GR1Pi9JF.js";
|
|
4
4
|
import { styleText } from "node:util";
|
|
5
5
|
import dryrun from "@gunshi/plugin-dryrun";
|
|
6
|
-
import { cli } from "gunshi";
|
|
6
|
+
import { cli, lazy } from "gunshi";
|
|
7
7
|
//#region src/index.ts
|
|
8
8
|
/**
|
|
9
9
|
* Strips the leading executable + script entries when `process.argv` is passed directly.
|
|
@@ -16,25 +16,30 @@ function stripExecArgs(argv) {
|
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a
|
|
19
|
-
* quiet flag is passed, then runs the generate, validate, mcp, and init commands. Defaults to
|
|
19
|
+
* quiet flag is passed, then runs the generate, validate, mcp, studio, and init commands. Defaults to
|
|
20
20
|
* `generate` when no command is given.
|
|
21
21
|
*/
|
|
22
22
|
async function run(argv = process.argv) {
|
|
23
23
|
const isQuietFlag = argv.some((arg) => QUIET_FLAGS.has(arg));
|
|
24
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`);
|
|
25
|
-
const { command: generateCommand } = await import("./generate-
|
|
26
|
-
const { command:
|
|
27
|
-
const {
|
|
28
|
-
const
|
|
25
|
+
const { command: generateCommand } = await import("./generate-CEHA2OSd.js");
|
|
26
|
+
const { command: initCommand } = await import("./init-CgQnnwbc.js");
|
|
27
|
+
const { definition: validateDefinition } = await import("./validate-QpkCbIFJ.js");
|
|
28
|
+
const validateCommand = lazy(async () => (await import("./run-n7yOll1q.js")).runner, validateDefinition);
|
|
29
|
+
const { definition: mcpDefinition } = await import("./mcp-B-GxGgVr.js");
|
|
30
|
+
const mcpCommand = lazy(async () => (await import("./run-DgV0unjs.js")).runner, mcpDefinition);
|
|
31
|
+
const { definition: studioDefinition } = await import("./studio-DKv2YLJZ.js");
|
|
32
|
+
const studioCommand = lazy(async () => (await import("./run-CH9jQeET.js")).runner, studioDefinition);
|
|
29
33
|
await cli(stripExecArgs(argv), generateCommand, {
|
|
30
34
|
name: "kubb",
|
|
31
35
|
version,
|
|
32
|
-
description:
|
|
36
|
+
description: "Generate code from an OpenAPI specification, or connect the project to Kubb Studio.",
|
|
33
37
|
subCommands: {
|
|
34
38
|
generate: generateCommand,
|
|
35
39
|
init: initCommand,
|
|
36
40
|
validate: validateCommand,
|
|
37
|
-
mcp: mcpCommand
|
|
41
|
+
mcp: mcpCommand,
|
|
42
|
+
studio: studioCommand
|
|
38
43
|
},
|
|
39
44
|
fallbackToEntry: true,
|
|
40
45
|
strict: true,
|
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 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:
|
|
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, lazy } 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, studio, 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: initCommand } = await import('./commands/init.ts')\n // Each runner pulls in an optional peer (@kubb/adapter-oas, @kubb/mcp, @kubb/studio), so it\n // loads only when its command runs.\n const { definition: validateDefinition } = await import('./commands/validate.ts')\n const validateCommand = lazy(async () => (await import('./runners/validate/run.ts')).runner, validateDefinition)\n const { definition: mcpDefinition } = await import('./commands/mcp.ts')\n const mcpCommand = lazy(async () => (await import('./runners/mcp/run.ts')).runner, mcpDefinition)\n const { definition: studioDefinition } = await import('./commands/studio.ts')\n const studioCommand = lazy(async () => (await import('./runners/studio/run.ts')).runner, studioDefinition)\n\n await cli(stripExecArgs(argv), generateCommand, {\n name: 'kubb',\n version,\n // Not `generateCommand.description`: gunshi prints this on every subcommand's help too, so\n // `kubb studio --help` would open with a paragraph about generating types.\n description: 'Generate code from an OpenAPI specification, or connect the project to Kubb Studio.',\n subCommands: {\n generate: generateCommand,\n init: initCommand,\n validate: validateCommand,\n mcp: mcpCommand,\n studio: studioCommand,\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,gBAAgB,MAAM,OAAO;CAG9C,MAAM,EAAE,YAAY,uBAAuB,MAAM,OAAO;CACxD,MAAM,kBAAkB,KAAK,aAAa,MAAM,OAAO,qBAAA,CAA8B,QAAQ,kBAAkB;CAC/G,MAAM,EAAE,YAAY,kBAAkB,MAAM,OAAO;CACnD,MAAM,aAAa,KAAK,aAAa,MAAM,OAAO,qBAAA,CAAyB,QAAQ,aAAa;CAChG,MAAM,EAAE,YAAY,qBAAqB,MAAM,OAAO;CACtD,MAAM,gBAAgB,KAAK,aAAa,MAAM,OAAO,qBAAA,CAA4B,QAAQ,gBAAgB;CAEzG,MAAM,IAAI,cAAc,IAAI,GAAG,iBAAiB;EAC9C,MAAM;EACN;EAGA,aAAa;EACb,aAAa;GACX,UAAU;GACV,MAAM;GACN,UAAU;GACV,KAAK;GACL,QAAQ;EACV;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,5 +1,5 @@
|
|
|
1
1
|
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import { t as version } from "./package-
|
|
2
|
+
import { t as version } from "./package-GR1Pi9JF.js";
|
|
3
3
|
import { t as dryRunId } from "./gunshiDryRun-DdKJuVn1.js";
|
|
4
4
|
import { defineWithTypes } from "gunshi";
|
|
5
5
|
//#region src/commands/init.ts
|
|
@@ -40,7 +40,7 @@ const command = defineWithTypes()({
|
|
|
40
40
|
},
|
|
41
41
|
async run(ctx) {
|
|
42
42
|
const { values } = ctx;
|
|
43
|
-
const { run } = await import("./run-
|
|
43
|
+
const { run } = await import("./run-BzvsJ0Ek.js");
|
|
44
44
|
await run({
|
|
45
45
|
yes: values.yes,
|
|
46
46
|
version,
|
|
@@ -54,4 +54,4 @@ const command = defineWithTypes()({
|
|
|
54
54
|
//#endregion
|
|
55
55
|
export { command };
|
|
56
56
|
|
|
57
|
-
//# sourceMappingURL=init-
|
|
57
|
+
//# sourceMappingURL=init-CgQnnwbc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-
|
|
1
|
+
{"version":3,"file":"init-CgQnnwbc.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,5 +1,5 @@
|
|
|
1
1
|
require("./rolldown-runtime-qbf5tadS.cjs");
|
|
2
|
-
const require_package = require("./package-
|
|
2
|
+
const require_package = require("./package-vVVyiYqL.cjs");
|
|
3
3
|
let gunshi = require("gunshi");
|
|
4
4
|
let _gunshi_plugin_dryrun = require("@gunshi/plugin-dryrun");
|
|
5
5
|
//#region src/commands/init.ts
|
|
@@ -40,7 +40,7 @@ const command = (0, gunshi.defineWithTypes)()({
|
|
|
40
40
|
},
|
|
41
41
|
async run(ctx) {
|
|
42
42
|
const { values } = ctx;
|
|
43
|
-
const { run } = await Promise.resolve().then(() => require("./run-
|
|
43
|
+
const { run } = await Promise.resolve().then(() => require("./run-DRBqVXX0.cjs"));
|
|
44
44
|
await run({
|
|
45
45
|
yes: values.yes,
|
|
46
46
|
version: require_package.version,
|
|
@@ -54,4 +54,4 @@ const command = (0, gunshi.defineWithTypes)()({
|
|
|
54
54
|
//#endregion
|
|
55
55
|
exports.command = command;
|
|
56
56
|
|
|
57
|
-
//# sourceMappingURL=init-
|
|
57
|
+
//# sourceMappingURL=init-_p5e5VuD.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-
|
|
1
|
+
{"version":3,"file":"init-_p5e5VuD.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,21 +1,19 @@
|
|
|
1
|
-
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import { t as version } from "./package-DiBDd6nT.js";
|
|
3
1
|
import { define } from "gunshi";
|
|
4
2
|
//#region src/commands/mcp.ts
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Declaration only, so listing `kubb --help` never loads `@kubb/mcp`. `index.ts` pairs this
|
|
5
|
+
* with the runner through gunshi's `lazy`.
|
|
6
|
+
*/
|
|
7
|
+
const definition = define({
|
|
6
8
|
name: "mcp",
|
|
7
9
|
description: "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.",
|
|
8
10
|
examples: [
|
|
9
11
|
"kubb mcp",
|
|
10
12
|
"# Then add to your MCP client config:",
|
|
11
13
|
"# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }"
|
|
12
|
-
].join("\n")
|
|
13
|
-
async run() {
|
|
14
|
-
const { run } = await import("./run-DCfdTu52.js");
|
|
15
|
-
await run({ version });
|
|
16
|
-
}
|
|
14
|
+
].join("\n")
|
|
17
15
|
});
|
|
18
16
|
//#endregion
|
|
19
|
-
export {
|
|
17
|
+
export { definition };
|
|
20
18
|
|
|
21
|
-
//# sourceMappingURL=mcp-
|
|
19
|
+
//# sourceMappingURL=mcp-B-GxGgVr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-B-GxGgVr.js","names":[],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { define } from 'gunshi'\n\n/**\n * Declaration only, so listing `kubb --help` never loads `@kubb/mcp`. `index.ts` pairs this\n * with the runner through gunshi's `lazy`.\n */\nexport const definition = 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})\n"],"mappings":";;;;;;AAMA,MAAa,aAAa,OAAO;CAC/B,MAAM;CACN,aACE;CACF,UAAU;EAAC;EAAY;EAAyC;CAA+E,CAAC,CAAC,KAAK,IAAI;AAC5J,CAAC"}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
require("./rolldown-runtime-qbf5tadS.cjs");
|
|
2
|
-
const require_package = require("./package-CnUMuss9.cjs");
|
|
3
1
|
//#region src/commands/mcp.ts
|
|
4
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Declaration only, so listing `kubb --help` never loads `@kubb/mcp`. `index.ts` pairs this
|
|
4
|
+
* with the runner through gunshi's `lazy`.
|
|
5
|
+
*/
|
|
6
|
+
const definition = (0, require("gunshi").define)({
|
|
5
7
|
name: "mcp",
|
|
6
8
|
description: "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.",
|
|
7
9
|
examples: [
|
|
8
10
|
"kubb mcp",
|
|
9
11
|
"# Then add to your MCP client config:",
|
|
10
12
|
"# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }"
|
|
11
|
-
].join("\n")
|
|
12
|
-
async run() {
|
|
13
|
-
const { run } = await Promise.resolve().then(() => require("./run-Cs5FunVC.cjs"));
|
|
14
|
-
await run({ version: require_package.version });
|
|
15
|
-
}
|
|
13
|
+
].join("\n")
|
|
16
14
|
});
|
|
17
15
|
//#endregion
|
|
18
|
-
exports.
|
|
16
|
+
exports.definition = definition;
|
|
19
17
|
|
|
20
|
-
//# sourceMappingURL=mcp-
|
|
18
|
+
//# sourceMappingURL=mcp-B3B-rE7W.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-B3B-rE7W.cjs","names":["define"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { define } from 'gunshi'\n\n/**\n * Declaration only, so listing `kubb --help` never loads `@kubb/mcp`. `index.ts` pairs this\n * with the runner through gunshi's `lazy`.\n */\nexport const definition = 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})\n"],"mappings":";;;;;AAMA,MAAa,cAAA,mBAAaA,CAAAA,CAAAA,OAAAA,CAAO;CAC/B,MAAM;CACN,aACE;CACF,UAAU;EAAC;EAAY;EAAyC;CAA+E,CAAC,CAAC,KAAK,IAAI;AAC5J,CAAC"}
|