@kubb/cli 5.0.0-beta.4 → 5.0.0-beta.6

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 (110) hide show
  1. package/dist/agent-BJEvbSiP.js +68 -0
  2. package/dist/agent-BJEvbSiP.js.map +1 -0
  3. package/dist/agent-CXNO6dgj.cjs +70 -0
  4. package/dist/agent-CXNO6dgj.cjs.map +1 -0
  5. package/dist/{agent-B4cAAab2.cjs → agent-D9CKYh4K.cjs} +3 -3
  6. package/dist/{agent-B4cAAab2.cjs.map → agent-D9CKYh4K.cjs.map} +1 -1
  7. package/dist/{agent-sdYBBgrd.js → agent-VXKxLCho.js} +3 -3
  8. package/dist/{agent-sdYBBgrd.js.map → agent-VXKxLCho.js.map} +1 -1
  9. package/dist/constants-BPJBMT_6.js +45 -0
  10. package/dist/constants-BPJBMT_6.js.map +1 -0
  11. package/dist/constants-BYGmiFs0.cjs +139 -0
  12. package/dist/constants-BYGmiFs0.cjs.map +1 -0
  13. package/dist/constants-DSJ-Xrbv.js +116 -0
  14. package/dist/constants-DSJ-Xrbv.js.map +1 -0
  15. package/dist/constants-Rcaqzyd-.cjs +80 -0
  16. package/dist/constants-Rcaqzyd-.cjs.map +1 -0
  17. package/dist/define-Bdn8j5VM.cjs.map +1 -1
  18. package/dist/define-Ctii4bel.js.map +1 -1
  19. package/dist/errors-CLCjoSg0.cjs.map +1 -1
  20. package/dist/errors-CjPmyZHy.js.map +1 -1
  21. package/dist/{generate-BDGOOsBM.cjs → generate-BB2Q7I9s.cjs} +9 -3
  22. package/dist/{generate-BDGOOsBM.cjs.map → generate-BB2Q7I9s.cjs.map} +1 -1
  23. package/dist/{generate-B1Pa2ho-.cjs → generate-B_p5dl68.cjs} +13 -14
  24. package/dist/generate-B_p5dl68.cjs.map +1 -0
  25. package/dist/{generate-DuhxPLGr.js → generate-BmulGxIM.js} +9 -3
  26. package/dist/{generate-DuhxPLGr.js.map → generate-BmulGxIM.js.map} +1 -1
  27. package/dist/{generate-CNrRLY4n.js → generate-DAsdUw3z.js} +13 -14
  28. package/dist/{generate-CNrRLY4n.js.map → generate-DAsdUw3z.js.map} +1 -1
  29. package/dist/index.cjs +19 -10
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.js +19 -10
  32. package/dist/index.js.map +1 -1
  33. package/dist/init-BTp9if7K.js +53 -0
  34. package/dist/init-BTp9if7K.js.map +1 -0
  35. package/dist/{init-CZ5Xq2Hd.cjs → init-CJ80lKSP.cjs} +47 -101
  36. package/dist/init-CJ80lKSP.cjs.map +1 -0
  37. package/dist/{init-eNRlotJK.js → init-DCqcEq86.js} +44 -98
  38. package/dist/init-DCqcEq86.js.map +1 -0
  39. package/dist/init-Dpg8e1HN.cjs +53 -0
  40. package/dist/init-Dpg8e1HN.cjs.map +1 -0
  41. package/dist/mcp-C9RoU-Dg.js +39 -0
  42. package/dist/mcp-C9RoU-Dg.js.map +1 -0
  43. package/dist/{mcp-CYOgxB82.cjs → mcp-D1llTaRM.cjs} +7 -4
  44. package/dist/mcp-D1llTaRM.cjs.map +1 -0
  45. package/dist/{mcp-DmJm3TrU.js → mcp-DNUw8nqb.js} +7 -4
  46. package/dist/mcp-DNUw8nqb.js.map +1 -0
  47. package/dist/mcp-wpl6sYYR.cjs +39 -0
  48. package/dist/mcp-wpl6sYYR.cjs.map +1 -0
  49. package/dist/{package-BapVyQ-w.cjs → package-iheSdfas.cjs} +2 -2
  50. package/dist/package-iheSdfas.cjs.map +1 -0
  51. package/dist/package-vLafMWCe.js +6 -0
  52. package/dist/package-vLafMWCe.js.map +1 -0
  53. package/dist/shell-475fQKaX.cjs.map +1 -1
  54. package/dist/shell-DLzN4fRo.js.map +1 -1
  55. package/dist/{telemetry-DN95_2pF.cjs → telemetry-BLX0NzRk.cjs} +2 -2
  56. package/dist/{telemetry-DN95_2pF.cjs.map → telemetry-BLX0NzRk.cjs.map} +1 -1
  57. package/dist/{telemetry-LgT_sdPe.js → telemetry-juq4QBf7.js} +2 -2
  58. package/dist/{telemetry-LgT_sdPe.js.map → telemetry-juq4QBf7.js.map} +1 -1
  59. package/dist/validate-BU4fPTMc.cjs +47 -0
  60. package/dist/validate-BU4fPTMc.cjs.map +1 -0
  61. package/dist/validate-BfJoCxrC.js +26 -0
  62. package/dist/validate-BfJoCxrC.js.map +1 -0
  63. package/dist/validate-DIDBROB2.cjs +26 -0
  64. package/dist/validate-DIDBROB2.cjs.map +1 -0
  65. package/dist/validate-k9s_hFah.js +46 -0
  66. package/dist/validate-k9s_hFah.js.map +1 -0
  67. package/package.json +12 -7
  68. package/src/commands/agent/start.ts +8 -5
  69. package/src/commands/agent.ts +3 -1
  70. package/src/commands/generate.ts +3 -1
  71. package/src/commands/init.ts +33 -2
  72. package/src/commands/mcp.ts +27 -3
  73. package/src/commands/validate.ts +4 -2
  74. package/src/constants.ts +2 -54
  75. package/src/runners/init.ts +29 -118
  76. package/src/runners/mcp.ts +7 -2
  77. package/src/runners/validate.ts +23 -4
  78. package/src/utils/getCosmiConfig.ts +8 -13
  79. package/dist/agent-CR6Z96og.js +0 -56
  80. package/dist/agent-CR6Z96og.js.map +0 -1
  81. package/dist/agent-Dmxzqg4d.cjs +0 -58
  82. package/dist/agent-Dmxzqg4d.cjs.map +0 -1
  83. package/dist/constants-CnDXa1R6.cjs +0 -148
  84. package/dist/constants-CnDXa1R6.cjs.map +0 -1
  85. package/dist/constants-aL3CP_Wq.js +0 -95
  86. package/dist/constants-aL3CP_Wq.js.map +0 -1
  87. package/dist/generate-B1Pa2ho-.cjs.map +0 -1
  88. package/dist/init-CZ5Xq2Hd.cjs.map +0 -1
  89. package/dist/init-CnZXHrbq.js +0 -25
  90. package/dist/init-CnZXHrbq.js.map +0 -1
  91. package/dist/init-NYJSZJSb.cjs +0 -25
  92. package/dist/init-NYJSZJSb.cjs.map +0 -1
  93. package/dist/init-eNRlotJK.js.map +0 -1
  94. package/dist/mcp-CYOgxB82.cjs.map +0 -1
  95. package/dist/mcp-CdFWyrwi.cjs +0 -16
  96. package/dist/mcp-CdFWyrwi.cjs.map +0 -1
  97. package/dist/mcp-DhSxuDMD.js +0 -16
  98. package/dist/mcp-DhSxuDMD.js.map +0 -1
  99. package/dist/mcp-DmJm3TrU.js.map +0 -1
  100. package/dist/package-BapVyQ-w.cjs.map +0 -1
  101. package/dist/package-DyJE-qNq.js +0 -6
  102. package/dist/package-DyJE-qNq.js.map +0 -1
  103. package/dist/validate-C6npXzel.cjs +0 -25
  104. package/dist/validate-C6npXzel.cjs.map +0 -1
  105. package/dist/validate-kLJoT_hi.js +0 -33
  106. package/dist/validate-kLJoT_hi.js.map +0 -1
  107. package/dist/validate-n38Rh-Y7.js +0 -25
  108. package/dist/validate-n38Rh-Y7.js.map +0 -1
  109. package/dist/validate-yKKzqEZ5.cjs +0 -34
  110. package/dist/validate-yKKzqEZ5.cjs.map +0 -1
@@ -5,121 +5,9 @@ import { styleText } from 'node:util'
5
5
  import * as clack from '@clack/prompts'
6
6
  import type { PackageManagerInfo } from '@internals/utils'
7
7
  import { detectPackageManager } from '@internals/utils'
8
- import { initDefaults, KUBB_CONFIG_FILENAME, pluginDefaultConfigs } from '../constants.ts'
8
+ import { availablePlugins, generateConfigFile, initDefaults, KUBB_CONFIG_FILENAME, type PluginOption } from '@internals/shared'
9
9
  import { hasPackageJson, initPackageJson, installPackages } from '../utils/packageManager.ts'
10
10
 
11
- type PluginOption = {
12
- value: string
13
- label: string
14
- hint?: string
15
- packageName: string
16
- importName: string
17
- category: 'types' | 'client' | 'framework' | 'validation' | 'testing' | 'mocks' | 'documentation' | 'ai'
18
- }
19
-
20
- const availablePlugins: PluginOption[] = [
21
- {
22
- value: 'plugin-ts',
23
- label: 'TypeScript',
24
- hint: 'Recommended',
25
- packageName: '@kubb/plugin-ts',
26
- importName: 'pluginTs',
27
- category: 'types',
28
- },
29
- {
30
- value: 'plugin-client',
31
- label: 'Client (Fetch/Axios)',
32
- packageName: '@kubb/plugin-client',
33
- importName: 'pluginClient',
34
- category: 'client',
35
- },
36
- {
37
- value: 'plugin-react-query',
38
- label: 'React Query / TanStack Query',
39
- packageName: '@kubb/plugin-react-query',
40
- importName: 'pluginReactQuery',
41
- category: 'framework',
42
- },
43
- {
44
- value: 'plugin-vue-query',
45
- label: 'Vue Query',
46
- packageName: '@kubb/plugin-vue-query',
47
- importName: 'pluginVueQuery',
48
- category: 'framework',
49
- },
50
- {
51
- value: 'plugin-zod',
52
- label: 'Zod Schemas',
53
- packageName: '@kubb/plugin-zod',
54
- importName: 'pluginZod',
55
- category: 'validation',
56
- },
57
- {
58
- value: 'plugin-faker',
59
- label: 'Faker.js Mocks',
60
- packageName: '@kubb/plugin-faker',
61
- importName: 'pluginFaker',
62
- category: 'mocks',
63
- },
64
- {
65
- value: 'plugin-msw',
66
- label: 'MSW Handlers',
67
- packageName: '@kubb/plugin-msw',
68
- importName: 'pluginMsw',
69
- category: 'mocks',
70
- },
71
- {
72
- value: 'plugin-cypress',
73
- label: 'Cypress Tests',
74
- packageName: '@kubb/plugin-cypress',
75
- importName: 'pluginCypress',
76
- category: 'testing',
77
- },
78
- {
79
- value: 'plugin-mcp',
80
- label: 'MCP Server (AI / Model Context Protocol)',
81
- packageName: '@kubb/plugin-mcp',
82
- importName: 'pluginMcp',
83
- category: 'ai',
84
- },
85
- {
86
- value: 'plugin-redoc',
87
- label: 'ReDoc Documentation',
88
- packageName: '@kubb/plugin-redoc',
89
- importName: 'pluginRedoc',
90
- category: 'documentation',
91
- },
92
- ]
93
-
94
- function generateConfigFile(selectedPlugins: PluginOption[], inputPath: string, outputPath: string): string {
95
- const imports = selectedPlugins.map((plugin) => `import { ${plugin.importName} } from '${plugin.packageName}'`).join('\n')
96
-
97
- const pluginConfigs = selectedPlugins
98
- .map((plugin) => {
99
- const config = (pluginDefaultConfigs as Record<string, string>)[plugin.value] ?? `${plugin.importName}()`
100
- return ` ${config},`
101
- })
102
- .join('\n')
103
-
104
- return `import { defineConfig } from 'kubb'
105
- ${imports}
106
-
107
- export default defineConfig({
108
- root: '.',
109
- input: {
110
- path: '${inputPath}',
111
- },
112
- output: {
113
- path: '${outputPath}',
114
- clean: true,
115
- },
116
- plugins: [
117
- ${pluginConfigs}
118
- ],
119
- })
120
- `
121
- }
122
-
123
11
  function cancelAndExit(message = 'Operation cancelled.'): never {
124
12
  clack.cancel(message)
125
13
  process.exit(0)
@@ -128,9 +16,12 @@ function cancelAndExit(message = 'Operation cancelled.'): never {
128
16
  type InitOptions = {
129
17
  yes: boolean
130
18
  version: string
19
+ input?: string
20
+ output?: string
21
+ plugins?: string
131
22
  }
132
23
 
133
- export async function runInit({ yes, version }: InitOptions): Promise<void> {
24
+ export async function runInit({ yes, version, input: inputFlag, output: outputFlag, plugins: pluginsFlag }: InitOptions): Promise<void> {
134
25
  const cwd = process.cwd()
135
26
 
136
27
  clack.intro(styleText('bgCyan', styleText('black', ' Kubb Init ')))
@@ -165,7 +56,10 @@ export async function runInit({ yes, version }: InitOptions): Promise<void> {
165
56
 
166
57
  // Prompt for OpenAPI spec path
167
58
  let inputPath: string
168
- if (yes) {
59
+ if (inputFlag) {
60
+ inputPath = inputFlag
61
+ clack.log.info(`Using input path: ${styleText('cyan', inputPath)}`)
62
+ } else if (yes) {
169
63
  inputPath = initDefaults.inputPath
170
64
  clack.log.info(`Using input path: ${styleText('cyan', inputPath)}`)
171
65
  } else {
@@ -186,7 +80,10 @@ export async function runInit({ yes, version }: InitOptions): Promise<void> {
186
80
 
187
81
  // Prompt for output directory
188
82
  let outputPath: string
189
- if (yes) {
83
+ if (outputFlag) {
84
+ outputPath = outputFlag
85
+ clack.log.info(`Using output path: ${styleText('cyan', outputPath)}`)
86
+ } else if (yes) {
190
87
  outputPath = initDefaults.outputPath
191
88
  clack.log.info(`Using output path: ${styleText('cyan', outputPath)}`)
192
89
  } else {
@@ -207,7 +104,21 @@ export async function runInit({ yes, version }: InitOptions): Promise<void> {
207
104
 
208
105
  // Plugin selection
209
106
  let selectedPlugins: PluginOption[]
210
- if (yes) {
107
+ if (pluginsFlag) {
108
+ const requestedValues = pluginsFlag
109
+ .split(',')
110
+ .map((v) => v.trim())
111
+ .filter(Boolean)
112
+ selectedPlugins = availablePlugins.filter((plugin) => requestedValues.includes(plugin.value))
113
+ if (selectedPlugins.length === 0) {
114
+ selectedPlugins = availablePlugins.filter((plugin) => (initDefaults.plugins as readonly string[]).includes(plugin.value))
115
+ clack.log.warn(
116
+ `No valid plugins found in --plugins value; falling back to default: ${styleText('cyan', selectedPlugins.map((p) => p.label).join(', '))}`,
117
+ )
118
+ } else {
119
+ clack.log.info(`Using plugins: ${styleText('cyan', selectedPlugins.map((p) => p.label).join(', '))}`)
120
+ }
121
+ } else if (yes) {
211
122
  selectedPlugins = availablePlugins.filter((plugin) => (initDefaults.plugins as readonly string[]).includes(plugin.value))
212
123
  clack.log.info(`Using plugins: ${styleText('cyan', selectedPlugins.map((p) => p.label).join(', '))}`)
213
124
  } else {
@@ -247,7 +158,7 @@ export async function runInit({ yes, version }: InitOptions): Promise<void> {
247
158
  const configSpinner = clack.spinner()
248
159
  configSpinner.start(`Creating ${KUBB_CONFIG_FILENAME}`)
249
160
 
250
- const configContent = generateConfigFile(selectedPlugins, inputPath, outputPath)
161
+ const configContent = generateConfigFile({ selectedPlugins, inputPath, outputPath })
251
162
  const configPath = path.join(cwd, KUBB_CONFIG_FILENAME)
252
163
 
253
164
  if (fs.existsSync(configPath)) {
@@ -6,9 +6,11 @@ import { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'
6
6
 
7
7
  type McpOptions = {
8
8
  version: string
9
+ port?: string
10
+ host?: string
9
11
  }
10
12
 
11
- export async function runMcp({ version }: McpOptions): Promise<void> {
13
+ export async function runMcp({ version, port, host }: McpOptions): Promise<void> {
12
14
  let mod: typeof McpModule
13
15
  try {
14
16
  mod = (await import('@kubb/mcp')) as typeof McpModule
@@ -28,7 +30,10 @@ export async function runMcp({ version }: McpOptions): Promise<void> {
28
30
  try {
29
31
  console.log('⏳ Starting MCP server...')
30
32
  console.warn(styleText('yellow', 'This feature is still under development — use with caution'))
31
- run()
33
+ run(undefined, {
34
+ port: port !== undefined ? Number(port) : undefined,
35
+ host,
36
+ })
32
37
  await sendTelemetry(
33
38
  buildTelemetryEvent({
34
39
  command: 'mcp',
@@ -1,6 +1,6 @@
1
1
  import process from 'node:process'
2
+ import { styleText } from 'node:util'
2
3
  import { getErrorMessage } from '@internals/utils'
3
- import { parseDocument, validateDocument } from '@kubb/adapter-oas'
4
4
  import { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'
5
5
 
6
6
  type ValidateOptions = {
@@ -8,11 +8,21 @@ type ValidateOptions = {
8
8
  version: string
9
9
  }
10
10
 
11
- export async function runValidate({ input, version }: ValidateOptions): Promise<void> {
11
+ type ValidateModule = typeof import('@kubb/adapter-oas')
12
+ type ValidateDependencies = {
13
+ loadValidateModule: () => Promise<ValidateModule>
14
+ }
15
+
16
+ export function loadValidateModule(): Promise<ValidateModule> {
17
+ return import('@kubb/adapter-oas') as Promise<ValidateModule>
18
+ }
19
+
20
+ export async function runValidate({ input, version }: ValidateOptions, dependencies: ValidateDependencies = { loadValidateModule }): Promise<void> {
12
21
  const hrStart = process.hrtime()
13
22
  try {
14
- const document = await parseDocument(input)
15
- await validateDocument(document, { throwOnError: true })
23
+ const { adapterOas } = await dependencies.loadValidateModule()
24
+ const adapter = adapterOas()
25
+ await adapter.validate!(input, { throwOnError: true })
16
26
 
17
27
  await sendTelemetry(
18
28
  buildTelemetryEvent({
@@ -32,6 +42,15 @@ export async function runValidate({ input, version }: ValidateOptions): Promise<
32
42
  status: 'failed',
33
43
  }),
34
44
  )
45
+ if (error instanceof Error && /@kubb\/adapter-oas/.test(error.message)) {
46
+ console.error(styleText('red', 'The @kubb/adapter-oas package is not installed.'))
47
+ console.error('')
48
+ console.error('Install it with:')
49
+ console.error(styleText('cyan', ' npm install @kubb/adapter-oas'))
50
+ console.error(styleText('cyan', ' # or'))
51
+ console.error(styleText('cyan', ' pnpm install @kubb/adapter-oas'))
52
+ console.error('')
53
+ }
35
54
  console.error('❌ Validation failed')
36
55
  console.error(getErrorMessage(error))
37
56
  process.exit(1)
@@ -1,6 +1,6 @@
1
1
  import type { Config } from '@kubb/core'
2
2
  import { cosmiconfig } from 'cosmiconfig'
3
- import { unrun } from 'unrun'
3
+ import { createJiti } from 'jiti'
4
4
 
5
5
  type CosmiconfigResult = {
6
6
  filepath: string
@@ -8,21 +8,16 @@ type CosmiconfigResult = {
8
8
  config: Config
9
9
  }
10
10
 
11
- const unrunInputOptions = {
12
- transform: {
13
- jsx: {
14
- runtime: 'automatic' as const,
15
- importSource: '@kubb/renderer-jsx',
16
- },
11
+ const jiti = createJiti(import.meta.url, {
12
+ jsx: {
13
+ runtime: 'automatic',
14
+ importSource: '@kubb/renderer-jsx',
17
15
  },
18
- }
16
+ moduleCache: false,
17
+ })
19
18
 
20
19
  const tsLoader = async (configFile: string) => {
21
- const { module } = await unrun({
22
- path: configFile,
23
- inputOptions: unrunInputOptions,
24
- })
25
- return module
20
+ return jiti.import(configFile, { default: true })
26
21
  }
27
22
 
28
23
  export async function getCosmiConfig(moduleName: string, config?: string): Promise<CosmiconfigResult> {
@@ -1,56 +0,0 @@
1
- import "./chunk--u3MIqq1.js";
2
- import { n as defineCommand } from "./define-Ctii4bel.js";
3
- import { t as version } from "./package-DyJE-qNq.js";
4
- import { s as agentDefaults } from "./constants-aL3CP_Wq.js";
5
- //#endregion
6
- //#region src/commands/agent.ts
7
- const command = defineCommand({
8
- name: "agent",
9
- description: "Manage the Kubb Agent server",
10
- subCommands: [defineCommand({
11
- name: "start",
12
- description: "Start the Agent server",
13
- options: {
14
- config: {
15
- type: "string",
16
- description: "Path to the Kubb config",
17
- short: "c"
18
- },
19
- port: {
20
- type: "string",
21
- description: `Port for the server (default: ${agentDefaults.port})`,
22
- short: "p"
23
- },
24
- host: {
25
- type: "string",
26
- description: "Host for the server",
27
- default: agentDefaults.host
28
- },
29
- "allow-write": {
30
- type: "boolean",
31
- description: "Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.",
32
- default: false
33
- },
34
- "allow-all": {
35
- type: "boolean",
36
- description: "Grant all permissions (implies --allow-write).",
37
- default: false
38
- }
39
- },
40
- async run({ values }) {
41
- const { runAgentStart } = await import("./agent-sdYBBgrd.js");
42
- await runAgentStart({
43
- port: values.port !== void 0 ? values.port : void 0,
44
- host: values.host,
45
- configPath: values.config,
46
- allowWrite: values["allow-write"],
47
- allowAll: values["allow-all"],
48
- version
49
- });
50
- }
51
- })]
52
- });
53
- //#endregion
54
- export { command };
55
-
56
- //# sourceMappingURL=agent-CR6Z96og.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-CR6Z96og.js","names":["command","startCommand"],"sources":["../src/commands/agent/start.ts","../src/commands/agent.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../../package.json'\nimport { agentDefaults } from '../../constants.ts'\n\nexport const command = defineCommand({\n name: 'start',\n description: 'Start the Agent server',\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n port: {\n type: 'string',\n description: `Port for the server (default: ${agentDefaults.port})`,\n short: 'p',\n },\n host: {\n type: 'string',\n description: 'Host for the server',\n default: agentDefaults.host,\n },\n 'allow-write': {\n type: 'boolean',\n description: 'Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.',\n default: false,\n },\n 'allow-all': {\n type: 'boolean',\n description: 'Grant all permissions (implies --allow-write).',\n default: false,\n },\n },\n async run({ values }) {\n const { runAgentStart } = await import('../../runners/agent.ts')\n\n await runAgentStart({\n port: values.port !== undefined ? values.port : undefined,\n host: values.host,\n configPath: values.config,\n allowWrite: values['allow-write'],\n allowAll: values['allow-all'],\n version,\n })\n },\n})\n","import { defineCommand } from '@internals/utils'\nimport { command as startCommand } from './agent/start.ts'\n\nexport const command = defineCommand({\n name: 'agent',\n description: 'Manage the Kubb Agent server',\n subCommands: [startCommand],\n})\n"],"mappings":";;;;;;ACGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,aAAa,CDFQ,cAAc;EACnC,MAAM;EACN,aAAa;EACb,SAAS;GACP,QAAQ;IACN,MAAM;IACN,aAAa;IACb,OAAO;IACR;GACD,MAAM;IACJ,MAAM;IACN,aAAa,iCAAiC,cAAc,KAAK;IACjE,OAAO;IACR;GACD,MAAM;IACJ,MAAM;IACN,aAAa;IACb,SAAS,cAAc;IACxB;GACD,eAAe;IACb,MAAM;IACN,aAAa;IACb,SAAS;IACV;GACD,aAAa;IACX,MAAM;IACN,aAAa;IACb,SAAS;IACV;GACF;EACD,MAAM,IAAI,EAAE,UAAU;GACpB,MAAM,EAAE,kBAAkB,MAAM,OAAO;AAEvC,SAAM,cAAc;IAClB,MAAM,OAAO,SAAS,KAAA,IAAY,OAAO,OAAO,KAAA;IAChD,MAAM,OAAO;IACb,YAAY,OAAO;IACnB,YAAY,OAAO;IACnB,UAAU,OAAO;IACjB;IACD,CAAC;;EAEL,CCxCeC,CAAa;CAC5B,CAAC"}
@@ -1,58 +0,0 @@
1
- require("./chunk-ByKO4r7w.cjs");
2
- const require_define = require("./define-Bdn8j5VM.cjs");
3
- const require_package = require("./package-BapVyQ-w.cjs");
4
- const require_constants = require("./constants-CnDXa1R6.cjs");
5
- //#region src/commands/agent/start.ts
6
- const command$1 = require_define.defineCommand({
7
- name: "start",
8
- description: "Start the Agent server",
9
- options: {
10
- config: {
11
- type: "string",
12
- description: "Path to the Kubb config",
13
- short: "c"
14
- },
15
- port: {
16
- type: "string",
17
- description: `Port for the server (default: ${require_constants.agentDefaults.port})`,
18
- short: "p"
19
- },
20
- host: {
21
- type: "string",
22
- description: "Host for the server",
23
- default: require_constants.agentDefaults.host
24
- },
25
- "allow-write": {
26
- type: "boolean",
27
- description: "Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.",
28
- default: false
29
- },
30
- "allow-all": {
31
- type: "boolean",
32
- description: "Grant all permissions (implies --allow-write).",
33
- default: false
34
- }
35
- },
36
- async run({ values }) {
37
- const { runAgentStart } = await Promise.resolve().then(() => require("./agent-B4cAAab2.cjs"));
38
- await runAgentStart({
39
- port: values.port !== void 0 ? values.port : void 0,
40
- host: values.host,
41
- configPath: values.config,
42
- allowWrite: values["allow-write"],
43
- allowAll: values["allow-all"],
44
- version: require_package.version
45
- });
46
- }
47
- });
48
- //#endregion
49
- //#region src/commands/agent.ts
50
- const command = require_define.defineCommand({
51
- name: "agent",
52
- description: "Manage the Kubb Agent server",
53
- subCommands: [command$1]
54
- });
55
- //#endregion
56
- exports.command = command;
57
-
58
- //# sourceMappingURL=agent-Dmxzqg4d.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-Dmxzqg4d.cjs","names":["command","defineCommand","agentDefaults","defineCommand","startCommand"],"sources":["../src/commands/agent/start.ts","../src/commands/agent.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../../package.json'\nimport { agentDefaults } from '../../constants.ts'\n\nexport const command = defineCommand({\n name: 'start',\n description: 'Start the Agent server',\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n port: {\n type: 'string',\n description: `Port for the server (default: ${agentDefaults.port})`,\n short: 'p',\n },\n host: {\n type: 'string',\n description: 'Host for the server',\n default: agentDefaults.host,\n },\n 'allow-write': {\n type: 'boolean',\n description: 'Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.',\n default: false,\n },\n 'allow-all': {\n type: 'boolean',\n description: 'Grant all permissions (implies --allow-write).',\n default: false,\n },\n },\n async run({ values }) {\n const { runAgentStart } = await import('../../runners/agent.ts')\n\n await runAgentStart({\n port: values.port !== undefined ? values.port : undefined,\n host: values.host,\n configPath: values.config,\n allowWrite: values['allow-write'],\n allowAll: values['allow-all'],\n version,\n })\n },\n})\n","import { defineCommand } from '@internals/utils'\nimport { command as startCommand } from './agent/start.ts'\n\nexport const command = defineCommand({\n name: 'agent',\n description: 'Manage the Kubb Agent server',\n subCommands: [startCommand],\n})\n"],"mappings":";;;;;AAIA,MAAaA,YAAUC,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa,iCAAiCC,kBAAAA,cAAc,KAAK;GACjE,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACb,SAASA,kBAAAA,cAAc;GACxB;EACD,eAAe;GACb,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACD,aAAa;GACX,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACF;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,kBAAkB,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,uBAAA,CAAA;AAEhC,QAAM,cAAc;GAClB,MAAM,OAAO,SAAS,KAAA,IAAY,OAAO,OAAO,KAAA;GAChD,MAAM,OAAO;GACb,YAAY,OAAO;GACnB,YAAY,OAAO;GACnB,UAAU,OAAO;GACjB,SAAA,gBAAA;GACD,CAAC;;CAEL,CAAC;;;AC3CF,MAAa,UAAUC,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,aAAa,CAACC,UAAa;CAC5B,CAAC"}
@@ -1,148 +0,0 @@
1
- //#region src/constants.ts
2
- /**
3
- * Default filename for the Kubb configuration file.
4
- *
5
- * Used by the `init` command when scaffolding new projects and by the `agent` default config.
6
- */
7
- const KUBB_CONFIG_FILENAME = "kubb.config.ts";
8
- /**
9
- * NPM registry endpoint used to check for @kubb/cli updates.
10
- */
11
- const KUBB_NPM_PACKAGE_URL = "https://registry.npmjs.org/@kubb/cli/latest";
12
- /**
13
- * OpenTelemetry ingestion endpoint for anonymous usage telemetry.
14
- */
15
- const OTLP_ENDPOINT = "https://otlp.kubb.dev";
16
- /**
17
- * Horizontal rule rendered above/below the plain-logger generation summary.
18
- */
19
- const SUMMARY_SEPARATOR = "─".repeat(27);
20
- /**
21
- * Glob pattern for paths the file watcher ignores.
22
- */
23
- const WATCHER_IGNORED_PATHS = "**/{.git,node_modules}/**";
24
- /**
25
- * Flags that short-circuit execution (help/version) — no telemetry notice is shown.
26
- */
27
- const QUIET_FLAGS = new Set([
28
- "--help",
29
- "-h",
30
- "--version",
31
- "-v"
32
- ]);
33
- const agentDefaults = {
34
- port: "3000",
35
- host: "localhost",
36
- configFile: KUBB_CONFIG_FILENAME,
37
- retryTimeout: "30000",
38
- studioUrl: "https://studio.kubb.dev",
39
- /**
40
- * Relative path from the @kubb/agent package root to the server entry.
41
- */
42
- serverEntryPath: ".output/server/index.mjs"
43
- };
44
- /**
45
- * Default values used during interactive `init` scaffolding.
46
- */
47
- const initDefaults = {
48
- inputPath: "./openapi.yaml",
49
- outputPath: "./src/gen",
50
- plugins: ["plugin-ts"]
51
- };
52
- /**
53
- * Maps each plugin value to the default config snippet inserted by `init`.
54
- * The `satisfies` constraint ensures all values remain plain strings while
55
- * `as const` keeps the object deeply immutable.
56
- */
57
- const pluginDefaultConfigs = {
58
- "plugin-ts": `pluginTs({
59
- output: { path: 'models' },
60
- })`,
61
- "plugin-client": `pluginClient({
62
- output: { path: 'clients' },
63
- })`,
64
- "plugin-react-query": `pluginReactQuery({
65
- output: { path: 'hooks' },
66
- })`,
67
- "plugin-vue-query": `pluginVueQuery({
68
- output: { path: 'hooks' },
69
- })`,
70
- "plugin-zod": `pluginZod({
71
- output: { path: 'zod' },
72
- })`,
73
- "plugin-faker": `pluginFaker({
74
- output: { path: 'mocks' },
75
- })`,
76
- "plugin-msw": `pluginMsw({
77
- output: { path: 'msw' },
78
- })`,
79
- "plugin-cypress": `pluginCypress({
80
- output: { path: 'cypress' },
81
- })`,
82
- "plugin-mcp": `pluginMcp({
83
- output: { path: 'mcp' },
84
- })`,
85
- "plugin-redoc": `pluginRedoc({
86
- output: { path: 'redoc' },
87
- })`
88
- };
89
- /**
90
- * Color palette used by randomCliColor() for deterministic plugin name coloring.
91
- */
92
- //#endregion
93
- Object.defineProperty(exports, "KUBB_CONFIG_FILENAME", {
94
- enumerable: true,
95
- get: function() {
96
- return KUBB_CONFIG_FILENAME;
97
- }
98
- });
99
- Object.defineProperty(exports, "KUBB_NPM_PACKAGE_URL", {
100
- enumerable: true,
101
- get: function() {
102
- return KUBB_NPM_PACKAGE_URL;
103
- }
104
- });
105
- Object.defineProperty(exports, "OTLP_ENDPOINT", {
106
- enumerable: true,
107
- get: function() {
108
- return OTLP_ENDPOINT;
109
- }
110
- });
111
- Object.defineProperty(exports, "QUIET_FLAGS", {
112
- enumerable: true,
113
- get: function() {
114
- return QUIET_FLAGS;
115
- }
116
- });
117
- Object.defineProperty(exports, "SUMMARY_SEPARATOR", {
118
- enumerable: true,
119
- get: function() {
120
- return SUMMARY_SEPARATOR;
121
- }
122
- });
123
- Object.defineProperty(exports, "WATCHER_IGNORED_PATHS", {
124
- enumerable: true,
125
- get: function() {
126
- return WATCHER_IGNORED_PATHS;
127
- }
128
- });
129
- Object.defineProperty(exports, "agentDefaults", {
130
- enumerable: true,
131
- get: function() {
132
- return agentDefaults;
133
- }
134
- });
135
- Object.defineProperty(exports, "initDefaults", {
136
- enumerable: true,
137
- get: function() {
138
- return initDefaults;
139
- }
140
- });
141
- Object.defineProperty(exports, "pluginDefaultConfigs", {
142
- enumerable: true,
143
- get: function() {
144
- return pluginDefaultConfigs;
145
- }
146
- });
147
-
148
- //# sourceMappingURL=constants-CnDXa1R6.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants-CnDXa1R6.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Default filename for the Kubb configuration file.\n *\n * Used by the `init` command when scaffolding new projects and by the `agent` default config.\n */\nexport const KUBB_CONFIG_FILENAME = 'kubb.config.ts' as const\n\n/**\n * NPM registry endpoint used to check for @kubb/cli updates.\n */\nexport const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const\n\n/**\n * OpenTelemetry ingestion endpoint for anonymous usage telemetry.\n */\nexport const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const\n\n/**\n * Horizontal rule rendered above/below the plain-logger generation summary.\n */\nexport const SUMMARY_SEPARATOR = '─'.repeat(27)\n\n/**\n * Maximum number of █ characters in a plugin timing bar.\n */\nexport const SUMMARY_MAX_BAR_LENGTH = 10 as const\n\n/**\n * Divides elapsed milliseconds into bar-length units (1 block per 100 ms).\n */\nexport const SUMMARY_TIME_SCALE_DIVISOR = 100 as const\n\n/**\n * Glob pattern for paths the file watcher ignores.\n */\nexport const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/**\n * Flags that short-circuit execution (help/version) — no telemetry notice is shown.\n */\nexport const QUIET_FLAGS = new Set(['--help', '-h', '--version', '-v'] as const)\n\nexport const agentDefaults = {\n port: '3000',\n host: 'localhost',\n configFile: KUBB_CONFIG_FILENAME,\n retryTimeout: '30000',\n studioUrl: 'https://studio.kubb.dev',\n /**\n * Relative path from the @kubb/agent package root to the server entry.\n */\n serverEntryPath: '.output/server/index.mjs',\n} as const\n\n/**\n * Default values used during interactive `init` scaffolding.\n */\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-ts'],\n} as const\n\n/**\n * Maps each plugin value to the default config snippet inserted by `init`.\n * The `satisfies` constraint ensures all values remain plain strings while\n * `as const` keeps the object deeply immutable.\n */\nexport const pluginDefaultConfigs = {\n 'plugin-ts': `pluginTs({\n output: { path: 'models' },\n })`,\n 'plugin-client': `pluginClient({\n output: { path: 'clients' },\n })`,\n 'plugin-react-query': `pluginReactQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-zod': `pluginZod({\n output: { path: 'zod' },\n })`,\n 'plugin-faker': `pluginFaker({\n output: { path: 'mocks' },\n })`,\n 'plugin-msw': `pluginMsw({\n output: { path: 'msw' },\n })`,\n 'plugin-cypress': `pluginCypress({\n output: { path: 'cypress' },\n })`,\n 'plugin-mcp': `pluginMcp({\n output: { path: 'mcp' },\n })`,\n 'plugin-redoc': `pluginRedoc({\n output: { path: 'redoc' },\n })`,\n} as const satisfies Record<string, string>\n\n/**\n * Color palette used by randomCliColor() for deterministic plugin name coloring.\n */\n"],"mappings":";;;;;;AAKA,MAAa,uBAAuB;;;;AAKpC,MAAa,uBAAuB;;;;AAKpC,MAAa,gBAAgB;;;;AAK7B,MAAa,oBAAoB,IAAI,OAAO,GAAG;;;;AAe/C,MAAa,wBAAwB;;;;AAKrC,MAAa,cAAc,IAAI,IAAI;CAAC;CAAU;CAAM;CAAa;CAAK,CAAU;AAEhF,MAAa,gBAAgB;CAC3B,MAAM;CACN,MAAM;CACN,YAAY;CACZ,cAAc;CACd,WAAW;;;;CAIX,iBAAiB;CAClB;;;;AAKD,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,YAAY;CACvB;;;;;;AAOD,MAAa,uBAAuB;CAClC,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,oBAAoB;;;CAGpB,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGd,kBAAkB;;;CAGlB,cAAc;;;CAGd,gBAAgB;;;CAGjB"}
@@ -1,95 +0,0 @@
1
- //#region src/constants.ts
2
- /**
3
- * Default filename for the Kubb configuration file.
4
- *
5
- * Used by the `init` command when scaffolding new projects and by the `agent` default config.
6
- */
7
- const KUBB_CONFIG_FILENAME = "kubb.config.ts";
8
- /**
9
- * NPM registry endpoint used to check for @kubb/cli updates.
10
- */
11
- const KUBB_NPM_PACKAGE_URL = "https://registry.npmjs.org/@kubb/cli/latest";
12
- /**
13
- * OpenTelemetry ingestion endpoint for anonymous usage telemetry.
14
- */
15
- const OTLP_ENDPOINT = "https://otlp.kubb.dev";
16
- /**
17
- * Horizontal rule rendered above/below the plain-logger generation summary.
18
- */
19
- const SUMMARY_SEPARATOR = "─".repeat(27);
20
- /**
21
- * Glob pattern for paths the file watcher ignores.
22
- */
23
- const WATCHER_IGNORED_PATHS = "**/{.git,node_modules}/**";
24
- /**
25
- * Flags that short-circuit execution (help/version) — no telemetry notice is shown.
26
- */
27
- const QUIET_FLAGS = new Set([
28
- "--help",
29
- "-h",
30
- "--version",
31
- "-v"
32
- ]);
33
- const agentDefaults = {
34
- port: "3000",
35
- host: "localhost",
36
- configFile: KUBB_CONFIG_FILENAME,
37
- retryTimeout: "30000",
38
- studioUrl: "https://studio.kubb.dev",
39
- /**
40
- * Relative path from the @kubb/agent package root to the server entry.
41
- */
42
- serverEntryPath: ".output/server/index.mjs"
43
- };
44
- /**
45
- * Default values used during interactive `init` scaffolding.
46
- */
47
- const initDefaults = {
48
- inputPath: "./openapi.yaml",
49
- outputPath: "./src/gen",
50
- plugins: ["plugin-ts"]
51
- };
52
- /**
53
- * Maps each plugin value to the default config snippet inserted by `init`.
54
- * The `satisfies` constraint ensures all values remain plain strings while
55
- * `as const` keeps the object deeply immutable.
56
- */
57
- const pluginDefaultConfigs = {
58
- "plugin-ts": `pluginTs({
59
- output: { path: 'models' },
60
- })`,
61
- "plugin-client": `pluginClient({
62
- output: { path: 'clients' },
63
- })`,
64
- "plugin-react-query": `pluginReactQuery({
65
- output: { path: 'hooks' },
66
- })`,
67
- "plugin-vue-query": `pluginVueQuery({
68
- output: { path: 'hooks' },
69
- })`,
70
- "plugin-zod": `pluginZod({
71
- output: { path: 'zod' },
72
- })`,
73
- "plugin-faker": `pluginFaker({
74
- output: { path: 'mocks' },
75
- })`,
76
- "plugin-msw": `pluginMsw({
77
- output: { path: 'msw' },
78
- })`,
79
- "plugin-cypress": `pluginCypress({
80
- output: { path: 'cypress' },
81
- })`,
82
- "plugin-mcp": `pluginMcp({
83
- output: { path: 'mcp' },
84
- })`,
85
- "plugin-redoc": `pluginRedoc({
86
- output: { path: 'redoc' },
87
- })`
88
- };
89
- /**
90
- * Color palette used by randomCliColor() for deterministic plugin name coloring.
91
- */
92
- //#endregion
93
- export { SUMMARY_SEPARATOR as a, initDefaults as c, QUIET_FLAGS as i, pluginDefaultConfigs as l, KUBB_NPM_PACKAGE_URL as n, WATCHER_IGNORED_PATHS as o, OTLP_ENDPOINT as r, agentDefaults as s, KUBB_CONFIG_FILENAME as t };
94
-
95
- //# sourceMappingURL=constants-aL3CP_Wq.js.map