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

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 (157) hide show
  1. package/README.md +209 -51
  2. package/dist/agent-D3K_-kiv.js +68 -0
  3. package/dist/agent-D3K_-kiv.js.map +1 -0
  4. package/dist/agent-DTqKBULa.cjs +70 -0
  5. package/dist/agent-DTqKBULa.cjs.map +1 -0
  6. package/dist/{chunk--u3MIqq1.js → chunk-CRm0XQPb.js} +1 -0
  7. package/dist/constants-84a47qA-.js +35 -0
  8. package/dist/constants-84a47qA-.js.map +1 -0
  9. package/dist/constants-AHhyFH15.cjs +139 -0
  10. package/dist/constants-AHhyFH15.cjs.map +1 -0
  11. package/dist/constants-BtmponZ3.cjs +58 -0
  12. package/dist/constants-BtmponZ3.cjs.map +1 -0
  13. package/dist/constants-C94RKp3A.js +116 -0
  14. package/dist/constants-C94RKp3A.js.map +1 -0
  15. package/dist/{define-Bdn8j5VM.cjs → define-C4AB3POr.cjs} +2 -2
  16. package/dist/{define-Bdn8j5VM.cjs.map → define-C4AB3POr.cjs.map} +1 -1
  17. package/dist/{define-Ctii4bel.js → define-DNG1U8ha.js} +2 -2
  18. package/dist/{define-Ctii4bel.js.map → define-DNG1U8ha.js.map} +1 -1
  19. package/dist/{errors-CjPmyZHy.js → errors-CoxrNXaA.js} +2 -2
  20. package/dist/{errors-CjPmyZHy.js.map → errors-CoxrNXaA.js.map} +1 -1
  21. package/dist/{errors-CLCjoSg0.cjs → errors-DykI11xo.cjs} +2 -2
  22. package/dist/{errors-CLCjoSg0.cjs.map → errors-DykI11xo.cjs.map} +1 -1
  23. package/dist/generate-CZYIOngX.cjs +76 -0
  24. package/dist/generate-CZYIOngX.cjs.map +1 -0
  25. package/dist/generate-HcvbU80u.js +77 -0
  26. package/dist/generate-HcvbU80u.js.map +1 -0
  27. package/dist/index.cjs +23 -14
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +23 -14
  31. package/dist/index.js.map +1 -1
  32. package/dist/init-BMtuczv8.js +53 -0
  33. package/dist/init-BMtuczv8.js.map +1 -0
  34. package/dist/init-DybfkgNy.cjs +53 -0
  35. package/dist/init-DybfkgNy.cjs.map +1 -0
  36. package/dist/mcp-BF9dnH_F.js +39 -0
  37. package/dist/mcp-BF9dnH_F.js.map +1 -0
  38. package/dist/mcp-YzKoU6_l.cjs +39 -0
  39. package/dist/mcp-YzKoU6_l.cjs.map +1 -0
  40. package/dist/package-BCwMApnr.js +6 -0
  41. package/dist/package-BCwMApnr.js.map +1 -0
  42. package/dist/{package-BapVyQ-w.cjs → package-DPe5CA4S.cjs} +2 -2
  43. package/dist/package-DPe5CA4S.cjs.map +1 -0
  44. package/dist/{agent-sdYBBgrd.js → run-BQ3Qj0xB.js} +46 -43
  45. package/dist/run-BQ3Qj0xB.js.map +1 -0
  46. package/dist/run-BQzoaxjR.js +32 -0
  47. package/dist/run-BQzoaxjR.js.map +1 -0
  48. package/dist/run-CGf0KEts.js +51 -0
  49. package/dist/run-CGf0KEts.js.map +1 -0
  50. package/dist/{init-CZ5Xq2Hd.cjs → run-C_NMctua.cjs} +107 -149
  51. package/dist/run-C_NMctua.cjs.map +1 -0
  52. package/dist/run-CkTpemme.cjs +52 -0
  53. package/dist/run-CkTpemme.cjs.map +1 -0
  54. package/dist/run-Cl4SrSob.cjs +33 -0
  55. package/dist/run-Cl4SrSob.cjs.map +1 -0
  56. package/dist/{agent-B4cAAab2.cjs → run-D-s2LdlW.cjs} +46 -43
  57. package/dist/run-D-s2LdlW.cjs.map +1 -0
  58. package/dist/{init-eNRlotJK.js → run-D8dCWepS.js} +107 -149
  59. package/dist/run-D8dCWepS.js.map +1 -0
  60. package/dist/run-DaV_NiKR.js +1509 -0
  61. package/dist/run-DaV_NiKR.js.map +1 -0
  62. package/dist/run-UWQ9wImP.cjs +1512 -0
  63. package/dist/run-UWQ9wImP.cjs.map +1 -0
  64. package/dist/{shell-DLzN4fRo.js → shell-BrqyJdB7.js} +2 -2
  65. package/dist/{shell-DLzN4fRo.js.map → shell-BrqyJdB7.js.map} +1 -1
  66. package/dist/{shell-475fQKaX.cjs → shell-Lh-vLWwH.cjs} +2 -2
  67. package/dist/{shell-475fQKaX.cjs.map → shell-Lh-vLWwH.cjs.map} +1 -1
  68. package/dist/validate-BHc3lUKB.js +26 -0
  69. package/dist/validate-BHc3lUKB.js.map +1 -0
  70. package/dist/validate-CqRqJxmQ.cjs +26 -0
  71. package/dist/validate-CqRqJxmQ.cjs.map +1 -0
  72. package/package.json +16 -15
  73. package/src/commands/agent/start.ts +10 -7
  74. package/src/commands/agent.ts +3 -1
  75. package/src/commands/generate.ts +21 -13
  76. package/src/commands/init.ts +34 -3
  77. package/src/commands/mcp.ts +28 -4
  78. package/src/commands/validate.ts +6 -4
  79. package/src/constants.ts +3 -74
  80. package/src/index.ts +6 -4
  81. package/src/loggers/clackLogger.ts +137 -178
  82. package/src/loggers/plainLogger.ts +49 -102
  83. package/src/loggers/types.ts +6 -1
  84. package/src/loggers/utils.ts +141 -26
  85. package/src/runners/agent/run.ts +113 -0
  86. package/src/runners/agent/utils.ts +98 -0
  87. package/src/runners/generate/run.ts +404 -0
  88. package/src/runners/generate/utils.ts +219 -0
  89. package/src/runners/init/run.ts +212 -0
  90. package/src/{utils/packageManager.ts → runners/init/utils.ts} +12 -2
  91. package/src/runners/mcp/run.ts +37 -0
  92. package/src/runners/validate/run.ts +63 -0
  93. package/dist/agent-B4cAAab2.cjs.map +0 -1
  94. package/dist/agent-CR6Z96og.js +0 -56
  95. package/dist/agent-CR6Z96og.js.map +0 -1
  96. package/dist/agent-Dmxzqg4d.cjs +0 -58
  97. package/dist/agent-Dmxzqg4d.cjs.map +0 -1
  98. package/dist/agent-sdYBBgrd.js.map +0 -1
  99. package/dist/constants-CnDXa1R6.cjs +0 -148
  100. package/dist/constants-CnDXa1R6.cjs.map +0 -1
  101. package/dist/constants-aL3CP_Wq.js +0 -95
  102. package/dist/constants-aL3CP_Wq.js.map +0 -1
  103. package/dist/generate-B1Pa2ho-.cjs +0 -1756
  104. package/dist/generate-B1Pa2ho-.cjs.map +0 -1
  105. package/dist/generate-BDGOOsBM.cjs +0 -65
  106. package/dist/generate-BDGOOsBM.cjs.map +0 -1
  107. package/dist/generate-CNrRLY4n.js +0 -1753
  108. package/dist/generate-CNrRLY4n.js.map +0 -1
  109. package/dist/generate-DuhxPLGr.js +0 -66
  110. package/dist/generate-DuhxPLGr.js.map +0 -1
  111. package/dist/init-CZ5Xq2Hd.cjs.map +0 -1
  112. package/dist/init-CnZXHrbq.js +0 -25
  113. package/dist/init-CnZXHrbq.js.map +0 -1
  114. package/dist/init-NYJSZJSb.cjs +0 -25
  115. package/dist/init-NYJSZJSb.cjs.map +0 -1
  116. package/dist/init-eNRlotJK.js.map +0 -1
  117. package/dist/mcp-CYOgxB82.cjs +0 -47
  118. package/dist/mcp-CYOgxB82.cjs.map +0 -1
  119. package/dist/mcp-CdFWyrwi.cjs +0 -16
  120. package/dist/mcp-CdFWyrwi.cjs.map +0 -1
  121. package/dist/mcp-DhSxuDMD.js +0 -16
  122. package/dist/mcp-DhSxuDMD.js.map +0 -1
  123. package/dist/mcp-DmJm3TrU.js +0 -46
  124. package/dist/mcp-DmJm3TrU.js.map +0 -1
  125. package/dist/package-BapVyQ-w.cjs.map +0 -1
  126. package/dist/package-DyJE-qNq.js +0 -6
  127. package/dist/package-DyJE-qNq.js.map +0 -1
  128. package/dist/telemetry-DN95_2pF.cjs +0 -282
  129. package/dist/telemetry-DN95_2pF.cjs.map +0 -1
  130. package/dist/telemetry-LgT_sdPe.js +0 -245
  131. package/dist/telemetry-LgT_sdPe.js.map +0 -1
  132. package/dist/validate-C6npXzel.cjs +0 -25
  133. package/dist/validate-C6npXzel.cjs.map +0 -1
  134. package/dist/validate-kLJoT_hi.js +0 -33
  135. package/dist/validate-kLJoT_hi.js.map +0 -1
  136. package/dist/validate-n38Rh-Y7.js +0 -25
  137. package/dist/validate-n38Rh-Y7.js.map +0 -1
  138. package/dist/validate-yKKzqEZ5.cjs +0 -34
  139. package/dist/validate-yKKzqEZ5.cjs.map +0 -1
  140. package/src/loggers/fileSystemLogger.ts +0 -138
  141. package/src/loggers/githubActionsLogger.ts +0 -379
  142. package/src/runners/agent.ts +0 -155
  143. package/src/runners/generate.ts +0 -333
  144. package/src/runners/init.ts +0 -296
  145. package/src/runners/mcp.ts +0 -51
  146. package/src/runners/validate.ts +0 -39
  147. package/src/types.ts +0 -11
  148. package/src/utils/Writables.ts +0 -17
  149. package/src/utils/executeHooks.ts +0 -45
  150. package/src/utils/flags.ts +0 -9
  151. package/src/utils/getConfig.ts +0 -10
  152. package/src/utils/getCosmiConfig.ts +0 -80
  153. package/src/utils/getSummary.ts +0 -68
  154. package/src/utils/runHook.ts +0 -91
  155. package/src/utils/telemetry.ts +0 -273
  156. package/src/utils/watcher.ts +0 -19
  157. /package/dist/{chunk-ByKO4r7w.cjs → chunk-Bx3C2hgW.cjs} +0 -0
package/README.md CHANGED
@@ -1,95 +1,253 @@
1
1
  <div align="center">
2
- <h1>Kubb Cli</h1>
3
2
  <a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
4
- <img width="180" src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo">
3
+ <img src="https://kubb.dev/og.png" alt="Kubb banner">
5
4
  </a>
6
5
 
7
6
  [![npm version][npm-version-src]][npm-version-href]
8
7
  [![npm downloads][npm-downloads-src]][npm-downloads-href]
9
- [![Coverage][coverage-src]][coverage-href]
8
+ [![Stars][stars-src]][stars-href]
10
9
  [![License][license-src]][license-href]
11
- [![Sponsors][sponsors-src]][sponsors-href]
10
+ [![Node][node-src]][node-href]
12
11
 
13
12
  <h4>
14
- <a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/main//examples/typescript" target="_blank">View Demo</a>
15
- <span> · </span>
16
- <a href="https://kubb.dev/" target="_blank">Documentation</a>
17
- <span> · </span>
18
- <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
19
- <span> · </span>
20
- <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Request Feature</a>
21
- </h4>
13
+ <a href="https://kubb.dev" target="_blank">Documentation</a>
14
+ <span> · </span>
15
+ <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
16
+ <span> · </span>
17
+ <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Request Feature</a>
18
+ </h4>
22
19
  </div>
23
20
 
21
+ <br />
22
+
23
+ # @kubb/cli
24
+
25
+ ### The command-line interface for Kubb
26
+
27
+ Official CLI for Kubb. Run `kubb generate` to transform OpenAPI/Swagger specs into TypeScript types, API clients, hooks, validators, and mocks. Includes interactive project setup (`kubb init`), spec validation, watch mode, MCP server, and agent server commands.
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ bun add -D @kubb/cli
33
+ # or
34
+ pnpm add -D @kubb/cli
35
+ # or
36
+ npm install -D @kubb/cli
37
+ ```
38
+
24
39
  ## Commands
25
40
 
41
+ - [`kubb init`](#kubb-init) — scaffold a new project
42
+ - [`kubb generate`](#kubb-generate) — run code generation
43
+ - [`kubb validate`](#kubb-validate) — validate an OpenAPI spec
44
+ - [`kubb mcp`](#kubb-mcp) — start the MCP server for AI assistants
45
+ - [`kubb agent start`](#kubb-agent-start) — start the HTTP agent server
46
+
47
+ ---
48
+
26
49
  ### `kubb init`
27
50
 
28
- Initialize a new Kubb project with an interactive setup wizard.
51
+ Scaffold a `kubb.config.ts` and install plugins for code generation from an OpenAPI spec. Run without flags for an interactive setup wizard, or pass flags to skip the prompts.
29
52
 
30
53
  ```bash
31
54
  npx kubb init
32
55
  ```
33
56
 
34
- Use the `-y` / `--yes` flag to skip all prompts and accept the defaults:
57
+ #### Options
58
+
59
+ | Flag | Short | Type | Default | Description |
60
+ | ------------------ | ----- | ------- | ---------------- | ------------------------------------------ |
61
+ | `--yes` | `-y` | boolean | `false` | Skip all prompts and use defaults |
62
+ | `--input <path>` | `-i` | string | `./openapi.yaml` | Path to the OpenAPI specification |
63
+ | `--output <path>` | `-o` | string | `./src/gen` | Output directory for generated files |
64
+ | `--plugins <list>` | | string | | Comma-separated list of plugins to install |
65
+
66
+ Available plugin values for `--plugins`: `plugin-ts`, `plugin-client`, `plugin-react-query`, `plugin-vue-query`, `plugin-zod`, `plugin-faker`, `plugin-msw`, `plugin-cypress`, `plugin-mcp`, `plugin-redoc`.
67
+
68
+ #### Examples
35
69
 
36
70
  ```bash
37
- npx kubb init -y
38
- ```
71
+ # Interactive wizard
72
+ npx kubb init
39
73
 
40
- Defaults when using `-y`:
74
+ # Accept all defaults
75
+ npx kubb init --yes
41
76
 
42
- - Input path: `./openapi.yaml`
43
- - Output path: `./src/gen`
44
- - Plugins: OpenAPI Parser + TypeScript
77
+ # Fully non-interactive
78
+ npx kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod
79
+
80
+ # Select specific plugins only
81
+ npx kubb init --plugins plugin-ts,plugin-client,plugin-react-query
82
+ ```
45
83
 
46
- This command will:
84
+ The wizard will:
47
85
 
48
- 1. Detect or create a `package.json` if it doesn't exist
49
- 2. Prompt you for your OpenAPI specification path (default: `./openapi.yaml`)
50
- 3. Ask for the output directory for generated files (default: `./src/gen`)
51
- 4. Let you select which Kubb plugins to use (default: OpenAPI Parser + TypeScript)
86
+ 1. Detect or create a `package.json` if one does not exist
87
+ 2. Prompt for your OpenAPI specification path (default: `./openapi.yaml`)
88
+ 3. Ask for the output directory (default: `./src/gen`)
89
+ 4. Let you choose which plugins to install
52
90
  5. Install the selected packages using your package manager (npm, pnpm, yarn, or bun)
53
- 6. Generate a `kubb.config.ts` file with your chosen configuration
91
+ 6. Generate a `kubb.config.ts` with your chosen configuration
92
+
93
+ ---
54
94
 
55
95
  ### `kubb generate`
56
96
 
57
- Generate files based on your `kubb.config.ts` configuration.
97
+ 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.
58
98
 
59
99
  ```bash
60
100
  npx kubb generate
61
101
  ```
62
102
 
63
- Options:
103
+ #### Options
104
+
105
+ | Flag | Short | Type | Default | Description |
106
+ | -------------------- | ----- | ------- | ------- | --------------------------------------------------------------------------------------------------- |
107
+ | `[input]` | | string | | OpenAPI file path — overrides `input.path` in the config |
108
+ | `--config <path>` | `-c` | string | | Path to the Kubb config file |
109
+ | `--logLevel <level>` | `-l` | string | `info` | Log level: `silent`, `info`, or `verbose` |
110
+ | `--watch` | `-w` | boolean | `false` | Re-generate whenever the input file changes |
111
+ | `--verbose` | `-v` | boolean | `false` | Override log level to `verbose` |
112
+ | `--silent` | `-s` | boolean | `false` | Override log level to `silent` |
113
+ | `--reporter <names>` | | string | `cli` | Reporters that render the run, comma-separated: `cli`, `json`, `file`. Overrides `config.reporters` |
114
+
115
+ #### Examples
116
+
117
+ ```bash
118
+ # Use kubb.config.ts in the current directory
119
+ npx kubb generate
120
+
121
+ # Override the input spec without editing the config
122
+ npx kubb generate ./openapi.yaml
123
+
124
+ # Point to a custom config file
125
+ npx kubb generate --config ./configs/kubb.config.ts
126
+
127
+ # Watch for changes and regenerate automatically
128
+ npx kubb generate --watch
64
129
 
65
- - `-c, --config <path>` - Path to the Kubb config file
66
- - `-l, --logLevel <level>` - Set log level (silent, info, verbose, debug)
67
- - `-w, --watch` - Watch mode based on the input file
68
- - `-d, --debug` - Enable debug mode
69
- - `-v, --verbose` - Enable verbose mode
70
- - `-s, --silent` - Enable silent mode
130
+ # Verbose output
131
+ npx kubb generate --verbose
132
+
133
+ # Write a JSON run report alongside the CLI output
134
+ npx kubb generate --reporter cli,json
135
+ ```
136
+
137
+ ---
71
138
 
72
139
  ### `kubb validate`
73
140
 
74
- Validate a Swagger/OpenAPI file.
141
+ 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.
142
+
143
+ ```bash
144
+ npx kubb validate --input <path-or-url>
145
+ ```
146
+
147
+ #### Options
148
+
149
+ | Flag | Short | Type | Required | Description |
150
+ | ---------------- | ----- | ------ | -------- | --------------------------------------------------- |
151
+ | `--input <path>` | `-i` | string | ✅ | Path or URL to the OpenAPI/Swagger file to validate |
152
+
153
+ #### Examples
75
154
 
76
155
  ```bash
77
- npx kubb validate <path-to-openapi>
156
+ # Validate a local file
157
+ npx kubb validate --input ./openapi.yaml
158
+
159
+ # Validate a remote spec
160
+ npx kubb validate --input https://petstore3.swagger.io/api/v3/openapi.json
78
161
  ```
79
162
 
163
+ ---
164
+
80
165
  ### `kubb mcp`
81
166
 
82
- Start the MCP server to enable the MCP client to interact with the LLM.
167
+ Start a Model Context Protocol (MCP) server that exposes Kubb code generation as a tool for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect the assistant can then call `kubb generate` directly without leaving the chat.
168
+
169
+ Runs over **stdio** by default (compatible with all MCP clients). Pass `--port` to expose an HTTP server instead.
83
170
 
84
171
  ```bash
85
172
  npx kubb mcp
86
173
  ```
87
174
 
175
+ #### Options
176
+
177
+ | Flag | Short | Type | Default | Description |
178
+ | ------------------- | ----- | ------ | ----------- | ----------------------------------------- |
179
+ | `--port <number>` | `-p` | string | | Port for HTTP MCP server (omit for stdio) |
180
+ | `--host <hostname>` | | string | `localhost` | Hostname to bind to (HTTP mode only) |
181
+
182
+ #### Examples
183
+
184
+ ```bash
185
+ # stdio mode (recommended for Claude Desktop, Cursor, etc.)
186
+ npx kubb mcp
187
+
188
+ # HTTP mode
189
+ npx kubb mcp --port 3001
190
+ ```
191
+
192
+ #### MCP client configuration
193
+
194
+ Add the following to your MCP client config (e.g. Claude Desktop's `claude_desktop_config.json`):
195
+
196
+ ```json
197
+ {
198
+ "mcpServers": {
199
+ "kubb": {
200
+ "command": "npx",
201
+ "args": ["kubb", "mcp"]
202
+ }
203
+ }
204
+ }
205
+ ```
206
+
207
+ ---
208
+
209
+ ### `kubb agent start`
210
+
211
+ Start the Kubb Agent HTTP server. Exposes a REST API that accepts a `kubb.config.ts` patch and returns generated code as a stream. Use `--allow-write` to also write files to disk.
212
+
213
+ ```bash
214
+ npx kubb agent start
215
+ ```
216
+
217
+ #### Options
218
+
219
+ | Flag | Short | Type | Default | Description |
220
+ | ------------------- | ----- | ------- | --------- | ----------------------------------------------------------------- |
221
+ | `--config <path>` | `-c` | string | | Path to the Kubb config file |
222
+ | `--port <number>` | `-p` | string | `3000` | Port the HTTP server listens on |
223
+ | `--host <hostname>` | | string | `0.0.0.0` | Hostname the HTTP server binds to |
224
+ | `--allow-write` | | boolean | `false` | Write generated files to disk (otherwise output is streamed only) |
225
+ | `--allow-all` | | boolean | `false` | Grant all permissions (implies `--allow-write`) |
226
+
227
+ #### Examples
228
+
229
+ ```bash
230
+ # Start with defaults
231
+ npx kubb agent start
232
+
233
+ # Custom port
234
+ npx kubb agent start --port 4000
235
+
236
+ # Allow writing files to disk
237
+ npx kubb agent start --allow-write
238
+
239
+ # Full permissions with custom config
240
+ npx kubb agent start --config ./kubb.config.ts --allow-all
241
+ ```
242
+
243
+ See the [`@kubb/agent` README](../agent/README.md) for full environment variable reference, Docker setup, WebSocket API, and Studio integration.
244
+
88
245
  ## Supporting Kubb
89
246
 
90
- Kubb uses an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
247
+ Kubb is an open source project, and its development is funded entirely by sponsors. If you would like to become a sponsor, please consider:
91
248
 
92
249
  - [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
250
+ - [See sponsorship tiers and our sponsors](https://kubb.dev/sponsors)
93
251
 
94
252
  <p align="center">
95
253
  <a href="https://github.com/sponsors/stijnvanhulle">
@@ -97,19 +255,19 @@ Kubb uses an MIT-licensed open source project with its ongoing development made
97
255
  </a>
98
256
  </p>
99
257
 
258
+ ## License
259
+
260
+ [MIT](https://github.com/kubb-labs/kubb/blob/main/licenses/LICENSE-MIT)
261
+
100
262
  <!-- Badges -->
101
263
 
102
- [npm-version-src]: https://img.shields.io/npm/v/@kubb/cli?flat&colorA=18181B&colorB=f58517
103
- [npm-version-href]: https://npmjs.com/package/@kubb/cli
104
- [npm-downloads-src]: https://img.shields.io/npm/dm/@kubb/cli?flat&colorA=18181B&colorB=f58517
105
- [npm-downloads-href]: https://npmjs.com/package/@kubb/cli
106
- [license-src]: https://img.shields.io/github/license/kubb-labs/kubb.svg?flat&colorA=18181B&colorB=f58517
264
+ [npm-version-src]: https://shieldcn.dev/npm/v/@kubb/cli.svg?variant=secondary&size=xs&theme=zinc&mode=dark
265
+ [npm-version-href]: https://npmx.dev/package/@kubb/cli
266
+ [npm-downloads-src]: https://shieldcn.dev/npm/dm/@kubb/cli.svg?variant=secondary&size=xs&theme=zinc&mode=dark
267
+ [npm-downloads-href]: https://npmx.dev/package/@kubb/cli
268
+ [stars-src]: https://shieldcn.dev/github/stars/kubb-labs/kubb.svg?variant=secondary&size=xs&theme=zinc&mode=dark
269
+ [stars-href]: https://github.com/kubb-labs/kubb
270
+ [license-src]: https://shieldcn.dev/npm/license/@kubb/cli.svg?variant=secondary&size=xs&theme=zinc
107
271
  [license-href]: https://github.com/kubb-labs/kubb/blob/main/LICENSE
108
- [build-src]: https://img.shields.io/github/actions/workflow/status/kubb-labs/kubb/ci.yaml?style=flat&colorA=18181B&colorB=f58517
109
- [build-href]: https://www.npmjs.com/package/@kubb/cli
110
- [minified-src]: https://img.shields.io/bundlephobia/min/@kubb/cli?style=flat&colorA=18181B&colorB=f58517
111
- [minified-href]: https://www.npmjs.com/package/@kubb/cli
112
- [coverage-src]: https://img.shields.io/codecov/c/github/kubb-labs/kubb?style=flat&colorA=18181B&colorB=f58517
113
- [coverage-href]: https://www.npmjs.com/package/@kubb/cli
114
- [sponsors-src]: https://img.shields.io/github/sponsors/stijnvanhulle?style=flat&colorA=18181B&colorB=f58517
115
- [sponsors-href]: https://github.com/sponsors/stijnvanhulle/
272
+ [node-src]: https://shieldcn.dev/npm/node/@kubb/cli.svg?variant=secondary&size=xs&theme=zinc&mode=dark
273
+ [node-href]: https://npmx.dev/package/@kubb/cli
@@ -0,0 +1,68 @@
1
+ import "./chunk-CRm0XQPb.js";
2
+ import { n as defineCommand } from "./define-DNG1U8ha.js";
3
+ import { t as version } from "./package-BCwMApnr.js";
4
+ import { i as agentDefaults } from "./constants-84a47qA-.js";
5
+ //#endregion
6
+ //#region src/commands/agent.ts
7
+ const command = defineCommand({
8
+ name: "agent",
9
+ description: "Manage the Kubb Agent — an HTTP server that lets AI agents trigger code generation programmatically via a REST API. Useful when an AI workflow needs to generate code without direct CLI access.",
10
+ examples: [
11
+ "kubb agent start",
12
+ "kubb agent start --port 4000 --allow-write",
13
+ "kubb agent start --config ./kubb.config.ts --allow-all"
14
+ ],
15
+ subCommands: [defineCommand({
16
+ name: "start",
17
+ description: "Start the Kubb Agent HTTP server. Exposes a REST API that accepts a kubb.config.ts patch and returns generated code as a stream. Use --allow-write to also write files to disk.",
18
+ examples: [
19
+ "kubb agent start",
20
+ "kubb agent start --port 4000",
21
+ "kubb agent start --allow-write",
22
+ "kubb agent start --config ./kubb.config.ts --allow-all"
23
+ ],
24
+ options: {
25
+ config: {
26
+ type: "string",
27
+ description: "Path to the Kubb config file",
28
+ short: "c"
29
+ },
30
+ port: {
31
+ type: "string",
32
+ description: "Port the HTTP server listens on",
33
+ short: "p",
34
+ default: agentDefaults.port
35
+ },
36
+ host: {
37
+ type: "string",
38
+ description: "Hostname the HTTP server binds to",
39
+ default: agentDefaults.host
40
+ },
41
+ "allow-write": {
42
+ type: "boolean",
43
+ description: "Write generated files to the filesystem. When omitted, output is streamed only and no files are written.",
44
+ default: false
45
+ },
46
+ "allow-all": {
47
+ type: "boolean",
48
+ description: "Grant all permissions (implies --allow-write).",
49
+ default: false
50
+ }
51
+ },
52
+ async run({ values }) {
53
+ const { run } = await import("./run-BQ3Qj0xB.js");
54
+ await run({
55
+ port: values.port !== void 0 ? values.port : void 0,
56
+ host: values.host,
57
+ configPath: values.config,
58
+ allowWrite: values["allow-write"],
59
+ allowAll: values["allow-all"],
60
+ version
61
+ });
62
+ }
63
+ })]
64
+ });
65
+ //#endregion
66
+ export { command };
67
+
68
+ //# sourceMappingURL=agent-D3K_-kiv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-D3K_-kiv.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:\n 'Start the Kubb Agent HTTP server. Exposes a REST API that accepts a kubb.config.ts patch and returns generated code as a stream. Use --allow-write to also write files to disk.',\n examples: ['kubb agent start', 'kubb agent start --port 4000', 'kubb agent start --allow-write', 'kubb agent start --config ./kubb.config.ts --allow-all'],\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config file',\n short: 'c',\n },\n port: {\n type: 'string',\n description: 'Port the HTTP server listens on',\n short: 'p',\n default: agentDefaults.port,\n },\n host: {\n type: 'string',\n description: 'Hostname the HTTP server binds to',\n default: agentDefaults.host,\n },\n 'allow-write': {\n type: 'boolean',\n description: 'Write generated files to the filesystem. When omitted, output is streamed only and no files are written.',\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 { run } = await import('../../runners/agent/run.ts')\n\n await run({\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:\n 'Manage the Kubb Agent — an HTTP server that lets AI agents trigger code generation programmatically via a REST API. Useful when an AI workflow needs to generate code without direct CLI access.',\n examples: ['kubb agent start', 'kubb agent start --port 4000 --allow-write', 'kubb agent start --config ./kubb.config.ts --allow-all'],\n subCommands: [startCommand],\n})\n"],"mappings":";;;;;;ACGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EAAC;EAAoB;EAA8C;CAAwD;CACrI,aAAa,CDJQ,cAAc;EACnC,MAAM;EACN,aACE;EACF,UAAU;GAAC;GAAoB;GAAgC;GAAkC;EAAwD;EACzJ,SAAS;GACP,QAAQ;IACN,MAAM;IACN,aAAa;IACb,OAAO;GACT;GACA,MAAM;IACJ,MAAM;IACN,aAAa;IACb,OAAO;IACP,SAAS,cAAc;GACzB;GACA,MAAM;IACJ,MAAM;IACN,aAAa;IACb,SAAS,cAAc;GACzB;GACA,eAAe;IACb,MAAM;IACN,aAAa;IACb,SAAS;GACX;GACA,aAAa;IACX,MAAM;IACN,aAAa;IACb,SAAS;GACX;EACF;EACA,MAAM,IAAI,EAAE,UAAU;GACpB,MAAM,EAAE,QAAQ,MAAM,OAAO;GAE7B,MAAM,IAAI;IACR,MAAM,OAAO,SAAS,KAAA,IAAY,OAAO,OAAO,KAAA;IAChD,MAAM,OAAO;IACb,YAAY,OAAO;IACnB,YAAY,OAAO;IACnB,UAAU,OAAO;IACjB;GACF,CAAC;EACH;CACF,CCzCgBC,CAAY;AAC5B,CAAC"}
@@ -0,0 +1,70 @@
1
+ require("./chunk-Bx3C2hgW.cjs");
2
+ const require_define = require("./define-C4AB3POr.cjs");
3
+ const require_package = require("./package-DPe5CA4S.cjs");
4
+ const require_constants = require("./constants-BtmponZ3.cjs");
5
+ //#region src/commands/agent/start.ts
6
+ const command$1 = require_define.defineCommand({
7
+ name: "start",
8
+ description: "Start the Kubb Agent HTTP server. Exposes a REST API that accepts a kubb.config.ts patch and returns generated code as a stream. Use --allow-write to also write files to disk.",
9
+ examples: [
10
+ "kubb agent start",
11
+ "kubb agent start --port 4000",
12
+ "kubb agent start --allow-write",
13
+ "kubb agent start --config ./kubb.config.ts --allow-all"
14
+ ],
15
+ options: {
16
+ config: {
17
+ type: "string",
18
+ description: "Path to the Kubb config file",
19
+ short: "c"
20
+ },
21
+ port: {
22
+ type: "string",
23
+ description: "Port the HTTP server listens on",
24
+ short: "p",
25
+ default: require_constants.agentDefaults.port
26
+ },
27
+ host: {
28
+ type: "string",
29
+ description: "Hostname the HTTP server binds to",
30
+ default: require_constants.agentDefaults.host
31
+ },
32
+ "allow-write": {
33
+ type: "boolean",
34
+ description: "Write generated files to the filesystem. When omitted, output is streamed only and no files are written.",
35
+ default: false
36
+ },
37
+ "allow-all": {
38
+ type: "boolean",
39
+ description: "Grant all permissions (implies --allow-write).",
40
+ default: false
41
+ }
42
+ },
43
+ async run({ values }) {
44
+ const { run } = await Promise.resolve().then(() => require("./run-D-s2LdlW.cjs"));
45
+ await run({
46
+ port: values.port !== void 0 ? values.port : void 0,
47
+ host: values.host,
48
+ configPath: values.config,
49
+ allowWrite: values["allow-write"],
50
+ allowAll: values["allow-all"],
51
+ version: require_package.version
52
+ });
53
+ }
54
+ });
55
+ //#endregion
56
+ //#region src/commands/agent.ts
57
+ const command = require_define.defineCommand({
58
+ name: "agent",
59
+ description: "Manage the Kubb Agent — an HTTP server that lets AI agents trigger code generation programmatically via a REST API. Useful when an AI workflow needs to generate code without direct CLI access.",
60
+ examples: [
61
+ "kubb agent start",
62
+ "kubb agent start --port 4000 --allow-write",
63
+ "kubb agent start --config ./kubb.config.ts --allow-all"
64
+ ],
65
+ subCommands: [command$1]
66
+ });
67
+ //#endregion
68
+ exports.command = command;
69
+
70
+ //# sourceMappingURL=agent-DTqKBULa.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-DTqKBULa.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:\n 'Start the Kubb Agent HTTP server. Exposes a REST API that accepts a kubb.config.ts patch and returns generated code as a stream. Use --allow-write to also write files to disk.',\n examples: ['kubb agent start', 'kubb agent start --port 4000', 'kubb agent start --allow-write', 'kubb agent start --config ./kubb.config.ts --allow-all'],\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config file',\n short: 'c',\n },\n port: {\n type: 'string',\n description: 'Port the HTTP server listens on',\n short: 'p',\n default: agentDefaults.port,\n },\n host: {\n type: 'string',\n description: 'Hostname the HTTP server binds to',\n default: agentDefaults.host,\n },\n 'allow-write': {\n type: 'boolean',\n description: 'Write generated files to the filesystem. When omitted, output is streamed only and no files are written.',\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 { run } = await import('../../runners/agent/run.ts')\n\n await run({\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:\n 'Manage the Kubb Agent — an HTTP server that lets AI agents trigger code generation programmatically via a REST API. Useful when an AI workflow needs to generate code without direct CLI access.',\n examples: ['kubb agent start', 'kubb agent start --port 4000 --allow-write', 'kubb agent start --config ./kubb.config.ts --allow-all'],\n subCommands: [startCommand],\n})\n"],"mappings":";;;;;AAIA,MAAaA,YAAUC,eAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EAAC;EAAoB;EAAgC;EAAkC;CAAwD;CACzJ,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;EACT;EACA,MAAM;GACJ,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAASC,kBAAAA,cAAc;EACzB;EACA,MAAM;GACJ,MAAM;GACN,aAAa;GACb,SAASA,kBAAAA,cAAc;EACzB;EACA,eAAe;GACb,MAAM;GACN,aAAa;GACb,SAAS;EACX;EACA,aAAa;GACX,MAAM;GACN,aAAa;GACb,SAAS;EACX;CACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,EAAA,WAAA,QAAM,oBAAA,CAAA;EAEtB,MAAM,IAAI;GACR,MAAM,OAAO,SAAS,KAAA,IAAY,OAAO,OAAO,KAAA;GAChD,MAAM,OAAO;GACb,YAAY,OAAO;GACnB,YAAY,OAAO;GACnB,UAAU,OAAO;GACjB,SAAA,gBAAA;EACF,CAAC;CACH;AACF,CAAC;;;AC9CD,MAAa,UAAUC,eAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EAAC;EAAoB;EAA8C;CAAwD;CACrI,aAAa,CAACC,SAAY;AAC5B,CAAC"}
@@ -1,3 +1,4 @@
1
+ import "node:module";
1
2
  //#region \0rolldown/runtime.js
2
3
  var __defProp = Object.defineProperty;
3
4
  var __name = (target, value) => __defProp(target, "name", {
@@ -0,0 +1,35 @@
1
+ import { t as KUBB_CONFIG_FILENAME } from "./constants-C94RKp3A.js";
2
+ //#region src/constants.ts
3
+ /**
4
+ * NPM registry endpoint used to check for @kubb/cli updates.
5
+ */
6
+ const KUBB_NPM_PACKAGE_URL = "https://registry.npmjs.org/@kubb/cli/latest";
7
+ "─".repeat(27);
8
+ /**
9
+ * Glob pattern for paths the file watcher ignores.
10
+ */
11
+ const WATCHER_IGNORED_PATHS = "**/{.git,node_modules}/**";
12
+ /**
13
+ * Flags that short-circuit execution (help/version), no telemetry notice is shown.
14
+ */
15
+ const QUIET_FLAGS = new Set([
16
+ "--help",
17
+ "-h",
18
+ "--version",
19
+ "-v"
20
+ ]);
21
+ const agentDefaults = {
22
+ port: "3000",
23
+ host: "localhost",
24
+ configFile: KUBB_CONFIG_FILENAME,
25
+ retryTimeout: "30000",
26
+ studioUrl: "https://kubb.studio",
27
+ /**
28
+ * Relative path from the @kubb/agent package root to the server entry.
29
+ */
30
+ serverEntryPath: ".output/server/index.mjs"
31
+ };
32
+ //#endregion
33
+ export { agentDefaults as i, QUIET_FLAGS as n, WATCHER_IGNORED_PATHS as r, KUBB_NPM_PACKAGE_URL as t };
34
+
35
+ //# sourceMappingURL=constants-84a47qA-.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-84a47qA-.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import { KUBB_CONFIG_FILENAME } from '@internals/shared'\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 * Horizontal rule rendered above/below the plain-logger generation summary.\n */\nexport const SUMMARY_SEPARATOR = '─'.repeat(27)\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://kubb.studio',\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"],"mappings":";;;;;AAKA,MAAa,uBAAuB;AAKH,IAAI,OAAO,EAAE;;;;AAK9C,MAAa,wBAAwB;;;;AAKrC,MAAa,cAAc,IAAI,IAAI;CAAC;CAAU;CAAM;CAAa;AAAI,CAAU;AAE/E,MAAa,gBAAgB;CAC3B,MAAM;CACN,MAAM;CACN,YAAY;CACZ,cAAc;CACd,WAAW;;;;CAIX,iBAAiB;AACnB"}
@@ -0,0 +1,139 @@
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
+ Object.defineProperty(exports, "KUBB_CONFIG_FILENAME", {
115
+ enumerable: true,
116
+ get: function() {
117
+ return KUBB_CONFIG_FILENAME;
118
+ }
119
+ });
120
+ Object.defineProperty(exports, "availablePlugins", {
121
+ enumerable: true,
122
+ get: function() {
123
+ return availablePlugins;
124
+ }
125
+ });
126
+ Object.defineProperty(exports, "initDefaults", {
127
+ enumerable: true,
128
+ get: function() {
129
+ return initDefaults;
130
+ }
131
+ });
132
+ Object.defineProperty(exports, "pluginDefaultConfigs", {
133
+ enumerable: true,
134
+ get: function() {
135
+ return pluginDefaultConfigs;
136
+ }
137
+ });
138
+
139
+ //# sourceMappingURL=constants-AHhyFH15.cjs.map