@kubb/cli 5.0.0-beta.8 → 5.0.0-beta.81

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 (135) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +48 -79
  3. package/bin/kubb.js +9 -3
  4. package/dist/Telemetry-jtbchpQE.cjs +315 -0
  5. package/dist/Telemetry-jtbchpQE.cjs.map +1 -0
  6. package/dist/Telemetry-ugO-B77y.js +284 -0
  7. package/dist/Telemetry-ugO-B77y.js.map +1 -0
  8. package/dist/{define-Bdn8j5VM.cjs → defineCommand-Bo3yZTWI.cjs} +3 -21
  9. package/dist/defineCommand-Bo3yZTWI.cjs.map +1 -0
  10. package/dist/{define-m_fp-Aqm.js → defineCommand-DMEeqliP.js} +4 -16
  11. package/dist/defineCommand-DMEeqliP.js.map +1 -0
  12. package/dist/{errors-CINO1EIv.js → errors-Dc_d7BfX.js} +2 -2
  13. package/dist/{errors-CINO1EIv.js.map → errors-Dc_d7BfX.js.map} +1 -1
  14. package/dist/{errors-CLCjoSg0.cjs → errors-gxFK0vrp.cjs} +2 -2
  15. package/dist/{errors-CLCjoSg0.cjs.map → errors-gxFK0vrp.cjs.map} +1 -1
  16. package/dist/{generate-DzC1brc9.js → generate-C-J93nyx.js} +21 -16
  17. package/dist/generate-C-J93nyx.js.map +1 -0
  18. package/dist/{generate-CiBa5UMJ.cjs → generate-ONVXJYuR.cjs} +21 -16
  19. package/dist/generate-ONVXJYuR.cjs.map +1 -0
  20. package/dist/index.cjs +87 -152
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.ts +6 -1
  23. package/dist/index.js +87 -152
  24. package/dist/index.js.map +1 -1
  25. package/dist/{init-BYlb-ua0.js → init-B-vyaxN4.js} +7 -7
  26. package/dist/init-B-vyaxN4.js.map +1 -0
  27. package/dist/{init-BVYkUQ-b.cjs → init-jpDYabNs.cjs} +8 -8
  28. package/dist/init-jpDYabNs.cjs.map +1 -0
  29. package/dist/mcp-CEKfNLNk.js +21 -0
  30. package/dist/mcp-CEKfNLNk.js.map +1 -0
  31. package/dist/mcp-FhVeNd9X.cjs +21 -0
  32. package/dist/mcp-FhVeNd9X.cjs.map +1 -0
  33. package/dist/package-CWDzRwvR.js +6 -0
  34. package/dist/package-CWDzRwvR.js.map +1 -0
  35. package/dist/{package-BvBzYG6c.cjs → package-CuDwndsr.cjs} +2 -2
  36. package/dist/package-CuDwndsr.cjs.map +1 -0
  37. package/dist/{chunk-BvFE5Tac.js → rolldown-runtime-C0LytTxp.js} +0 -1
  38. package/dist/{run-CF97BWVa.js → run-44Zxh8Ec.js} +130 -85
  39. package/dist/run-44Zxh8Ec.js.map +1 -0
  40. package/dist/run-BBLhhWZu.js +32 -0
  41. package/dist/run-BBLhhWZu.js.map +1 -0
  42. package/dist/run-Bz6ZUrhp.cjs +33 -0
  43. package/dist/run-Bz6ZUrhp.cjs.map +1 -0
  44. package/dist/run-CJMruw7K.cjs +1326 -0
  45. package/dist/run-CJMruw7K.cjs.map +1 -0
  46. package/dist/{run-CCZ24VKk.js → run-CPBFfbI7.js} +5 -5
  47. package/dist/run-CPBFfbI7.js.map +1 -0
  48. package/dist/run-Ccii8MpO.js +1323 -0
  49. package/dist/run-Ccii8MpO.js.map +1 -0
  50. package/dist/{run-YsoCk5we.cjs → run-DXEMoDFa.cjs} +143 -98
  51. package/dist/run-DXEMoDFa.cjs.map +1 -0
  52. package/dist/{run-CQbj3ley.cjs → run-DYkciQ4u.cjs} +6 -6
  53. package/dist/run-DYkciQ4u.cjs.map +1 -0
  54. package/dist/tools-CZT9wSA6.cjs +175 -0
  55. package/dist/tools-CZT9wSA6.cjs.map +1 -0
  56. package/dist/tools-D0UogMU3.js +152 -0
  57. package/dist/tools-D0UogMU3.js.map +1 -0
  58. package/dist/{validate-Da2LIDVc.js → validate-BKsUlm03.js} +5 -5
  59. package/dist/{validate-Da2LIDVc.js.map → validate-BKsUlm03.js.map} +1 -1
  60. package/dist/{validate-BYuHYBhg.cjs → validate-FY50bAV1.cjs} +6 -6
  61. package/dist/{validate-BYuHYBhg.cjs.map → validate-FY50bAV1.cjs.map} +1 -1
  62. package/package.json +13 -25
  63. package/dist/agent-DPLjUza1.cjs +0 -70
  64. package/dist/agent-DPLjUza1.cjs.map +0 -1
  65. package/dist/agent-DTeGTNl7.js +0 -68
  66. package/dist/agent-DTeGTNl7.js.map +0 -1
  67. package/dist/constants-B2JTeRBb.js +0 -42
  68. package/dist/constants-B2JTeRBb.js.map +0 -1
  69. package/dist/constants-BINTA5VZ.cjs +0 -77
  70. package/dist/constants-BINTA5VZ.cjs.map +0 -1
  71. package/dist/constants-BYGmiFs0.cjs +0 -139
  72. package/dist/constants-BYGmiFs0.cjs.map +0 -1
  73. package/dist/constants-DSJ-Xrbv.js +0 -116
  74. package/dist/constants-DSJ-Xrbv.js.map +0 -1
  75. package/dist/define-Bdn8j5VM.cjs.map +0 -1
  76. package/dist/define-m_fp-Aqm.js.map +0 -1
  77. package/dist/generate-CiBa5UMJ.cjs.map +0 -1
  78. package/dist/generate-DzC1brc9.js.map +0 -1
  79. package/dist/init-BVYkUQ-b.cjs.map +0 -1
  80. package/dist/init-BYlb-ua0.js.map +0 -1
  81. package/dist/mcp-Bm2Q7YdS.js +0 -39
  82. package/dist/mcp-Bm2Q7YdS.js.map +0 -1
  83. package/dist/mcp-CiNoagVX.cjs +0 -39
  84. package/dist/mcp-CiNoagVX.cjs.map +0 -1
  85. package/dist/package-BvBzYG6c.cjs.map +0 -1
  86. package/dist/package-s8PvCnk-.js +0 -6
  87. package/dist/package-s8PvCnk-.js.map +0 -1
  88. package/dist/run-BzpYYOQs.js +0 -121
  89. package/dist/run-BzpYYOQs.js.map +0 -1
  90. package/dist/run-CCZ24VKk.js.map +0 -1
  91. package/dist/run-CF97BWVa.js.map +0 -1
  92. package/dist/run-CQbj3ley.cjs.map +0 -1
  93. package/dist/run-CXTVu3Wl.js +0 -1738
  94. package/dist/run-CXTVu3Wl.js.map +0 -1
  95. package/dist/run-D0hmRpHy.js +0 -49
  96. package/dist/run-D0hmRpHy.js.map +0 -1
  97. package/dist/run-DwdAwnLG.cjs +0 -125
  98. package/dist/run-DwdAwnLG.cjs.map +0 -1
  99. package/dist/run-Lr0Ctnu0.cjs +0 -50
  100. package/dist/run-Lr0Ctnu0.cjs.map +0 -1
  101. package/dist/run-QyqW2rPC.cjs +0 -1741
  102. package/dist/run-QyqW2rPC.cjs.map +0 -1
  103. package/dist/run-YsoCk5we.cjs.map +0 -1
  104. package/dist/shell-475fQKaX.cjs +0 -62
  105. package/dist/shell-475fQKaX.cjs.map +0 -1
  106. package/dist/shell-CN6DNqeC.js +0 -51
  107. package/dist/shell-CN6DNqeC.js.map +0 -1
  108. package/dist/telemetry-B2iWkY5e.cjs +0 -280
  109. package/dist/telemetry-B2iWkY5e.cjs.map +0 -1
  110. package/dist/telemetry-BkektVz6.js +0 -243
  111. package/dist/telemetry-BkektVz6.js.map +0 -1
  112. package/src/commands/agent/start.ts +0 -50
  113. package/src/commands/agent.ts +0 -10
  114. package/src/commands/generate.ts +0 -59
  115. package/src/commands/init.ts +0 -51
  116. package/src/commands/mcp.ts +0 -36
  117. package/src/commands/validate.ts +0 -22
  118. package/src/constants.ts +0 -48
  119. package/src/index.ts +0 -45
  120. package/src/loggers/clackLogger.ts +0 -460
  121. package/src/loggers/fileSystemLogger.ts +0 -151
  122. package/src/loggers/githubActionsLogger.ts +0 -367
  123. package/src/loggers/plainLogger.ts +0 -243
  124. package/src/loggers/types.ts +0 -7
  125. package/src/loggers/utils.ts +0 -252
  126. package/src/runners/agent/run.ts +0 -113
  127. package/src/runners/agent/utils.ts +0 -98
  128. package/src/runners/generate/run.ts +0 -276
  129. package/src/runners/generate/utils.ts +0 -209
  130. package/src/runners/init/run.ts +0 -211
  131. package/src/runners/init/utils.ts +0 -33
  132. package/src/runners/mcp/run.ts +0 -55
  133. package/src/runners/validate/run.ts +0 -63
  134. package/src/telemetry.ts +0 -280
  135. /package/dist/{chunk-ByKO4r7w.cjs → rolldown-runtime-Bx3C2hgW.cjs} +0 -0
@@ -1,59 +0,0 @@
1
- import { defineCommand } from '@internals/utils'
2
-
3
- export const command = defineCommand({
4
- name: 'generate',
5
- description:
6
- 'Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.',
7
- arguments: ['[input]'],
8
- examples: ['kubb generate', 'kubb generate ./openapi.yaml', 'kubb generate --config kubb.config.ts', 'kubb generate --watch'],
9
- options: {
10
- config: {
11
- type: 'string',
12
- description: 'Path to the Kubb config',
13
- short: 'c',
14
- },
15
- logLevel: {
16
- type: 'string',
17
- description: 'Info, silent, verbose or debug',
18
- short: 'l',
19
- default: 'info',
20
- hint: 'silent|info|verbose|debug',
21
- enum: ['silent', 'info', 'verbose', 'debug'],
22
- },
23
- watch: {
24
- type: 'boolean',
25
- description: 'Watch mode based on the input file',
26
- short: 'w',
27
- default: false,
28
- },
29
- debug: {
30
- type: 'boolean',
31
- description: 'Override logLevel to debug',
32
- short: 'd',
33
- default: false,
34
- },
35
- verbose: {
36
- type: 'boolean',
37
- description: 'Override logLevel to verbose',
38
- short: 'v',
39
- default: false,
40
- },
41
- silent: {
42
- type: 'boolean',
43
- description: 'Override logLevel to silent',
44
- short: 's',
45
- default: false,
46
- },
47
- },
48
- async run({ values, positionals }) {
49
- const logLevel = values.debug ? 'debug' : values.verbose ? 'verbose' : values.silent ? 'silent' : values.logLevel
50
- const { run } = await import('../runners/generate/run.ts')
51
-
52
- await run({
53
- input: positionals[0],
54
- configPath: values.config,
55
- logLevel,
56
- watch: values.watch,
57
- })
58
- },
59
- })
@@ -1,51 +0,0 @@
1
- import { defineCommand } from '@internals/utils'
2
- import { version } from '../../package.json'
3
-
4
- export const command = defineCommand({
5
- name: 'init',
6
- description:
7
- 'Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.',
8
- examples: [
9
- 'kubb init',
10
- 'kubb init --yes',
11
- 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',
12
- 'kubb init --plugins plugin-ts,plugin-client,plugin-react-query',
13
- ],
14
- options: {
15
- yes: {
16
- type: 'boolean',
17
- description: 'Skip prompts and use default options',
18
- short: 'y',
19
- default: false,
20
- },
21
- input: {
22
- type: 'string',
23
- description: 'Path to the OpenAPI specification',
24
- short: 'i',
25
- hint: 'path',
26
- },
27
- output: {
28
- type: 'string',
29
- description: 'Output directory for generated files',
30
- short: 'o',
31
- hint: 'path',
32
- },
33
- plugins: {
34
- type: 'string',
35
- description:
36
- 'Comma-separated list of plugins to use (plugin-ts, plugin-client, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)',
37
- hint: 'plugin-ts,plugin-zod,...',
38
- },
39
- },
40
- async run({ values }) {
41
- const { run } = await import('../runners/init/run.ts')
42
-
43
- await run({
44
- yes: values.yes,
45
- version,
46
- input: values.input,
47
- output: values.output,
48
- plugins: values.plugins,
49
- })
50
- },
51
- })
@@ -1,36 +0,0 @@
1
- import { defineCommand } from '@internals/utils'
2
- import { version } from '../../package.json'
3
-
4
- export const command = defineCommand({
5
- name: 'mcp',
6
- description:
7
- 'Start a Model Context Protocol (MCP) server that exposes Kubb code generation as tools for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect to it — the assistant can then call kubb generate directly without leaving the chat.',
8
- examples: [
9
- 'kubb mcp',
10
- 'kubb mcp --port 3001',
11
- '# Then add to your MCP client config:',
12
- '# { "mcpServers": { "kubb": { "command": "npx", "args": ["kubb", "mcp"] } } }',
13
- ],
14
- options: {
15
- port: {
16
- type: 'string',
17
- short: 'p',
18
- description: 'Port for HTTP MCP server (omit for stdio)',
19
- hint: 'number',
20
- },
21
- host: {
22
- type: 'string',
23
- description: 'Hostname to bind to (HTTP mode only)',
24
- default: 'localhost',
25
- },
26
- },
27
- async run({ values }) {
28
- const { run } = await import('../runners/mcp/run.ts')
29
-
30
- await run({
31
- version,
32
- port: values.port,
33
- host: values.host,
34
- })
35
- },
36
- })
@@ -1,22 +0,0 @@
1
- import { defineCommand } from '@internals/utils'
2
- import { version } from '../../package.json'
3
-
4
- export const command = defineCommand({
5
- name: 'validate',
6
- description:
7
- 'Parse and validate an OpenAPI/Swagger file for structural correctness. Reports schema errors, missing required fields, and malformed references. Use this before running generate to catch spec issues early.',
8
- examples: ['kubb validate --input ./openapi.yaml', 'kubb validate --input https://petstore3.swagger.io/api/v3/openapi.json'],
9
- options: {
10
- input: {
11
- type: 'string',
12
- description: 'Path or URL to the OpenAPI/Swagger file to validate',
13
- short: 'i',
14
- required: true,
15
- },
16
- },
17
- async run({ values }) {
18
- const { run } = await import('../runners/validate/run.ts')
19
-
20
- await run({ input: values.input, version })
21
- },
22
- })
package/src/constants.ts DELETED
@@ -1,48 +0,0 @@
1
- import { KUBB_CONFIG_FILENAME } from '@internals/shared'
2
-
3
- /**
4
- * NPM registry endpoint used to check for @kubb/cli updates.
5
- */
6
- export const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const
7
-
8
- /**
9
- * OpenTelemetry ingestion endpoint for anonymous usage telemetry.
10
- */
11
- export const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const
12
-
13
- /**
14
- * Horizontal rule rendered above/below the plain-logger generation summary.
15
- */
16
- export const SUMMARY_SEPARATOR = '─'.repeat(27)
17
-
18
- /**
19
- * Maximum number of █ characters in a plugin timing bar.
20
- */
21
- export const SUMMARY_MAX_BAR_LENGTH = 10 as const
22
-
23
- /**
24
- * Divides elapsed milliseconds into bar-length units (1 block per 100 ms).
25
- */
26
- export const SUMMARY_TIME_SCALE_DIVISOR = 100 as const
27
-
28
- /**
29
- * Glob pattern for paths the file watcher ignores.
30
- */
31
- export const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const
32
-
33
- /**
34
- * Flags that short-circuit execution (help/version) — no telemetry notice is shown.
35
- */
36
- export const QUIET_FLAGS = new Set(['--help', '-h', '--version', '-v'] as const)
37
-
38
- export const agentDefaults = {
39
- port: '3000',
40
- host: 'localhost',
41
- configFile: KUBB_CONFIG_FILENAME,
42
- retryTimeout: '30000',
43
- studioUrl: 'https://kubb.studio',
44
- /**
45
- * Relative path from the @kubb/agent package root to the server entry.
46
- */
47
- serverEntryPath: '.output/server/index.mjs',
48
- } as const
package/src/index.ts DELETED
@@ -1,45 +0,0 @@
1
- import { styleText } from 'node:util'
2
- import { createCLI, isFlag } from '@internals/utils'
3
- import { version } from '../package.json'
4
- import { QUIET_FLAGS } from './constants.ts'
5
- import { isTelemetryDisabled } from './telemetry.ts'
6
-
7
- const cli = createCLI()
8
-
9
- function shouldShowTelemetryNotice(argv: Array<string>): boolean {
10
- if (isTelemetryDisabled()) {
11
- return false
12
- }
13
-
14
- // Skip when the user is just asking for help or version info
15
- if (argv.some((arg) => isFlag(QUIET_FLAGS, arg))) {
16
- return false
17
- }
18
-
19
- // Skip in non-interactive / scripting contexts
20
- if (!process.stdout.isTTY) {
21
- return false
22
- }
23
-
24
- return true
25
- }
26
-
27
- export async function run(argv: Array<string> = process.argv): Promise<void> {
28
- if (shouldShowTelemetryNotice(argv)) {
29
- console.log(
30
- `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\n`,
31
- )
32
- }
33
-
34
- const { command: generateCommand } = await import('./commands/generate.ts')
35
- const { command: validateCommand } = await import('./commands/validate.ts')
36
- const { command: mcpCommand } = await import('./commands/mcp.ts')
37
- const { command: agentCommand } = await import('./commands/agent.ts')
38
- const { command: initCommand } = await import('./commands/init.ts')
39
-
40
- await cli.run([generateCommand, validateCommand, mcpCommand, agentCommand, initCommand], argv, {
41
- programName: 'kubb',
42
- defaultCommandName: 'generate',
43
- version,
44
- })
45
- }