@kubb/cli 5.19.0 → 5.19.2
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-Ctyp_EFO.js → Telemetry-DDa3d9Ey.js} +2 -2
- package/dist/{Telemetry-Ctyp_EFO.js.map → Telemetry-DDa3d9Ey.js.map} +1 -1
- package/dist/{Telemetry-B2TeLVo4.cjs → Telemetry-ZlFAZoKo.cjs} +2 -2
- package/dist/{Telemetry-B2TeLVo4.cjs.map → Telemetry-ZlFAZoKo.cjs.map} +1 -1
- package/dist/{background-CByahHYn.js → background-D_Hk9S60.js} +3 -3
- package/dist/{background-CByahHYn.js.map → background-D_Hk9S60.js.map} +1 -1
- package/dist/{background-D6dQxXt6.cjs → background-DlN0wZ-P.cjs} +3 -3
- package/dist/{background-D6dQxXt6.cjs.map → background-DlN0wZ-P.cjs.map} +1 -1
- package/dist/{background-D60rO2Lz.js → background-DrXJUqYs.js} +1 -1
- package/dist/{configFile-B_xrd2yx.cjs → configFile-CFaV_To0.cjs} +29 -9
- package/dist/configFile-CFaV_To0.cjs.map +1 -0
- package/dist/{configFile-Bh_5k4pf.js → configFile-lKPtO_1r.js} +27 -8
- package/dist/configFile-lKPtO_1r.js.map +1 -0
- package/dist/{credentials-LPHovWZe.js → credentials-Dt313vgj.js} +44 -3
- package/dist/credentials-Dt313vgj.js.map +1 -0
- package/dist/{credentials-DznluKkp.js → credentials-IBslrRDp.js} +1 -1
- package/dist/{credentials-Cl3eOa8G.cjs → credentials-oCYvG4wU.cjs} +44 -3
- package/dist/credentials-oCYvG4wU.cjs.map +1 -0
- package/dist/index.cjs +12 -12
- package/dist/index.js +12 -12
- package/dist/{mcp-D2gcpCcx.cjs → mcp-B0sg0a1T.cjs} +2 -2
- package/dist/{mcp-D2gcpCcx.cjs.map → mcp-B0sg0a1T.cjs.map} +1 -1
- package/dist/{mcp-BrB7TJZU.js → mcp-DT7DXED7.js} +2 -2
- package/dist/{mcp-BrB7TJZU.js.map → mcp-DT7DXED7.js.map} +1 -1
- package/dist/{package-DM5mr0Yc.cjs → package-BL41dCng.cjs} +2 -2
- package/dist/package-BL41dCng.cjs.map +1 -0
- package/dist/package-Beb8rLsX.js +5 -0
- package/dist/package-Beb8rLsX.js.map +1 -0
- package/dist/{run-BJiP4ib3.js → run-9OE27APP.js} +1 -1
- package/dist/{run-BSsTBfse.js → run-B8z02C9y.js} +3 -3
- package/dist/{run-BSsTBfse.js.map → run-B8z02C9y.js.map} +1 -1
- package/dist/{run-6qjg9Twy.cjs → run-Bez8ban6.cjs} +87 -20
- package/dist/run-Bez8ban6.cjs.map +1 -0
- package/dist/{run-B3TuKUr4.js → run-Bn5MQwU6.js} +3 -3
- package/dist/{run-B3TuKUr4.js.map → run-Bn5MQwU6.js.map} +1 -1
- package/dist/{run-C6tE9zTS.cjs → run-BwmpFwjs.cjs} +3 -3
- package/dist/{run-C6tE9zTS.cjs.map → run-BwmpFwjs.cjs.map} +1 -1
- package/dist/{run-Cxfs1SLQ.js → run-CXSssG05.js} +3 -3
- package/dist/{run-Cxfs1SLQ.js.map → run-CXSssG05.js.map} +1 -1
- package/dist/{run-D0HO6_Yr.cjs → run-Cz4jqsVH.cjs} +3 -3
- package/dist/{run-D0HO6_Yr.cjs.map → run-Cz4jqsVH.cjs.map} +1 -1
- package/dist/{run-Dyzva1xB.js → run-D0JXa0Fy.js} +4 -4
- package/dist/{run-Dyzva1xB.js.map → run-D0JXa0Fy.js.map} +1 -1
- package/dist/{run-C2lQXYrF.cjs → run-DR5lwSnY.cjs} +3 -3
- package/dist/{run-C2lQXYrF.cjs.map → run-DR5lwSnY.cjs.map} +1 -1
- package/dist/{run-CC9TBCph.js → run-DZF-DqiM.js} +3 -3
- package/dist/{run-CC9TBCph.js.map → run-DZF-DqiM.js.map} +1 -1
- package/dist/{run-4MUhIiPj.cjs → run-NJZqZ_Ks.cjs} +2 -2
- package/dist/{run-4MUhIiPj.cjs.map → run-NJZqZ_Ks.cjs.map} +1 -1
- package/dist/{run-CcWmws1R.js → run-QoD0FWNr.js} +2 -2
- package/dist/{run-CcWmws1R.js.map → run-QoD0FWNr.js.map} +1 -1
- package/dist/{run-ejmyJI37.cjs → run-hI6xgYoD.cjs} +2 -2
- package/dist/{run-ejmyJI37.cjs.map → run-hI6xgYoD.cjs.map} +1 -1
- package/dist/{run-DFOjQVMO.js → run-o6CUMVvI.js} +88 -21
- package/dist/run-o6CUMVvI.js.map +1 -0
- package/dist/{run-D2tJP_b8.js → run-prZAFZhg.js} +2 -2
- package/dist/{run-D2tJP_b8.js.map → run-prZAFZhg.js.map} +1 -1
- package/dist/{run-lH8k2FY7.cjs → run-puI1uinj.cjs} +3 -3
- package/dist/{run-lH8k2FY7.cjs.map → run-puI1uinj.cjs.map} +1 -1
- package/dist/{run-3OxB7Zxn.cjs → run-w8oRvtdl.cjs} +3 -3
- package/dist/{run-3OxB7Zxn.cjs.map → run-w8oRvtdl.cjs.map} +1 -1
- package/dist/{shared-SrKde4x4.js → shared-B5nei7B5.js} +2 -1
- package/dist/{shared-SrKde4x4.js.map → shared-B5nei7B5.js.map} +1 -1
- package/dist/{shared-DoD3p_X8.cjs → shared-CK7OtOSX.cjs} +2 -1
- package/dist/{shared-DoD3p_X8.cjs.map → shared-CK7OtOSX.cjs.map} +1 -1
- package/dist/{snapshot-DnqAAzKE.js → snapshot-CNgjb8Ah.js} +2 -2
- package/dist/{snapshot-DnqAAzKE.js.map → snapshot-CNgjb8Ah.js.map} +1 -1
- package/dist/{snapshot-DdRni_x5.cjs → snapshot-D5BgJXOI.cjs} +2 -2
- package/dist/{snapshot-DdRni_x5.cjs.map → snapshot-D5BgJXOI.cjs.map} +1 -1
- package/dist/{status-wHJjD3Fs.cjs → status-B1yTx9dh.cjs} +2 -2
- package/dist/{status-wHJjD3Fs.cjs.map → status-B1yTx9dh.cjs.map} +1 -1
- package/dist/{status-X9BNNp9F.js → status-Daf5hM1A.js} +2 -2
- package/dist/{status-X9BNNp9F.js.map → status-Daf5hM1A.js.map} +1 -1
- package/dist/{studio-rRSg33RE.js → studio-Cbl4KqJ7.js} +15 -15
- package/dist/{studio-rRSg33RE.js.map → studio-Cbl4KqJ7.js.map} +1 -1
- package/dist/{studio-j4As00N6.cjs → studio-k8_5TclR.cjs} +15 -15
- package/dist/{studio-j4As00N6.cjs.map → studio-k8_5TclR.cjs.map} +1 -1
- package/dist/studioWorker.js +2 -2
- package/dist/{validate-CyxoAzEK.cjs → validate-CNJ8y8Rz.cjs} +3 -3
- package/dist/{validate-CyxoAzEK.cjs.map → validate-CNJ8y8Rz.cjs.map} +1 -1
- package/dist/{validate-CSbYneXo.js → validate-CmjGWI5Y.js} +3 -3
- package/dist/{validate-CSbYneXo.js.map → validate-CmjGWI5Y.js.map} +1 -1
- package/package.json +7 -7
- package/dist/configFile-B_xrd2yx.cjs.map +0 -1
- package/dist/configFile-Bh_5k4pf.js.map +0 -1
- package/dist/credentials-Cl3eOa8G.cjs.map +0 -1
- package/dist/credentials-LPHovWZe.js.map +0 -1
- package/dist/package-CcsdQpSf.js +0 -5
- package/dist/package-CcsdQpSf.js.map +0 -1
- package/dist/package-DM5mr0Yc.cjs.map +0 -1
- package/dist/run-6qjg9Twy.cjs.map +0 -1
- package/dist/run-DFOjQVMO.js.map +0 -1
|
@@ -3,15 +3,15 @@ import { r as toPermissionFlag } from "./text-HYWAcipy.js";
|
|
|
3
3
|
import { a as KUBB_CONFIG_FILENAME } from "./config-re864UnO.js";
|
|
4
4
|
import { t as isCIEnvironment } from "./isCIEnvironment-DAMZSlP2.js";
|
|
5
5
|
import { n as toError } from "./errors-CEzFbRvL.js";
|
|
6
|
-
import { n as trackRun } from "./Telemetry-
|
|
6
|
+
import { n as trackRun } from "./Telemetry-DDa3d9Ey.js";
|
|
7
7
|
import { c as plainWriter, i as logStep, t as logBlock } from "./log-B_uVM704.js";
|
|
8
8
|
import { n as setupReporters } from "./reporters-B6p0n7s3.js";
|
|
9
9
|
import { a as logTip, n as logIntro, r as logOutro } from "./intro-Dun8Eqod.js";
|
|
10
10
|
import { t as createSpinner } from "./spinner-D5DgYSS5.js";
|
|
11
11
|
import { n as isRichOutput, t as canUseTTY } from "./env-BYZIPHqz.js";
|
|
12
12
|
import { t as getConfigs } from "./config-CGcQTdZV.js";
|
|
13
|
-
import { a as readCredentials, n as getCredentialsPath, o as
|
|
14
|
-
import { t as version } from "./package-
|
|
13
|
+
import { a as readCredentials, n as getCredentialsPath, o as updateCredentials, r as getMachineId, t as clearCredentials } from "./credentials-Dt313vgj.js";
|
|
14
|
+
import { t as version } from "./package-Beb8rLsX.js";
|
|
15
15
|
import { styleText } from "node:util";
|
|
16
16
|
import { hostname } from "node:os";
|
|
17
17
|
import process from "node:process";
|
|
@@ -19,7 +19,7 @@ import { x } from "tinyexec";
|
|
|
19
19
|
import path from "node:path";
|
|
20
20
|
import * as prompts from "@clack/prompts";
|
|
21
21
|
import { Diagnostics, Hookable, cliReporter, logLevel } from "@kubb/core";
|
|
22
|
-
import { InvalidAgentTokenError, PairingCanceledError, connectAgent, defaultStudioUrl, pairAgent } from "@kubb/studio";
|
|
22
|
+
import { InvalidAgentTokenError, PairingCanceledError, connectAgent, defaultStudioUrl, generateAgentKey, pairAgent, refreshAgentToken } from "@kubb/studio";
|
|
23
23
|
import { AgentPermission } from "@kubb/studio/protocol";
|
|
24
24
|
// ../../internals/utils/src/copyToClipboard.ts
|
|
25
25
|
const COMMANDS = {
|
|
@@ -70,6 +70,7 @@ function openInBrowser(target) {
|
|
|
70
70
|
x(process.platform === "darwin" ? "open" : "xdg-open", [target]).then(ignore, ignore);
|
|
71
71
|
}
|
|
72
72
|
// src/runners/studio/run.ts
|
|
73
|
+
const REFRESH_EVERY_MS = 864e5;
|
|
73
74
|
/**
|
|
74
75
|
* Pairs this machine with Studio and stores the resulting token.
|
|
75
76
|
*
|
|
@@ -83,12 +84,14 @@ async function login({ studioUrl, autoOpen }, { signal, previousCredentials } =
|
|
|
83
84
|
let waiting = false;
|
|
84
85
|
let countdown;
|
|
85
86
|
try {
|
|
87
|
+
const privateKey = generateAgentKey();
|
|
86
88
|
const { token, agent } = await pairAgent({
|
|
87
89
|
studioUrl,
|
|
88
90
|
type: "cli",
|
|
89
91
|
name: path.basename(process.cwd()),
|
|
90
92
|
hostname: hostname(),
|
|
91
93
|
machineId: await getMachineId(),
|
|
94
|
+
privateKey,
|
|
92
95
|
signal,
|
|
93
96
|
onCode: (session) => {
|
|
94
97
|
logStep([
|
|
@@ -115,16 +118,23 @@ async function login({ studioUrl, autoOpen }, { signal, previousCredentials } =
|
|
|
115
118
|
});
|
|
116
119
|
clearInterval(countdown);
|
|
117
120
|
spinner.stop(`Paired as ${agent.name}${agent.organizationSlug ? ` · org ${agent.organizationSlug}` : ""}`);
|
|
118
|
-
const
|
|
119
|
-
const credentials = {
|
|
121
|
+
const paired = {
|
|
120
122
|
studioUrl,
|
|
121
123
|
token,
|
|
124
|
+
issuedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
125
|
+
privateKey,
|
|
122
126
|
agentId: agent.id,
|
|
123
127
|
agentSlug: agent.slug,
|
|
124
|
-
...agent.organizationSlug ? { organizationSlug: agent.organizationSlug } : {}
|
|
125
|
-
...keepsIdentity && previousCredentials?.projects ? { projects: previousCredentials.projects } : {}
|
|
128
|
+
...agent.organizationSlug ? { organizationSlug: agent.organizationSlug } : {}
|
|
126
129
|
};
|
|
127
|
-
await
|
|
130
|
+
const credentials = await updateCredentials((stored) => {
|
|
131
|
+
const previous = stored ?? previousCredentials;
|
|
132
|
+
const keepsIdentity = previous?.studioUrl === studioUrl && previous.agentId === agent.id;
|
|
133
|
+
return {
|
|
134
|
+
...paired,
|
|
135
|
+
...keepsIdentity && previous.projects ? { projects: previous.projects } : {}
|
|
136
|
+
};
|
|
137
|
+
});
|
|
128
138
|
console.log(`Credentials stored in ${getCredentialsPath()}`);
|
|
129
139
|
return credentials;
|
|
130
140
|
} catch (error) {
|
|
@@ -190,6 +200,12 @@ const PERMISSIONS = [
|
|
|
190
200
|
title: (configPath) => `Save the spec from Studio as the input in ${configPath}`,
|
|
191
201
|
hint: "keep a pasted spec, URL, or git file"
|
|
192
202
|
},
|
|
203
|
+
{
|
|
204
|
+
key: AgentPermission.FILE_REFS,
|
|
205
|
+
label: "outside refs",
|
|
206
|
+
title: () => "Let a $ref read files outside the project",
|
|
207
|
+
hint: "specs that share schemas"
|
|
208
|
+
},
|
|
193
209
|
{
|
|
194
210
|
key: AgentPermission.EXEC,
|
|
195
211
|
label: "run tools",
|
|
@@ -235,15 +251,18 @@ async function resolvePermissions(options, credentials, configPath = KUBB_CONFIG
|
|
|
235
251
|
return granted;
|
|
236
252
|
}
|
|
237
253
|
const answers = Object.fromEntries(pending.map(({ key }) => [key, selected.includes(key)]));
|
|
238
|
-
await
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
...
|
|
242
|
-
|
|
243
|
-
...
|
|
244
|
-
|
|
254
|
+
await updateCredentials((stored) => {
|
|
255
|
+
const current = stored ?? credentials;
|
|
256
|
+
return {
|
|
257
|
+
...current,
|
|
258
|
+
projects: {
|
|
259
|
+
...current.projects,
|
|
260
|
+
[project]: {
|
|
261
|
+
...current.projects?.[project],
|
|
262
|
+
...answers
|
|
263
|
+
}
|
|
245
264
|
}
|
|
246
|
-
}
|
|
265
|
+
};
|
|
247
266
|
});
|
|
248
267
|
return {
|
|
249
268
|
...granted,
|
|
@@ -298,9 +317,10 @@ async function connect(options, context = {}) {
|
|
|
298
317
|
events.once("SIGTERM", stop);
|
|
299
318
|
}
|
|
300
319
|
let unwatch;
|
|
320
|
+
let refreshTimer;
|
|
301
321
|
try {
|
|
302
322
|
if (!context.prepared) {
|
|
303
|
-
const { getWorkerStatus } = await import("./background-
|
|
323
|
+
const { getWorkerStatus } = await import("./background-DrXJUqYs.js");
|
|
304
324
|
if ((await getWorkerStatus()).running) throw new Diagnostics.Error({
|
|
305
325
|
code: Diagnostics.code.unknown,
|
|
306
326
|
severity: "error",
|
|
@@ -312,6 +332,45 @@ async function connect(options, context = {}) {
|
|
|
312
332
|
const { configPath } = prepared;
|
|
313
333
|
let hinted = false;
|
|
314
334
|
let pairedAgain = false;
|
|
335
|
+
let recovered = false;
|
|
336
|
+
const warn = (message) => options.logLevel !== "silent" && console.log(styleText("yellow", message));
|
|
337
|
+
const refreshToken = async (force) => {
|
|
338
|
+
if (!force && Date.now() - Date.parse(credentials.issuedAt ?? "") < REFRESH_EVERY_MS) return false;
|
|
339
|
+
const replaced = credentials.token;
|
|
340
|
+
try {
|
|
341
|
+
const token = await refreshAgentToken({
|
|
342
|
+
studioUrl: options.studioUrl,
|
|
343
|
+
token: replaced,
|
|
344
|
+
machineId: await getMachineId(),
|
|
345
|
+
privateKey: credentials.privateKey,
|
|
346
|
+
signal
|
|
347
|
+
});
|
|
348
|
+
if (!token || credentials.token !== replaced) return false;
|
|
349
|
+
const refreshed = {
|
|
350
|
+
token,
|
|
351
|
+
issuedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
352
|
+
};
|
|
353
|
+
credentials = {
|
|
354
|
+
...credentials,
|
|
355
|
+
...refreshed
|
|
356
|
+
};
|
|
357
|
+
await updateCredentials((stored) => stored?.token === replaced ? {
|
|
358
|
+
...stored,
|
|
359
|
+
...refreshed
|
|
360
|
+
} : void 0).catch((error) => warn(`Could not store the refreshed token: ${toError(error).message}`));
|
|
361
|
+
return true;
|
|
362
|
+
} catch (error) {
|
|
363
|
+
if (!signal.aborted && !(error instanceof InvalidAgentTokenError)) warn(`Could not refresh the agent token: ${toError(error).message}`);
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
let refreshing;
|
|
368
|
+
const refresh = ({ force = false } = {}) => refreshing ??= refreshToken(force).finally(() => {
|
|
369
|
+
refreshing = void 0;
|
|
370
|
+
});
|
|
371
|
+
await refresh();
|
|
372
|
+
refreshTimer = setInterval(() => void refresh(), REFRESH_EVERY_MS);
|
|
373
|
+
refreshTimer.unref();
|
|
315
374
|
const hooks = new Hookable();
|
|
316
375
|
setupReporters(hooks, {
|
|
317
376
|
logLevel: logLevel[options.logLevel ?? "info"],
|
|
@@ -322,6 +381,7 @@ async function connect(options, context = {}) {
|
|
|
322
381
|
let background = false;
|
|
323
382
|
hooks.hook("studio:connected", async () => {
|
|
324
383
|
pairedAgain = false;
|
|
384
|
+
recovered = false;
|
|
325
385
|
await context.onState?.("connected");
|
|
326
386
|
if (listens && !unwatch) unwatch = watchKeys({
|
|
327
387
|
onBackground: () => {
|
|
@@ -338,11 +398,13 @@ async function connect(options, context = {}) {
|
|
|
338
398
|
hooks.hook("studio:reconnecting", () => context.onState?.("reconnecting"));
|
|
339
399
|
for (;;) try {
|
|
340
400
|
await connectAgent({
|
|
341
|
-
token: credentials.token,
|
|
401
|
+
token: () => credentials.token,
|
|
402
|
+
privateKey: credentials.privateKey,
|
|
342
403
|
studioUrl: options.studioUrl,
|
|
343
404
|
configPath,
|
|
344
405
|
version: options.version,
|
|
345
406
|
root: process.cwd(),
|
|
407
|
+
agentType: "cli",
|
|
346
408
|
permissions,
|
|
347
409
|
loadConfigs: async () => (await loadConfigs(options)).configs,
|
|
348
410
|
hooks,
|
|
@@ -351,6 +413,10 @@ async function connect(options, context = {}) {
|
|
|
351
413
|
break;
|
|
352
414
|
} catch (error) {
|
|
353
415
|
if (!(error instanceof InvalidAgentTokenError)) throw error;
|
|
416
|
+
if (!recovered && !pairedAgain) {
|
|
417
|
+
recovered = true;
|
|
418
|
+
if (await refresh({ force: true })) continue;
|
|
419
|
+
}
|
|
354
420
|
await context.onState?.("authentication required");
|
|
355
421
|
await clearCredentials();
|
|
356
422
|
if (pairedAgain) throw new Error(`${error.message} Studio rejected the newly approved token too. Run \`kubb studio login\` and try again.`);
|
|
@@ -368,7 +434,7 @@ async function connect(options, context = {}) {
|
|
|
368
434
|
await hooks.callHook("kubb:lifecycle:end");
|
|
369
435
|
unwatch?.();
|
|
370
436
|
if (background) {
|
|
371
|
-
const { startWorker } = await import("./background-
|
|
437
|
+
const { startWorker } = await import("./background-DrXJUqYs.js");
|
|
372
438
|
await startWorker(options);
|
|
373
439
|
if (options.logLevel !== "silent") logOutro("Running in the background · kubb studio stop");
|
|
374
440
|
return;
|
|
@@ -377,6 +443,7 @@ async function connect(options, context = {}) {
|
|
|
377
443
|
} catch (error) {
|
|
378
444
|
if (!(error instanceof PairingCanceledError)) throw error;
|
|
379
445
|
} finally {
|
|
446
|
+
clearInterval(refreshTimer);
|
|
380
447
|
unwatch?.();
|
|
381
448
|
events.off("SIGINT", stop);
|
|
382
449
|
events.off("SIGTERM", stop);
|
|
@@ -440,4 +507,4 @@ async function runStudio(values, action, { block = false, json = false } = {}) {
|
|
|
440
507
|
}
|
|
441
508
|
export { login as a, runStudio as c, loadConfigs as i, watchKeys as l, formatCountdown as n, prepareConnection as o, formatPermissionRows as r, resolvePermissions as s, connect as t };
|
|
442
509
|
|
|
443
|
-
//# sourceMappingURL=run-
|
|
510
|
+
//# sourceMappingURL=run-o6CUMVvI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-o6CUMVvI.js","names":["logLevelMap"],"sources":["../../../internals/utils/src/copyToClipboard.ts","../../../internals/utils/src/openInBrowser.ts","../src/runners/studio/run.ts"],"sourcesContent":["import process from 'node:process'\nimport { x } from 'tinyexec'\nimport { isCIEnvironment } from './isCIEnvironment.ts'\n\nconst COMMANDS: Partial<Record<NodeJS.Platform, [string, ...Array<string>]>> = {\n darwin: ['pbcopy'],\n win32: ['clip.exe'],\n linux: ['xclip', '-selection', 'clipboard'],\n}\n\n/**\n * Copies text to the system clipboard with the platform's own tool. Resolves `false` in CI, on a\n * platform without a known tool, or when the tool is missing or fails.\n */\nexport async function copyToClipboard(text: string): Promise<boolean> {\n // Wayland sessions have no X selection for xclip to serve, so they use `wl-copy`.\n const command = process.platform === 'linux' && process.env.WAYLAND_DISPLAY ? (['wl-copy'] as const) : COMMANDS[process.platform]\n if (!command || isCIEnvironment()) return false\n\n const [name, ...args] = command\n // stdout and stderr are ignored: xclip and wl-copy stay alive to serve the selection and would hold open pipes until the timeout.\n const run = x(name, args, { timeout: 2_000, nodeOptions: { stdio: ['pipe', 'ignore', 'ignore'] } })\n // A missing tool closes stdin before the write lands; the rejection below reports it.\n run.process?.stdin?.once('error', () => {})\n run.process?.stdin?.end(text)\n\n return run.then(\n ({ exitCode }) => exitCode === 0,\n () => false,\n )\n}\n","import process from 'node:process'\nimport { x } from 'tinyexec'\nimport { isCIEnvironment } from './isCIEnvironment.ts'\n\nconst ignore = () => {}\n\n/**\n * Opens a URL or local file in the default browser, unless running in CI.\n */\nexport function openInBrowser(target: string): void {\n if (isCIEnvironment()) return\n\n if (process.platform === 'win32') {\n x('cmd', ['/c', 'start', '', target]).then(ignore, ignore)\n return\n }\n x(process.platform === 'darwin' ? 'open' : 'xdg-open', [target]).then(ignore, ignore)\n}\n","import { hostname } from 'node:os'\nimport { toPermissionFlag } from '../../ui/text.ts'\nimport path from 'node:path'\nimport process from 'node:process'\nimport { styleText } from 'node:util'\nimport * as prompts from '@clack/prompts'\nimport { KUBB_CONFIG_FILENAME } from '@internals/shared'\nimport { copyToClipboard, isCIEnvironment, openInBrowser, toError } from '@internals/utils'\nimport type { CLIOptions, Config } from '@kubb/core'\nimport { cliReporter, Diagnostics, Hookable, type KubbHooks, logLevel as logLevelMap } from '@kubb/core'\nimport { connectAgent, defaultStudioUrl, generateAgentKey, InvalidAgentTokenError, pairAgent, PairingCanceledError, refreshAgentToken } from '@kubb/studio'\nimport { AgentPermission } from '@kubb/studio/protocol'\nimport { trackRun } from '../../Telemetry.ts'\nimport { plainWriter } from '../../loggers/plainWriter.ts'\nimport setupReporters from '../../loggers/reporters.ts'\nimport { logIntro, logOutro, logTip } from '../../ui/intro.ts'\nimport { logBlock, logStep } from '../../ui/log.ts'\nimport { createSpinner } from '../../ui/spinner.ts'\nimport { canUseTTY, isRichOutput } from '../../utils/env.ts'\nimport { getConfigs } from '../../config.ts'\nimport { clearCredentials, type Credentials, getCredentialsPath, getMachineId, readCredentials, updateCredentials } from './credentials.ts'\nimport { version } from '../../../package.json'\n\nconst REFRESH_EVERY_MS = 24 * 60 * 60 * 1000\n\nexport type StudioOptions = {\n /**\n * Current `@kubb/cli` version, reported to Studio and used for the telemetry payload.\n */\n version: string\n configPath?: string\n /**\n * Base URL of the Studio instance, for a self-hosted deployment. Resolved before it reaches here,\n * since stored credentials are bound to it.\n */\n studioUrl: string\n /**\n * What Studio may do in this project. Each flag grants outright; the rest are asked once per\n * project through {@link resolvePermissions}.\n */\n permission: Record<AgentPermission, boolean>\n /**\n * Whether to open the approval page in a browser during pairing.\n */\n autoOpen: boolean\n logLevel?: CLIOptions['logLevel']\n}\n\nexport type SnapshotOptions = Pick<StudioOptions, 'configPath' | 'studioUrl' | 'logLevel'> & {\n /**\n * Organization CI API key. Falls back to `KUBB_TOKEN`.\n */\n token?: string\n /**\n * Stable identity for the CI agent. Falls back to CI auto-detection.\n */\n id?: string\n /** Identity of another CI agent to also compare with. Falls back to CI auto-detection. */\n baseId?: string\n /**\n * Package name for the generated tarball. Falls back to the nearest package.json.\n */\n name?: string\n /**\n * Package version for the generated tarball. Falls back to the nearest package.json.\n */\n packageVersion?: string\n /**\n * Print the result as one JSON object instead of a summary.\n */\n json?: boolean\n}\n\n/** The flags a `kubb studio` subcommand parsed; each one is optional since a subcommand declares only the flags it uses. */\nexport type StudioValues = {\n config?: string\n url?: string\n allowRead?: boolean\n allowReadAst?: boolean\n allowWrite?: boolean\n allowConfigEdit?: boolean\n allowInstall?: boolean\n allowUpdate?: boolean\n allowRemove?: boolean\n allowSaveInput?: boolean\n allowFileRefs?: boolean\n allowExec?: boolean\n open?: boolean\n logLevel?: CLIOptions['logLevel']\n}\n\ntype LoginOptions = {\n /**\n * Aborting this cancels an in-flight pairing request or poll and rejects with\n * {@link PairingCanceledError}. Wired to `kubb studio`'s shutdown signal, so Ctrl+C during\n * pairing cancels it instead of leaving the poll running.\n */\n signal?: AbortSignal\n /**\n * Credentials from before this login. When the fresh pairing resolves to the same agent on the\n * same Studio, its saved project permissions carry forward instead of being asked again.\n * Left out for an explicitly requested `kubb studio login`, which always starts clean.\n */\n previousCredentials?: Credentials | null\n}\n\n/**\n * Pairs this machine with Studio and stores the resulting token.\n *\n * The CLI holds a code and the browser approves it, rather than the user copying a token out of\n * the UI. The token comes back over the CLI's own HTTPS POST, so it never lands in a URL, a\n * server log, or a `Referer` header.\n */\nexport async function login({ studioUrl, autoOpen }: StudioOptions, { signal, previousCredentials }: LoginOptions = {}): Promise<Credentials> {\n const spinner = createSpinner()\n // A retry notice stays on screen a while before the countdown takes the line back.\n let retryUntil = 0\n // The spinner only starts once a code is shown.\n let waiting = false\n let countdown: NodeJS.Timeout | undefined\n\n try {\n const privateKey = generateAgentKey()\n const { token, agent } = await pairAgent({\n studioUrl,\n type: 'cli',\n name: path.basename(process.cwd()),\n hostname: hostname(),\n machineId: await getMachineId(),\n privateKey,\n signal,\n onCode: (session) => {\n logStep(\n [\n 'Pair this machine',\n `${styleText('dim', 'Open')} ${styleText('cyan', session.verification_uri)}`,\n `${styleText('dim', 'Code')} ${styleText('bold', session.user_code)}`,\n ].join('\\n'),\n )\n\n if (autoOpen) {\n openInBrowser(session.verification_uri_complete)\n }\n\n // Same fallback as the poll in `@kubb/studio`, so the countdown ends when polling does.\n const deadline = Date.now() + (session.expires_in > 0 ? session.expires_in : 600) * 1000\n let copied = false\n const waitingText = () =>\n `Waiting for approval ${styleText('dim', `expires in ${formatCountdown(deadline - Date.now())}${copied ? ' · code copied' : ''} · ctrl+c to cancel`)}`\n clearInterval(countdown)\n spinner.start(waitingText())\n waiting = true\n // Plain output prints every message, so only an animated spinner ticks.\n if (isRichOutput()) countdown = setInterval(() => Date.now() > retryUntil && spinner.message(waitingText()), 1000)\n // Not awaited: the code shows at once, and the spinner picks up the copy when it lands.\n void copyToClipboard(session.user_code).then((done) => {\n copied = done\n })\n },\n onRetry: (error) => {\n retryUntil = Date.now() + 5000\n spinner.message(`Could not reach Kubb Studio, retrying: ${error.message}`)\n },\n })\n clearInterval(countdown)\n spinner.stop(`Paired as ${agent.name}${agent.organizationSlug ? ` · org ${agent.organizationSlug}` : ''}`)\n\n const paired: Credentials = {\n studioUrl,\n token,\n issuedAt: new Date().toISOString(),\n privateKey,\n agentId: agent.id,\n agentSlug: agent.slug,\n ...(agent.organizationSlug ? { organizationSlug: agent.organizationSlug } : {}),\n }\n const credentials = await updateCredentials((stored) => {\n // Read under the lock, so permissions saved while the pairing waited are kept.\n const previous = stored ?? previousCredentials\n const keepsIdentity = previous?.studioUrl === studioUrl && previous.agentId === agent.id\n return { ...paired, ...(keepsIdentity && previous.projects ? { projects: previous.projects } : {}) }\n })\n\n console.log(`Credentials stored in ${getCredentialsPath()}`)\n\n return credentials\n } catch (error) {\n clearInterval(countdown)\n if (waiting) {\n spinner.stop(error instanceof PairingCanceledError ? 'Pairing canceled' : 'Pairing failed')\n }\n throw error\n }\n}\n\n/** Time left on a pairing code as `m:ss`, never below `0:00`. */\nexport function formatCountdown(ms: number): string {\n const seconds = Math.max(0, Math.ceil(ms / 1000))\n\n return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, '0')}`\n}\n\n/**\n * What each permission is asked as, in the order the list shows them.\n */\nconst PERMISSIONS: ReadonlyArray<{\n key: AgentPermission\n /**\n * Short label for status output and the connect summary.\n */\n label: string\n title: (configPath: string) => string\n hint: string\n}> = [\n { key: AgentPermission.READ, label: 'read source', title: () => 'Read generated files', hint: 'show code in the browser' },\n { key: AgentPermission.READ_AST, label: 'read spec', title: () => 'Read the parsed spec', hint: 'browse schemas and operations' },\n { key: AgentPermission.WRITE, label: 'write files', title: () => 'Write files to disk', hint: 'generate from the browser' },\n { key: AgentPermission.CONFIG_EDIT, label: 'edit config', title: (configPath) => `Change ${configPath}`, hint: 'edit plugin options' },\n { key: AgentPermission.INSTALL, label: 'add plugins', title: () => 'Install extensions from the registry', hint: 'kubb add from the browser' },\n { key: AgentPermission.UPDATE, label: 'update plugins', title: () => 'Update installed extensions', hint: 'kubb update from the browser' },\n { key: AgentPermission.REMOVE, label: 'remove plugins', title: () => 'Remove extensions', hint: 'kubb remove from the browser' },\n {\n key: AgentPermission.SAVE_INPUT,\n label: 'save input',\n title: (configPath) => `Save the spec from Studio as the input in ${configPath}`,\n hint: 'keep a pasted spec, URL, or git file',\n },\n { key: AgentPermission.FILE_REFS, label: 'outside refs', title: () => 'Let a $ref read files outside the project', hint: 'specs that share schemas' },\n { key: AgentPermission.EXEC, label: 'run tools', title: () => 'Run the formatter, linter, and postGenerate', hint: 'after each generation' },\n]\n\n/**\n * Two permissions per row, each marked granted or not, with the flags that grant the missing ones\n * after the last row. For `kubb studio status`.\n */\nexport function formatPermissionRows(granted: Partial<Record<AgentPermission, boolean>>): Array<string> {\n const width = Math.max(...PERMISSIONS.map(({ label }) => label.length))\n const cells = PERMISSIONS.map(({ key, label }) => `${granted[key] ? styleText('green', '✓') : styleText('red', '✖')} ${label.padEnd(width)}`)\n const rows = Array.from({ length: Math.ceil(cells.length / 2) }, (_, index) => cells.slice(index * 2, index * 2 + 2).join(' '))\n const flags = PERMISSIONS.filter(({ key }) => !granted[key])\n .map(({ key }) => toPermissionFlag(key))\n .join(' ')\n\n return flags ? [...rows.slice(0, -1), `${rows.at(-1)} ${styleText('dim', flags)}`] : rows\n}\n\n/**\n * Resolves Studio permissions for the current project.\n * Flags win, saved answers are reused, and the rest are asked in one list whose answers are stored\n * in `~/.kubb/credentials.json`.\n */\nexport async function resolvePermissions(\n options: StudioOptions,\n credentials: Credentials,\n configPath: string = KUBB_CONFIG_FILENAME,\n { edit = false }: { edit?: boolean } = {},\n): Promise<Record<AgentPermission, boolean>> {\n const project = process.cwd()\n const remembered = credentials.projects?.[project]\n const granted = Object.fromEntries(PERMISSIONS.map(({ key }) => [key, options.permission[key] || remembered?.[key] === true])) as Record<\n AgentPermission,\n boolean\n >\n // `edit` asks again for every permission no flag grants, with the saved ones checked.\n const pending = PERMISSIONS.filter(({ key }) => !options.permission[key] && (edit || typeof remembered?.[key] !== 'boolean'))\n\n if (!pending.length || isCIEnvironment() || !canUseTTY()) return granted\n\n prompts.updateSettings({ withGuide: true })\n const selected = await prompts.multiselect({\n message: 'What may Kubb Studio do in this project?',\n options: pending.map(({ key, title, hint }) => ({ value: key, label: title(configPath), hint })),\n ...(edit ? { initialValues: pending.filter(({ key }) => remembered?.[key] === true).map(({ key }) => key) } : {}),\n required: false,\n })\n // A canceled list grants nothing and saves nothing, so the next run asks again.\n if (prompts.isCancel(selected)) {\n if (edit) throw new Error('Canceled. Permissions are unchanged.')\n return granted\n }\n\n const answers = Object.fromEntries(pending.map(({ key }) => [key, selected.includes(key)]))\n // Merged into the stored record, so a token refreshed by a running connection is kept.\n await updateCredentials((stored) => {\n const current = stored ?? credentials\n return { ...current, projects: { ...current.projects, [project]: { ...current.projects?.[project], ...answers } } }\n })\n\n return { ...granted, ...answers }\n}\n\n/**\n * Loads the project's Kubb config the same way `kubb generate` does, one entry per `defineConfig(...)` entry.\n */\nexport async function loadConfigs(options: Pick<StudioOptions, 'configPath' | 'logLevel'>): Promise<{ configPath: string; configs: Array<Config> }> {\n const { configPath, configs } = await getConfigs({ configPath: options.configPath, logLevel: options.logLevel })\n\n if (!configs.length) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.unknown,\n severity: 'error',\n message: 'Config not defined, create a kubb.config.ts or pass it with --config',\n })\n }\n\n // `getConfigs` resolves this to an absolute path. Relativized here, once, so the permission\n // prompt and the path Studio receives over the wire both show the project-relative form instead\n // of leaking the local filesystem layout.\n return { configPath: path.relative(process.cwd(), configPath) || configPath, configs }\n}\n\nexport type PreparedConnection = {\n configPath: string\n credentials: Credentials\n permissions: StudioOptions['permission']\n}\n\n/** Validates the project and resolves pairing and permissions before starting its worker. */\nexport async function prepareConnection(options: StudioOptions, signal?: AbortSignal): Promise<PreparedConnection> {\n const { configPath } = await loadConfigs(options)\n const stored = await readCredentials()\n const credentials = await (async () => {\n if (stored?.studioUrl === options.studioUrl) return stored\n if (isCIEnvironment()) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.unknown,\n severity: 'error',\n message: `Not paired with ${options.studioUrl}. In CI, run \\`kubb studio snapshot\\` instead, or run \\`kubb studio login\\` on a machine with a browser.`,\n })\n }\n return login(options, { signal })\n })()\n const permissions = await resolvePermissions(options, credentials, configPath)\n return { configPath, credentials, permissions }\n}\n\nexport type WorkerState = 'starting' | 'connected' | 'reconnecting' | 'authentication required' | 'stopped'\n\n/** Runs the same project connection in the foreground or in a background worker. */\nexport async function connect(\n options: StudioOptions,\n context: {\n prepared?: PreparedConnection\n signal?: AbortSignal\n onState?: (state: WorkerState) => void | Promise<void>\n } = {},\n): Promise<void> {\n const shutdown = new AbortController()\n const signal = context.signal ?? shutdown.signal\n const stop = () => shutdown.abort()\n const events = process as unknown as NodeJS.EventEmitter\n if (!context.signal) {\n events.once('SIGINT', stop)\n events.once('SIGTERM', stop)\n }\n let unwatch: (() => void) | undefined\n let refreshTimer: NodeJS.Timeout | undefined\n try {\n if (!context.prepared) {\n const { getWorkerStatus } = await import('./background.ts')\n const worker = await getWorkerStatus()\n if (worker.running)\n throw new Diagnostics.Error({\n code: Diagnostics.code.unknown,\n severity: 'error',\n message: 'This project is running in the background. Run `kubb studio stop` first.',\n })\n }\n const prepared = context.prepared ?? (await prepareConnection(options, signal))\n let { credentials, permissions } = prepared\n const { configPath } = prepared\n let hinted = false\n // Set by a fresh pairing until it connects, so a token rejected right after approval fails the run instead of looping.\n let pairedAgain = false\n let recovered = false\n\n const warn = (message: string) => options.logLevel !== 'silent' && console.log(styleText('yellow', message))\n // Resolves whether the token changed; a failure keeps the old one.\n const refreshToken = async (force: boolean): Promise<boolean> => {\n if (!force && Date.now() - Date.parse(credentials.issuedAt ?? '') < REFRESH_EVERY_MS) return false\n const replaced = credentials.token\n try {\n const token = await refreshAgentToken({\n studioUrl: options.studioUrl,\n token: replaced,\n machineId: await getMachineId(),\n privateKey: credentials.privateKey,\n signal,\n })\n // A pairing that finished meanwhile owns the credentials now.\n if (!token || credentials.token !== replaced) return false\n const refreshed = { token, issuedAt: new Date().toISOString() }\n credentials = { ...credentials, ...refreshed }\n // Only the token changes on disk, so permissions saved since this run read the file are kept.\n await updateCredentials((stored) => (stored?.token === replaced ? { ...stored, ...refreshed } : undefined)).catch((error: unknown) =>\n warn(`Could not store the refreshed token: ${toError(error).message}`),\n )\n return true\n } catch (error) {\n if (!signal.aborted && !(error instanceof InvalidAgentTokenError)) warn(`Could not refresh the agent token: ${toError(error).message}`)\n return false\n }\n }\n // The timer and a rejected token share one request: two refreshes of one token cannot both succeed.\n let refreshing: Promise<boolean> | undefined\n const refresh = ({ force = false } = {}): Promise<boolean> =>\n (refreshing ??= refreshToken(force).finally(() => {\n refreshing = undefined\n }))\n await refresh()\n refreshTimer = setInterval(() => void refresh(), REFRESH_EVERY_MS)\n refreshTimer.unref()\n\n // The background worker writes to a log file, so it gets the plain logger rather than the\n // animated one. The logger also covers the `studio:*` events and each generation run.\n const hooks = new Hookable<KubbHooks>()\n setupReporters(hooks, {\n logLevel: logLevelMap[options.logLevel ?? 'info'],\n reporters: [cliReporter],\n ...(context.onState ? { writer: plainWriter } : {}),\n })\n // `b` hands the session to the background worker; only a foreground run in a terminal listens.\n const listens = !context.onState && process.stdin.isTTY === true && canUseTTY()\n let background = false\n hooks.hook('studio:connected', async () => {\n pairedAgain = false\n recovered = false\n await context.onState?.('connected')\n if (listens && !unwatch) {\n unwatch = watchKeys({\n onBackground: () => {\n background = true\n stop()\n },\n onStop: stop,\n })\n }\n if (hinted || context.onState || options.logLevel === 'silent') return\n hinted = true\n logBlock([\n `${styleText('dim', 'Project')} ${path.basename(process.cwd())} ${styleText(\n 'dim',\n PERMISSIONS.filter(({ key }) => permissions[key])\n .map(({ label }) => label)\n .join(' · ') || 'no permissions',\n )}`,\n styleText('dim', listens ? 'Press b to keep running in the background, Ctrl+C to disconnect' : 'Press Ctrl+C to disconnect'),\n ])\n logTip()\n })\n hooks.hook('studio:reconnecting', () => context.onState?.('reconnecting'))\n\n for (;;) {\n try {\n await connectAgent({\n token: () => credentials.token,\n privateKey: credentials.privateKey,\n studioUrl: options.studioUrl,\n configPath,\n version: options.version,\n root: process.cwd(),\n agentType: 'cli',\n permissions,\n loadConfigs: async () => (await loadConfigs(options)).configs,\n hooks,\n signal,\n })\n break\n } catch (error) {\n if (!(error instanceof InvalidAgentTokenError)) throw error\n // The answer to an earlier refresh may have been lost, so the token is traded in once more.\n if (!recovered && !pairedAgain) {\n recovered = true\n if (await refresh({ force: true })) continue\n }\n await context.onState?.('authentication required')\n await clearCredentials()\n if (pairedAgain) throw new Error(`${error.message} Studio rejected the newly approved token too. Run \\`kubb studio login\\` and try again.`)\n if (context.onState || isCIEnvironment() || !canUseTTY()) throw new Error(`${error.message} Run \\`kubb studio login\\` to pair again.`)\n\n // The pairing prompts need stdin back.\n unwatch?.()\n unwatch = undefined\n console.log(styleText('yellow', `${error.message} Pairing again...`))\n credentials = await login(options, { signal, previousCredentials: credentials })\n pairedAgain = true\n permissions = await resolvePermissions(options, credentials, configPath)\n }\n }\n // Stops the \"Ready for jobs\" spinner, which would otherwise keep drawing under the closing line.\n await hooks.callHook('kubb:lifecycle:end')\n unwatch?.()\n if (background) {\n const { startWorker } = await import('./background.ts')\n await startWorker(options)\n if (options.logLevel !== 'silent') logOutro('Running in the background · kubb studio stop')\n return\n }\n if (!context.onState && signal.aborted && options.logLevel !== 'silent') logOutro('Disconnected')\n } catch (error) {\n if (!(error instanceof PairingCanceledError)) throw error\n } finally {\n clearInterval(refreshTimer)\n unwatch?.()\n events.off('SIGINT', stop)\n events.off('SIGTERM', stop)\n }\n}\n\n/**\n * Listens for single keys on a TTY stdin. Raw mode turns Ctrl+C into a key instead of SIGINT, so it\n * is handled here too. Returns the function that restores the terminal, safe to call twice.\n */\nexport function watchKeys({ onBackground, onStop }: { onBackground: () => void; onStop: () => void }): () => void {\n const stdin = process.stdin\n const onData = (data: Buffer) => {\n const key = data.toString()\n if (key === 'b' || key === 'B') onBackground()\n if (key === '\\u0003') onStop()\n }\n // A clack spinner reads stdin too and exits the process on Ctrl+C, before the session can close\n // its socket, so its Ctrl+C alias is lifted while these keys are read.\n const cancelAlias = prompts.settings.aliases.get('\\u0003')\n prompts.settings.aliases.delete('\\u0003')\n stdin.setRawMode(true)\n stdin.on('data', onData)\n stdin.resume()\n let restored = false\n\n return () => {\n if (restored) return\n restored = true\n if (cancelAlias) prompts.settings.aliases.set('\\u0003', cancelAlias)\n stdin.off('data', onData)\n stdin.setRawMode(false)\n stdin.pause()\n }\n}\n\n/**\n * Runs a Studio command from its parsed flags: builds the {@link StudioOptions}, prints the intro,\n * and reports the run to telemetry. A failure is printed and sets the exit code instead of throwing.\n */\nexport async function runStudio(\n values: StudioValues,\n action: (options: StudioOptions) => Promise<unknown>,\n { block = false, json = false }: { block?: boolean; json?: boolean } = {},\n): Promise<void> {\n const options: StudioOptions = {\n version,\n configPath: values.config,\n studioUrl: values.url ?? defaultStudioUrl,\n permission: Object.fromEntries(Object.values(AgentPermission).map((key) => [key, values[key] ?? false])) as Record<AgentPermission, boolean>,\n autoOpen: values.open ?? true,\n logLevel: values.logLevel,\n }\n const report = trackRun({ command: 'studio', hrStart: process.hrtime() })\n\n try {\n if (options.logLevel !== 'silent' && !json) {\n logIntro({\n warning: styleText('yellow', 'This feature is still under development, use with caution'),\n block,\n })\n }\n\n await action(options)\n\n await report({ status: 'success' })\n } catch (error) {\n await report({ status: 'failed' })\n console.error(toError(error).message)\n process.exitCode = 1\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAM,WAAyE;CAC7E,QAAQ,CAAC,QAAQ;CACjB,OAAO,CAAC,UAAU;CAClB,OAAO;EAAC;EAAS;EAAc;CAAW;AAC5C;;;;;AAMA,eAAsB,gBAAgB,MAAgC;CAEpE,MAAM,UAAU,QAAQ,aAAa,WAAW,QAAQ,IAAI,kBAAmB,CAAC,SAAS,IAAc,SAAS,Q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SAAS,UAAU,UAAU,2DAA2D;GACxF;EACF,CAAC;EAGH,MAAM,OAAO,OAAO;EAEpB,MAAM,OAAO,EAAE,QAAQ,UAAU,CAAC;CACpC,SAAS,OAAO;EACd,MAAM,OAAO,EAAE,QAAQ,SAAS,CAAC;EACjC,QAAQ,MAAM,QAAQ,KAAK,CAAC,CAAC,OAAO;EACpC,QAAQ,WAAW;CACrB;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./rolldown-runtime-BowF1xt-.js";
|
|
2
2
|
import { n as toError } from "./errors-CEzFbRvL.js";
|
|
3
|
-
import { n as trackRun } from "./Telemetry-
|
|
3
|
+
import { n as trackRun } from "./Telemetry-DDa3d9Ey.js";
|
|
4
4
|
import { styleText } from "node:util";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
// src/runners/mcp/run.ts
|
|
@@ -28,4 +28,4 @@ async function run() {
|
|
|
28
28
|
}
|
|
29
29
|
export { run };
|
|
30
30
|
|
|
31
|
-
//# sourceMappingURL=run-
|
|
31
|
+
//# sourceMappingURL=run-prZAFZhg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-
|
|
1
|
+
{"version":3,"file":"run-prZAFZhg.js","names":[],"sources":["../src/runners/mcp/run.ts"],"sourcesContent":["import process from 'node:process'\nimport { styleText } from 'node:util'\nimport { toError } from '@internals/utils'\nimport type * as McpModule from '@kubb/mcp'\nimport { trackRun } from '../../Telemetry.ts'\n\n/**\n * Starts the `@kubb/mcp` server over stdio and reports the outcome to telemetry.\n */\nexport async function run(): Promise<void> {\n const { run: startMcpServer } = (await import('@kubb/mcp')) as typeof McpModule\n\n const report = trackRun({ command: 'mcp', hrStart: process.hrtime() })\n\n try {\n // The MCP stdio transport owns stdout: anything else written there corrupts the JSON-RPC stream.\n console.error(styleText('cyan', '⏳ Starting MCP server...'))\n console.warn(styleText('yellow', 'This feature is still under development, use with caution'))\n const server = startMcpServer()\n // Report once the client introduces itself, so the event names the client (e.g. `claude-code`, `cursor-vscode`).\n server.on('initialize', ({ clientInfo }) => void report({ status: 'success', mcpClient: clientInfo.name }), { once: true })\n } catch (error) {\n await report({ status: 'failed' })\n console.error(toError(error).message)\n process.exitCode = 1\n }\n}\n"],"mappings":";;;;;;;;;AASA,eAAsB,MAAqB;CACzC,MAAM,EAAE,KAAK,mBAAoB,MAAM,OAAO;CAE9C,MAAM,SAAS,SAAS;EAAE,SAAS;EAAO,SAAS,QAAQ,OAAO;CAAE,CAAC;CAErE,IAAI;EAEF,QAAQ,MAAM,UAAU,QAAQ,0BAA0B,CAAC;EAC3D,QAAQ,KAAK,UAAU,UAAU,2DAA2D,CAAC;EAG7F,eAAK,CAAC,CAAC,GAAG,eAAe,EAAE,iBAAiB,KAAK,OAAO;GAAE,QAAQ;GAAW,WAAW,WAAW;EAAK,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC;CAC5H,SAAS,OAAO;EACd,MAAM,OAAO,EAAE,QAAQ,SAAS,CAAC;EACjC,QAAQ,MAAM,QAAQ,KAAK,CAAC,CAAC,OAAO;EACpC,QAAQ,WAAW;CACrB;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-BV8xUvPy.cjs");
|
|
2
|
-
const require_configFile = require("./configFile-
|
|
2
|
+
const require_configFile = require("./configFile-CFaV_To0.cjs");
|
|
3
3
|
const require_config = require("./config-BU9xeaGq.cjs");
|
|
4
4
|
const require_spinner = require("./spinner-BQgUoe7F.cjs");
|
|
5
5
|
const require_time = require("./time-D4xUq6tx.cjs");
|
|
@@ -10,7 +10,7 @@ const require_log = require("./log-BzmBldY6.cjs");
|
|
|
10
10
|
const require_registry = require("./registry-CTVAqQFn.cjs");
|
|
11
11
|
const require_installWithSpinner = require("./installWithSpinner-qjIqjyiW.cjs");
|
|
12
12
|
const require_utils = require("./utils-_hY0r-7x.cjs");
|
|
13
|
-
const require_package = require("./package-
|
|
13
|
+
const require_package = require("./package-BL41dCng.cjs");
|
|
14
14
|
let node_util = require("node:util");
|
|
15
15
|
let gunshi = require("gunshi");
|
|
16
16
|
let node_process = require("node:process");
|
|
@@ -372,4 +372,4 @@ const command = (0, gunshi.defineWithTypes)()({
|
|
|
372
372
|
exports.command = command;
|
|
373
373
|
exports.run = run;
|
|
374
374
|
|
|
375
|
-
//# sourceMappingURL=run-
|
|
375
|
+
//# sourceMappingURL=run-puI1uinj.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-lH8k2FY7.cjs","names":["clack","editConfig","ConfigEditOperation","Diagnostics","KUBB_CONFIG_FILENAME","getConfigs","createKubb","resolveCommand","process","isInteractiveRun","fetchRegistryIndex","registryUrl","incompatibility","exists","path","detectPackageManager","withSpinner","initPackageJson","findSpecFiles","readSpecInfo","pluralize","initDefaults","findPlugin","parsePluginsFlag","isHttpUrl","styleText","missingPluginDependencies","KUBB_PACKAGE_NAME","version","installSpec","installPackages","installWithSpinner","write","addGenerateScript","generateScript","formatMs","getElapsedMs","defineWithTypes","dryRunId"],"sources":["../../../internals/shared/src/init.ts","../src/runners/init/run.ts"],"sourcesContent":["/** The `kubb.config.ts` `kubb init` writes before `kubb add` puts each plugin in. */\nexport function generateConfigFile({ inputPath, outputPath }: { inputPath: string; outputPath: string }): string {\n return `import { defineConfig } from 'kubb/config'\n\nexport default defineConfig({\n input: '${inputPath}',\n output: {\n path: '${outputPath}',\n clean: true,\n },\n plugins: [],\n})\n`\n}\n","import path from 'node:path'\nimport process from 'node:process'\nimport { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport type { DryRunExtension } from '@gunshi/plugin-dryrun'\nimport { defineWithTypes } from 'gunshi'\nimport { resolveCommand } from 'package-manager-detector'\nimport { ConfigEditOperation, editConfig, generateConfigFile, initDefaults, KUBB_CONFIG_FILENAME, KUBB_PACKAGE_NAME } from '@internals/shared'\nimport { exists, formatMs, getElapsedMs, write } from '@internals/utils'\nimport { createKubb, Diagnostics, type RegistryEntry } from '@kubb/core'\nimport { dryRunId, type DryRunExtensions } from '../../commands/shared.ts'\nimport { getConfigs } from '../../config.ts'\nimport { isHttpUrl, pluralize } from '../../ui/text.ts'\nimport { isInteractiveRun, logIntro, logOutro } from '../../ui/intro.ts'\nimport { logBlock, logError, logStep, logWarn } from '../../ui/log.ts'\nimport { withSpinner } from '../../ui/spinner.ts'\nimport { fetchRegistryIndex, incompatibility, installSpec, registryUrl } from '../../utils/registry.ts'\nimport { installWithSpinner } from '../installWithSpinner.ts'\nimport {\n addGenerateScript,\n detectPackageManager,\n findPlugin,\n findSpecFiles,\n generateScript,\n initPackageJson,\n installPackages,\n missingPluginDependencies,\n type PackageManagerInfo,\n parsePluginsFlag,\n readSpecInfo,\n} from './utils.ts'\nimport { version } from '../../../package.json'\n\nfunction cancelAndExit(message = 'Operation canceled.'): never {\n clack.cancel(message)\n process.exit(0)\n}\n\nfunction unwrap<T>(value: T): Exclude<T, symbol> {\n if (clack.isCancel(value)) cancelAndExit()\n return value as Exclude<T, symbol>\n}\n\ntype InitOptions = {\n /**\n * When `true`, skips all interactive prompts and uses the detected or default values.\n */\n yes: boolean\n /**\n * Input path flag value from `--input`. When provided, skips the input prompt.\n */\n input?: string\n /**\n * Output directory flag value from `--output`. When provided, skips the output prompt.\n */\n output?: string\n /**\n * Comma-separated plugin list from `--plugins`, e.g. `'plugin-ts,zod'`. When provided, skips the plugin selection prompt.\n */\n plugins?: string\n /**\n * Dry-run extension from `@gunshi/plugin-dryrun`. When enabled, package installation, file\n * writes, and the first run are skipped.\n */\n dryRun: DryRunExtension\n}\n\ntype Choices = {\n inputPath: string\n outputPath: string\n plugins: Array<RegistryEntry>\n}\n\n/** The full `kubb.config.ts` for `choices`, with each plugin added the way `kubb add` adds it. */\nfunction buildConfig({ inputPath, outputPath, plugins }: Choices): string {\n const { source, outcomes } = editConfig({\n source: generateConfigFile({ inputPath, outputPath }),\n edits: plugins.map((entry) => ({ operation: ConfigEditOperation.ADD_PLUGIN, plugin: entry.artifact.package })),\n extensions: new Map(plugins.map(({ artifact, manifest }) => [artifact.package, { package: artifact.package, version: artifact.version, manifest }])),\n })\n const failed = outcomes.find((outcome) => !outcome.applied)\n if (failed && failed.edit.operation === ConfigEditOperation.ADD_PLUGIN)\n throw new Diagnostics.Error({\n code: Diagnostics.code.unknown,\n severity: 'error',\n message: `Could not add ${failed.edit.plugin} to ${KUBB_CONFIG_FILENAME}: ${failed.reason}`,\n help: `Run kubb init without that plugin, then add it with kubb add.`,\n })\n return source\n}\n\n/** Generates from the config at `configPath` without reporters, and returns how many files it wrote. */\nasync function firstRun(configPath: string): Promise<number> {\n const { configs } = await getConfigs({ configPath })\n let files = 0\n for (const config of configs) {\n const result = await createKubb(config).generate()\n if (!result.success) throw new Error(result.diagnostics.flatMap((diagnostic) => (diagnostic.severity === 'error' ? [diagnostic.message] : [])).join('\\n'))\n files += result.files.length\n }\n return files\n}\n\n/** The command that runs `kubb generate`: the `generate` script when it runs Kubb, otherwise `npx kubb generate`. */\nfunction generateCommand({ packageManager, script, watch }: { packageManager: PackageManagerInfo; script: string | undefined; watch: boolean }): string {\n if (script !== 'kubb generate') return `npx kubb generate${watch ? ' --watch' : ''}`\n const { command, args } = resolveCommand(packageManager.agent, 'run', watch ? ['generate', '--watch'] : ['generate'])!\n return [command, ...args].join(' ')\n}\n\n/**\n * Runs the Kubb setup wizard: detects the package manager and specs, asks for the spec, plugins, and\n * output folder, shows the config for review, then installs, writes `kubb.config.ts`, adds a\n * `generate` script, and runs the first generation.\n * Pass `yes: true` to skip all prompts and print one line per step.\n */\nexport async function run({ yes, input: inputFlag, output: outputFlag, plugins: pluginsFlag, dryRun }: InitOptions): Promise<void> {\n const cwd = process.cwd()\n\n if (!yes) logIntro({ title: isInteractiveRun({ yes, dryRun: dryRun.enabled }) ? undefined : 'Set up Kubb' })\n\n try {\n // Start the registry fetch now but await it only at the plugin step, so the first prompt never waits on the network\n const registry = fetchRegistryIndex({ registry: registryUrl() }).then((entries) =>\n entries.filter((entry) => entry.kind === 'plugin' && !incompatibility(entry.manifest)),\n )\n registry.catch(() => {})\n\n if (!(await exists(path.join(cwd, 'package.json')))) {\n if (!yes) {\n const shouldInit = unwrap(await clack.confirm({ message: 'No package.json found. Would you like to create one?', initialValue: true }))\n if (!shouldInit) cancelAndExit()\n }\n\n const packageManager = await detectPackageManager(cwd)\n await withSpinner({\n message: `Initializing package.json with ${packageManager.name}`,\n promise: initPackageJson(cwd, packageManager),\n done: () => `Created package.json with ${packageManager.name}`,\n failed: 'Could not create package.json',\n plain: yes,\n })\n }\n\n const packageManager = await detectPackageManager(cwd)\n const specs = await findSpecFiles(cwd)\n\n if (!yes) {\n logStep(`Package manager ${packageManager.name}`)\n if (specs[0]) {\n const { version: specVersion, operations } = await readSpecInfo(path.join(cwd, specs[0]))\n const details = [\n specs[0].slice(2),\n specVersion ? `${specVersion.startsWith('2') ? 'Swagger' : 'OpenAPI'} ${specVersion}` : undefined,\n operations === undefined ? undefined : pluralize(operations, 'operation'),\n specs.length > 1 ? `+${specs.length - 1} more` : undefined,\n ]\n logStep(`Found ${details.filter(Boolean).join(' · ')}`)\n }\n }\n\n // `--plugins` and `--yes` need the registry before any prompt; the interactive path reads it at the plugin step\n const plugins = pluginsFlag || yes ? await registry : undefined\n const defaultPlugins = (entries: Array<RegistryEntry>) => initDefaults.plugins.flatMap((id) => findPlugin({ plugins: entries, id }) ?? [])\n\n const flagPlugins = pluginsFlag && plugins ? parsePluginsFlag({ plugins, value: pluginsFlag }) : undefined\n\n let choices: Choices = {\n inputPath: inputFlag ?? specs[0] ?? initDefaults.inputPath,\n outputPath: outputFlag ?? initDefaults.outputPath,\n plugins: flagPlugins ?? (plugins ? defaultPlugins(plugins) : []),\n }\n if (yes && !choices.plugins.length) {\n throw new Error('The registry has no default plugin. Pass --plugins to choose one.')\n }\n\n async function askInput(current: string): Promise<string> {\n const choice = specs.length\n ? unwrap(\n await clack.select({\n message: 'Which spec should Kubb read?',\n options: [\n ...specs.map((spec) => ({ value: spec, label: spec, hint: 'found in this repo' })),\n { value: 'url', label: 'A URL' },\n { value: 'file', label: 'Another file' },\n ],\n initialValue: specs.includes(current) ? current : isHttpUrl(current) ? 'url' : 'file',\n }),\n )\n : isHttpUrl(current)\n ? 'url'\n : 'file'\n if (specs.includes(choice)) return choice\n const isUrl = choice === 'url'\n const initial = isUrl === isHttpUrl(current) && !specs.includes(current) ? current : undefined\n return unwrap(\n await clack.text({\n message: isUrl ? 'Spec URL' : 'Spec path',\n placeholder: isUrl ? 'https://example.com/openapi.yaml' : initDefaults.inputPath,\n initialValue: initial,\n defaultValue: isUrl ? undefined : initDefaults.inputPath,\n validate: (value) => {\n if (isUrl && !isHttpUrl(value ?? '')) return 'Enter an http(s) URL'\n },\n }),\n )\n }\n\n async function askPlugins(previous: Array<RegistryEntry>): Promise<Array<RegistryEntry>> {\n const plugins = await registry\n const current = previous.length ? previous : defaultPlugins(plugins)\n const width = Math.max(...plugins.map((entry) => entry.manifest.displayName.length))\n const nameWidth = Math.max(...plugins.map((entry) => entry.manifest.name.length))\n const values = unwrap(\n await clack.multiselect({\n message: 'What should Kubb generate?',\n options: plugins.map(({ id, manifest }) => ({\n value: id,\n label: `${manifest.displayName.padEnd(width)} ${styleText('dim', manifest.name.padEnd(nameWidth))}`.trimEnd(),\n })),\n initialValues: current.map((entry) => entry.id),\n required: true,\n }),\n )\n return plugins.filter((entry) => values.includes(entry.id))\n }\n\n // Flags for all three choices leave nothing to ask or review, as before the review step existed\n const answered = yes || Boolean(inputFlag && outputFlag && pluginsFlag)\n if (!answered) {\n let firstPass = true\n while (true) {\n // The first pass skips the questions a flag answered; \"Change a choice\" asks them all again.\n choices = {\n inputPath: firstPass && inputFlag ? inputFlag : await askInput(choices.inputPath),\n plugins: firstPass && flagPlugins ? flagPlugins : await askPlugins(choices.plugins),\n outputPath:\n firstPass && outputFlag\n ? outputFlag\n : unwrap(await clack.text({ message: 'Output folder', placeholder: choices.outputPath, defaultValue: choices.outputPath })),\n }\n firstPass = false\n const missing = missingPluginDependencies(choices.plugins.map((entry) => entry.manifest))\n if (missing.length) {\n logWarn(`${missing.join('\\n')}\\nAdd the missing plugins.`)\n continue\n }\n const config = buildConfig(choices)\n const packages = [KUBB_PACKAGE_NAME, ...choices.plugins.map((entry) => entry.artifact.package)]\n logStep(`Review ${KUBB_CONFIG_FILENAME}`)\n logBlock([...config.trimEnd().split('\\n'), '', `${styleText('dim', 'Installs')} ${packages.join(' ')} with ${packageManager.name}`])\n const configExists = await exists(path.join(cwd, KUBB_CONFIG_FILENAME))\n const confirmed = unwrap(\n await clack.select({\n message: configExists ? `${KUBB_CONFIG_FILENAME} exists. Overwrite it?` : 'Create it?',\n options: [\n { value: true, label: 'Yes' },\n { value: false, label: 'Change a choice' },\n ],\n }),\n )\n if (confirmed) break\n }\n }\n\n // Check the selection against the plugins' manifests before installing anything\n const missing = missingPluginDependencies(choices.plugins.map((entry) => entry.manifest))\n if (missing.length) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.missingDependency,\n severity: 'error',\n message: `${missing.join('\\n')}\\nAdd the missing plugins and run kubb init again.`,\n })\n }\n\n const configPath = path.join(cwd, KUBB_CONFIG_FILENAME)\n if (answered && !yes && (await exists(configPath))) {\n const overwrite = unwrap(await clack.confirm({ message: `${KUBB_CONFIG_FILENAME} exists. Overwrite it?`, initialValue: false }))\n if (!overwrite) cancelAndExit('Keeping existing configuration.')\n }\n\n // Install `kubb` at the running CLI's version and each plugin at the version the registry pins\n const packagesToInstall = [`${KUBB_PACKAGE_NAME}@${version}`, ...choices.plugins.map((entry) => installSpec(entry.artifact))]\n const packageNames = [KUBB_PACKAGE_NAME, ...choices.plugins.map((entry) => entry.artifact.package)]\n const dry = { message: `install ${packagesToInstall.length} packages with ${packageManager.name}` }\n if (yes) {\n await withSpinner({\n message: '',\n promise: dryRun.run(() => installPackages(packagesToInstall, packageManager, cwd), dry),\n done: () => `Installed ${packageNames.join(' ')} with ${packageManager.name}`,\n plain: true,\n })\n } else {\n await installWithSpinner({\n packages: packagesToInstall,\n names: `${packagesToInstall.length} packages`,\n packageManager,\n cwd,\n install: async (packages, packageManager, cwd, onLine) => void (await dryRun.run(() => installPackages(packages, packageManager, cwd, onLine), dry)),\n })\n }\n\n await withSpinner({\n message: `Writing ${KUBB_CONFIG_FILENAME}`,\n promise: dryRun.run(async () => void (await write(configPath, buildConfig(choices))), { message: `write ${KUBB_CONFIG_FILENAME}` }),\n done: () => `Wrote ${KUBB_CONFIG_FILENAME}`,\n failed: `Could not write ${KUBB_CONFIG_FILENAME}`,\n plain: yes,\n })\n\n const scriptAdded = await dryRun.run(() => addGenerateScript(cwd), {\n message: 'add a generate script to package.json',\n resolve: async () => (await generateScript(cwd)) === undefined,\n })\n if (scriptAdded && !yes) logStep('Added \"generate\": \"kubb generate\" to package.json')\n\n const script = scriptAdded ? 'kubb generate' : await generateScript(cwd)\n const runStart = process.hrtime()\n try {\n await dryRun.run(\n () =>\n withSpinner({\n message: 'Running the first generation',\n promise: firstRun(configPath),\n done: (files) =>\n yes\n ? `Generated ${pluralize(files, 'file')} in ${choices.outputPath}`\n : `First run ${pluralize(files, 'file')} in ${choices.outputPath} · ${formatMs(getElapsedMs(runStart))}`,\n failed: 'First run failed',\n plain: yes,\n }),\n { message: 'run the first generation', resolve: () => 0 },\n )\n } catch (error) {\n logError(error instanceof Error ? error.message : String(error))\n const message = `Kubb is set up, but the first run failed. Fix the error, then run ${generateCommand({ packageManager, script, watch: false })}.`\n if (yes) console.log(message)\n else logOutro(styleText('yellow', message))\n process.exitCode = 1\n return\n }\n\n if (yes) {\n console.log(`Kubb is set up. Run ${generateCommand({ packageManager, script, watch: false })} after changing the spec.`)\n return\n }\n logOutro(`${styleText('green', '✓ Kubb is set up')}\\n ${styleText('dim', 'Next')} ${generateCommand({ packageManager, script, watch: true })}`)\n } catch (error) {\n logError(styleText('red', 'An error occurred during initialization'))\n if (error instanceof Error) {\n logError(error.message)\n }\n process.exit(1)\n }\n}\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'init',\n description: 'Set up a config, install plugins, and run the first generation.',\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 --yes --input ./openapi.yaml --plugins ts,zod --output src/api',\n 'kubb init --plugins plugin-ts,plugin-axios,plugin-react-query',\n 'kubb init --yes --dry-run',\n ].join('\\n'),\n toKebab: true,\n args: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use the detected spec, the default plugin, and the default output folder',\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 Kubb registry ids of the plugins to add, the same ids `kubb add` takes (plugin-ts, plugin-zod, acme/plugin-x), or short names (ts, zod)',\n metavar: 'plugin-ts,plugin-zod,...',\n },\n },\n run: ({ values, extensions }) => run({ yes: values.yes, input: values.input, output: values.output, plugins: values.plugins, dryRun: extensions[dryRunId] }),\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAgB,mBAAmB,EAAE,WAAW,cAAiE;CAC/G,OAAO;;;YAGG,UAAU;;aAET,WAAW;;;;;;AAMxB;;ACoBA,SAAS,cAAc,UAAU,uBAA8B;CAC7D,eAAM,OAAO,OAAO;CACpB,aAAA,QAAQ,KAAK,CAAC;AAChB;AAEA,SAAS,OAAU,OAA8B;CAC/C,IAAIA,eAAM,SAAS,KAAK,GAAG,cAAc;CACzC,OAAO;AACT;;AAiCA,SAAS,YAAY,EAAE,WAAW,YAAY,WAA4B;CACxE,MAAM,EAAE,QAAQ,aAAaC,mBAAAA,WAAW;EACtC,QAAQ,mBAAmB;GAAE;GAAW;EAAW,CAAC;EACpD,OAAO,QAAQ,KAAK,WAAW;GAAE,WAAWC,mBAAAA,oB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,CAAC,GAAG;CACnJ,SAAS,OAAO;EACd,YAAA,UAAA,GAASA,UAAAA,UAAAA,CAAU,OAAO,yCAAyC,CAAC;EACpE,IAAI,iBAAiB,OACnB,YAAA,SAAS,MAAM,OAAO;EAExB,aAAA,QAAQ,KAAK,CAAC;CAChB;AACF;AAEA,MAAa,WAAA,GAAUY,OAAAA,gBAAAA,CAAkD,CAAC,CAAC;CACzE,MAAM;CACN,aAAa;CACb,UAAU;EACR;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CACX,SAAS;CACT,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,EAAE,QAAQ,iBAAiB,IAAI;EAAE,KAAK,OAAO;EAAK,OAAO,OAAO;EAAO,QAAQ,OAAO;EAAQ,SAAS,OAAO;EAAS,QAAQ,WAAWC,sBAAAA;CAAU,CAAC;AAC7J,CAAC"}
|
|
1
|
+
{"version":3,"file":"run-puI1uinj.cjs","names":["clack","editConfig","ConfigEditOperation","Diagnostics","KUBB_CONFIG_FILENAME","getConfigs","createKubb","resolveCommand","process","isInteractiveRun","fetchRegistryIndex","registryUrl","incompatibility","exists","path","detectPackageManager","withSpinner","initPackageJson","findSpecFiles","readSpecInfo","pluralize","initDefaults","findPlugin","parsePluginsFlag","isHttpUrl","styleText","missingPluginDependencies","KUBB_PACKAGE_NAME","version","installSpec","installPackages","installWithSpinner","write","addGenerateScript","generateScript","formatMs","getElapsedMs","defineWithTypes","dryRunId"],"sources":["../../../internals/shared/src/init.ts","../src/runners/init/run.ts"],"sourcesContent":["/** The `kubb.config.ts` `kubb init` writes before `kubb add` puts each plugin in. */\nexport function generateConfigFile({ inputPath, outputPath }: { inputPath: string; outputPath: string }): string {\n return `import { defineConfig } from 'kubb/config'\n\nexport default defineConfig({\n input: '${inputPath}',\n output: {\n path: '${outputPath}',\n clean: true,\n },\n plugins: [],\n})\n`\n}\n","import path from 'node:path'\nimport process from 'node:process'\nimport { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport type { DryRunExtension } from '@gunshi/plugin-dryrun'\nimport { defineWithTypes } from 'gunshi'\nimport { resolveCommand } from 'package-manager-detector'\nimport { ConfigEditOperation, editConfig, generateConfigFile, initDefaults, KUBB_CONFIG_FILENAME, KUBB_PACKAGE_NAME } from '@internals/shared'\nimport { exists, formatMs, getElapsedMs, write } from '@internals/utils'\nimport { createKubb, Diagnostics, type RegistryEntry } from '@kubb/core'\nimport { dryRunId, type DryRunExtensions } from '../../commands/shared.ts'\nimport { getConfigs } from '../../config.ts'\nimport { isHttpUrl, pluralize } from '../../ui/text.ts'\nimport { isInteractiveRun, logIntro, logOutro } from '../../ui/intro.ts'\nimport { logBlock, logError, logStep, logWarn } from '../../ui/log.ts'\nimport { withSpinner } from '../../ui/spinner.ts'\nimport { fetchRegistryIndex, incompatibility, installSpec, registryUrl } from '../../utils/registry.ts'\nimport { installWithSpinner } from '../installWithSpinner.ts'\nimport {\n addGenerateScript,\n detectPackageManager,\n findPlugin,\n findSpecFiles,\n generateScript,\n initPackageJson,\n installPackages,\n missingPluginDependencies,\n type PackageManagerInfo,\n parsePluginsFlag,\n readSpecInfo,\n} from './utils.ts'\nimport { version } from '../../../package.json'\n\nfunction cancelAndExit(message = 'Operation canceled.'): never {\n clack.cancel(message)\n process.exit(0)\n}\n\nfunction unwrap<T>(value: T): Exclude<T, symbol> {\n if (clack.isCancel(value)) cancelAndExit()\n return value as Exclude<T, symbol>\n}\n\ntype InitOptions = {\n /**\n * When `true`, skips all interactive prompts and uses the detected or default values.\n */\n yes: boolean\n /**\n * Input path flag value from `--input`. When provided, skips the input prompt.\n */\n input?: string\n /**\n * Output directory flag value from `--output`. When provided, skips the output prompt.\n */\n output?: string\n /**\n * Comma-separated plugin list from `--plugins`, e.g. `'plugin-ts,zod'`. When provided, skips the plugin selection prompt.\n */\n plugins?: string\n /**\n * Dry-run extension from `@gunshi/plugin-dryrun`. When enabled, package installation, file\n * writes, and the first run are skipped.\n */\n dryRun: DryRunExtension\n}\n\ntype Choices = {\n inputPath: string\n outputPath: string\n plugins: Array<RegistryEntry>\n}\n\n/** The full `kubb.config.ts` for `choices`, with each plugin added the way `kubb add` adds it. */\nfunction buildConfig({ inputPath, outputPath, plugins }: Choices): string {\n const { source, outcomes } = editConfig({\n source: generateConfigFile({ inputPath, outputPath }),\n edits: plugins.map((entry) => ({ operation: ConfigEditOperation.ADD_PLUGIN, plugin: entry.artifact.package })),\n extensions: new Map(plugins.map(({ artifact, manifest }) => [artifact.package, { package: artifact.package, version: artifact.version, manifest }])),\n })\n const failed = outcomes.find((outcome) => !outcome.applied)\n if (failed && failed.edit.operation === ConfigEditOperation.ADD_PLUGIN)\n throw new Diagnostics.Error({\n code: Diagnostics.code.unknown,\n severity: 'error',\n message: `Could not add ${failed.edit.plugin} to ${KUBB_CONFIG_FILENAME}: ${failed.reason}`,\n help: `Run kubb init without that plugin, then add it with kubb add.`,\n })\n return source\n}\n\n/** Generates from the config at `configPath` without reporters, and returns how many files it wrote. */\nasync function firstRun(configPath: string): Promise<number> {\n const { configs } = await getConfigs({ configPath })\n let files = 0\n for (const config of configs) {\n const result = await createKubb(config).generate()\n if (!result.success) throw new Error(result.diagnostics.flatMap((diagnostic) => (diagnostic.severity === 'error' ? [diagnostic.message] : [])).join('\\n'))\n files += result.files.length\n }\n return files\n}\n\n/** The command that runs `kubb generate`: the `generate` script when it runs Kubb, otherwise `npx kubb generate`. */\nfunction generateCommand({ packageManager, script, watch }: { packageManager: PackageManagerInfo; script: string | undefined; watch: boolean }): string {\n if (script !== 'kubb generate') return `npx kubb generate${watch ? ' --watch' : ''}`\n const { command, args } = resolveCommand(packageManager.agent, 'run', watch ? ['generate', '--watch'] : ['generate'])!\n return [command, ...args].join(' ')\n}\n\n/**\n * Runs the Kubb setup wizard: detects the package manager and specs, asks for the spec, plugins, and\n * output folder, shows the config for review, then installs, writes `kubb.config.ts`, adds a\n * `generate` script, and runs the first generation.\n * Pass `yes: true` to skip all prompts and print one line per step.\n */\nexport async function run({ yes, input: inputFlag, output: outputFlag, plugins: pluginsFlag, dryRun }: InitOptions): Promise<void> {\n const cwd = process.cwd()\n\n if (!yes) logIntro({ title: isInteractiveRun({ yes, dryRun: dryRun.enabled }) ? undefined : 'Set up Kubb' })\n\n try {\n // Start the registry fetch now but await it only at the plugin step, so the first prompt never waits on the network\n const registry = fetchRegistryIndex({ registry: registryUrl() }).then((entries) =>\n entries.filter((entry) => entry.kind === 'plugin' && !incompatibility(entry.manifest)),\n )\n registry.catch(() => {})\n\n if (!(await exists(path.join(cwd, 'package.json')))) {\n if (!yes) {\n const shouldInit = unwrap(await clack.confirm({ message: 'No package.json found. Would you like to create one?', initialValue: true }))\n if (!shouldInit) cancelAndExit()\n }\n\n const packageManager = await detectPackageManager(cwd)\n await withSpinner({\n message: `Initializing package.json with ${packageManager.name}`,\n promise: initPackageJson(cwd, packageManager),\n done: () => `Created package.json with ${packageManager.name}`,\n failed: 'Could not create package.json',\n plain: yes,\n })\n }\n\n const packageManager = await detectPackageManager(cwd)\n const specs = await findSpecFiles(cwd)\n\n if (!yes) {\n logStep(`Package manager ${packageManager.name}`)\n if (specs[0]) {\n const { version: specVersion, operations } = await readSpecInfo(path.join(cwd, specs[0]))\n const details = [\n specs[0].slice(2),\n specVersion ? `${specVersion.startsWith('2') ? 'Swagger' : 'OpenAPI'} ${specVersion}` : undefined,\n operations === undefined ? undefined : pluralize(operations, 'operation'),\n specs.length > 1 ? `+${specs.length - 1} more` : undefined,\n ]\n logStep(`Found ${details.filter(Boolean).join(' · ')}`)\n }\n }\n\n // `--plugins` and `--yes` need the registry before any prompt; the interactive path reads it at the plugin step\n const plugins = pluginsFlag || yes ? await registry : undefined\n const defaultPlugins = (entries: Array<RegistryEntry>) => initDefaults.plugins.flatMap((id) => findPlugin({ plugins: entries, id }) ?? [])\n\n const flagPlugins = pluginsFlag && plugins ? parsePluginsFlag({ plugins, value: pluginsFlag }) : undefined\n\n let choices: Choices = {\n inputPath: inputFlag ?? specs[0] ?? initDefaults.inputPath,\n outputPath: outputFlag ?? initDefaults.outputPath,\n plugins: flagPlugins ?? (plugins ? defaultPlugins(plugins) : []),\n }\n if (yes && !choices.plugins.length) {\n throw new Error('The registry has no default plugin. Pass --plugins to choose one.')\n }\n\n async function askInput(current: string): Promise<string> {\n const choice = specs.length\n ? unwrap(\n await clack.select({\n message: 'Which spec should Kubb read?',\n options: [\n ...specs.map((spec) => ({ value: spec, label: spec, hint: 'found in this repo' })),\n { value: 'url', label: 'A URL' },\n { value: 'file', label: 'Another file' },\n ],\n initialValue: specs.includes(current) ? current : isHttpUrl(current) ? 'url' : 'file',\n }),\n )\n : isHttpUrl(current)\n ? 'url'\n : 'file'\n if (specs.includes(choice)) return choice\n const isUrl = choice === 'url'\n const initial = isUrl === isHttpUrl(current) && !specs.includes(current) ? current : undefined\n return unwrap(\n await clack.text({\n message: isUrl ? 'Spec URL' : 'Spec path',\n placeholder: isUrl ? 'https://example.com/openapi.yaml' : initDefaults.inputPath,\n initialValue: initial,\n defaultValue: isUrl ? undefined : initDefaults.inputPath,\n validate: (value) => {\n if (isUrl && !isHttpUrl(value ?? '')) return 'Enter an http(s) URL'\n },\n }),\n )\n }\n\n async function askPlugins(previous: Array<RegistryEntry>): Promise<Array<RegistryEntry>> {\n const plugins = await registry\n const current = previous.length ? previous : defaultPlugins(plugins)\n const width = Math.max(...plugins.map((entry) => entry.manifest.displayName.length))\n const nameWidth = Math.max(...plugins.map((entry) => entry.manifest.name.length))\n const values = unwrap(\n await clack.multiselect({\n message: 'What should Kubb generate?',\n options: plugins.map(({ id, manifest }) => ({\n value: id,\n label: `${manifest.displayName.padEnd(width)} ${styleText('dim', manifest.name.padEnd(nameWidth))}`.trimEnd(),\n })),\n initialValues: current.map((entry) => entry.id),\n required: true,\n }),\n )\n return plugins.filter((entry) => values.includes(entry.id))\n }\n\n // Flags for all three choices leave nothing to ask or review, as before the review step existed\n const answered = yes || Boolean(inputFlag && outputFlag && pluginsFlag)\n if (!answered) {\n let firstPass = true\n while (true) {\n // The first pass skips the questions a flag answered; \"Change a choice\" asks them all again.\n choices = {\n inputPath: firstPass && inputFlag ? inputFlag : await askInput(choices.inputPath),\n plugins: firstPass && flagPlugins ? flagPlugins : await askPlugins(choices.plugins),\n outputPath:\n firstPass && outputFlag\n ? outputFlag\n : unwrap(await clack.text({ message: 'Output folder', placeholder: choices.outputPath, defaultValue: choices.outputPath })),\n }\n firstPass = false\n const missing = missingPluginDependencies(choices.plugins.map((entry) => entry.manifest))\n if (missing.length) {\n logWarn(`${missing.join('\\n')}\\nAdd the missing plugins.`)\n continue\n }\n const config = buildConfig(choices)\n const packages = [KUBB_PACKAGE_NAME, ...choices.plugins.map((entry) => entry.artifact.package)]\n logStep(`Review ${KUBB_CONFIG_FILENAME}`)\n logBlock([...config.trimEnd().split('\\n'), '', `${styleText('dim', 'Installs')} ${packages.join(' ')} with ${packageManager.name}`])\n const configExists = await exists(path.join(cwd, KUBB_CONFIG_FILENAME))\n const confirmed = unwrap(\n await clack.select({\n message: configExists ? `${KUBB_CONFIG_FILENAME} exists. Overwrite it?` : 'Create it?',\n options: [\n { value: true, label: 'Yes' },\n { value: false, label: 'Change a choice' },\n ],\n }),\n )\n if (confirmed) break\n }\n }\n\n // Check the selection against the plugins' manifests before installing anything\n const missing = missingPluginDependencies(choices.plugins.map((entry) => entry.manifest))\n if (missing.length) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.missingDependency,\n severity: 'error',\n message: `${missing.join('\\n')}\\nAdd the missing plugins and run kubb init again.`,\n })\n }\n\n const configPath = path.join(cwd, KUBB_CONFIG_FILENAME)\n if (answered && !yes && (await exists(configPath))) {\n const overwrite = unwrap(await clack.confirm({ message: `${KUBB_CONFIG_FILENAME} exists. Overwrite it?`, initialValue: false }))\n if (!overwrite) cancelAndExit('Keeping existing configuration.')\n }\n\n // Install `kubb` at the running CLI's version and each plugin at the version the registry pins\n const packagesToInstall = [`${KUBB_PACKAGE_NAME}@${version}`, ...choices.plugins.map((entry) => installSpec(entry.artifact))]\n const packageNames = [KUBB_PACKAGE_NAME, ...choices.plugins.map((entry) => entry.artifact.package)]\n const dry = { message: `install ${packagesToInstall.length} packages with ${packageManager.name}` }\n if (yes) {\n await withSpinner({\n message: '',\n promise: dryRun.run(() => installPackages(packagesToInstall, packageManager, cwd), dry),\n done: () => `Installed ${packageNames.join(' ')} with ${packageManager.name}`,\n plain: true,\n })\n } else {\n await installWithSpinner({\n packages: packagesToInstall,\n names: `${packagesToInstall.length} packages`,\n packageManager,\n cwd,\n install: async (packages, packageManager, cwd, onLine) => void (await dryRun.run(() => installPackages(packages, packageManager, cwd, onLine), dry)),\n })\n }\n\n await withSpinner({\n message: `Writing ${KUBB_CONFIG_FILENAME}`,\n promise: dryRun.run(async () => void (await write(configPath, buildConfig(choices))), { message: `write ${KUBB_CONFIG_FILENAME}` }),\n done: () => `Wrote ${KUBB_CONFIG_FILENAME}`,\n failed: `Could not write ${KUBB_CONFIG_FILENAME}`,\n plain: yes,\n })\n\n const scriptAdded = await dryRun.run(() => addGenerateScript(cwd), {\n message: 'add a generate script to package.json',\n resolve: async () => (await generateScript(cwd)) === undefined,\n })\n if (scriptAdded && !yes) logStep('Added \"generate\": \"kubb generate\" to package.json')\n\n const script = scriptAdded ? 'kubb generate' : await generateScript(cwd)\n const runStart = process.hrtime()\n try {\n await dryRun.run(\n () =>\n withSpinner({\n message: 'Running the first generation',\n promise: firstRun(configPath),\n done: (files) =>\n yes\n ? `Generated ${pluralize(files, 'file')} in ${choices.outputPath}`\n : `First run ${pluralize(files, 'file')} in ${choices.outputPath} · ${formatMs(getElapsedMs(runStart))}`,\n failed: 'First run failed',\n plain: yes,\n }),\n { message: 'run the first generation', resolve: () => 0 },\n )\n } catch (error) {\n logError(error instanceof Error ? error.message : String(error))\n const message = `Kubb is set up, but the first run failed. Fix the error, then run ${generateCommand({ packageManager, script, watch: false })}.`\n if (yes) console.log(message)\n else logOutro(styleText('yellow', message))\n process.exitCode = 1\n return\n }\n\n if (yes) {\n console.log(`Kubb is set up. Run ${generateCommand({ packageManager, script, watch: false })} after changing the spec.`)\n return\n }\n logOutro(`${styleText('green', '✓ Kubb is set up')}\\n ${styleText('dim', 'Next')} ${generateCommand({ packageManager, script, watch: true })}`)\n } catch (error) {\n logError(styleText('red', 'An error occurred during initialization'))\n if (error instanceof Error) {\n logError(error.message)\n }\n process.exit(1)\n }\n}\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'init',\n description: 'Set up a config, install plugins, and run the first generation.',\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 --yes --input ./openapi.yaml --plugins ts,zod --output src/api',\n 'kubb init --plugins plugin-ts,plugin-axios,plugin-react-query',\n 'kubb init --yes --dry-run',\n ].join('\\n'),\n toKebab: true,\n args: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use the detected spec, the default plugin, and the default output folder',\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 Kubb registry ids of the plugins to add, the same ids `kubb add` takes (plugin-ts, plugin-zod, acme/plugin-x), or short names (ts, zod)',\n metavar: 'plugin-ts,plugin-zod,...',\n },\n },\n run: ({ values, extensions }) => run({ yes: values.yes, input: values.input, output: values.output, plugins: values.plugins, dryRun: extensions[dryRunId] }),\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,S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@@ -1,10 +1,10 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-BV8xUvPy.cjs");
|
|
2
2
|
const require_config = require("./config-BU9xeaGq.cjs");
|
|
3
|
-
const require_configFile = require("./configFile-
|
|
3
|
+
const require_configFile = require("./configFile-CFaV_To0.cjs");
|
|
4
4
|
const require_errors = require("./errors-Bewwe8mY.cjs");
|
|
5
5
|
const require_utils = require("./utils-_hY0r-7x.cjs");
|
|
6
6
|
const require_spinner = require("./spinner-BQgUoe7F.cjs");
|
|
7
|
-
const require_shared = require("./shared-
|
|
7
|
+
const require_shared = require("./shared-CK7OtOSX.cjs");
|
|
8
8
|
const require_intro = require("./intro-PFXmY9bD.cjs");
|
|
9
9
|
const require_log = require("./log-BzmBldY6.cjs");
|
|
10
10
|
const require_summary = require("./summary-n4osDoch.cjs");
|
|
@@ -337,4 +337,4 @@ exports.command = command;
|
|
|
337
337
|
exports.run = run;
|
|
338
338
|
exports.summarize = summarize;
|
|
339
339
|
|
|
340
|
-
//# sourceMappingURL=run-
|
|
340
|
+
//# sourceMappingURL=run-w8oRvtdl.cjs.map
|