@kubb/cli 5.0.0-beta.12 → 5.0.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-Cnierxlu.cjs → agent-Dn1Kfd_R.cjs} +2 -2
- package/dist/{agent-Cnierxlu.cjs.map → agent-Dn1Kfd_R.cjs.map} +1 -1
- package/dist/{agent-7Ofp95W1.js → agent-SCGeyEIE.js} +2 -2
- package/dist/{agent-7Ofp95W1.js.map → agent-SCGeyEIE.js.map} +1 -1
- package/dist/{generate-Dg2WIM_P.js → generate-CLYE3RWE.js} +2 -2
- package/dist/{generate-Dg2WIM_P.js.map → generate-CLYE3RWE.js.map} +1 -1
- package/dist/{generate-DDCifj6I.cjs → generate-z_83cgcO.cjs} +2 -2
- package/dist/{generate-DDCifj6I.cjs.map → generate-z_83cgcO.cjs.map} +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.js +6 -6
- package/dist/{init-CY46yRCY.js → init-BvHHgquV.js} +2 -2
- package/dist/{init-CY46yRCY.js.map → init-BvHHgquV.js.map} +1 -1
- package/dist/{init-m6yfR6V3.cjs → init-S-eLRaep.cjs} +2 -2
- package/dist/{init-m6yfR6V3.cjs.map → init-S-eLRaep.cjs.map} +1 -1
- package/dist/{mcp-XtdQ_R_3.cjs → mcp-BkBwpF6r.cjs} +2 -2
- package/dist/{mcp-XtdQ_R_3.cjs.map → mcp-BkBwpF6r.cjs.map} +1 -1
- package/dist/{mcp-D03qyCSQ.js → mcp-DEjoAmP2.js} +2 -2
- package/dist/{mcp-D03qyCSQ.js.map → mcp-DEjoAmP2.js.map} +1 -1
- package/dist/{package-ztjDYoaO.cjs → package-C7ZmbQd7.cjs} +2 -2
- package/dist/package-C7ZmbQd7.cjs.map +1 -0
- package/dist/package-D5eM8mZw.js +6 -0
- package/dist/package-D5eM8mZw.js.map +1 -0
- package/dist/{run-D2-o4yxg.js → run-BNvaRFvz.js} +29 -11
- package/dist/{run-D2-o4yxg.js.map → run-BNvaRFvz.js.map} +1 -1
- package/dist/{run-oon9qHTC.cjs → run-DK-3QOOS.cjs} +29 -11
- package/dist/{run-oon9qHTC.cjs.map → run-DK-3QOOS.cjs.map} +1 -1
- package/dist/{validate-C3EcZ814.cjs → validate-C3hmnp-x.cjs} +2 -2
- package/dist/{validate-C3EcZ814.cjs.map → validate-C3hmnp-x.cjs.map} +1 -1
- package/dist/{validate-D2wZ7m5I.js → validate-qvniflGp.js} +2 -2
- package/dist/{validate-D2wZ7m5I.js.map → validate-qvniflGp.js.map} +1 -1
- package/package.json +7 -7
- package/src/runners/generate/run.ts +28 -5
- package/src/runners/generate/utils.ts +1 -1
- package/dist/package-s6dIgf99.js +0 -6
- package/dist/package-s6dIgf99.js.map +0 -1
- package/dist/package-ztjDYoaO.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require("./chunk-ByKO4r7w.cjs");
|
|
2
2
|
const require_define = require("./define-Bdn8j5VM.cjs");
|
|
3
|
-
const require_package = require("./package-
|
|
3
|
+
const require_package = require("./package-C7ZmbQd7.cjs");
|
|
4
4
|
//#region src/commands/validate.ts
|
|
5
5
|
const command = require_define.defineCommand({
|
|
6
6
|
name: "validate",
|
|
@@ -23,4 +23,4 @@ const command = require_define.defineCommand({
|
|
|
23
23
|
//#endregion
|
|
24
24
|
exports.command = command;
|
|
25
25
|
|
|
26
|
-
//# sourceMappingURL=validate-
|
|
26
|
+
//# sourceMappingURL=validate-C3hmnp-x.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-
|
|
1
|
+
{"version":3,"file":"validate-C3hmnp-x.cjs","names":["defineCommand"],"sources":["../src/commands/validate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'validate',\n description:\n 'Parse and validate an OpenAPI/Swagger file for structural correctness. Reports schema errors, missing required fields, and malformed references. Use this before running generate to catch spec issues early.',\n examples: ['kubb validate --input ./openapi.yaml', 'kubb validate --input https://petstore3.swagger.io/api/v3/openapi.json'],\n options: {\n input: {\n type: 'string',\n description: 'Path or URL to the OpenAPI/Swagger file to validate',\n short: 'i',\n required: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/validate/run.ts')\n\n await run({ input: values.input, version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,eAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU,CAAC,wCAAwC,yEAAyE;CAC5H,SAAS,EACP,OAAO;EACL,MAAM;EACN,aAAa;EACb,OAAO;EACP,UAAU;EACX,EACF;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,qBAAA,CAAA;EAEtB,MAAM,IAAI;GAAE,OAAO,OAAO;GAAO,SAAA,gBAAA;GAAS,CAAC;;CAE9C,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./chunk-BvFE5Tac.js";
|
|
2
2
|
import { n as defineCommand } from "./define-m_fp-Aqm.js";
|
|
3
|
-
import { t as version } from "./package-
|
|
3
|
+
import { t as version } from "./package-D5eM8mZw.js";
|
|
4
4
|
//#region src/commands/validate.ts
|
|
5
5
|
const command = defineCommand({
|
|
6
6
|
name: "validate",
|
|
@@ -23,4 +23,4 @@ const command = defineCommand({
|
|
|
23
23
|
//#endregion
|
|
24
24
|
export { command };
|
|
25
25
|
|
|
26
|
-
//# sourceMappingURL=validate-
|
|
26
|
+
//# sourceMappingURL=validate-qvniflGp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-
|
|
1
|
+
{"version":3,"file":"validate-qvniflGp.js","names":[],"sources":["../src/commands/validate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'validate',\n description:\n 'Parse and validate an OpenAPI/Swagger file for structural correctness. Reports schema errors, missing required fields, and malformed references. Use this before running generate to catch spec issues early.',\n examples: ['kubb validate --input ./openapi.yaml', 'kubb validate --input https://petstore3.swagger.io/api/v3/openapi.json'],\n options: {\n input: {\n type: 'string',\n description: 'Path or URL to the OpenAPI/Swagger file to validate',\n short: 'i',\n required: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/validate/run.ts')\n\n await run({ input: values.input, version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU,CAAC,wCAAwC,yEAAyE;CAC5H,SAAS,EACP,OAAO;EACL,MAAM;EACN,aAAa;EACb,OAAO;EACP,UAAU;EACX,EACF;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GAAE,OAAO,OAAO;GAAO;GAAS,CAAC;;CAE9C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/cli",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.14",
|
|
4
4
|
"description": "Official CLI for Kubb. Run kubb generate, kubb init, kubb validate, kubb mcp, and kubb agent to manage the full code generation lifecycle from OpenAPI/Swagger specs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -47,22 +47,22 @@
|
|
|
47
47
|
"registry": "https://registry.npmjs.org/"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@clack/prompts": "^1.
|
|
50
|
+
"@clack/prompts": "^1.4.0",
|
|
51
51
|
"chokidar": "^5.0.0",
|
|
52
52
|
"cosmiconfig": "^9.0.1",
|
|
53
53
|
"jiti": "^2.7.0",
|
|
54
54
|
"tinyexec": "^1.1.2",
|
|
55
|
-
"@kubb/core": "5.0.0-beta.
|
|
55
|
+
"@kubb/core": "5.0.0-beta.14"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@internals/shared": "0.0.0",
|
|
59
59
|
"@internals/utils": "0.0.0",
|
|
60
|
-
"@kubb/adapter-oas": "5.0.0-beta.
|
|
60
|
+
"@kubb/adapter-oas": "5.0.0-beta.14"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@kubb/adapter-oas": "5.0.0-beta.
|
|
64
|
-
"@kubb/agent": "5.0.0-beta.
|
|
65
|
-
"@kubb/mcp": "5.0.0-beta.
|
|
63
|
+
"@kubb/adapter-oas": "5.0.0-beta.14",
|
|
64
|
+
"@kubb/agent": "5.0.0-beta.14",
|
|
65
|
+
"@kubb/mcp": "5.0.0-beta.14"
|
|
66
66
|
},
|
|
67
67
|
"peerDependenciesMeta": {
|
|
68
68
|
"@kubb/adapter-oas": {
|
|
@@ -10,7 +10,7 @@ import { version } from '../../../package.json'
|
|
|
10
10
|
import { KUBB_NPM_PACKAGE_URL } from '../../constants.ts'
|
|
11
11
|
import { setupLogger, type HookSinkFactory } from '../../loggers/utils.ts'
|
|
12
12
|
import { buildTelemetryEvent, sendTelemetry } from '../../telemetry.ts'
|
|
13
|
-
import { executeHooks, getConfigs, startWatcher } from './utils.ts'
|
|
13
|
+
import { executeHooks, getConfigs, runHook, startWatcher } from './utils.ts'
|
|
14
14
|
|
|
15
15
|
type GenerateProps = {
|
|
16
16
|
input?: string
|
|
@@ -98,9 +98,20 @@ async function runToolPass({
|
|
|
98
98
|
.join(' ')
|
|
99
99
|
|
|
100
100
|
try {
|
|
101
|
+
const hookArgs = toolConfig.args(outputPath)
|
|
101
102
|
const hookEndPromise = waitForHookEnd(hooks, hookId, () => hooks.emit('kubb:success', { message: successMessage }), toolConfig.errorMessage)
|
|
102
103
|
|
|
103
|
-
await hooks.emit('kubb:hook:start', { id: hookId, command: toolConfig.command, args:
|
|
104
|
+
await hooks.emit('kubb:hook:start', { id: hookId, command: toolConfig.command, args: hookArgs })
|
|
105
|
+
|
|
106
|
+
runHook({
|
|
107
|
+
id: hookId,
|
|
108
|
+
command: toolConfig.command,
|
|
109
|
+
args: hookArgs,
|
|
110
|
+
commandWithArgs: [toolConfig.command, ...hookArgs].join(' '),
|
|
111
|
+
context: hooks,
|
|
112
|
+
stream: false,
|
|
113
|
+
sink: {},
|
|
114
|
+
}).catch(() => {})
|
|
104
115
|
|
|
105
116
|
await hookEndPromise
|
|
106
117
|
} catch (caughtError) {
|
|
@@ -117,7 +128,7 @@ async function runToolPass({
|
|
|
117
128
|
}
|
|
118
129
|
}
|
|
119
130
|
|
|
120
|
-
async function generate(options: GenerateProps): Promise<
|
|
131
|
+
async function generate(options: GenerateProps): Promise<boolean> {
|
|
121
132
|
const { input, hooks, logLevel, makeSink } = options
|
|
122
133
|
|
|
123
134
|
const hrStart = process.hrtime()
|
|
@@ -163,7 +174,7 @@ async function generate(options: GenerateProps): Promise<void> {
|
|
|
163
174
|
})
|
|
164
175
|
|
|
165
176
|
await reportTelemetry('failed')
|
|
166
|
-
|
|
177
|
+
return false
|
|
167
178
|
}
|
|
168
179
|
|
|
169
180
|
await hooks.emit('kubb:success', { message: 'Generation succeeded', info: inputPath })
|
|
@@ -207,6 +218,7 @@ async function generate(options: GenerateProps): Promise<void> {
|
|
|
207
218
|
await hooks.emit('kubb:generation:summary', { config, failedPlugins, filesCreated: files.length, status: 'success', hrStart, pluginTimings })
|
|
208
219
|
|
|
209
220
|
await reportTelemetry('success')
|
|
221
|
+
return true
|
|
210
222
|
}
|
|
211
223
|
|
|
212
224
|
type GenerateCommandOptions = {
|
|
@@ -252,6 +264,7 @@ export async function run({ input, configPath, logLevel: logLevelKey, watch }: G
|
|
|
252
264
|
await hooks.emit('kubb:config:end', { configs })
|
|
253
265
|
await hooks.emit('kubb:lifecycle:start', { version })
|
|
254
266
|
|
|
267
|
+
let anyFailed = false
|
|
255
268
|
for (const config of configs) {
|
|
256
269
|
if (isInputPath(config) && watch) {
|
|
257
270
|
await startWatcher(
|
|
@@ -264,11 +277,21 @@ export async function run({ input, configPath, logLevel: logLevelKey, watch }: G
|
|
|
264
277
|
{ info: (msg) => clack.log.info(msg), error: (msg) => clack.log.error(msg) },
|
|
265
278
|
)
|
|
266
279
|
} else {
|
|
267
|
-
|
|
280
|
+
try {
|
|
281
|
+
const succeeded = await generate({ input, config, logLevel, hooks, makeSink })
|
|
282
|
+
if (!succeeded) anyFailed = true
|
|
283
|
+
} catch (configError) {
|
|
284
|
+
await hooks.emit('kubb:error', { error: toError(configError) })
|
|
285
|
+
anyFailed = true
|
|
286
|
+
}
|
|
268
287
|
}
|
|
269
288
|
}
|
|
270
289
|
|
|
271
290
|
await hooks.emit('kubb:lifecycle:end')
|
|
291
|
+
|
|
292
|
+
if (anyFailed) {
|
|
293
|
+
process.exit(1)
|
|
294
|
+
}
|
|
272
295
|
} catch (error) {
|
|
273
296
|
await hooks.emit('kubb:error', { error: toError(error) })
|
|
274
297
|
process.exit(1)
|
|
@@ -140,7 +140,7 @@ type RunHookOptions = {
|
|
|
140
140
|
sink?: HookSinkOptions
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
async function runHook({ id, command, args, commandWithArgs, context, stream = false, sink }: RunHookOptions): Promise<void> {
|
|
143
|
+
export async function runHook({ id, command, args, commandWithArgs, context, stream = false, sink }: RunHookOptions): Promise<void> {
|
|
144
144
|
const emitEnd = (success: boolean, error: Error | null) => context.emit('kubb:hook:end', { command, args, id, success, error })
|
|
145
145
|
|
|
146
146
|
try {
|
package/dist/package-s6dIgf99.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package-s6dIgf99.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package-ztjDYoaO.cjs","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
|