@kubb/cli 5.18.8 → 5.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/{Telemetry-CBzCK4kO.cjs → Telemetry-B2TeLVo4.cjs} +2 -2
  2. package/dist/{Telemetry-CBzCK4kO.cjs.map → Telemetry-B2TeLVo4.cjs.map} +1 -1
  3. package/dist/{Telemetry-DUl_hxVn.js → Telemetry-Ctyp_EFO.js} +2 -2
  4. package/dist/{Telemetry-DUl_hxVn.js.map → Telemetry-Ctyp_EFO.js.map} +1 -1
  5. package/dist/{background-CA9lRKAK.js → background-CByahHYn.js} +2 -2
  6. package/dist/{background-CA9lRKAK.js.map → background-CByahHYn.js.map} +1 -1
  7. package/dist/{background-DK3HLyNk.js → background-D60rO2Lz.js} +1 -1
  8. package/dist/{background-fhpYDuSs.cjs → background-D6dQxXt6.cjs} +2 -2
  9. package/dist/{background-fhpYDuSs.cjs.map → background-D6dQxXt6.cjs.map} +1 -1
  10. package/dist/{configFile-BQ-Pp7i_.cjs → configFile-B_xrd2yx.cjs} +5 -5
  11. package/dist/configFile-B_xrd2yx.cjs.map +1 -0
  12. package/dist/{configFile-CPXDgTC2.js → configFile-Bh_5k4pf.js} +5 -5
  13. package/dist/configFile-Bh_5k4pf.js.map +1 -0
  14. package/dist/{fs-CmODfKN-.js → fs-CWRKTIst.js} +59 -2
  15. package/dist/fs-CWRKTIst.js.map +1 -0
  16. package/dist/index.cjs +11 -11
  17. package/dist/index.js +11 -11
  18. package/dist/{installWithSpinner-gv_OWgww.js → installWithSpinner-RJhWCsgh.js} +2 -2
  19. package/dist/{installWithSpinner-gv_OWgww.js.map → installWithSpinner-RJhWCsgh.js.map} +1 -1
  20. package/dist/{installWithSpinner-DZDlVp1J.cjs → installWithSpinner-qjIqjyiW.cjs} +3 -3
  21. package/dist/{installWithSpinner-DZDlVp1J.cjs.map → installWithSpinner-qjIqjyiW.cjs.map} +1 -1
  22. package/dist/{mcp-CQXp9pcW.js → mcp-BrB7TJZU.js} +2 -2
  23. package/dist/{mcp-CQXp9pcW.js.map → mcp-BrB7TJZU.js.map} +1 -1
  24. package/dist/{mcp-BBD4kdKF.cjs → mcp-D2gcpCcx.cjs} +2 -2
  25. package/dist/{mcp-BBD4kdKF.cjs.map → mcp-D2gcpCcx.cjs.map} +1 -1
  26. package/dist/package-CcsdQpSf.js +5 -0
  27. package/dist/package-CcsdQpSf.js.map +1 -0
  28. package/dist/{package-DXNoJQYa.cjs → package-DM5mr0Yc.cjs} +2 -2
  29. package/dist/package-DM5mr0Yc.cjs.map +1 -0
  30. package/dist/{reporters-DeruUk9K.js → reporters-B6p0n7s3.js} +8 -66
  31. package/dist/reporters-B6p0n7s3.js.map +1 -0
  32. package/dist/{reporters-CzxaQ_bD.js → reporters-BDzKLpyo.js} +1 -1
  33. package/dist/{reporters-CaJ8brYA.cjs → reporters-DLK4D0js.cjs} +10 -68
  34. package/dist/reporters-DLK4D0js.cjs.map +1 -0
  35. package/dist/{run-GdctJlXN.cjs → run-3OxB7Zxn.cjs} +5 -5
  36. package/dist/{run-GdctJlXN.cjs.map → run-3OxB7Zxn.cjs.map} +1 -1
  37. package/dist/{run-Bxqg0GuI.cjs → run-4MUhIiPj.cjs} +2 -2
  38. package/dist/{run-Bxqg0GuI.cjs.map → run-4MUhIiPj.cjs.map} +1 -1
  39. package/dist/{run-OqiJknWr.cjs → run-6qjg9Twy.cjs} +7 -7
  40. package/dist/{run-OqiJknWr.cjs.map → run-6qjg9Twy.cjs.map} +1 -1
  41. package/dist/{run-CYdKWpyH.js → run-B3TuKUr4.js} +5 -5
  42. package/dist/{run-CYdKWpyH.js.map → run-B3TuKUr4.js.map} +1 -1
  43. package/dist/{run-Bi8hhAzv.js → run-BJiP4ib3.js} +1 -1
  44. package/dist/{run-CmHjIMpd.js → run-BSsTBfse.js} +5 -5
  45. package/dist/{run-CmHjIMpd.js.map → run-BSsTBfse.js.map} +1 -1
  46. package/dist/{run-k-LqKkgU.cjs → run-C2lQXYrF.cjs} +5 -5
  47. package/dist/{run-k-LqKkgU.cjs.map → run-C2lQXYrF.cjs.map} +1 -1
  48. package/dist/{run-CIEKCdM-.cjs → run-C6tE9zTS.cjs} +6 -6
  49. package/dist/{run-CIEKCdM-.cjs.map → run-C6tE9zTS.cjs.map} +1 -1
  50. package/dist/{run-96_svbr3.js → run-CC9TBCph.js} +4 -4
  51. package/dist/{run-96_svbr3.js.map → run-CC9TBCph.js.map} +1 -1
  52. package/dist/{run-ixh050Ip.js → run-CcWmws1R.js} +2 -2
  53. package/dist/{run-ixh050Ip.js.map → run-CcWmws1R.js.map} +1 -1
  54. package/dist/{run-Df4PGOFX.js → run-Cxfs1SLQ.js} +4 -4
  55. package/dist/{run-Df4PGOFX.js.map → run-Cxfs1SLQ.js.map} +1 -1
  56. package/dist/{run-DLRu4z5Z.cjs → run-D0HO6_Yr.cjs} +4 -4
  57. package/dist/{run-DLRu4z5Z.cjs.map → run-D0HO6_Yr.cjs.map} +1 -1
  58. package/dist/{run-ORjkOWFp.js → run-D2tJP_b8.js} +2 -2
  59. package/dist/{run-ORjkOWFp.js.map → run-D2tJP_b8.js.map} +1 -1
  60. package/dist/{run-U2Ze_QP4.js → run-DFOjQVMO.js} +6 -6
  61. package/dist/{run-U2Ze_QP4.js.map → run-DFOjQVMO.js.map} +1 -1
  62. package/dist/{run-CpyFU0RM.js → run-Dyzva1xB.js} +6 -6
  63. package/dist/{run-CpyFU0RM.js.map → run-Dyzva1xB.js.map} +1 -1
  64. package/dist/{run-BIgV2zvB.cjs → run-ejmyJI37.cjs} +2 -2
  65. package/dist/{run-BIgV2zvB.cjs.map → run-ejmyJI37.cjs.map} +1 -1
  66. package/dist/{run-BSA2x4iE.cjs → run-lH8k2FY7.cjs} +6 -6
  67. package/dist/{run-BSA2x4iE.cjs.map → run-lH8k2FY7.cjs.map} +1 -1
  68. package/dist/{snapshot-C-ge8g3_.cjs → snapshot-DdRni_x5.cjs} +4 -4
  69. package/dist/{snapshot-C-ge8g3_.cjs.map → snapshot-DdRni_x5.cjs.map} +1 -1
  70. package/dist/{snapshot-CSacL1qI.js → snapshot-DnqAAzKE.js} +4 -4
  71. package/dist/{snapshot-CSacL1qI.js.map → snapshot-DnqAAzKE.js.map} +1 -1
  72. package/dist/{spinner-D584jFAz.cjs → spinner-BQgUoe7F.cjs} +70 -1
  73. package/dist/spinner-BQgUoe7F.cjs.map +1 -0
  74. package/dist/{status-Bq-Bjo2n.js → status-X9BNNp9F.js} +3 -3
  75. package/dist/{status-Bq-Bjo2n.js.map → status-X9BNNp9F.js.map} +1 -1
  76. package/dist/{status-D-Osmkhr.cjs → status-wHJjD3Fs.cjs} +3 -3
  77. package/dist/{status-D-Osmkhr.cjs.map → status-wHJjD3Fs.cjs.map} +1 -1
  78. package/dist/{studio-BZ53idqa.cjs → studio-j4As00N6.cjs} +11 -11
  79. package/dist/{studio-BZ53idqa.cjs.map → studio-j4As00N6.cjs.map} +1 -1
  80. package/dist/{studio-BBXKjMN-.js → studio-rRSg33RE.js} +11 -11
  81. package/dist/{studio-BBXKjMN-.js.map → studio-rRSg33RE.js.map} +1 -1
  82. package/dist/studioWorker.js +2 -2
  83. package/dist/{utils-BVccq6W0.js → utils-DnmjcKb0.js} +4 -10
  84. package/dist/utils-DnmjcKb0.js.map +1 -0
  85. package/dist/{utils-C9fYoqP2.cjs → utils-_hY0r-7x.cjs} +4 -10
  86. package/dist/utils-_hY0r-7x.cjs.map +1 -0
  87. package/dist/{validate-BuStuH_z.js → validate-CSbYneXo.js} +2 -2
  88. package/dist/{validate-BuStuH_z.js.map → validate-CSbYneXo.js.map} +1 -1
  89. package/dist/{validate-rr0LpFhN.cjs → validate-CyxoAzEK.cjs} +2 -2
  90. package/dist/{validate-rr0LpFhN.cjs.map → validate-CyxoAzEK.cjs.map} +1 -1
  91. package/package.json +7 -7
  92. package/dist/configFile-BQ-Pp7i_.cjs.map +0 -1
  93. package/dist/configFile-CPXDgTC2.js.map +0 -1
  94. package/dist/fs-CmODfKN-.js.map +0 -1
  95. package/dist/package-CdMFA8OG.js +0 -5
  96. package/dist/package-CdMFA8OG.js.map +0 -1
  97. package/dist/package-DXNoJQYa.cjs.map +0 -1
  98. package/dist/reporters-CaJ8brYA.cjs.map +0 -1
  99. package/dist/reporters-DeruUk9K.js.map +0 -1
  100. package/dist/spinner-D584jFAz.cjs.map +0 -1
  101. package/dist/utils-BVccq6W0.js.map +0 -1
  102. package/dist/utils-C9fYoqP2.cjs.map +0 -1
@@ -14,7 +14,7 @@ function studioCommand({ action, block, ...definition }) {
14
14
  ...definition,
15
15
  toKebab: true,
16
16
  async run({ values }) {
17
- const { runStudio } = await import("./run-Bi8hhAzv.js");
17
+ const { runStudio } = await import("./run-BJiP4ib3.js");
18
18
  await runStudio(values, action, { block });
19
19
  }
20
20
  });
@@ -43,7 +43,7 @@ const command$7 = studioCommand({
43
43
  },
44
44
  block: true,
45
45
  async action(options) {
46
- const { connect } = await import("./run-Bi8hhAzv.js");
46
+ const { connect } = await import("./run-BJiP4ib3.js");
47
47
  await connect(options);
48
48
  }
49
49
  });
@@ -54,7 +54,7 @@ const command$6 = studioCommand({
54
54
  examples: ["kubb studio login", "kubb studio login --url http://localhost:3000"].join("\n"),
55
55
  args: command$7.args,
56
56
  async action(options) {
57
- const { login } = await import("./run-Bi8hhAzv.js");
57
+ const { login } = await import("./run-BJiP4ib3.js");
58
58
  await login(options);
59
59
  }
60
60
  });
@@ -65,7 +65,7 @@ const command$5 = studioCommand({
65
65
  examples: "kubb studio logout",
66
66
  args: {},
67
67
  async action() {
68
- const { stopWorker } = await import("./background-DK3HLyNk.js");
68
+ const { stopWorker } = await import("./background-D60rO2Lz.js");
69
69
  const { clearCredentials } = await import("./credentials-DznluKkp.js");
70
70
  await stopWorker();
71
71
  await clearCredentials();
@@ -80,7 +80,7 @@ const command$4 = studioCommand({
80
80
  args: {},
81
81
  async action(options) {
82
82
  const { readCredentials } = await import("./credentials-DznluKkp.js");
83
- const { resolvePermissions } = await import("./run-Bi8hhAzv.js");
83
+ const { resolvePermissions } = await import("./run-BJiP4ib3.js");
84
84
  const { canUseTTY } = await import("./env-BgVegN_u.js");
85
85
  const credentials = await readCredentials();
86
86
  if (!credentials) throw new Error("This project is not paired with Kubb Studio. Run `kubb studio` first.");
@@ -125,7 +125,7 @@ const command$3 = define({
125
125
  ...logLevelArg
126
126
  },
127
127
  async run(ctx) {
128
- const { runner } = await import("./snapshot-CSacL1qI.js");
128
+ const { runner } = await import("./snapshot-DnqAAzKE.js");
129
129
  await runner(ctx);
130
130
  }
131
131
  });
@@ -135,7 +135,7 @@ const command$2 = studioCommand({
135
135
  description: "Keep this project connected to Kubb Studio in the background.",
136
136
  args: command$7.args,
137
137
  async action(options) {
138
- const { startWorker } = await import("./background-DK3HLyNk.js");
138
+ const { startWorker } = await import("./background-D60rO2Lz.js");
139
139
  await startWorker(options);
140
140
  }
141
141
  });
@@ -143,7 +143,7 @@ const stopCommand = define({
143
143
  name: "stop",
144
144
  description: "Stop this project's background connection and keep its pairing.",
145
145
  async run() {
146
- const { stopWorker } = await import("./background-DK3HLyNk.js");
146
+ const { stopWorker } = await import("./background-D60rO2Lz.js");
147
147
  await stopWorker();
148
148
  console.log("Background connection stopped.");
149
149
  }
@@ -155,9 +155,9 @@ const command$1 = studioCommand({
155
155
  examples: "kubb studio status",
156
156
  args: { url: studioConnectionArgs.url },
157
157
  async action(options) {
158
- const { getWorkerLogPath, getWorkerStatus } = await import("./background-DK3HLyNk.js");
158
+ const { getWorkerLogPath, getWorkerStatus } = await import("./background-D60rO2Lz.js");
159
159
  const { readCredentials } = await import("./credentials-DznluKkp.js");
160
- const { formatStatus } = await import("./status-Bq-Bjo2n.js");
160
+ const { formatStatus } = await import("./status-X9BNNp9F.js");
161
161
  const [worker, credentials] = await Promise.all([getWorkerStatus(), readCredentials()]);
162
162
  console.log([
163
163
  "",
@@ -212,4 +212,4 @@ function routeStudioFlags(args) {
212
212
  }
213
213
  export { command, routeStudioFlags };
214
214
 
215
- //# sourceMappingURL=studio-BBXKjMN-.js.map
215
+ //# sourceMappingURL=studio-rRSg33RE.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"studio-BBXKjMN-.js","names":["command","command","connectCommand","command","command","command","command","connectCommand","command","connectCommand","startCommand","loginCommand","logoutCommand","statusCommand","permissionsCommand","snapshotCommand"],"sources":["../src/commands/studio/studioCommand.ts","../src/commands/studio/connect.ts","../src/commands/studio/login.ts","../src/commands/studio/logout.ts","../src/commands/studio/permissions.ts","../src/commands/studio/snapshot.ts","../src/commands/studio/background.ts","../src/commands/studio/status.ts","../src/commands/studio/index.ts"],"sourcesContent":["import { type Args, define } from 'gunshi'\nimport type { StudioOptions, StudioValues } from '../../runners/studio/run.ts'\n\n/**\n * Defines a `kubb studio` subcommand. The runner, and with it `@kubb/studio`, loads only when the\n * command runs, so `kubb --help` never does.\n */\nexport function studioCommand({\n action,\n block,\n ...definition\n}: {\n name: string\n description: string\n examples?: string\n args?: Args\n /** Opens a block a later `logOutro` closes, for a command that keeps running. */\n block?: boolean\n /** The command body, given the options built from its flags. */\n action: (options: StudioOptions) => Promise<unknown>\n}) {\n return define({\n ...definition,\n toKebab: true,\n async run({ values }) {\n const { runStudio } = await import('../../runners/studio/run.ts')\n await runStudio(values as StudioValues, action, { block })\n },\n })\n}\n","import { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\nimport { studioCommand } from './studioCommand.ts'\n\nexport const command = studioCommand({\n name: 'connect',\n description: 'Connect this project to Kubb Studio and generate from the browser.',\n examples: [\n 'kubb studio connect',\n 'kubb studio connect --allow-read',\n 'kubb studio connect --allow-write --allow-exec',\n 'kubb studio connect --url http://localhost:3000',\n ].join('\\n'),\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n open: {\n type: 'boolean',\n description: 'Open the approval page in a browser while pairing',\n default: true,\n negatable: true,\n },\n ...logLevelArg,\n },\n block: true,\n async action(options) {\n const { connect } = await import('../../runners/studio/run.ts')\n await connect(options)\n },\n})\n","import { command as connectCommand } from './connect.ts'\nimport { studioCommand } from './studioCommand.ts'\n\nexport const command = studioCommand({\n name: 'login',\n description: 'Pair this machine with Kubb Studio without connecting.',\n examples: ['kubb studio login', 'kubb studio login --url http://localhost:3000'].join('\\n'),\n args: connectCommand.args,\n async action(options) {\n const { login } = await import('../../runners/studio/run.ts')\n await login(options)\n },\n})\n","import { studioCommand } from './studioCommand.ts'\n\nexport const command = studioCommand({\n name: 'logout',\n description: 'Forget the stored Kubb Studio token.',\n examples: 'kubb studio logout',\n args: {},\n async action() {\n const { stopWorker } = await import('../../runners/studio/background.ts')\n const { clearCredentials } = await import('../../runners/studio/credentials.ts')\n await stopWorker()\n await clearCredentials()\n console.log('Signed out of Kubb Studio.')\n },\n})\n","import path from 'node:path'\nimport process from 'node:process'\nimport { findConfigFile } from '@internals/shared'\nimport { studioCommand } from './studioCommand.ts'\n\nexport const command = studioCommand({\n name: 'permissions',\n description: 'Change what Kubb Studio may do in this project.',\n examples: 'kubb studio permissions',\n args: {},\n async action(options) {\n const { readCredentials } = await import('../../runners/studio/credentials.ts')\n const { resolvePermissions } = await import('../../runners/studio/run.ts')\n const { canUseTTY } = await import('../../utils/env.ts')\n\n const credentials = await readCredentials()\n if (!credentials) throw new Error('This project is not paired with Kubb Studio. Run `kubb studio` first.')\n if (!canUseTTY()) throw new Error('Changing permissions needs an interactive terminal.')\n\n const configFile = findConfigFile()\n await resolvePermissions(options, credentials, configFile && path.relative(process.cwd(), configFile), { edit: true })\n console.log(\n 'Permissions saved. A running connection keeps the old ones until you restart it: press Ctrl+C and run `kubb studio` again, or run `kubb studio stop`, then `kubb studio start`. Keep `--url` and `--config`, and leave out the `--allow-*` flag of any permission you turned off, since a flag grants it anyway.',\n )\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'snapshot',\n description: 'Generate and publish a Kubb Studio snapshot from CI.',\n examples: ['kubb studio snapshot', 'kubb studio snapshot --json'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n id: {\n type: 'string',\n description: 'Stable identity for the CI agent, such as a pull request. Auto-detected on GitHub Actions, GitLab CI, Bitbucket Pipelines and CircleCI',\n },\n baseId: {\n type: 'string',\n description:\n \"Identity of another CI agent, such as the base branch's, to also compare this snapshot with. Auto-detected on GitHub pull requests and GitLab merge requests\",\n toKebab: true,\n },\n name: {\n type: 'string',\n description: 'Package name for the generated tarball. Defaults to the name in package.json',\n },\n packageVersion: {\n type: 'string',\n description: 'Package version for the generated tarball. Defaults to the version in package.json',\n toKebab: true,\n },\n json: {\n type: 'boolean',\n description: 'Print the result as one JSON object instead of a summary',\n default: false,\n },\n ...logLevelArg,\n },\n async run(ctx) {\n const { runner } = await import('../../runners/studio/snapshot.ts')\n await runner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\nimport { studioCommand } from './studioCommand.ts'\n\nexport const command = studioCommand({\n name: 'start',\n description: 'Keep this project connected to Kubb Studio in the background.',\n args: connectCommand.args,\n async action(options) {\n const { startWorker } = await import('../../runners/studio/background.ts')\n await startWorker(options)\n },\n})\n\nexport const stopCommand = define({\n name: 'stop',\n description: \"Stop this project's background connection and keep its pairing.\",\n async run() {\n const { stopWorker } = await import('../../runners/studio/background.ts')\n await stopWorker()\n console.log('Background connection stopped.')\n },\n})\n","import process from 'node:process'\nimport { studioConnectionArgs } from '../shared.ts'\nimport { studioCommand } from './studioCommand.ts'\n\nexport const command = studioCommand({\n name: 'status',\n description: 'Show the project worker, Kubb Studio pairing, and saved permissions.',\n examples: 'kubb studio status',\n args: { url: studioConnectionArgs.url },\n async action(options) {\n const { getWorkerLogPath, getWorkerStatus } = await import('../../runners/studio/background.ts')\n const { readCredentials } = await import('../../runners/studio/credentials.ts')\n const { formatStatus } = await import('../../runners/studio/status.ts')\n\n const [worker, credentials] = await Promise.all([getWorkerStatus(), readCredentials()])\n console.log(\n ['', ...formatStatus({ studioUrl: options.studioUrl, credentials, worker, project: process.cwd(), logPath: getWorkerLogPath() }), ''].join('\\n'),\n )\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\nimport { command as loginCommand } from './login.ts'\nimport { command as logoutCommand } from './logout.ts'\nimport { command as permissionsCommand } from './permissions.ts'\nimport { command as snapshotCommand } from './snapshot.ts'\nimport { command as startCommand, stopCommand } from './background.ts'\nimport { command as statusCommand } from './status.ts'\n\nexport const command = define({\n ...connectCommand,\n name: 'studio',\n description: 'Connect this project to Kubb Studio, or manage its pairing and snapshots.',\n examples: [\n 'kubb studio',\n 'kubb studio --allow-read',\n 'kubb studio login',\n 'kubb studio status',\n 'kubb studio permissions',\n 'kubb studio logout',\n 'kubb studio snapshot',\n ].join('\\n'),\n subCommands: {\n start: startCommand,\n stop: stopCommand,\n connect: connectCommand,\n login: loginCommand,\n logout: logoutCommand,\n status: statusCommand,\n permissions: permissionsCommand,\n snapshot: snapshotCommand,\n },\n})\n\n/**\n * Sends `kubb studio --flag value` to `kubb studio connect`, the same runner. gunshi picks a\n * subcommand from the first token that is not a flag, so `--url http://…` would read the URL as one.\n */\nexport function routeStudioFlags(args: Array<string>): Array<string> {\n const [name, next] = args\n if (name !== 'studio' || !next?.startsWith('-') || next === '--help' || next === '-h') return args\n\n return ['studio', 'connect', ...args.slice(1)]\n}\n"],"mappings":";;;;;;;;;;;AAOA,SAAgB,cAAc,EAC5B,QACA,OACA,GAAG,cAUF;CACD,OAAO,OAAO;EACZ,GAAG;EACH,SAAS;EACT,MAAM,IAAI,EAAE,UAAU;GACpB,MAAM,EAAE,cAAc,MAAM,OAAO;GACnC,MAAM,UAAU,QAAwB,QAAQ,EAAE,MAAM,CAAC;EAC3D;CACF,CAAC;AACH;;AC1BA,MAAaA,YAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,UAAU;EACR;EACA;EACA;EACA;CACF,CAAC,CAA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Aa;IAAE,WAAW,QAAQ;IAAW;IAAa;IAAQ,SAAS,QAAQ,IAAI;IAAG,SAAS,iBAAiB;GAAE,CAAC;GAAG;EAAE,CAAC,CAAC,KAAK,IAAI,CACjJ;CACF;AACF,CAAC;;ACVD,MAAa,UAAU,OAAO;CAC5B,GAAGC;CACH,MAAM;CACN,aAAa;CACb,UAAU;EACR;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CACX,aAAa;EACX,OAAOC;EACP,MAAM;EACN,SAASD;EACT,OAAOE;EACP,QAAQC;EACR,QAAQC;EACR,aAAaC;EACb,UAAUC;CACZ;AACF,CAAC;;;;;AAMD,SAAgB,iBAAiB,MAAoC;CACnE,MAAM,CAAC,MAAM,QAAQ;CACrB,IAAI,SAAS,YAAY,CAAC,MAAM,WAAW,GAAG,KAAK,SAAS,YAAY,SAAS,MAAM,OAAO;CAE9F,OAAO;EAAC;EAAU;EAAW,GAAG,KAAK,MAAM,CAAC;CAAC;AAC/C"}
1
+ {"version":3,"file":"studio-rRSg33RE.js","names":["command","command","connectCommand","command","command","command","command","connectCommand","command","connectCommand","startCommand","loginCommand","logoutCommand","statusCommand","permissionsCommand","snapshotCommand"],"sources":["../src/commands/studio/studioCommand.ts","../src/commands/studio/connect.ts","../src/commands/studio/login.ts","../src/commands/studio/logout.ts","../src/commands/studio/permissions.ts","../src/commands/studio/snapshot.ts","../src/commands/studio/background.ts","../src/commands/studio/status.ts","../src/commands/studio/index.ts"],"sourcesContent":["import { type Args, define } from 'gunshi'\nimport type { StudioOptions, StudioValues } from '../../runners/studio/run.ts'\n\n/**\n * Defines a `kubb studio` subcommand. The runner, and with it `@kubb/studio`, loads only when the\n * command runs, so `kubb --help` never does.\n */\nexport function studioCommand({\n action,\n block,\n ...definition\n}: {\n name: string\n description: string\n examples?: string\n args?: Args\n /** Opens a block a later `logOutro` closes, for a command that keeps running. */\n block?: boolean\n /** The command body, given the options built from its flags. */\n action: (options: StudioOptions) => Promise<unknown>\n}) {\n return define({\n ...definition,\n toKebab: true,\n async run({ values }) {\n const { runStudio } = await import('../../runners/studio/run.ts')\n await runStudio(values as StudioValues, action, { block })\n },\n })\n}\n","import { configArg, logLevelArg, studioConnectionArgs, studioPermissionArgs } from '../shared.ts'\nimport { studioCommand } from './studioCommand.ts'\n\nexport const command = studioCommand({\n name: 'connect',\n description: 'Connect this project to Kubb Studio and generate from the browser.',\n examples: [\n 'kubb studio connect',\n 'kubb studio connect --allow-read',\n 'kubb studio connect --allow-write --allow-exec',\n 'kubb studio connect --url http://localhost:3000',\n ].join('\\n'),\n args: {\n ...configArg,\n ...studioConnectionArgs,\n ...studioPermissionArgs,\n open: {\n type: 'boolean',\n description: 'Open the approval page in a browser while pairing',\n default: true,\n negatable: true,\n },\n ...logLevelArg,\n },\n block: true,\n async action(options) {\n const { connect } = await import('../../runners/studio/run.ts')\n await connect(options)\n },\n})\n","import { command as connectCommand } from './connect.ts'\nimport { studioCommand } from './studioCommand.ts'\n\nexport const command = studioCommand({\n name: 'login',\n description: 'Pair this machine with Kubb Studio without connecting.',\n examples: ['kubb studio login', 'kubb studio login --url http://localhost:3000'].join('\\n'),\n args: connectCommand.args,\n async action(options) {\n const { login } = await import('../../runners/studio/run.ts')\n await login(options)\n },\n})\n","import { studioCommand } from './studioCommand.ts'\n\nexport const command = studioCommand({\n name: 'logout',\n description: 'Forget the stored Kubb Studio token.',\n examples: 'kubb studio logout',\n args: {},\n async action() {\n const { stopWorker } = await import('../../runners/studio/background.ts')\n const { clearCredentials } = await import('../../runners/studio/credentials.ts')\n await stopWorker()\n await clearCredentials()\n console.log('Signed out of Kubb Studio.')\n },\n})\n","import path from 'node:path'\nimport process from 'node:process'\nimport { findConfigFile } from '@internals/shared'\nimport { studioCommand } from './studioCommand.ts'\n\nexport const command = studioCommand({\n name: 'permissions',\n description: 'Change what Kubb Studio may do in this project.',\n examples: 'kubb studio permissions',\n args: {},\n async action(options) {\n const { readCredentials } = await import('../../runners/studio/credentials.ts')\n const { resolvePermissions } = await import('../../runners/studio/run.ts')\n const { canUseTTY } = await import('../../utils/env.ts')\n\n const credentials = await readCredentials()\n if (!credentials) throw new Error('This project is not paired with Kubb Studio. Run `kubb studio` first.')\n if (!canUseTTY()) throw new Error('Changing permissions needs an interactive terminal.')\n\n const configFile = findConfigFile()\n await resolvePermissions(options, credentials, configFile && path.relative(process.cwd(), configFile), { edit: true })\n console.log(\n 'Permissions saved. A running connection keeps the old ones until you restart it: press Ctrl+C and run `kubb studio` again, or run `kubb studio stop`, then `kubb studio start`. Keep `--url` and `--config`, and leave out the `--allow-*` flag of any permission you turned off, since a flag grants it anyway.',\n )\n },\n})\n","import { define } from 'gunshi'\nimport { configArg, logLevelArg, studioConnectionArgs } from '../shared.ts'\n\nexport const command = define({\n name: 'snapshot',\n description: 'Generate and publish a Kubb Studio snapshot from CI.',\n examples: ['kubb studio snapshot', 'kubb studio snapshot --json'].join('\\n'),\n toKebab: true,\n args: {\n ...configArg,\n ...studioConnectionArgs,\n id: {\n type: 'string',\n description: 'Stable identity for the CI agent, such as a pull request. Auto-detected on GitHub Actions, GitLab CI, Bitbucket Pipelines and CircleCI',\n },\n baseId: {\n type: 'string',\n description:\n \"Identity of another CI agent, such as the base branch's, to also compare this snapshot with. Auto-detected on GitHub pull requests and GitLab merge requests\",\n toKebab: true,\n },\n name: {\n type: 'string',\n description: 'Package name for the generated tarball. Defaults to the name in package.json',\n },\n packageVersion: {\n type: 'string',\n description: 'Package version for the generated tarball. Defaults to the version in package.json',\n toKebab: true,\n },\n json: {\n type: 'boolean',\n description: 'Print the result as one JSON object instead of a summary',\n default: false,\n },\n ...logLevelArg,\n },\n async run(ctx) {\n const { runner } = await import('../../runners/studio/snapshot.ts')\n await runner(ctx)\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\nimport { studioCommand } from './studioCommand.ts'\n\nexport const command = studioCommand({\n name: 'start',\n description: 'Keep this project connected to Kubb Studio in the background.',\n args: connectCommand.args,\n async action(options) {\n const { startWorker } = await import('../../runners/studio/background.ts')\n await startWorker(options)\n },\n})\n\nexport const stopCommand = define({\n name: 'stop',\n description: \"Stop this project's background connection and keep its pairing.\",\n async run() {\n const { stopWorker } = await import('../../runners/studio/background.ts')\n await stopWorker()\n console.log('Background connection stopped.')\n },\n})\n","import process from 'node:process'\nimport { studioConnectionArgs } from '../shared.ts'\nimport { studioCommand } from './studioCommand.ts'\n\nexport const command = studioCommand({\n name: 'status',\n description: 'Show the project worker, Kubb Studio pairing, and saved permissions.',\n examples: 'kubb studio status',\n args: { url: studioConnectionArgs.url },\n async action(options) {\n const { getWorkerLogPath, getWorkerStatus } = await import('../../runners/studio/background.ts')\n const { readCredentials } = await import('../../runners/studio/credentials.ts')\n const { formatStatus } = await import('../../runners/studio/status.ts')\n\n const [worker, credentials] = await Promise.all([getWorkerStatus(), readCredentials()])\n console.log(\n ['', ...formatStatus({ studioUrl: options.studioUrl, credentials, worker, project: process.cwd(), logPath: getWorkerLogPath() }), ''].join('\\n'),\n )\n },\n})\n","import { define } from 'gunshi'\nimport { command as connectCommand } from './connect.ts'\nimport { command as loginCommand } from './login.ts'\nimport { command as logoutCommand } from './logout.ts'\nimport { command as permissionsCommand } from './permissions.ts'\nimport { command as snapshotCommand } from './snapshot.ts'\nimport { command as startCommand, stopCommand } from './background.ts'\nimport { command as statusCommand } from './status.ts'\n\nexport const command = define({\n ...connectCommand,\n name: 'studio',\n description: 'Connect this project to Kubb Studio, or manage its pairing and snapshots.',\n examples: [\n 'kubb studio',\n 'kubb studio --allow-read',\n 'kubb studio login',\n 'kubb studio status',\n 'kubb studio permissions',\n 'kubb studio logout',\n 'kubb studio snapshot',\n ].join('\\n'),\n subCommands: {\n start: startCommand,\n stop: stopCommand,\n connect: connectCommand,\n login: loginCommand,\n logout: logoutCommand,\n status: statusCommand,\n permissions: permissionsCommand,\n snapshot: snapshotCommand,\n },\n})\n\n/**\n * Sends `kubb studio --flag value` to `kubb studio connect`, the same runner. gunshi picks a\n * subcommand from the first token that is not a flag, so `--url http://…` would read the URL as one.\n */\nexport function routeStudioFlags(args: Array<string>): Array<string> {\n const [name, next] = args\n if (name !== 'studio' || !next?.startsWith('-') || next === '--help' || next === '-h') return args\n\n return ['studio', 'connect', ...args.slice(1)]\n}\n"],"mappings":";;;;;;;;;;;AAOA,SAAgB,cAAc,EAC5B,QACA,OACA,GAAG,cAUF;CACD,OAAO,OAAO;EACZ,GAAG;EACH,SAAS;EACT,MAAM,IAAI,EAAE,UAAU;GACpB,MAAM,EAAE,cAAc,MAAM,OAAO;GACnC,MAAM,UAAU,QAAwB,QAAQ,EAAE,MAAM,CAAC;EAC3D;CACF,CAAC;AACH;;AC1BA,MAAaA,YAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,UAAU;EACR;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CACX,MAAM;EACJ,GAAG;EACH,GAAG;EACH,GAAG;EACH,MAAM;GACJ,MAAM;GACN,aAAa;GACb,SAAS;GACT,WAAW;EACb;EACA,GAAG;CACL;CACA,OAAO;CACP,MAAM,OAAO,SAAS;EACpB,MAAM,EAAE,YAAY,MAAM,OAAO;EACjC,MAAM,QAAQ,OAAO;CACvB;AACF,CAAC;;AC1BD,MAAaC,YAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,UAAU,CAAC,qBAAqB,+CAA+C,CAAC,CAAC,KAAK,IAAI;CAC1F,MAAMC,UAAe;CACrB,MAAM,OAAO,SAAS;EACpB,MAAM,EAAE,UAAU,MAAM,OAAO;EAC/B,MAAM,MAAM,OAAO;CACrB;AACF,CAAC;;ACVD,MAAaC,YAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,UAAU;CACV,MAAM,CAAC;CACP,MAAM,SAAS;EACb,MAAM,EAAE,eAAe,MAAM,OAAO;EACpC,MAAM,EAAE,qBAAqB,MAAM,OAAO;EAC1C,MAAM,WAAW;EACjB,MAAM,iBAAiB;EACvB,QAAQ,IAAI,4BAA4B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} from "./background-CA9lRKAK.js";
3
- import { t as connect } from "./run-U2Ze_QP4.js";
2
+ import { r as serveWorker, t as getWorkerLogPath } from "./background-CByahHYn.js";
3
+ import { t as connect } from "./run-DFOjQVMO.js";
4
4
  import { format } from "node:util";
5
5
  import { appendFileSync, statSync, writeFileSync } from "node:fs";
6
6
  // src/runners/studio/worker.ts
@@ -1,5 +1,5 @@
1
1
  import "./rolldown-runtime-BowF1xt-.js";
2
- import { a as toPosixPath, i as read, o as write } from "./fs-CmODfKN-.js";
2
+ import { a as toPosixPath, i as read, l as memo, o as write } from "./fs-CWRKTIst.js";
3
3
  import process from "node:process";
4
4
  import { x } from "tinyexec";
5
5
  import fs from "node:fs";
@@ -21,16 +21,10 @@ function convert(text, pascal) {
21
21
  return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
22
22
  }).join("").replace(/[^a-zA-Z0-9]/g, "");
23
23
  }
24
- const cache = /* @__PURE__ */ new Map();
25
- const cacheLimit = 1e5;
24
+ const cache = memo.create({ max: 1e5 });
26
25
  function toCamelOrPascal(text, pascal) {
27
26
  const key = `${pascal ? "P" : "c"}${text}`;
28
- const cached = cache.get(key);
29
- if (cached !== void 0) return cached;
30
- const result = convert(text, pascal);
31
- if (cache.size >= cacheLimit) cache.clear();
32
- cache.set(key, result);
33
- return result;
27
+ return memo(cache, key, () => convert(text, pascal));
34
28
  }
35
29
  /**
36
30
  * Converts `text` to camelCase.
@@ -239,4 +233,4 @@ async function generateScript(cwd) {
239
233
  }
240
234
  export { generateScript as a, missingPluginDependencies as c, uninstallPackages as d, camelCase as f, findSpecFiles as i, parsePluginsFlag as l, detectPackageManager as n, initPackageJson as o, pascalCase as p, findPlugin as r, installPackages as s, addGenerateScript as t, readSpecInfo as u };
241
235
 
242
- //# sourceMappingURL=utils-BVccq6W0.js.map
236
+ //# sourceMappingURL=utils-DnmjcKb0.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-DnmjcKb0.js","names":[],"sources":["../../../internals/utils/src/casing.ts","../src/runners/init/utils.ts"],"sourcesContent":["import { memo } from './promise.ts'\n\ntype Options = {\n /** Text prepended before casing is applied. */\n prefix?: string\n /** Text appended before casing is applied. */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction convert(text: string, pascal: boolean): string {\n return (\n text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n // A status range such as `2xx` stays one word.\n .replace(/(\\d)(?!xx(?![a-z]))([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n )\n}\n\n// Plugins case the same names on every visit. Clearing at the limit bounds a long-running host.\nconst cache = memo.create<string, string>({ max: 100_000 })\n\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const key = `${pascal ? 'P' : 'c'}${text}`\n return memo(cache, key, () => convert(text, pascal))\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n// A word starts at `petType`, `sensor2Reading`, and `HTTPResponse`, while `IDs` and `OAuth` stay whole\nconst wordStart = /(?<=[a-z\\d])(?=[A-Z])|(?<=[A-Z]{2})(?=[A-Z][a-z]{2})/\n\n// A segment without lowercase letters, such as `COOL` or `2D`, stays one word, so a snake_case name is left unchanged.\nfunction words(text: string): Array<string> {\n return text\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .flatMap((segment) => (segment === segment.toUpperCase() ? segment : segment.split(wordStart)))\n}\n\n/**\n * Uppercases only the first character of `text`. Unlike `pascalCase` it never splits words or strips characters.\n *\n * @example\n * `capitalize('getPetById') // 'GetPetById'`\n */\nexport function capitalize(text: string): string {\n return `${text.charAt(0).toUpperCase()}${text.slice(1)}`\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * `snakeCase('helloWorld') // 'hello_world'`\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return words(`${prefix} ${text} ${suffix}`)\n .map((word) => word.replace(/[^a-zA-Z0-9]/g, '').toLowerCase())\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * `screamingSnakeCase('helloWorld') // 'HELLO_WORLD'`\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","import fs from 'node:fs'\nimport { glob } from 'node:fs/promises'\nimport path from 'node:path'\nimport process from 'node:process'\nimport { read, toPosixPath, write } from '@internals/utils'\nimport { Diagnostics, type ExtensionManifest, type RegistryEntry } from '@kubb/core'\nimport { type Agent, type AgentName, detect, resolveCommand } from 'package-manager-detector'\nimport { x } from 'tinyexec'\n\nexport type PackageManagerName = Extract<AgentName, 'npm' | 'pnpm' | 'yarn' | 'bun'>\n\n/**\n * A project's package manager: `name` for messages, `agent` for `resolveCommand`.\n */\nexport type PackageManagerInfo = { name: PackageManagerName; agent: Agent }\n\n/**\n * Subcommands that create a `package.json`; `package-manager-detector` has no `init` command.\n */\nconst initCommands: Record<PackageManagerName, ReadonlyArray<string>> = { npm: ['init', '-y'], pnpm: ['init'], yarn: ['init', '-y'], bun: ['init', '-y'] }\n\n/** Minimal shape of `package.json` fields read during detection. */\ntype PackageJson = {\n /** The `packageManager` field from `package.json` (e.g. `\"pnpm@9.0.0\"`). */\n packageManager?: string\n scripts?: Record<string, string>\n}\n\n/**\n * Detects the package manager in `cwd`: the `packageManager` field in `package.json`, then a lock file, then `npm`. Parent folders are not searched.\n */\nexport async function detectPackageManager(cwd: string = process.cwd()): Promise<PackageManagerInfo> {\n const found = await detect({ cwd, stopDir: cwd, strategies: ['packageManager-field', 'lockfile'] })\n return found && found.name in initCommands ? (found as PackageManagerInfo) : { name: 'npm', agent: 'npm' }\n}\n\n/**\n * Initializes a new `package.json` at `cwd` using the detected package manager.\n */\nexport async function initPackageJson(cwd: string, packageManager: PackageManagerInfo): Promise<void> {\n await x(packageManager.name, [...initCommands[packageManager.name]], {\n nodeOptions: { cwd, stdio: 'inherit' },\n throwOnError: true,\n })\n}\n\n/** How many trailing lines of a failed install's output the error keeps. */\nconst INSTALL_OUTPUT_LINES = 20\nconst INSTALL_TIMEOUT_MS = 5 * 60_000\n\n/**\n * Installs the given packages at `cwd` using the detected package manager. Each output line goes\n * to `onLine`, so the caller can show it while the install runs; a failed install also keeps the\n * end of the output in the error.\n */\nexport async function installPackages(\n packages: Array<string>,\n packageManager: PackageManagerInfo,\n cwd: string = process.cwd(),\n onLine?: (line: string) => void,\n command: 'add' | 'uninstall' = 'add',\n): Promise<void> {\n const { command: bin, args } = resolveCommand(packageManager.agent, command, command === 'add' ? ['-D', ...packages] : packages)!\n // No stdin, so a package manager that wants input fails instead of waiting. The timeout ends a stalled install.\n const result = x(bin, args, {\n nodeOptions: { cwd, stdio: ['ignore', 'pipe', 'pipe'] },\n timeout: INSTALL_TIMEOUT_MS,\n throwOnError: false,\n })\n const lines: Array<string> = []\n for await (const line of result) {\n lines.push(line)\n onLine?.(line)\n }\n if (result.exitCode === 0) return\n if (result.exitCode === undefined) throw new Error(`\\`${bin} ${args.join(' ')}\\` timed out after ${INSTALL_TIMEOUT_MS / 60_000} minutes`)\n\n const output = lines.slice(-INSTALL_OUTPUT_LINES).join('\\n')\n throw new Error(`\\`${bin} ${args.join(' ')}\\` failed with exit code ${result.exitCode}${output ? `:\\n${output}` : ''}`)\n}\n\n/**\n * Uninstalls the given packages at `cwd` with the package manager's remove command, like {@link installPackages}.\n */\nexport function uninstallPackages(packages: Array<string>, packageManager: PackageManagerInfo, cwd: string = process.cwd()): Promise<void> {\n return installPackages(packages, packageManager, cwd, undefined, 'uninstall')\n}\n\n/**\n * What the selected plugins' `manifests` say is missing from the selection: a `dependencies`\n * entry, or a `client` plugin next to a `consumer`. Empty when nothing is missing.\n * `optionalDependencies` are skipped, since `kubb init` writes the default options.\n */\nexport function missingPluginDependencies(manifests: Array<ExtensionManifest>): Array<string> {\n const selected = manifests.map((manifest) => manifest.name)\n const hasClient = manifests.some((manifest) => manifest.role === 'client')\n return manifests.flatMap((manifest) => [\n ...(manifest.dependencies ?? []).filter((name) => !selected.includes(name)).map((name) => `${manifest.name} needs ${name}.`),\n ...(manifest.role === 'consumer' && !hasClient ? [`${manifest.name} needs a client plugin, such as plugin-axios or plugin-fetch.`] : []),\n ])\n}\n\nasync function readPackageJson(cwd: string): Promise<PackageJson> {\n try {\n return JSON.parse(await read(path.join(cwd, 'package.json'))) as PackageJson\n } catch {\n return {}\n }\n}\n\nconst SPEC_FILE = /^(openapi|swagger)[\\w.-]*\\.(ya?ml|json)$/i\nconst SKIPPED_DIRS = new Set(['node_modules', 'dist', 'build', 'coverage'])\n\n/**\n * Finds OpenAPI spec files up to `depth` folders below `cwd`, shallowest first, as `./`-relative\n * paths. Skips hidden and build folders without walking them and returns at most `limit` files.\n */\nexport async function findSpecFiles(cwd: string, { depth = 3, limit = 20 }: { depth?: number; limit?: number } = {}): Promise<Array<string>> {\n const found: Array<string> = []\n const pattern = `{${Array.from({ length: depth + 1 }, (_, level) => '*/'.repeat(level)).join(',')}}*`\n // The extension stays out of the pattern so SPEC_FILE matches it case-insensitively. Dot folders are skipped by default.\n const files = glob(pattern, { cwd, exclude: (file) => file.split(path.sep).some((segment) => SKIPPED_DIRS.has(segment)) })\n for await (const file of files) if (SPEC_FILE.test(path.basename(file))) found.push(toPosixPath(file))\n return found\n .toSorted((a, b) => a.split('/').length - b.split('/').length || a.localeCompare(b))\n .slice(0, limit)\n .map((file) => `./${file}`)\n}\n\n/** The spec version and operation count, when the file states them. */\nexport type SpecInfo = { version?: string; operations?: number }\n\nconst SPEC_HEAD_BYTES = 256 * 1024\nconst METHOD = '(?:get|put|post|delete|options|head|patch|trace)'\n\n/**\n * Reads the OpenAPI or Swagger version and counts the operations from the first 256 KB of the\n * file, so a large spec is never parsed. The count is left out when the file is longer.\n */\nexport async function readSpecInfo(file: string): Promise<SpecInfo> {\n const handle = await fs.promises.open(file)\n try {\n const buffer = Buffer.alloc(SPEC_HEAD_BYTES)\n const { bytesRead } = await handle.read(buffer, 0, SPEC_HEAD_BYTES, 0)\n const head = buffer.toString('utf-8', 0, bytesRead)\n const complete = bytesRead < SPEC_HEAD_BYTES\n const version = head.match(/^\\s*[\"']?(?:openapi|swagger)[\"']?\\s*:\\s*[\"']?(\\d[\\d.]*)/m)?.[1]\n // shortcut: counts method keys at any depth, so a schema property named `get` counts too; use the adapter when that matters.\n const methods = new RegExp(`^\\\\s*[\"']?${METHOD}[\"']?\\\\s*:\\\\s*(?:\\\\{|$)`, 'gm')\n return { version, operations: complete ? (head.match(methods)?.length ?? 0) : undefined }\n } finally {\n await handle.close()\n }\n}\n\n/** Finds a plugin by registry id, slug, or short name, so `ts`, `plugin-ts`, and `kubb-labs/plugin-ts` all match. */\nexport function findPlugin({ plugins, id }: { plugins: Array<RegistryEntry>; id: string }): RegistryEntry | undefined {\n const ids = id.includes('/') ? [id] : [`kubb-labs/${id}`, `kubb-labs/plugin-${id}`]\n return plugins.find((entry) => ids.includes(entry.id))\n}\n\n/**\n * Turns the comma-separated `--plugins` value into registry entries.\n *\n * @throws when an id is not in `plugins`.\n */\nexport function parsePluginsFlag({ plugins, value }: { plugins: Array<RegistryEntry>; value: string }): Array<RegistryEntry> {\n const ids = value\n .split(',')\n .map((id) => id.trim())\n .filter(Boolean)\n const unknown = ids.filter((id) => !findPlugin({ plugins, id }))\n if (unknown.length)\n throw new Diagnostics.Error({\n code: Diagnostics.code.pluginNotFound,\n severity: 'error',\n message: `Not in the Kubb registry: ${unknown.join(', ')}. Browse the plugins at https://kubb.dev/extensions.`,\n help: 'Use plugin ids from https://kubb.dev/extensions, such as plugin-ts or ts.',\n })\n return ids.map((id) => findPlugin({ plugins, id })!)\n}\n\n/** Adds `\"generate\": \"kubb generate\"` to the `package.json` scripts at `cwd`. Returns `false`, and changes nothing, when a `generate` script exists. */\nexport async function addGenerateScript(cwd: string): Promise<boolean> {\n const file = path.join(cwd, 'package.json')\n const source = await read(file)\n const packageJson = JSON.parse(source) as PackageJson\n if (packageJson.scripts?.generate !== undefined) return false\n const indent = source.match(/^[ \\t]+/m)?.[0] ?? ' '\n const updated = { ...packageJson, scripts: { ...packageJson.scripts, generate: 'kubb generate' } }\n await write(file, JSON.stringify(updated, null, indent))\n return true\n}\n\n/** Reads the `generate` script from the `package.json` at `cwd`. */\nexport async function generateScript(cwd: string): Promise<string | undefined> {\n return (await readPackageJson(cwd)).scripts?.generate\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,SAAS,QAAQ,MAAc,QAAyB;CACtD,OACE,KACG,KAAK,CAAC,CACN,QAAQ,qBAAqB,OAAO,CAAC,CACrC,QAAQ,yBAAyB,OAAO,CAAC,CAEzC,QAAQ,+BAA+B,OAAO,CAAC,CAC/C,MAAM,eAAe,CA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cAAc;CAC1C,MAAM,SAAS,MAAM,KAAK,IAAI;CAC9B,MAAM,cAAc,KAAK,MAAM,MAAM;CACrC,IAAI,YAAY,SAAS,aAAa,KAAA,GAAW,OAAO;CACxD,MAAM,SAAS,OAAO,MAAM,UAAU,CAAC,GAAG,MAAM;CAChD,MAAM,UAAU;EAAE,GAAG;EAAa,SAAS;GAAE,GAAG,YAAY;GAAS,UAAU;EAAgB;CAAE;CACjG,MAAM,MAAM,MAAM,KAAK,UAAU,SAAS,MAAM,MAAM,CAAC;CACvD,OAAO;AACT;;AAGA,eAAsB,eAAe,KAA0C;CAC7E,QAAQ,MAAM,gBAAgB,GAAG,EAAA,CAAG,SAAS;AAC/C"}
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-BV8xUvPy.cjs");
2
- const require_spinner = require("./spinner-D584jFAz.cjs");
2
+ const require_spinner = require("./spinner-BQgUoe7F.cjs");
3
3
  let node_process = require("node:process");
4
4
  node_process = require_rolldown_runtime.__toESM(node_process, 1);
5
5
  let tinyexec = require("tinyexec");
@@ -24,16 +24,10 @@ function convert(text, pascal) {
24
24
  return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
25
25
  }).join("").replace(/[^a-zA-Z0-9]/g, "");
26
26
  }
27
- const cache = /* @__PURE__ */ new Map();
28
- const cacheLimit = 1e5;
27
+ const cache = require_spinner.memo.create({ max: 1e5 });
29
28
  function toCamelOrPascal(text, pascal) {
30
29
  const key = `${pascal ? "P" : "c"}${text}`;
31
- const cached = cache.get(key);
32
- if (cached !== void 0) return cached;
33
- const result = convert(text, pascal);
34
- if (cache.size >= cacheLimit) cache.clear();
35
- cache.set(key, result);
36
- return result;
30
+ return require_spinner.memo(cache, key, () => convert(text, pascal));
37
31
  }
38
32
  /**
39
33
  * Converts `text` to camelCase.
@@ -319,4 +313,4 @@ Object.defineProperty(exports, "uninstallPackages", {
319
313
  }
320
314
  });
321
315
 
322
- //# sourceMappingURL=utils-C9fYoqP2.cjs.map
316
+ //# sourceMappingURL=utils-_hY0r-7x.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-_hY0r-7x.cjs","names":["memo","process","detect","x","resolveCommand","read","path","glob","toPosixPath","fs","Diagnostics","write"],"sources":["../../../internals/utils/src/casing.ts","../src/runners/init/utils.ts"],"sourcesContent":["import { memo } from './promise.ts'\n\ntype Options = {\n /** Text prepended before casing is applied. */\n prefix?: string\n /** Text appended before casing is applied. */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction convert(text: string, pascal: boolean): string {\n return (\n text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n // A status range such as `2xx` stays one word.\n .replace(/(\\d)(?!xx(?![a-z]))([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n )\n}\n\n// Plugins case the same names on every visit. Clearing at the limit bounds a long-running host.\nconst cache = memo.create<string, string>({ max: 100_000 })\n\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const key = `${pascal ? 'P' : 'c'}${text}`\n return memo(cache, key, () => convert(text, pascal))\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n// A word starts at `petType`, `sensor2Reading`, and `HTTPResponse`, while `IDs` and `OAuth` stay whole\nconst wordStart = /(?<=[a-z\\d])(?=[A-Z])|(?<=[A-Z]{2})(?=[A-Z][a-z]{2})/\n\n// A segment without lowercase letters, such as `COOL` or `2D`, stays one word, so a snake_case name is left unchanged.\nfunction words(text: string): Array<string> {\n return text\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .flatMap((segment) => (segment === segment.toUpperCase() ? segment : segment.split(wordStart)))\n}\n\n/**\n * Uppercases only the first character of `text`. Unlike `pascalCase` it never splits words or strips characters.\n *\n * @example\n * `capitalize('getPetById') // 'GetPetById'`\n */\nexport function capitalize(text: string): string {\n return `${text.charAt(0).toUpperCase()}${text.slice(1)}`\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * `snakeCase('helloWorld') // 'hello_world'`\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return words(`${prefix} ${text} ${suffix}`)\n .map((word) => word.replace(/[^a-zA-Z0-9]/g, '').toLowerCase())\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * `screamingSnakeCase('helloWorld') // 'HELLO_WORLD'`\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","import fs from 'node:fs'\nimport { glob } from 'node:fs/promises'\nimport path from 'node:path'\nimport process from 'node:process'\nimport { read, toPosixPath, write } from '@internals/utils'\nimport { Diagnostics, type ExtensionManifest, type RegistryEntry } from '@kubb/core'\nimport { type Agent, type AgentName, detect, resolveCommand } from 'package-manager-detector'\nimport { x } from 'tinyexec'\n\nexport type PackageManagerName = Extract<AgentName, 'npm' | 'pnpm' | 'yarn' | 'bun'>\n\n/**\n * A project's package manager: `name` for messages, `agent` for `resolveCommand`.\n */\nexport type PackageManagerInfo = { name: PackageManagerName; agent: Agent }\n\n/**\n * Subcommands that create a `package.json`; `package-manager-detector` has no `init` command.\n */\nconst initCommands: Record<PackageManagerName, ReadonlyArray<string>> = { npm: ['init', '-y'], pnpm: ['init'], yarn: ['init', '-y'], bun: ['init', '-y'] }\n\n/** Minimal shape of `package.json` fields read during detection. */\ntype PackageJson = {\n /** The `packageManager` field from `package.json` (e.g. `\"pnpm@9.0.0\"`). */\n packageManager?: string\n scripts?: Record<string, string>\n}\n\n/**\n * Detects the package manager in `cwd`: the `packageManager` field in `package.json`, then a lock file, then `npm`. Parent folders are not searched.\n */\nexport async function detectPackageManager(cwd: string = process.cwd()): Promise<PackageManagerInfo> {\n const found = await detect({ cwd, stopDir: cwd, strategies: ['packageManager-field', 'lockfile'] })\n return found && found.name in initCommands ? (found as PackageManagerInfo) : { name: 'npm', agent: 'npm' }\n}\n\n/**\n * Initializes a new `package.json` at `cwd` using the detected package manager.\n */\nexport async function initPackageJson(cwd: string, packageManager: PackageManagerInfo): Promise<void> {\n await x(packageManager.name, [...initCommands[packageManager.name]], {\n nodeOptions: { cwd, stdio: 'inherit' },\n throwOnError: true,\n })\n}\n\n/** How many trailing lines of a failed install's output the error keeps. */\nconst INSTALL_OUTPUT_LINES = 20\nconst INSTALL_TIMEOUT_MS = 5 * 60_000\n\n/**\n * Installs the given packages at `cwd` using the detected package manager. Each output line goes\n * to `onLine`, so the caller can show it while the install runs; a failed install also keeps the\n * end of the output in the error.\n */\nexport async function installPackages(\n packages: Array<string>,\n packageManager: PackageManagerInfo,\n cwd: string = process.cwd(),\n onLine?: (line: string) => void,\n command: 'add' | 'uninstall' = 'add',\n): Promise<void> {\n const { command: bin, args } = resolveCommand(packageManager.agent, command, command === 'add' ? ['-D', ...packages] : packages)!\n // No stdin, so a package manager that wants input fails instead of waiting. The timeout ends a stalled install.\n const result = x(bin, args, {\n nodeOptions: { cwd, stdio: ['ignore', 'pipe', 'pipe'] },\n timeout: INSTALL_TIMEOUT_MS,\n throwOnError: false,\n })\n const lines: Array<string> = []\n for await (const line of result) {\n lines.push(line)\n onLine?.(line)\n }\n if (result.exitCode === 0) return\n if (result.exitCode === undefined) throw new Error(`\\`${bin} ${args.join(' ')}\\` timed out after ${INSTALL_TIMEOUT_MS / 60_000} minutes`)\n\n const output = lines.slice(-INSTALL_OUTPUT_LINES).join('\\n')\n throw new Error(`\\`${bin} ${args.join(' ')}\\` failed with exit code ${result.exitCode}${output ? `:\\n${output}` : ''}`)\n}\n\n/**\n * Uninstalls the given packages at `cwd` with the package manager's remove command, like {@link installPackages}.\n */\nexport function uninstallPackages(packages: Array<string>, packageManager: PackageManagerInfo, cwd: string = process.cwd()): Promise<void> {\n return installPackages(packages, packageManager, cwd, undefined, 'uninstall')\n}\n\n/**\n * What the selected plugins' `manifests` say is missing from the selection: a `dependencies`\n * entry, or a `client` plugin next to a `consumer`. Empty when nothing is missing.\n * `optionalDependencies` are skipped, since `kubb init` writes the default options.\n */\nexport function missingPluginDependencies(manifests: Array<ExtensionManifest>): Array<string> {\n const selected = manifests.map((manifest) => manifest.name)\n const hasClient = manifests.some((manifest) => manifest.role === 'client')\n return manifests.flatMap((manifest) => [\n ...(manifest.dependencies ?? []).filter((name) => !selected.includes(name)).map((name) => `${manifest.name} needs ${name}.`),\n ...(manifest.role === 'consumer' && !hasClient ? [`${manifest.name} needs a client plugin, such as plugin-axios or plugin-fetch.`] : []),\n ])\n}\n\nasync function readPackageJson(cwd: string): Promise<PackageJson> {\n try {\n return JSON.parse(await read(path.join(cwd, 'package.json'))) as PackageJson\n } catch {\n return {}\n }\n}\n\nconst SPEC_FILE = /^(openapi|swagger)[\\w.-]*\\.(ya?ml|json)$/i\nconst SKIPPED_DIRS = new Set(['node_modules', 'dist', 'build', 'coverage'])\n\n/**\n * Finds OpenAPI spec files up to `depth` folders below `cwd`, shallowest first, as `./`-relative\n * paths. Skips hidden and build folders without walking them and returns at most `limit` files.\n */\nexport async function findSpecFiles(cwd: string, { depth = 3, limit = 20 }: { depth?: number; limit?: number } = {}): Promise<Array<string>> {\n const found: Array<string> = []\n const pattern = `{${Array.from({ length: depth + 1 }, (_, level) => '*/'.repeat(level)).join(',')}}*`\n // The extension stays out of the pattern so SPEC_FILE matches it case-insensitively. Dot folders are skipped by default.\n const files = glob(pattern, { cwd, exclude: (file) => file.split(path.sep).some((segment) => SKIPPED_DIRS.has(segment)) })\n for await (const file of files) if (SPEC_FILE.test(path.basename(file))) found.push(toPosixPath(file))\n return found\n .toSorted((a, b) => a.split('/').length - b.split('/').length || a.localeCompare(b))\n .slice(0, limit)\n .map((file) => `./${file}`)\n}\n\n/** The spec version and operation count, when the file states them. */\nexport type SpecInfo = { version?: string; operations?: number }\n\nconst SPEC_HEAD_BYTES = 256 * 1024\nconst METHOD = '(?:get|put|post|delete|options|head|patch|trace)'\n\n/**\n * Reads the OpenAPI or Swagger version and counts the operations from the first 256 KB of the\n * file, so a large spec is never parsed. The count is left out when the file is longer.\n */\nexport async function readSpecInfo(file: string): Promise<SpecInfo> {\n const handle = await fs.promises.open(file)\n try {\n const buffer = Buffer.alloc(SPEC_HEAD_BYTES)\n const { bytesRead } = await handle.read(buffer, 0, SPEC_HEAD_BYTES, 0)\n const head = buffer.toString('utf-8', 0, bytesRead)\n const complete = bytesRead < SPEC_HEAD_BYTES\n const version = head.match(/^\\s*[\"']?(?:openapi|swagger)[\"']?\\s*:\\s*[\"']?(\\d[\\d.]*)/m)?.[1]\n // shortcut: counts method keys at any depth, so a schema property named `get` counts too; use the adapter when that matters.\n const methods = new RegExp(`^\\\\s*[\"']?${METHOD}[\"']?\\\\s*:\\\\s*(?:\\\\{|$)`, 'gm')\n return { version, operations: complete ? (head.match(methods)?.length ?? 0) : undefined }\n } finally {\n await handle.close()\n }\n}\n\n/** Finds a plugin by registry id, slug, or short name, so `ts`, `plugin-ts`, and `kubb-labs/plugin-ts` all match. */\nexport function findPlugin({ plugins, id }: { plugins: Array<RegistryEntry>; id: string }): RegistryEntry | undefined {\n const ids = id.includes('/') ? [id] : [`kubb-labs/${id}`, `kubb-labs/plugin-${id}`]\n return plugins.find((entry) => ids.includes(entry.id))\n}\n\n/**\n * Turns the comma-separated `--plugins` value into registry entries.\n *\n * @throws when an id is not in `plugins`.\n */\nexport function parsePluginsFlag({ plugins, value }: { plugins: Array<RegistryEntry>; value: string }): Array<RegistryEntry> {\n const ids = value\n .split(',')\n .map((id) => id.trim())\n .filter(Boolean)\n const unknown = ids.filter((id) => !findPlugin({ plugins, id }))\n if (unknown.length)\n throw new Diagnostics.Error({\n code: Diagnostics.code.pluginNotFound,\n severity: 'error',\n message: `Not in the Kubb registry: ${unknown.join(', ')}. Browse the plugins at https://kubb.dev/extensions.`,\n help: 'Use plugin ids from https://kubb.dev/extensions, such as plugin-ts or ts.',\n })\n return ids.map((id) => findPlugin({ plugins, id })!)\n}\n\n/** Adds `\"generate\": \"kubb generate\"` to the `package.json` scripts at `cwd`. Returns `false`, and changes nothing, when a `generate` script exists. */\nexport async function addGenerateScript(cwd: string): Promise<boolean> {\n const file = path.join(cwd, 'package.json')\n const source = await read(file)\n const packageJson = JSON.parse(source) as PackageJson\n if (packageJson.scripts?.generate !== undefined) return false\n const indent = source.match(/^[ \\t]+/m)?.[0] ?? ' '\n const updated = { ...packageJson, scripts: { ...packageJson.scripts, generate: 'kubb generate' } }\n await write(file, JSON.stringify(updated, null, indent))\n return true\n}\n\n/** Reads the `generate` script from the `package.json` at `cwd`. */\nexport async function generateScript(cwd: string): Promise<string | undefined> {\n return (await readPackageJson(cwd)).scripts?.generate\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgBA,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AAO,OAAO;CACjB,MAAM,UAAU,IAAI,QAAQ,OAAO,CAAC,WAAW;EAAE;EAAS;CAAG,CAAC,CAAC;CAC/D,IAAI,QAAQ,QACV,MAAM,IAAIC,WAAAA,YAAY,MAAM;EAC1B,MAAMA,WAAAA,YAAY,KAAK;EACvB,UAAU;EACV,SAAS,6BAA6B,QAAQ,KAAK,IAAI,EAAE;EACzD,MAAM;CACR,CAAC;CACH,OAAO,IAAI,KAAK,OAAO,WAAW;EAAE;EAAS;CAAG,CAAC,CAAE;AACrD;;AAGA,eAAsB,kBAAkB,KAA+B;CACrE,MAAM,OAAOJ,UAAAA,QAAK,KAAK,KAAK,cAAc;CAC1C,MAAM,SAAS,MAAMD,gBAAAA,KAAK,IAAI;CAC9B,MAAM,cAAc,KAAK,MAAM,MAAM;CACrC,IAAI,YAAY,SAAS,aAAa,KAAA,GAAW,OAAO;CACxD,MAAM,SAAS,OAAO,MAAM,UAAU,CAAC,GAAG,MAAM;CAChD,MAAM,UAAU;EAAE,GAAG;EAAa,SAAS;GAAE,GAAG,YAAY;GAAS,UAAU;EAAgB;CAAE;CACjG,MAAMM,gBAAAA,MAAM,MAAM,KAAK,UAAU,SAAS,MAAM,MAAM,CAAC;CACvD,OAAO;AACT;;AAGA,eAAsB,eAAe,KAA0C;CAC7E,QAAQ,MAAM,gBAAgB,GAAG,EAAA,CAAG,SAAS;AAC/C"}
@@ -16,7 +16,7 @@ const command = define({
16
16
  }
17
17
  },
18
18
  async run({ values }) {
19
- const { run } = await import("./run-ixh050Ip.js");
19
+ const { run } = await import("./run-CcWmws1R.js");
20
20
  await run({
21
21
  input: values.input,
22
22
  configPath: values.config
@@ -25,4 +25,4 @@ const command = define({
25
25
  });
26
26
  export { command };
27
27
 
28
- //# sourceMappingURL=validate-BuStuH_z.js.map
28
+ //# sourceMappingURL=validate-CSbYneXo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate-BuStuH_z.js","names":[],"sources":["../src/commands/validate.ts"],"sourcesContent":["import { define } from 'gunshi'\nimport { configArg } from './shared.ts'\n\n/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/adapter-oas`. */\nexport const command = define({\n name: 'validate',\n description: 'Check a specification with the configured adapter before generating.',\n examples: ['kubb validate ./openapi.yaml', 'kubb validate https://petstore3.swagger.io/api/v3/openapi.json'].join('\\n'),\n args: {\n ...configArg,\n input: {\n type: 'positional',\n description: 'Path or URL to the specification to validate',\n required: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/validate/run.ts')\n await run({ input: values.input, configPath: values.config })\n },\n})\n"],"mappings":";;;;;AAIA,MAAa,UAAU,OAAO;CAC5B,MAAM;CACN,aAAa;CACb,UAAU,CAAC,gCAAgC,gEAAgE,CAAC,CAAC,KAAK,IAAI;CACtH,MAAM;EACJ,GAAG;EACH,OAAO;GACL,MAAM;GACN,aAAa;GACb,UAAU;EACZ;CACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAC7B,MAAM,IAAI;GAAE,OAAO,OAAO;GAAO,YAAY,OAAO;EAAO,CAAC;CAC9D;AACF,CAAC"}
1
+ {"version":3,"file":"validate-CSbYneXo.js","names":[],"sources":["../src/commands/validate.ts"],"sourcesContent":["import { define } from 'gunshi'\nimport { configArg } from './shared.ts'\n\n/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/adapter-oas`. */\nexport const command = define({\n name: 'validate',\n description: 'Check a specification with the configured adapter before generating.',\n examples: ['kubb validate ./openapi.yaml', 'kubb validate https://petstore3.swagger.io/api/v3/openapi.json'].join('\\n'),\n args: {\n ...configArg,\n input: {\n type: 'positional',\n description: 'Path or URL to the specification to validate',\n required: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/validate/run.ts')\n await run({ input: values.input, configPath: values.config })\n },\n})\n"],"mappings":";;;;;AAIA,MAAa,UAAU,OAAO;CAC5B,MAAM;CACN,aAAa;CACb,UAAU,CAAC,gCAAgC,gEAAgE,CAAC,CAAC,KAAK,IAAI;CACtH,MAAM;EACJ,GAAG;EACH,OAAO;GACL,MAAM;GACN,aAAa;GACb,UAAU;EACZ;CACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAC7B,MAAM,IAAI;GAAE,OAAO,OAAO;GAAO,YAAY,OAAO;EAAO,CAAC;CAC9D;AACF,CAAC"}
@@ -15,7 +15,7 @@ const command = (0, require("gunshi").define)({
15
15
  }
16
16
  },
17
17
  async run({ values }) {
18
- const { run } = await Promise.resolve().then(() => require("./run-Bxqg0GuI.cjs"));
18
+ const { run } = await Promise.resolve().then(() => require("./run-4MUhIiPj.cjs"));
19
19
  await run({
20
20
  input: values.input,
21
21
  configPath: values.config
@@ -24,4 +24,4 @@ const command = (0, require("gunshi").define)({
24
24
  });
25
25
  exports.command = command;
26
26
 
27
- //# sourceMappingURL=validate-rr0LpFhN.cjs.map
27
+ //# sourceMappingURL=validate-CyxoAzEK.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate-rr0LpFhN.cjs","names":["define","configArg"],"sources":["../src/commands/validate.ts"],"sourcesContent":["import { define } from 'gunshi'\nimport { configArg } from './shared.ts'\n\n/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/adapter-oas`. */\nexport const command = define({\n name: 'validate',\n description: 'Check a specification with the configured adapter before generating.',\n examples: ['kubb validate ./openapi.yaml', 'kubb validate https://petstore3.swagger.io/api/v3/openapi.json'].join('\\n'),\n args: {\n ...configArg,\n input: {\n type: 'positional',\n description: 'Path or URL to the specification to validate',\n required: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/validate/run.ts')\n await run({ input: values.input, configPath: values.config })\n },\n})\n"],"mappings":";;;;AAIA,MAAa,WAAA,G,gBAAUA,CAAAA,CAAAA,OAAAA,CAAO;CAC5B,MAAM;CACN,aAAa;CACb,UAAU,CAAC,gCAAgC,gEAAgE,CAAC,CAAC,KAAK,IAAI;CACtH,MAAM;EACJ,GAAGC,eAAAA;EACH,OAAO;GACL,MAAM;GACN,aAAa;GACb,UAAU;EACZ;CACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;EACtB,MAAM,IAAI;GAAE,OAAO,OAAO;GAAO,YAAY,OAAO;EAAO,CAAC;CAC9D;AACF,CAAC"}
1
+ {"version":3,"file":"validate-CyxoAzEK.cjs","names":["define","configArg"],"sources":["../src/commands/validate.ts"],"sourcesContent":["import { define } from 'gunshi'\nimport { configArg } from './shared.ts'\n\n/** The runner is imported when the command runs, so listing `kubb --help` never loads `@kubb/adapter-oas`. */\nexport const command = define({\n name: 'validate',\n description: 'Check a specification with the configured adapter before generating.',\n examples: ['kubb validate ./openapi.yaml', 'kubb validate https://petstore3.swagger.io/api/v3/openapi.json'].join('\\n'),\n args: {\n ...configArg,\n input: {\n type: 'positional',\n description: 'Path or URL to the specification to validate',\n required: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/validate/run.ts')\n await run({ input: values.input, configPath: values.config })\n },\n})\n"],"mappings":";;;;AAIA,MAAa,WAAA,G,gBAAUA,CAAAA,CAAAA,OAAAA,CAAO;CAC5B,MAAM;CACN,aAAa;CACb,UAAU,CAAC,gCAAgC,gEAAgE,CAAC,CAAC,KAAK,IAAI;CACtH,MAAM;EACJ,GAAGC,eAAAA;EACH,OAAO;GACL,MAAM;GACN,aAAa;GACb,UAAU;EACZ;CACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;EACtB,MAAM,IAAI;GAAE,OAAO,OAAO;GAAO,YAAY,OAAO;EAAO,CAAC;CAC9D;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/cli",
3
- "version": "5.18.8",
3
+ "version": "5.19.0",
4
4
  "description": "Official CLI for Kubb. Run kubb generate, kubb init, kubb validate, kubb studio, and kubb mcp to manage the full code generation lifecycle.",
5
5
  "keywords": [
6
6
  "cli",
@@ -68,7 +68,7 @@
68
68
  "dependencies": {
69
69
  "@clack/prompts": "^1.9.0",
70
70
  "@gunshi/plugin-dryrun": "^0.37.3",
71
- "@kubb/core": "^5.18.8",
71
+ "@kubb/core": "^5.19.0",
72
72
  "chokidar": "^6.0.0",
73
73
  "gunshi": "^0.37.3",
74
74
  "jiti": "^2.7.0",
@@ -80,13 +80,13 @@
80
80
  "devDependencies": {
81
81
  "@internals/shared": "0.0.1",
82
82
  "@internals/utils": "0.0.1",
83
- "@kubb/adapter-oas": "5.18.8",
84
- "@kubb/studio": "5.18.8"
83
+ "@kubb/adapter-oas": "5.19.0",
84
+ "@kubb/studio": "5.19.0"
85
85
  },
86
86
  "peerDependencies": {
87
- "@kubb/adapter-oas": "5.18.8",
88
- "@kubb/mcp": "5.18.8",
89
- "@kubb/studio": "5.18.8"
87
+ "@kubb/adapter-oas": "5.19.0",
88
+ "@kubb/mcp": "5.19.0",
89
+ "@kubb/studio": "5.19.0"
90
90
  },
91
91
  "peerDependenciesMeta": {
92
92
  "@kubb/adapter-oas": {