@kubb/cli 5.0.0-beta.11 → 5.0.0-beta.110

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 (138) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +55 -86
  3. package/bin/kubb.js +9 -3
  4. package/dist/Telemetry-7z2tIqPm.js +282 -0
  5. package/dist/Telemetry-7z2tIqPm.js.map +1 -0
  6. package/dist/{telemetry-B2iWkY5e.cjs → Telemetry-DQOmn6aR.cjs} +167 -116
  7. package/dist/Telemetry-DQOmn6aR.cjs.map +1 -0
  8. package/dist/{errors-CINO1EIv.js → errors-CMvLO2NE.js} +3 -15
  9. package/dist/{errors-CINO1EIv.js.map → errors-CMvLO2NE.js.map} +1 -1
  10. package/dist/{errors-CLCjoSg0.cjs → errors-CZtH2dKk.cjs} +2 -20
  11. package/dist/{errors-CLCjoSg0.cjs.map → errors-CZtH2dKk.cjs.map} +1 -1
  12. package/dist/generate-BcwqjrM8.cjs +95 -0
  13. package/dist/generate-BcwqjrM8.cjs.map +1 -0
  14. package/dist/generate-CYWEueP4.js +95 -0
  15. package/dist/generate-CYWEueP4.js.map +1 -0
  16. package/dist/index.cjs +33 -261
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.ts +6 -2
  19. package/dist/index.js +34 -262
  20. package/dist/index.js.map +1 -1
  21. package/dist/{init-DDBAAtNw.cjs → init-Ne4iWip6.cjs} +12 -13
  22. package/dist/init-Ne4iWip6.cjs.map +1 -0
  23. package/dist/{init-DalNYdKX.js → init-hCGd9LYk.js} +13 -13
  24. package/dist/init-hCGd9LYk.js.map +1 -0
  25. package/dist/mcp-C0rylVMu.js +21 -0
  26. package/dist/mcp-C0rylVMu.js.map +1 -0
  27. package/dist/mcp-t1zn9jKu.cjs +20 -0
  28. package/dist/mcp-t1zn9jKu.cjs.map +1 -0
  29. package/dist/package-BkVXQDrR.js +6 -0
  30. package/dist/package-BkVXQDrR.js.map +1 -0
  31. package/dist/{package-Dwr7GtJx.cjs → package-RKlBi2yq.cjs} +2 -2
  32. package/dist/package-RKlBi2yq.cjs.map +1 -0
  33. package/dist/{chunk-BvFE5Tac.js → rolldown-runtime-C0LytTxp.js} +0 -1
  34. package/dist/{chunk-ByKO4r7w.cjs → rolldown-runtime-qbf5tadS.cjs} +1 -1
  35. package/dist/{run-CQbj3ley.cjs → run-31OgOcxn.cjs} +9 -15
  36. package/dist/run-31OgOcxn.cjs.map +1 -0
  37. package/dist/run-Beh-ji9Y.js +1248 -0
  38. package/dist/run-Beh-ji9Y.js.map +1 -0
  39. package/dist/run-BlWEfHq_.cjs +315 -0
  40. package/dist/run-BlWEfHq_.cjs.map +1 -0
  41. package/dist/{run-CCZ24VKk.js → run-CaOjZRiQ.js} +7 -13
  42. package/dist/run-CaOjZRiQ.js.map +1 -0
  43. package/dist/{run-CF97BWVa.js → run-Cea4Wfyp.js} +157 -90
  44. package/dist/run-Cea4Wfyp.js.map +1 -0
  45. package/dist/run-DAHp52w3.js +33 -0
  46. package/dist/run-DAHp52w3.js.map +1 -0
  47. package/dist/run-DEVBHfNr.cjs +34 -0
  48. package/dist/run-DEVBHfNr.cjs.map +1 -0
  49. package/dist/run-YzBa37Vx.cjs +1251 -0
  50. package/dist/run-YzBa37Vx.cjs.map +1 -0
  51. package/dist/tools-DH1a7ZJH.js +152 -0
  52. package/dist/tools-DH1a7ZJH.js.map +1 -0
  53. package/dist/tools-bwKAf_r-.cjs +175 -0
  54. package/dist/tools-bwKAf_r-.cjs.map +1 -0
  55. package/dist/{validate-D5HeJjHB.cjs → validate-CpZJI3k7.cjs} +10 -12
  56. package/dist/validate-CpZJI3k7.cjs.map +1 -0
  57. package/dist/validate-D0qXVHbv.js +25 -0
  58. package/dist/validate-D0qXVHbv.js.map +1 -0
  59. package/package.json +15 -28
  60. package/dist/agent-DB8Fr0U8.cjs +0 -70
  61. package/dist/agent-DB8Fr0U8.cjs.map +0 -1
  62. package/dist/agent-DcsBatCv.js +0 -68
  63. package/dist/agent-DcsBatCv.js.map +0 -1
  64. package/dist/constants-B2JTeRBb.js +0 -42
  65. package/dist/constants-B2JTeRBb.js.map +0 -1
  66. package/dist/constants-BINTA5VZ.cjs +0 -77
  67. package/dist/constants-BINTA5VZ.cjs.map +0 -1
  68. package/dist/constants-BYGmiFs0.cjs +0 -139
  69. package/dist/constants-BYGmiFs0.cjs.map +0 -1
  70. package/dist/constants-DSJ-Xrbv.js +0 -116
  71. package/dist/constants-DSJ-Xrbv.js.map +0 -1
  72. package/dist/define-Bdn8j5VM.cjs +0 -54
  73. package/dist/define-Bdn8j5VM.cjs.map +0 -1
  74. package/dist/define-m_fp-Aqm.js +0 -43
  75. package/dist/define-m_fp-Aqm.js.map +0 -1
  76. package/dist/generate-DVe4vPXT.cjs +0 -71
  77. package/dist/generate-DVe4vPXT.cjs.map +0 -1
  78. package/dist/generate-dhgVXAZM.js +0 -72
  79. package/dist/generate-dhgVXAZM.js.map +0 -1
  80. package/dist/init-DDBAAtNw.cjs.map +0 -1
  81. package/dist/init-DalNYdKX.js.map +0 -1
  82. package/dist/mcp-CjLC0gfa.cjs +0 -39
  83. package/dist/mcp-CjLC0gfa.cjs.map +0 -1
  84. package/dist/mcp-qo6oTY1b.js +0 -39
  85. package/dist/mcp-qo6oTY1b.js.map +0 -1
  86. package/dist/package-BS53bjcw.js +0 -6
  87. package/dist/package-BS53bjcw.js.map +0 -1
  88. package/dist/package-Dwr7GtJx.cjs.map +0 -1
  89. package/dist/run-BzpYYOQs.js +0 -121
  90. package/dist/run-BzpYYOQs.js.map +0 -1
  91. package/dist/run-CCZ24VKk.js.map +0 -1
  92. package/dist/run-CF97BWVa.js.map +0 -1
  93. package/dist/run-CQbj3ley.cjs.map +0 -1
  94. package/dist/run-CdRxfPGM.js +0 -1736
  95. package/dist/run-CdRxfPGM.js.map +0 -1
  96. package/dist/run-CqN9CaCO.cjs +0 -1739
  97. package/dist/run-CqN9CaCO.cjs.map +0 -1
  98. package/dist/run-D0hmRpHy.js +0 -49
  99. package/dist/run-D0hmRpHy.js.map +0 -1
  100. package/dist/run-DwdAwnLG.cjs +0 -125
  101. package/dist/run-DwdAwnLG.cjs.map +0 -1
  102. package/dist/run-Lr0Ctnu0.cjs +0 -50
  103. package/dist/run-Lr0Ctnu0.cjs.map +0 -1
  104. package/dist/run-YsoCk5we.cjs +0 -248
  105. package/dist/run-YsoCk5we.cjs.map +0 -1
  106. package/dist/shell-475fQKaX.cjs +0 -62
  107. package/dist/shell-475fQKaX.cjs.map +0 -1
  108. package/dist/shell-CN6DNqeC.js +0 -51
  109. package/dist/shell-CN6DNqeC.js.map +0 -1
  110. package/dist/telemetry-B2iWkY5e.cjs.map +0 -1
  111. package/dist/telemetry-BkektVz6.js +0 -243
  112. package/dist/telemetry-BkektVz6.js.map +0 -1
  113. package/dist/validate-C00u0BgS.js +0 -26
  114. package/dist/validate-C00u0BgS.js.map +0 -1
  115. package/dist/validate-D5HeJjHB.cjs.map +0 -1
  116. package/src/commands/agent/start.ts +0 -50
  117. package/src/commands/agent.ts +0 -10
  118. package/src/commands/generate.ts +0 -59
  119. package/src/commands/init.ts +0 -51
  120. package/src/commands/mcp.ts +0 -36
  121. package/src/commands/validate.ts +0 -22
  122. package/src/constants.ts +0 -48
  123. package/src/index.ts +0 -45
  124. package/src/loggers/clackLogger.ts +0 -460
  125. package/src/loggers/fileSystemLogger.ts +0 -151
  126. package/src/loggers/githubActionsLogger.ts +0 -367
  127. package/src/loggers/plainLogger.ts +0 -243
  128. package/src/loggers/types.ts +0 -7
  129. package/src/loggers/utils.ts +0 -252
  130. package/src/runners/agent/run.ts +0 -113
  131. package/src/runners/agent/utils.ts +0 -98
  132. package/src/runners/generate/run.ts +0 -276
  133. package/src/runners/generate/utils.ts +0 -209
  134. package/src/runners/init/run.ts +0 -211
  135. package/src/runners/init/utils.ts +0 -33
  136. package/src/runners/mcp/run.ts +0 -55
  137. package/src/runners/validate/run.ts +0 -63
  138. package/src/telemetry.ts +0 -280
@@ -1,116 +0,0 @@
1
- //#region ../../internals/shared/src/constants.ts
2
- const KUBB_CONFIG_FILENAME = "kubb.config.ts";
3
- const initDefaults = {
4
- inputPath: "./openapi.yaml",
5
- outputPath: "./src/gen",
6
- plugins: ["plugin-ts"]
7
- };
8
- const availablePlugins = [
9
- {
10
- value: "plugin-ts",
11
- label: "TypeScript",
12
- hint: "Recommended",
13
- packageName: "@kubb/plugin-ts",
14
- importName: "pluginTs",
15
- category: "types"
16
- },
17
- {
18
- value: "plugin-client",
19
- label: "Client (Fetch/Axios)",
20
- packageName: "@kubb/plugin-client",
21
- importName: "pluginClient",
22
- category: "client"
23
- },
24
- {
25
- value: "plugin-react-query",
26
- label: "React Query / TanStack Query",
27
- packageName: "@kubb/plugin-react-query",
28
- importName: "pluginReactQuery",
29
- category: "framework"
30
- },
31
- {
32
- value: "plugin-vue-query",
33
- label: "Vue Query",
34
- packageName: "@kubb/plugin-vue-query",
35
- importName: "pluginVueQuery",
36
- category: "framework"
37
- },
38
- {
39
- value: "plugin-zod",
40
- label: "Zod Schemas",
41
- packageName: "@kubb/plugin-zod",
42
- importName: "pluginZod",
43
- category: "validation"
44
- },
45
- {
46
- value: "plugin-faker",
47
- label: "Faker.js Mocks",
48
- packageName: "@kubb/plugin-faker",
49
- importName: "pluginFaker",
50
- category: "mocks"
51
- },
52
- {
53
- value: "plugin-msw",
54
- label: "MSW Handlers",
55
- packageName: "@kubb/plugin-msw",
56
- importName: "pluginMsw",
57
- category: "mocks"
58
- },
59
- {
60
- value: "plugin-cypress",
61
- label: "Cypress Tests",
62
- packageName: "@kubb/plugin-cypress",
63
- importName: "pluginCypress",
64
- category: "testing"
65
- },
66
- {
67
- value: "plugin-mcp",
68
- label: "MCP Server (AI / Model Context Protocol)",
69
- packageName: "@kubb/plugin-mcp",
70
- importName: "pluginMcp",
71
- category: "ai"
72
- },
73
- {
74
- value: "plugin-redoc",
75
- label: "ReDoc Documentation",
76
- packageName: "@kubb/plugin-redoc",
77
- importName: "pluginRedoc",
78
- category: "documentation"
79
- }
80
- ];
81
- const pluginDefaultConfigs = {
82
- "plugin-ts": `pluginTs({
83
- output: { path: 'models' },
84
- })`,
85
- "plugin-client": `pluginClient({
86
- output: { path: 'clients' },
87
- })`,
88
- "plugin-react-query": `pluginReactQuery({
89
- output: { path: 'hooks' },
90
- })`,
91
- "plugin-vue-query": `pluginVueQuery({
92
- output: { path: 'hooks' },
93
- })`,
94
- "plugin-zod": `pluginZod({
95
- output: { path: 'zod' },
96
- })`,
97
- "plugin-faker": `pluginFaker({
98
- output: { path: 'mocks' },
99
- })`,
100
- "plugin-msw": `pluginMsw({
101
- output: { path: 'msw' },
102
- })`,
103
- "plugin-cypress": `pluginCypress({
104
- output: { path: 'cypress' },
105
- })`,
106
- "plugin-mcp": `pluginMcp({
107
- output: { path: 'mcp' },
108
- })`,
109
- "plugin-redoc": `pluginRedoc({
110
- output: { path: 'redoc' },
111
- })`
112
- };
113
- //#endregion
114
- export { pluginDefaultConfigs as i, availablePlugins as n, initDefaults as r, KUBB_CONFIG_FILENAME as t };
115
-
116
- //# sourceMappingURL=constants-DSJ-Xrbv.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants-DSJ-Xrbv.js","names":[],"sources":["../../../internals/shared/src/constants.ts"],"sourcesContent":["import type { PluginOption } from './types.ts'\n\nexport const KUBB_CONFIG_FILENAME = 'kubb.config.ts' as const\n\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-ts'],\n} as const\n\nexport const availablePlugins: PluginOption[] = [\n {\n value: 'plugin-ts',\n label: 'TypeScript',\n hint: 'Recommended',\n packageName: '@kubb/plugin-ts',\n importName: 'pluginTs',\n category: 'types',\n },\n {\n value: 'plugin-client',\n label: 'Client (Fetch/Axios)',\n packageName: '@kubb/plugin-client',\n importName: 'pluginClient',\n category: 'client',\n },\n {\n value: 'plugin-react-query',\n label: 'React Query / TanStack Query',\n packageName: '@kubb/plugin-react-query',\n importName: 'pluginReactQuery',\n category: 'framework',\n },\n {\n value: 'plugin-vue-query',\n label: 'Vue Query',\n packageName: '@kubb/plugin-vue-query',\n importName: 'pluginVueQuery',\n category: 'framework',\n },\n {\n value: 'plugin-zod',\n label: 'Zod Schemas',\n packageName: '@kubb/plugin-zod',\n importName: 'pluginZod',\n category: 'validation',\n },\n {\n value: 'plugin-faker',\n label: 'Faker.js Mocks',\n packageName: '@kubb/plugin-faker',\n importName: 'pluginFaker',\n category: 'mocks',\n },\n {\n value: 'plugin-msw',\n label: 'MSW Handlers',\n packageName: '@kubb/plugin-msw',\n importName: 'pluginMsw',\n category: 'mocks',\n },\n {\n value: 'plugin-cypress',\n label: 'Cypress Tests',\n packageName: '@kubb/plugin-cypress',\n importName: 'pluginCypress',\n category: 'testing',\n },\n {\n value: 'plugin-mcp',\n label: 'MCP Server (AI / Model Context Protocol)',\n packageName: '@kubb/plugin-mcp',\n importName: 'pluginMcp',\n category: 'ai',\n },\n {\n value: 'plugin-redoc',\n label: 'ReDoc Documentation',\n packageName: '@kubb/plugin-redoc',\n importName: 'pluginRedoc',\n category: 'documentation',\n },\n]\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"],"mappings":";AAEA,MAAa,uBAAuB;AAEpC,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,YAAY;CACvB;AAED,MAAa,mBAAmC;CAC9C;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACF;AAED,MAAa,uBAAuB;CAClC,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,oBAAoB;;;CAGpB,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGd,kBAAkB;;;CAGlB,cAAc;;;CAGd,gBAAgB;;;CAGjB"}
@@ -1,54 +0,0 @@
1
- require("./chunk-ByKO4r7w.cjs");
2
- //#region ../../internals/utils/src/cli/define.ts
3
- /**
4
- * Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.
5
- *
6
- * @example
7
- * ```ts
8
- * const adapter = defineCLIAdapter({ run: myRun, renderHelp: myHelp })
9
- * createCLI({ adapter }).run(commands, argv, opts)
10
- * ```
11
- */
12
- function defineCLIAdapter(adapter) {
13
- return adapter;
14
- }
15
- /**
16
- * Returns a `CommandDefinition` with typed `values` in `run()`.
17
- * The callback receives `values` inferred from the declared options — no casts needed.
18
- *
19
- * @example
20
- * ```ts
21
- * const generate = defineCommand({
22
- * name: 'generate',
23
- * description: 'Generate client code',
24
- * options: { config: { type: 'string', description: 'Config path' } },
25
- * async run({ values }) { console.log(values.config) },
26
- * })
27
- * ```
28
- */
29
- function defineCommand(def) {
30
- const { run, ...rest } = def;
31
- if (!run) return rest;
32
- return {
33
- ...rest,
34
- run: (args) => run({
35
- values: args.values,
36
- positionals: args.positionals
37
- })
38
- };
39
- }
40
- //#endregion
41
- Object.defineProperty(exports, "defineCLIAdapter", {
42
- enumerable: true,
43
- get: function() {
44
- return defineCLIAdapter;
45
- }
46
- });
47
- Object.defineProperty(exports, "defineCommand", {
48
- enumerable: true,
49
- get: function() {
50
- return defineCommand;
51
- }
52
- });
53
-
54
- //# sourceMappingURL=define-Bdn8j5VM.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-Bdn8j5VM.cjs","names":[],"sources":["../../../internals/utils/src/cli/define.ts"],"sourcesContent":["import type { CLIAdapter, CommandDefinition, OptionDefinition } from './types.ts'\n\ntype OptionTypeMap = { string: string; boolean: boolean }\n\ntype IsRequired<O extends OptionDefinition> = O['default'] extends string | boolean ? true : O['required'] extends true ? true : false\n\n/**\n * Infers typed values from an options record. Options with a `default` or `required: true` are always defined.\n */\ntype InferValues<O extends Record<string, OptionDefinition>> = {\n [K in keyof O as IsRequired<O[K]> extends true ? K : never]: OptionTypeMap[O[K]['type']]\n} & {\n [K in keyof O as IsRequired<O[K]> extends true ? never : K]?: OptionTypeMap[O[K]['type']]\n}\n\n/**\n * Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.\n *\n * @example\n * ```ts\n * const adapter = defineCLIAdapter({ run: myRun, renderHelp: myHelp })\n * createCLI({ adapter }).run(commands, argv, opts)\n * ```\n */\nexport function defineCLIAdapter(adapter: CLIAdapter): CLIAdapter {\n return adapter\n}\n\n/**\n * Returns a `CommandDefinition` with typed `values` in `run()`.\n * The callback receives `values` inferred from the declared options — no casts needed.\n *\n * @example\n * ```ts\n * const generate = defineCommand({\n * name: 'generate',\n * description: 'Generate client code',\n * options: { config: { type: 'string', description: 'Config path' } },\n * async run({ values }) { console.log(values.config) },\n * })\n * ```\n */\nexport function defineCommand<O extends Record<string, OptionDefinition>>(def: {\n name: string\n description: string\n arguments?: string[]\n examples?: string[]\n options?: O\n subCommands?: CommandDefinition[]\n run?: (args: { values: InferValues<O>; positionals: string[] }) => Promise<void>\n}): CommandDefinition {\n const { run, ...rest } = def\n if (!run) return rest\n return {\n ...rest,\n run: (args) =>\n run({\n values: args.values as InferValues<O>,\n positionals: args.positionals,\n }),\n }\n}\n"],"mappings":";;;;;;;;;;;AAwBA,SAAgB,iBAAiB,SAAiC;CAChE,OAAO;;;;;;;;;;;;;;;;AAiBT,SAAgB,cAA0D,KAQpD;CACpB,MAAM,EAAE,KAAK,GAAG,SAAS;CACzB,IAAI,CAAC,KAAK,OAAO;CACjB,OAAO;EACL,GAAG;EACH,MAAM,SACJ,IAAI;GACF,QAAQ,KAAK;GACb,aAAa,KAAK;GACnB,CAAC;EACL"}
@@ -1,43 +0,0 @@
1
- import "./chunk-BvFE5Tac.js";
2
- //#region ../../internals/utils/src/cli/define.ts
3
- /**
4
- * Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.
5
- *
6
- * @example
7
- * ```ts
8
- * const adapter = defineCLIAdapter({ run: myRun, renderHelp: myHelp })
9
- * createCLI({ adapter }).run(commands, argv, opts)
10
- * ```
11
- */
12
- function defineCLIAdapter(adapter) {
13
- return adapter;
14
- }
15
- /**
16
- * Returns a `CommandDefinition` with typed `values` in `run()`.
17
- * The callback receives `values` inferred from the declared options — no casts needed.
18
- *
19
- * @example
20
- * ```ts
21
- * const generate = defineCommand({
22
- * name: 'generate',
23
- * description: 'Generate client code',
24
- * options: { config: { type: 'string', description: 'Config path' } },
25
- * async run({ values }) { console.log(values.config) },
26
- * })
27
- * ```
28
- */
29
- function defineCommand(def) {
30
- const { run, ...rest } = def;
31
- if (!run) return rest;
32
- return {
33
- ...rest,
34
- run: (args) => run({
35
- values: args.values,
36
- positionals: args.positionals
37
- })
38
- };
39
- }
40
- //#endregion
41
- export { defineCommand as n, defineCLIAdapter as t };
42
-
43
- //# sourceMappingURL=define-m_fp-Aqm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-m_fp-Aqm.js","names":[],"sources":["../../../internals/utils/src/cli/define.ts"],"sourcesContent":["import type { CLIAdapter, CommandDefinition, OptionDefinition } from './types.ts'\n\ntype OptionTypeMap = { string: string; boolean: boolean }\n\ntype IsRequired<O extends OptionDefinition> = O['default'] extends string | boolean ? true : O['required'] extends true ? true : false\n\n/**\n * Infers typed values from an options record. Options with a `default` or `required: true` are always defined.\n */\ntype InferValues<O extends Record<string, OptionDefinition>> = {\n [K in keyof O as IsRequired<O[K]> extends true ? K : never]: OptionTypeMap[O[K]['type']]\n} & {\n [K in keyof O as IsRequired<O[K]> extends true ? never : K]?: OptionTypeMap[O[K]['type']]\n}\n\n/**\n * Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.\n *\n * @example\n * ```ts\n * const adapter = defineCLIAdapter({ run: myRun, renderHelp: myHelp })\n * createCLI({ adapter }).run(commands, argv, opts)\n * ```\n */\nexport function defineCLIAdapter(adapter: CLIAdapter): CLIAdapter {\n return adapter\n}\n\n/**\n * Returns a `CommandDefinition` with typed `values` in `run()`.\n * The callback receives `values` inferred from the declared options — no casts needed.\n *\n * @example\n * ```ts\n * const generate = defineCommand({\n * name: 'generate',\n * description: 'Generate client code',\n * options: { config: { type: 'string', description: 'Config path' } },\n * async run({ values }) { console.log(values.config) },\n * })\n * ```\n */\nexport function defineCommand<O extends Record<string, OptionDefinition>>(def: {\n name: string\n description: string\n arguments?: string[]\n examples?: string[]\n options?: O\n subCommands?: CommandDefinition[]\n run?: (args: { values: InferValues<O>; positionals: string[] }) => Promise<void>\n}): CommandDefinition {\n const { run, ...rest } = def\n if (!run) return rest\n return {\n ...rest,\n run: (args) =>\n run({\n values: args.values as InferValues<O>,\n positionals: args.positionals,\n }),\n }\n}\n"],"mappings":";;;;;;;;;;;AAwBA,SAAgB,iBAAiB,SAAiC;CAChE,OAAO;;;;;;;;;;;;;;;;AAiBT,SAAgB,cAA0D,KAQpD;CACpB,MAAM,EAAE,KAAK,GAAG,SAAS;CACzB,IAAI,CAAC,KAAK,OAAO;CACjB,OAAO;EACL,GAAG;EACH,MAAM,SACJ,IAAI;GACF,QAAQ,KAAK;GACb,aAAa,KAAK;GACnB,CAAC;EACL"}
@@ -1,71 +0,0 @@
1
- require("./chunk-ByKO4r7w.cjs");
2
- //#region src/commands/generate.ts
3
- const command = require("./define-Bdn8j5VM.cjs").defineCommand({
4
- name: "generate",
5
- description: "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.",
6
- arguments: ["[input]"],
7
- examples: [
8
- "kubb generate",
9
- "kubb generate ./openapi.yaml",
10
- "kubb generate --config kubb.config.ts",
11
- "kubb generate --watch"
12
- ],
13
- options: {
14
- config: {
15
- type: "string",
16
- description: "Path to the Kubb config",
17
- short: "c"
18
- },
19
- logLevel: {
20
- type: "string",
21
- description: "Info, silent, verbose or debug",
22
- short: "l",
23
- default: "info",
24
- hint: "silent|info|verbose|debug",
25
- enum: [
26
- "silent",
27
- "info",
28
- "verbose",
29
- "debug"
30
- ]
31
- },
32
- watch: {
33
- type: "boolean",
34
- description: "Watch mode based on the input file",
35
- short: "w",
36
- default: false
37
- },
38
- debug: {
39
- type: "boolean",
40
- description: "Override logLevel to debug",
41
- short: "d",
42
- default: false
43
- },
44
- verbose: {
45
- type: "boolean",
46
- description: "Override logLevel to verbose",
47
- short: "v",
48
- default: false
49
- },
50
- silent: {
51
- type: "boolean",
52
- description: "Override logLevel to silent",
53
- short: "s",
54
- default: false
55
- }
56
- },
57
- async run({ values, positionals }) {
58
- const logLevel = values.debug ? "debug" : values.verbose ? "verbose" : values.silent ? "silent" : values.logLevel;
59
- const { run } = await Promise.resolve().then(() => require("./run-CqN9CaCO.cjs"));
60
- await run({
61
- input: positionals[0],
62
- configPath: values.config,
63
- logLevel,
64
- watch: values.watch
65
- });
66
- }
67
- });
68
- //#endregion
69
- exports.command = command;
70
-
71
- //# sourceMappingURL=generate-DVe4vPXT.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-DVe4vPXT.cjs","names":["defineCommand"],"sources":["../src/commands/generate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\n\nexport const command = defineCommand({\n name: 'generate',\n description:\n '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.',\n arguments: ['[input]'],\n examples: ['kubb generate', 'kubb generate ./openapi.yaml', 'kubb generate --config kubb.config.ts', 'kubb generate --watch'],\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n logLevel: {\n type: 'string',\n description: 'Info, silent, verbose or debug',\n short: 'l',\n default: 'info',\n hint: 'silent|info|verbose|debug',\n enum: ['silent', 'info', 'verbose', 'debug'],\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n short: 'w',\n default: false,\n },\n debug: {\n type: 'boolean',\n description: 'Override logLevel to debug',\n short: 'd',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n short: 'v',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n },\n async run({ values, positionals }) {\n const logLevel = values.debug ? 'debug' : values.verbose ? 'verbose' : values.silent ? 'silent' : values.logLevel\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: positionals[0],\n configPath: values.config,\n logLevel,\n watch: values.watch,\n })\n },\n})\n"],"mappings":";;AAEA,MAAa,0CAAUA,CAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,WAAW,CAAC,UAAU;CACtB,UAAU;EAAC;EAAiB;EAAgC;EAAyC;EAAwB;CAC7H,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,UAAU;GACR,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACT,MAAM;GACN,MAAM;IAAC;IAAU;IAAQ;IAAW;IAAQ;GAC7C;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,SAAS;GACP,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACF;CACD,MAAM,IAAI,EAAE,QAAQ,eAAe;EACjC,MAAM,WAAW,OAAO,QAAQ,UAAU,OAAO,UAAU,YAAY,OAAO,SAAS,WAAW,OAAO;EACzG,MAAM,EAAE,QAAQ,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,qBAAA,CAAA;EAEtB,MAAM,IAAI;GACR,OAAO,YAAY;GACnB,YAAY,OAAO;GACnB;GACA,OAAO,OAAO;GACf,CAAC;;CAEL,CAAC"}
@@ -1,72 +0,0 @@
1
- import "./chunk-BvFE5Tac.js";
2
- import { n as defineCommand } from "./define-m_fp-Aqm.js";
3
- //#region src/commands/generate.ts
4
- const command = defineCommand({
5
- name: "generate",
6
- description: "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: [
9
- "kubb generate",
10
- "kubb generate ./openapi.yaml",
11
- "kubb generate --config kubb.config.ts",
12
- "kubb generate --watch"
13
- ],
14
- options: {
15
- config: {
16
- type: "string",
17
- description: "Path to the Kubb config",
18
- short: "c"
19
- },
20
- logLevel: {
21
- type: "string",
22
- description: "Info, silent, verbose or debug",
23
- short: "l",
24
- default: "info",
25
- hint: "silent|info|verbose|debug",
26
- enum: [
27
- "silent",
28
- "info",
29
- "verbose",
30
- "debug"
31
- ]
32
- },
33
- watch: {
34
- type: "boolean",
35
- description: "Watch mode based on the input file",
36
- short: "w",
37
- default: false
38
- },
39
- debug: {
40
- type: "boolean",
41
- description: "Override logLevel to debug",
42
- short: "d",
43
- default: false
44
- },
45
- verbose: {
46
- type: "boolean",
47
- description: "Override logLevel to verbose",
48
- short: "v",
49
- default: false
50
- },
51
- silent: {
52
- type: "boolean",
53
- description: "Override logLevel to silent",
54
- short: "s",
55
- default: false
56
- }
57
- },
58
- async run({ values, positionals }) {
59
- const logLevel = values.debug ? "debug" : values.verbose ? "verbose" : values.silent ? "silent" : values.logLevel;
60
- const { run } = await import("./run-CdRxfPGM.js");
61
- await run({
62
- input: positionals[0],
63
- configPath: values.config,
64
- logLevel,
65
- watch: values.watch
66
- });
67
- }
68
- });
69
- //#endregion
70
- export { command };
71
-
72
- //# sourceMappingURL=generate-dhgVXAZM.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-dhgVXAZM.js","names":[],"sources":["../src/commands/generate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\n\nexport const command = defineCommand({\n name: 'generate',\n description:\n '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.',\n arguments: ['[input]'],\n examples: ['kubb generate', 'kubb generate ./openapi.yaml', 'kubb generate --config kubb.config.ts', 'kubb generate --watch'],\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n logLevel: {\n type: 'string',\n description: 'Info, silent, verbose or debug',\n short: 'l',\n default: 'info',\n hint: 'silent|info|verbose|debug',\n enum: ['silent', 'info', 'verbose', 'debug'],\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n short: 'w',\n default: false,\n },\n debug: {\n type: 'boolean',\n description: 'Override logLevel to debug',\n short: 'd',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n short: 'v',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n },\n async run({ values, positionals }) {\n const logLevel = values.debug ? 'debug' : values.verbose ? 'verbose' : values.silent ? 'silent' : values.logLevel\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: positionals[0],\n configPath: values.config,\n logLevel,\n watch: values.watch,\n })\n },\n})\n"],"mappings":";;;AAEA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aACE;CACF,WAAW,CAAC,UAAU;CACtB,UAAU;EAAC;EAAiB;EAAgC;EAAyC;EAAwB;CAC7H,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,UAAU;GACR,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACT,MAAM;GACN,MAAM;IAAC;IAAU;IAAQ;IAAW;IAAQ;GAC7C;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,SAAS;GACP,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACF;CACD,MAAM,IAAI,EAAE,QAAQ,eAAe;EACjC,MAAM,WAAW,OAAO,QAAQ,UAAU,OAAO,UAAU,YAAY,OAAO,SAAS,WAAW,OAAO;EACzG,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GACR,OAAO,YAAY;GACnB,YAAY,OAAO;GACnB;GACA,OAAO,OAAO;GACf,CAAC;;CAEL,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"init-DDBAAtNw.cjs","names":["defineCommand"],"sources":["../src/commands/init.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'init',\n description:\n '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.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --plugins plugin-ts,plugin-client,plugin-react-query',\n ],\n options: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use default options',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n hint: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n hint: 'path',\n },\n plugins: {\n type: 'string',\n description:\n '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)',\n hint: 'plugin-ts,plugin-zod,...',\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,eAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;EACD;CACD,SAAS;EACP,KAAK;GACH,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,MAAM;GACP;EACD,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,MAAM;GACP;EACD,SAAS;GACP,MAAM;GACN,aACE;GACF,MAAM;GACP;EACF;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,qBAAA,CAAA;EAEtB,MAAM,IAAI;GACR,KAAK,OAAO;GACZ,SAAA,gBAAA;GACA,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,SAAS,OAAO;GACjB,CAAC;;CAEL,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"init-DalNYdKX.js","names":[],"sources":["../src/commands/init.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'init',\n description:\n '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.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --plugins plugin-ts,plugin-client,plugin-react-query',\n ],\n options: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use default options',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n hint: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n hint: 'path',\n },\n plugins: {\n type: 'string',\n description:\n '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)',\n hint: 'plugin-ts,plugin-zod,...',\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;EACD;CACD,SAAS;EACP,KAAK;GACH,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,MAAM;GACP;EACD,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,MAAM;GACP;EACD,SAAS;GACP,MAAM;GACN,aACE;GACF,MAAM;GACP;EACF;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GACR,KAAK,OAAO;GACZ;GACA,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,SAAS,OAAO;GACjB,CAAC;;CAEL,CAAC"}
@@ -1,39 +0,0 @@
1
- require("./chunk-ByKO4r7w.cjs");
2
- const require_define = require("./define-Bdn8j5VM.cjs");
3
- const require_package = require("./package-Dwr7GtJx.cjs");
4
- //#region src/commands/mcp.ts
5
- const command = require_define.defineCommand({
6
- name: "mcp",
7
- description: "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 Promise.resolve().then(() => require("./run-Lr0Ctnu0.cjs"));
29
- await run({
30
- version: require_package.version,
31
- port: values.port,
32
- host: values.host
33
- });
34
- }
35
- });
36
- //#endregion
37
- exports.command = command;
38
-
39
- //# sourceMappingURL=mcp-CjLC0gfa.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp-CjLC0gfa.cjs","names":["defineCommand"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'mcp',\n description:\n '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.',\n examples: [\n 'kubb mcp',\n 'kubb mcp --port 3001',\n '# Then add to your MCP client config:',\n '# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }',\n ],\n options: {\n port: {\n type: 'string',\n short: 'p',\n description: 'Port for HTTP MCP server (omit for stdio)',\n hint: 'number',\n },\n host: {\n type: 'string',\n description: 'Hostname to bind to (HTTP mode only)',\n default: 'localhost',\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/mcp/run.ts')\n\n await run({\n version,\n port: values.port,\n host: values.host,\n })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,eAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;EACD;CACD,SAAS;EACP,MAAM;GACJ,MAAM;GACN,OAAO;GACP,aAAa;GACb,MAAM;GACP;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACF;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,qBAAA,CAAA;EAEtB,MAAM,IAAI;GACR,SAAA,gBAAA;GACA,MAAM,OAAO;GACb,MAAM,OAAO;GACd,CAAC;;CAEL,CAAC"}
@@ -1,39 +0,0 @@
1
- import "./chunk-BvFE5Tac.js";
2
- import { n as defineCommand } from "./define-m_fp-Aqm.js";
3
- import { t as version } from "./package-BS53bjcw.js";
4
- //#region src/commands/mcp.ts
5
- const command = defineCommand({
6
- name: "mcp",
7
- description: "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("./run-D0hmRpHy.js");
29
- await run({
30
- version,
31
- port: values.port,
32
- host: values.host
33
- });
34
- }
35
- });
36
- //#endregion
37
- export { command };
38
-
39
- //# sourceMappingURL=mcp-qo6oTY1b.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp-qo6oTY1b.js","names":[],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'mcp',\n description:\n '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.',\n examples: [\n 'kubb mcp',\n 'kubb mcp --port 3001',\n '# Then add to your MCP client config:',\n '# { \"mcpServers\": { \"kubb\": { \"command\": \"npx\", \"args\": [\"kubb\", \"mcp\"] } } }',\n ],\n options: {\n port: {\n type: 'string',\n short: 'p',\n description: 'Port for HTTP MCP server (omit for stdio)',\n hint: 'number',\n },\n host: {\n type: 'string',\n description: 'Hostname to bind to (HTTP mode only)',\n default: 'localhost',\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/mcp/run.ts')\n\n await run({\n version,\n port: values.port,\n host: values.host,\n })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;EACD;CACD,SAAS;EACP,MAAM;GACJ,MAAM;GACN,OAAO;GACP,aAAa;GACb,MAAM;GACP;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACF;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GACR;GACA,MAAM,OAAO;GACb,MAAM,OAAO;GACd,CAAC;;CAEL,CAAC"}
@@ -1,6 +0,0 @@
1
- //#region package.json
2
- var version = "5.0.0-beta.11";
3
- //#endregion
4
- export { version as t };
5
-
6
- //# sourceMappingURL=package-BS53bjcw.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"package-BS53bjcw.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"package-Dwr7GtJx.cjs","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1,121 +0,0 @@
1
- import "./chunk-BvFE5Tac.js";
2
- import { t as getErrorMessage } from "./errors-CINO1EIv.js";
3
- import { r as sendTelemetry, t as buildTelemetryEvent } from "./telemetry-BkektVz6.js";
4
- import { t as spawnAsync } from "./shell-CN6DNqeC.js";
5
- import { o as agentDefaults } from "./constants-B2JTeRBb.js";
6
- import { createRequire } from "node:module";
7
- import { styleText } from "node:util";
8
- import path from "node:path";
9
- import process from "node:process";
10
- import * as clack from "@clack/prompts";
11
- import net from "node:net";
12
- //#region src/runners/agent/utils.ts
13
- /**
14
- * Resolves the environment passed to the detached agent process using CLI values first, then environment values, then CLI defaults.
15
- */
16
- function resolveAgentStartEnvironment({ port, host, configPath, allowWrite, allowAll }) {
17
- const resolvedPort = port ?? process.env.PORT ?? agentDefaults.port;
18
- const resolvedHost = host !== agentDefaults.host ? host : process.env.HOST ?? agentDefaults.host;
19
- const resolvedAllowAll = allowAll || process.env.KUBB_AGENT_ALLOW_ALL === "true";
20
- const resolvedAllowWrite = resolvedAllowAll || allowWrite || process.env.KUBB_AGENT_ALLOW_WRITE === "true";
21
- const agentRoot = process.env.KUBB_AGENT_ROOT ?? process.cwd();
22
- const agentConfigPath = path.resolve(process.cwd(), configPath || process.env.KUBB_AGENT_CONFIG || agentDefaults.configFile);
23
- return {
24
- port: resolvedPort,
25
- host: resolvedHost,
26
- allowWrite: resolvedAllowWrite,
27
- allowAll: resolvedAllowAll,
28
- agentConfigPath,
29
- env: {
30
- ...process.env,
31
- PORT: resolvedPort,
32
- HOST: resolvedHost,
33
- KUBB_AGENT_ROOT: agentRoot,
34
- KUBB_AGENT_CONFIG: agentConfigPath,
35
- KUBB_AGENT_ALLOW_WRITE: String(resolvedAllowWrite),
36
- KUBB_AGENT_ALLOW_ALL: String(resolvedAllowAll),
37
- KUBB_AGENT_TOKEN: process.env.KUBB_AGENT_TOKEN,
38
- KUBB_AGENT_RETRY_TIMEOUT: process.env.KUBB_AGENT_RETRY_TIMEOUT ?? agentDefaults.retryTimeout,
39
- KUBB_STUDIO_URL: process.env.KUBB_STUDIO_URL ?? agentDefaults.studioUrl
40
- }
41
- };
42
- }
43
- function isPortAvailable(port, host) {
44
- return new Promise((resolve) => {
45
- const server = net.createServer();
46
- server.once("error", () => resolve(false));
47
- server.once("listening", () => {
48
- server.close();
49
- resolve(true);
50
- });
51
- server.listen(port, host);
52
- });
53
- }
54
- //#endregion
55
- //#region src/runners/agent/run.ts
56
- /**
57
- * Spawns the Kubb Agent HTTP server as a Node.js subprocess.
58
- * Resolves config from CLI flags and environment variables, validates the port, and exits with code 1 on failure.
59
- */
60
- async function run({ port, host, configPath, allowWrite, allowAll, version }) {
61
- const hrStart = process.hrtime();
62
- const report = (status) => sendTelemetry(buildTelemetryEvent({
63
- command: "agent",
64
- kubbVersion: version,
65
- hrStart,
66
- status
67
- }));
68
- try {
69
- try {
70
- process.loadEnvFile();
71
- } catch {}
72
- const require = createRequire(import.meta.url);
73
- let agentPkgPath;
74
- try {
75
- agentPkgPath = require.resolve("@kubb/agent/package.json");
76
- } catch (_e) {
77
- console.error(styleText("red", "The @kubb/agent package is not installed."));
78
- console.error("");
79
- console.error("Install it with:");
80
- console.error(styleText("cyan", " npm install @kubb/agent"));
81
- console.error(styleText("cyan", " # or"));
82
- console.error(styleText("cyan", " pnpm install @kubb/agent"));
83
- console.error("");
84
- process.exit(1);
85
- }
86
- const agentDir = path.dirname(agentPkgPath);
87
- const serverPath = path.join(agentDir, agentDefaults.serverEntryPath);
88
- const resolvedEnv = resolveAgentStartEnvironment({
89
- port,
90
- host,
91
- configPath,
92
- allowWrite,
93
- allowAll
94
- });
95
- const numericPort = Number(resolvedEnv.port);
96
- if (!Number.isInteger(numericPort) || numericPort <= 0) throw new Error(`Invalid port "${resolvedEnv.port}". Provide a positive integer with --port or PORT.`);
97
- clack.log.step(styleText("cyan", "Starting agent server..."));
98
- clack.log.info(styleText("dim", `Config: ${resolvedEnv.agentConfigPath}`));
99
- clack.log.info(styleText("dim", `Host: ${resolvedEnv.host}`));
100
- clack.log.info(styleText("dim", `Port: ${resolvedEnv.port}`));
101
- if (!resolvedEnv.allowWrite && !resolvedEnv.allowAll) clack.log.warn(styleText("yellow", "Filesystem writes disabled. Use --allow-write or --allow-all to enable."));
102
- if (!await isPortAvailable(numericPort, resolvedEnv.host)) {
103
- clack.log.error(styleText("red", `Port ${resolvedEnv.port} is already in use. Stop the existing process or choose a different port with --port.`));
104
- process.exit(1);
105
- }
106
- await spawnAsync("node", [serverPath], {
107
- env: resolvedEnv.env,
108
- cwd: process.cwd()
109
- });
110
- await report("success");
111
- } catch (error) {
112
- await report("failed");
113
- clack.log.error(styleText("red", "Failed to start agent server"));
114
- clack.log.error(getErrorMessage(error));
115
- process.exit(1);
116
- }
117
- }
118
- //#endregion
119
- export { run };
120
-
121
- //# sourceMappingURL=run-BzpYYOQs.js.map