@kubb/cli 5.0.0-beta.6 → 5.0.0-beta.7
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.
- package/README.md +177 -26
- package/dist/{agent-BJEvbSiP.js → agent-DN7o8nlE.js} +7 -7
- package/dist/agent-DN7o8nlE.js.map +1 -0
- package/dist/{agent-CXNO6dgj.cjs → agent-Fm9_8BBH.cjs} +5 -5
- package/dist/agent-Fm9_8BBH.cjs.map +1 -0
- package/dist/{chunk--u3MIqq1.js → chunk-BvFE5Tac.js} +1 -0
- package/dist/{constants-BPJBMT_6.js → constants-B2JTeRBb.js} +1 -4
- package/dist/{constants-BPJBMT_6.js.map → constants-B2JTeRBb.js.map} +1 -1
- package/dist/{constants-Rcaqzyd-.cjs → constants-BINTA5VZ.cjs} +1 -4
- package/dist/{constants-Rcaqzyd-.cjs.map → constants-BINTA5VZ.cjs.map} +1 -1
- package/dist/{define-Ctii4bel.js → define-m_fp-Aqm.js} +2 -2
- package/dist/{define-Ctii4bel.js.map → define-m_fp-Aqm.js.map} +1 -1
- package/dist/{errors-CjPmyZHy.js → errors-CINO1EIv.js} +2 -2
- package/dist/{errors-CjPmyZHy.js.map → errors-CINO1EIv.js.map} +1 -1
- package/dist/{generate-BmulGxIM.js → generate-BY-juRdH.js} +5 -5
- package/dist/{generate-BmulGxIM.js.map → generate-BY-juRdH.js.map} +1 -1
- package/dist/{generate-BB2Q7I9s.cjs → generate-Bod9YCbF.cjs} +3 -3
- package/dist/{generate-BB2Q7I9s.cjs.map → generate-Bod9YCbF.cjs.map} +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/{init-Dpg8e1HN.cjs → init-BIkZU6mB.cjs} +4 -4
- package/dist/{init-Dpg8e1HN.cjs.map → init-BIkZU6mB.cjs.map} +1 -1
- package/dist/{init-BTp9if7K.js → init-Cs3Fp6nN.js} +6 -6
- package/dist/{init-BTp9if7K.js.map → init-Cs3Fp6nN.js.map} +1 -1
- package/dist/{mcp-C9RoU-Dg.js → mcp-BSNulBcC.js} +6 -6
- package/dist/{mcp-C9RoU-Dg.js.map → mcp-BSNulBcC.js.map} +1 -1
- package/dist/{mcp-wpl6sYYR.cjs → mcp-DcSrFhhP.cjs} +4 -4
- package/dist/{mcp-wpl6sYYR.cjs.map → mcp-DcSrFhhP.cjs.map} +1 -1
- package/dist/package-D5wmvFl4.js +6 -0
- package/dist/package-D5wmvFl4.js.map +1 -0
- package/dist/{package-iheSdfas.cjs → package-DrUndPET.cjs} +2 -2
- package/dist/package-DrUndPET.cjs.map +1 -0
- package/dist/{generate-DAsdUw3z.js → run-BAJubgdA.js} +298 -315
- package/dist/run-BAJubgdA.js.map +1 -0
- package/dist/{agent-VXKxLCho.js → run-BzpYYOQs.js} +46 -43
- package/dist/run-BzpYYOQs.js.map +1 -0
- package/dist/{validate-k9s_hFah.js → run-CCZ24VKk.js} +25 -20
- package/dist/run-CCZ24VKk.js.map +1 -0
- package/dist/{init-DCqcEq86.js → run-CF97BWVa.js} +77 -68
- package/dist/run-CF97BWVa.js.map +1 -0
- package/dist/{validate-BU4fPTMc.cjs → run-CQbj3ley.cjs} +23 -18
- package/dist/run-CQbj3ley.cjs.map +1 -0
- package/dist/{generate-B_p5dl68.cjs → run-CqKd6JNc.cjs} +295 -312
- package/dist/run-CqKd6JNc.cjs.map +1 -0
- package/dist/{mcp-DNUw8nqb.js → run-D0hmRpHy.js} +23 -23
- package/dist/run-D0hmRpHy.js.map +1 -0
- package/dist/{agent-D9CKYh4K.cjs → run-DwdAwnLG.cjs} +44 -41
- package/dist/run-DwdAwnLG.cjs.map +1 -0
- package/dist/{mcp-D1llTaRM.cjs → run-Lr0Ctnu0.cjs} +21 -21
- package/dist/run-Lr0Ctnu0.cjs.map +1 -0
- package/dist/{init-CJ80lKSP.cjs → run-YsoCk5we.cjs} +75 -66
- package/dist/run-YsoCk5we.cjs.map +1 -0
- package/dist/{shell-DLzN4fRo.js → shell-CN6DNqeC.js} +2 -2
- package/dist/{shell-DLzN4fRo.js.map → shell-CN6DNqeC.js.map} +1 -1
- package/dist/{telemetry-BLX0NzRk.cjs → telemetry-B2iWkY5e.cjs} +5 -7
- package/dist/telemetry-B2iWkY5e.cjs.map +1 -0
- package/dist/{telemetry-juq4QBf7.js → telemetry-BkektVz6.js} +6 -8
- package/dist/telemetry-BkektVz6.js.map +1 -0
- package/dist/{validate-DIDBROB2.cjs → validate-Bfpf_UIh.cjs} +4 -4
- package/dist/{validate-DIDBROB2.cjs.map → validate-Bfpf_UIh.cjs.map} +1 -1
- package/dist/{validate-BfJoCxrC.js → validate-lbUkWQ5o.js} +6 -6
- package/dist/{validate-BfJoCxrC.js.map → validate-lbUkWQ5o.js.map} +1 -1
- package/package.json +7 -12
- package/src/commands/agent/start.ts +2 -2
- package/src/commands/generate.ts +2 -2
- package/src/commands/init.ts +2 -2
- package/src/commands/mcp.ts +2 -2
- package/src/commands/validate.ts +2 -2
- package/src/constants.ts +0 -4
- package/src/index.ts +5 -3
- package/src/loggers/clackLogger.ts +45 -43
- package/src/loggers/fileSystemLogger.ts +11 -1
- package/src/loggers/githubActionsLogger.ts +13 -25
- package/src/loggers/plainLogger.ts +12 -23
- package/src/loggers/types.ts +6 -0
- package/src/loggers/utils.ts +155 -9
- package/src/runners/agent/run.ts +113 -0
- package/src/runners/agent/utils.ts +98 -0
- package/src/runners/generate/run.ts +276 -0
- package/src/runners/generate/utils.ts +209 -0
- package/src/runners/{init.ts → init/run.ts} +70 -66
- package/src/{utils/packageManager.ts → runners/init/utils.ts} +10 -0
- package/src/runners/mcp/run.ts +55 -0
- package/src/runners/{validate.ts → validate/run.ts} +25 -20
- package/src/{utils/telemetry.ts → telemetry.ts} +12 -5
- package/dist/agent-BJEvbSiP.js.map +0 -1
- package/dist/agent-CXNO6dgj.cjs.map +0 -1
- package/dist/agent-D9CKYh4K.cjs.map +0 -1
- package/dist/agent-VXKxLCho.js.map +0 -1
- package/dist/generate-B_p5dl68.cjs.map +0 -1
- package/dist/generate-DAsdUw3z.js.map +0 -1
- package/dist/init-CJ80lKSP.cjs.map +0 -1
- package/dist/init-DCqcEq86.js.map +0 -1
- package/dist/mcp-D1llTaRM.cjs.map +0 -1
- package/dist/mcp-DNUw8nqb.js.map +0 -1
- package/dist/package-iheSdfas.cjs.map +0 -1
- package/dist/package-vLafMWCe.js +0 -6
- package/dist/package-vLafMWCe.js.map +0 -1
- package/dist/telemetry-BLX0NzRk.cjs.map +0 -1
- package/dist/telemetry-juq4QBf7.js.map +0 -1
- package/dist/validate-BU4fPTMc.cjs.map +0 -1
- package/dist/validate-k9s_hFah.js.map +0 -1
- package/src/runners/agent.ts +0 -155
- package/src/runners/generate.ts +0 -333
- package/src/runners/mcp.ts +0 -56
- package/src/types.ts +0 -11
- package/src/utils/Writables.ts +0 -17
- package/src/utils/executeHooks.ts +0 -45
- package/src/utils/flags.ts +0 -9
- package/src/utils/getConfig.ts +0 -10
- package/src/utils/getCosmiConfig.ts +0 -75
- package/src/utils/getSummary.ts +0 -68
- package/src/utils/runHook.ts +0 -91
- package/src/utils/watcher.ts +0 -19
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<h1
|
|
2
|
+
<h1>@kubb/cli</h1>
|
|
3
3
|
<a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
|
|
4
4
|
<img width="180" src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo">
|
|
5
5
|
</a>
|
|
@@ -21,70 +21,221 @@
|
|
|
21
21
|
</h4>
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
|
+
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.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
bun add -D @kubb/cli
|
|
30
|
+
# or
|
|
31
|
+
pnpm add -D @kubb/cli
|
|
32
|
+
# or
|
|
33
|
+
npm install -D @kubb/cli
|
|
34
|
+
```
|
|
35
|
+
|
|
24
36
|
## Commands
|
|
25
37
|
|
|
38
|
+
- [`kubb init`](#kubb-init) — scaffold a new project
|
|
39
|
+
- [`kubb generate`](#kubb-generate) — run code generation
|
|
40
|
+
- [`kubb validate`](#kubb-validate) — validate an OpenAPI spec
|
|
41
|
+
- [`kubb mcp`](#kubb-mcp) — start the MCP server for AI assistants
|
|
42
|
+
- [`kubb agent start`](#kubb-agent-start) — start the HTTP agent server
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
26
46
|
### `kubb init`
|
|
27
47
|
|
|
28
|
-
|
|
48
|
+
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
49
|
|
|
30
50
|
```bash
|
|
31
51
|
npx kubb init
|
|
32
52
|
```
|
|
33
53
|
|
|
34
|
-
|
|
54
|
+
#### Options
|
|
55
|
+
|
|
56
|
+
| Flag | Short | Type | Default | Description |
|
|
57
|
+
| ------------------ | ----- | ------- | ---------------- | ------------------------------------------ |
|
|
58
|
+
| `--yes` | `-y` | boolean | `false` | Skip all prompts and use defaults |
|
|
59
|
+
| `--input <path>` | `-i` | string | `./openapi.yaml` | Path to the OpenAPI specification |
|
|
60
|
+
| `--output <path>` | `-o` | string | `./src/gen` | Output directory for generated files |
|
|
61
|
+
| `--plugins <list>` | | string | | Comma-separated list of plugins to install |
|
|
62
|
+
|
|
63
|
+
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`.
|
|
64
|
+
|
|
65
|
+
#### Examples
|
|
35
66
|
|
|
36
67
|
```bash
|
|
37
|
-
|
|
38
|
-
|
|
68
|
+
# Interactive wizard
|
|
69
|
+
npx kubb init
|
|
39
70
|
|
|
40
|
-
|
|
71
|
+
# Accept all defaults
|
|
72
|
+
npx kubb init --yes
|
|
41
73
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
- Plugins: OpenAPI Parser + TypeScript
|
|
74
|
+
# Fully non-interactive
|
|
75
|
+
npx kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod
|
|
45
76
|
|
|
46
|
-
|
|
77
|
+
# Select specific plugins only
|
|
78
|
+
npx kubb init --plugins plugin-ts,plugin-client,plugin-react-query
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The wizard will:
|
|
47
82
|
|
|
48
|
-
1. Detect or create a `package.json` if
|
|
49
|
-
2. Prompt
|
|
50
|
-
3. Ask for the output directory
|
|
51
|
-
4. Let you
|
|
83
|
+
1. Detect or create a `package.json` if one does not exist
|
|
84
|
+
2. Prompt for your OpenAPI specification path (default: `./openapi.yaml`)
|
|
85
|
+
3. Ask for the output directory (default: `./src/gen`)
|
|
86
|
+
4. Let you choose which plugins to install
|
|
52
87
|
5. Install the selected packages using your package manager (npm, pnpm, yarn, or bun)
|
|
53
|
-
6. Generate a `kubb.config.ts`
|
|
88
|
+
6. Generate a `kubb.config.ts` with your chosen configuration
|
|
89
|
+
|
|
90
|
+
---
|
|
54
91
|
|
|
55
92
|
### `kubb generate`
|
|
56
93
|
|
|
57
|
-
Generate
|
|
94
|
+
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
95
|
|
|
59
96
|
```bash
|
|
60
97
|
npx kubb generate
|
|
61
98
|
```
|
|
62
99
|
|
|
63
|
-
Options
|
|
100
|
+
#### Options
|
|
101
|
+
|
|
102
|
+
| Flag | Short | Type | Default | Description |
|
|
103
|
+
| -------------------- | ----- | ------- | ------- | -------------------------------------------------------- |
|
|
104
|
+
| `[input]` | | string | | OpenAPI file path — overrides `input.path` in the config |
|
|
105
|
+
| `--config <path>` | `-c` | string | | Path to the Kubb config file |
|
|
106
|
+
| `--logLevel <level>` | `-l` | string | `info` | Log level: `silent`, `info`, `verbose`, or `debug` |
|
|
107
|
+
| `--watch` | `-w` | boolean | `false` | Re-generate whenever the input file changes |
|
|
108
|
+
| `--debug` | `-d` | boolean | `false` | Override log level to `debug` |
|
|
109
|
+
| `--verbose` | `-v` | boolean | `false` | Override log level to `verbose` |
|
|
110
|
+
| `--silent` | `-s` | boolean | `false` | Override log level to `silent` |
|
|
64
111
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
112
|
+
#### Examples
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Use kubb.config.ts in the current directory
|
|
116
|
+
npx kubb generate
|
|
117
|
+
|
|
118
|
+
# Override the input spec without editing the config
|
|
119
|
+
npx kubb generate ./openapi.yaml
|
|
120
|
+
|
|
121
|
+
# Point to a custom config file
|
|
122
|
+
npx kubb generate --config ./configs/kubb.config.ts
|
|
123
|
+
|
|
124
|
+
# Watch for changes and regenerate automatically
|
|
125
|
+
npx kubb generate --watch
|
|
126
|
+
|
|
127
|
+
# Debug output
|
|
128
|
+
npx kubb generate --debug
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
71
132
|
|
|
72
133
|
### `kubb validate`
|
|
73
134
|
|
|
74
|
-
|
|
135
|
+
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.
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
npx kubb validate --input <path-or-url>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
#### Options
|
|
142
|
+
|
|
143
|
+
| Flag | Short | Type | Required | Description |
|
|
144
|
+
| ---------------- | ----- | ------ | -------- | --------------------------------------------------- |
|
|
145
|
+
| `--input <path>` | `-i` | string | ✅ | Path or URL to the OpenAPI/Swagger file to validate |
|
|
146
|
+
|
|
147
|
+
#### Examples
|
|
75
148
|
|
|
76
149
|
```bash
|
|
77
|
-
|
|
150
|
+
# Validate a local file
|
|
151
|
+
npx kubb validate --input ./openapi.yaml
|
|
152
|
+
|
|
153
|
+
# Validate a remote spec
|
|
154
|
+
npx kubb validate --input https://petstore3.swagger.io/api/v3/openapi.json
|
|
78
155
|
```
|
|
79
156
|
|
|
157
|
+
---
|
|
158
|
+
|
|
80
159
|
### `kubb mcp`
|
|
81
160
|
|
|
82
|
-
Start
|
|
161
|
+
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.
|
|
162
|
+
|
|
163
|
+
Runs over **stdio** by default (compatible with all MCP clients). Pass `--port` to expose an HTTP server instead.
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
npx kubb mcp
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### Options
|
|
170
|
+
|
|
171
|
+
| Flag | Short | Type | Default | Description |
|
|
172
|
+
| ------------------- | ----- | ------ | ----------- | ----------------------------------------- |
|
|
173
|
+
| `--port <number>` | `-p` | string | | Port for HTTP MCP server (omit for stdio) |
|
|
174
|
+
| `--host <hostname>` | | string | `localhost` | Hostname to bind to (HTTP mode only) |
|
|
175
|
+
|
|
176
|
+
#### Examples
|
|
83
177
|
|
|
84
178
|
```bash
|
|
179
|
+
# stdio mode (recommended for Claude Desktop, Cursor, etc.)
|
|
85
180
|
npx kubb mcp
|
|
181
|
+
|
|
182
|
+
# HTTP mode
|
|
183
|
+
npx kubb mcp --port 3001
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### MCP client configuration
|
|
187
|
+
|
|
188
|
+
Add the following to your MCP client config (e.g. Claude Desktop's `claude_desktop_config.json`):
|
|
189
|
+
|
|
190
|
+
```json
|
|
191
|
+
{
|
|
192
|
+
"mcpServers": {
|
|
193
|
+
"kubb": {
|
|
194
|
+
"command": "npx",
|
|
195
|
+
"args": ["kubb", "mcp"]
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
86
199
|
```
|
|
87
200
|
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
### `kubb agent start`
|
|
204
|
+
|
|
205
|
+
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.
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
npx kubb agent start
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
#### Options
|
|
212
|
+
|
|
213
|
+
| Flag | Short | Type | Default | Description |
|
|
214
|
+
| ------------------- | ----- | ------- | --------- | ----------------------------------------------------------------- |
|
|
215
|
+
| `--config <path>` | `-c` | string | | Path to the Kubb config file |
|
|
216
|
+
| `--port <number>` | `-p` | string | `3000` | Port the HTTP server listens on |
|
|
217
|
+
| `--host <hostname>` | | string | `0.0.0.0` | Hostname the HTTP server binds to |
|
|
218
|
+
| `--allow-write` | | boolean | `false` | Write generated files to disk (otherwise output is streamed only) |
|
|
219
|
+
| `--allow-all` | | boolean | `false` | Grant all permissions (implies `--allow-write`) |
|
|
220
|
+
|
|
221
|
+
#### Examples
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
# Start with defaults
|
|
225
|
+
npx kubb agent start
|
|
226
|
+
|
|
227
|
+
# Custom port
|
|
228
|
+
npx kubb agent start --port 4000
|
|
229
|
+
|
|
230
|
+
# Allow writing files to disk
|
|
231
|
+
npx kubb agent start --allow-write
|
|
232
|
+
|
|
233
|
+
# Full permissions with custom config
|
|
234
|
+
npx kubb agent start --config ./kubb.config.ts --allow-all
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
See the [`@kubb/agent` README](../agent/README.md) for full environment variable reference, Docker setup, WebSocket API, and Studio integration.
|
|
238
|
+
|
|
88
239
|
## Supporting Kubb
|
|
89
240
|
|
|
90
241
|
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:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./chunk
|
|
2
|
-
import { n as defineCommand } from "./define-
|
|
3
|
-
import { t as version } from "./package-
|
|
4
|
-
import { o as agentDefaults } from "./constants-
|
|
1
|
+
import "./chunk-BvFE5Tac.js";
|
|
2
|
+
import { n as defineCommand } from "./define-m_fp-Aqm.js";
|
|
3
|
+
import { t as version } from "./package-D5wmvFl4.js";
|
|
4
|
+
import { o as agentDefaults } from "./constants-B2JTeRBb.js";
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/commands/agent.ts
|
|
7
7
|
const command = defineCommand({
|
|
@@ -50,8 +50,8 @@ const command = defineCommand({
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
async run({ values }) {
|
|
53
|
-
const {
|
|
54
|
-
await
|
|
53
|
+
const { run } = await import("./run-BzpYYOQs.js");
|
|
54
|
+
await run({
|
|
55
55
|
port: values.port !== void 0 ? values.port : void 0,
|
|
56
56
|
host: values.host,
|
|
57
57
|
configPath: values.config,
|
|
@@ -65,4 +65,4 @@ const command = defineCommand({
|
|
|
65
65
|
//#endregion
|
|
66
66
|
export { command };
|
|
67
67
|
|
|
68
|
-
//# sourceMappingURL=agent-
|
|
68
|
+
//# sourceMappingURL=agent-DN7o8nlE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-DN7o8nlE.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;EAAyD;CACtI,aAAa,CDJQ,cAAc;EACnC,MAAM;EACN,aACE;EACF,UAAU;GAAC;GAAoB;GAAgC;GAAkC;GAAyD;EAC1J,SAAS;GACP,QAAQ;IACN,MAAM;IACN,aAAa;IACb,OAAO;IACR;GACD,MAAM;IACJ,MAAM;IACN,aAAa;IACb,OAAO;IACP,SAAS,cAAc;IACxB;GACD,MAAM;IACJ,MAAM;IACN,aAAa;IACb,SAAS,cAAc;IACxB;GACD,eAAe;IACb,MAAM;IACN,aAAa;IACb,SAAS;IACV;GACD,aAAa;IACX,MAAM;IACN,aAAa;IACb,SAAS;IACV;GACF;EACD,MAAM,IAAI,EAAE,UAAU;GACpB,MAAM,EAAE,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;IACD,CAAC;;EAEL,CCzCeC,CAAa;CAC5B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require("./chunk-ByKO4r7w.cjs");
|
|
2
2
|
const require_define = require("./define-Bdn8j5VM.cjs");
|
|
3
|
-
const require_package = require("./package-
|
|
4
|
-
const require_constants = require("./constants-
|
|
3
|
+
const require_package = require("./package-DrUndPET.cjs");
|
|
4
|
+
const require_constants = require("./constants-BINTA5VZ.cjs");
|
|
5
5
|
//#region src/commands/agent/start.ts
|
|
6
6
|
const command$1 = require_define.defineCommand({
|
|
7
7
|
name: "start",
|
|
@@ -41,8 +41,8 @@ const command$1 = require_define.defineCommand({
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
async run({ values }) {
|
|
44
|
-
const {
|
|
45
|
-
await
|
|
44
|
+
const { run } = await Promise.resolve().then(() => require("./run-DwdAwnLG.cjs"));
|
|
45
|
+
await run({
|
|
46
46
|
port: values.port !== void 0 ? values.port : void 0,
|
|
47
47
|
host: values.host,
|
|
48
48
|
configPath: values.config,
|
|
@@ -67,4 +67,4 @@ const command = require_define.defineCommand({
|
|
|
67
67
|
//#endregion
|
|
68
68
|
exports.command = command;
|
|
69
69
|
|
|
70
|
-
//# sourceMappingURL=agent-
|
|
70
|
+
//# sourceMappingURL=agent-Fm9_8BBH.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-Fm9_8BBH.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;EAAyD;CAC1J,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAASC,kBAAAA,cAAc;GACxB;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACb,SAASA,kBAAAA,cAAc;GACxB;EACD,eAAe;GACb,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACD,aAAa;GACX,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACF;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,qBAAA,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;GACD,CAAC;;CAEL,CAAC;;;AC9CF,MAAa,UAAUC,eAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU;EAAC;EAAoB;EAA8C;EAAyD;CACtI,aAAa,CAACC,UAAa;CAC5B,CAAC"}
|
|
@@ -36,10 +36,7 @@ const agentDefaults = {
|
|
|
36
36
|
*/
|
|
37
37
|
serverEntryPath: ".output/server/index.mjs"
|
|
38
38
|
};
|
|
39
|
-
/**
|
|
40
|
-
* Color palette used by randomCliColor() for deterministic plugin name coloring.
|
|
41
|
-
*/
|
|
42
39
|
//#endregion
|
|
43
40
|
export { WATCHER_IGNORED_PATHS as a, SUMMARY_SEPARATOR as i, OTLP_ENDPOINT as n, agentDefaults as o, QUIET_FLAGS as r, KUBB_NPM_PACKAGE_URL as t };
|
|
44
41
|
|
|
45
|
-
//# sourceMappingURL=constants-
|
|
42
|
+
//# sourceMappingURL=constants-B2JTeRBb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants-
|
|
1
|
+
{"version":3,"file":"constants-B2JTeRBb.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 * OpenTelemetry ingestion endpoint for anonymous usage telemetry.\n */\nexport const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const\n\n/**\n * Horizontal rule rendered above/below the plain-logger generation summary.\n */\nexport const SUMMARY_SEPARATOR = '─'.repeat(27)\n\n/**\n * Maximum number of █ characters in a plugin timing bar.\n */\nexport const SUMMARY_MAX_BAR_LENGTH = 10 as const\n\n/**\n * Divides elapsed milliseconds into bar-length units (1 block per 100 ms).\n */\nexport const SUMMARY_TIME_SCALE_DIVISOR = 100 as const\n\n/**\n * Glob pattern for paths the file watcher ignores.\n */\nexport const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/**\n * Flags that short-circuit execution (help/version) — no telemetry notice is shown.\n */\nexport const QUIET_FLAGS = new Set(['--help', '-h', '--version', '-v'] as const)\n\nexport const agentDefaults = {\n port: '3000',\n host: 'localhost',\n configFile: KUBB_CONFIG_FILENAME,\n retryTimeout: '30000',\n studioUrl: 'https://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;;;;AAKpC,MAAa,gBAAgB;;;;AAK7B,MAAa,oBAAoB,IAAI,OAAO,GAAG;;;;AAe/C,MAAa,wBAAwB;;;;AAKrC,MAAa,cAAc,IAAI,IAAI;CAAC;CAAU;CAAM;CAAa;CAAK,CAAU;AAEhF,MAAa,gBAAgB;CAC3B,MAAM;CACN,MAAM;CACN,YAAY;CACZ,cAAc;CACd,WAAW;;;;CAIX,iBAAiB;CAClB"}
|
|
@@ -36,9 +36,6 @@ const agentDefaults = {
|
|
|
36
36
|
*/
|
|
37
37
|
serverEntryPath: ".output/server/index.mjs"
|
|
38
38
|
};
|
|
39
|
-
/**
|
|
40
|
-
* Color palette used by randomCliColor() for deterministic plugin name coloring.
|
|
41
|
-
*/
|
|
42
39
|
//#endregion
|
|
43
40
|
Object.defineProperty(exports, "KUBB_NPM_PACKAGE_URL", {
|
|
44
41
|
enumerable: true,
|
|
@@ -77,4 +74,4 @@ Object.defineProperty(exports, "agentDefaults", {
|
|
|
77
74
|
}
|
|
78
75
|
});
|
|
79
76
|
|
|
80
|
-
//# sourceMappingURL=constants-
|
|
77
|
+
//# sourceMappingURL=constants-BINTA5VZ.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants-
|
|
1
|
+
{"version":3,"file":"constants-BINTA5VZ.cjs","names":["KUBB_CONFIG_FILENAME"],"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 * OpenTelemetry ingestion endpoint for anonymous usage telemetry.\n */\nexport const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const\n\n/**\n * Horizontal rule rendered above/below the plain-logger generation summary.\n */\nexport const SUMMARY_SEPARATOR = '─'.repeat(27)\n\n/**\n * Maximum number of █ characters in a plugin timing bar.\n */\nexport const SUMMARY_MAX_BAR_LENGTH = 10 as const\n\n/**\n * Divides elapsed milliseconds into bar-length units (1 block per 100 ms).\n */\nexport const SUMMARY_TIME_SCALE_DIVISOR = 100 as const\n\n/**\n * Glob pattern for paths the file watcher ignores.\n */\nexport const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/**\n * Flags that short-circuit execution (help/version) — no telemetry notice is shown.\n */\nexport const QUIET_FLAGS = new Set(['--help', '-h', '--version', '-v'] as const)\n\nexport const agentDefaults = {\n port: '3000',\n host: 'localhost',\n configFile: KUBB_CONFIG_FILENAME,\n retryTimeout: '30000',\n studioUrl: 'https://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;;;;AAKpC,MAAa,gBAAgB;;;;AAK7B,MAAa,oBAAoB,IAAI,OAAO,GAAG;;;;AAe/C,MAAa,wBAAwB;;;;AAKrC,MAAa,cAAc,IAAI,IAAI;CAAC;CAAU;CAAM;CAAa;CAAK,CAAU;AAEhF,MAAa,gBAAgB;CAC3B,MAAM;CACN,MAAM;CACN,YAAYA,kBAAAA;CACZ,cAAc;CACd,WAAW;;;;CAIX,iBAAiB;CAClB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./chunk
|
|
1
|
+
import "./chunk-BvFE5Tac.js";
|
|
2
2
|
//#region ../../internals/utils/src/cli/define.ts
|
|
3
3
|
/**
|
|
4
4
|
* Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.
|
|
@@ -40,4 +40,4 @@ function defineCommand(def) {
|
|
|
40
40
|
//#endregion
|
|
41
41
|
export { defineCommand as n, defineCLIAdapter as t };
|
|
42
42
|
|
|
43
|
-
//# sourceMappingURL=define-
|
|
43
|
+
//# sourceMappingURL=define-m_fp-Aqm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import "./chunk
|
|
1
|
+
import "./chunk-BvFE5Tac.js";
|
|
2
2
|
//#region ../../internals/utils/src/errors.ts
|
|
3
3
|
/**
|
|
4
4
|
* Coerces an unknown thrown value to an `Error` instance.
|
|
@@ -40,4 +40,4 @@ function toCause(error) {
|
|
|
40
40
|
//#endregion
|
|
41
41
|
export { toCause as n, toError as r, getErrorMessage as t };
|
|
42
42
|
|
|
43
|
-
//# sourceMappingURL=errors-
|
|
43
|
+
//# sourceMappingURL=errors-CINO1EIv.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-
|
|
1
|
+
{"version":3,"file":"errors-CINO1EIv.js","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n *\n * @example\n * ```ts\n * throw new BuildError('Build failed', { errors: [err1, err2] })\n * ```\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces an unknown thrown value to an `Error` instance.\n * Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.\n *\n * @example\n * ```ts\n * try { ... } catch(err) {\n * throw new BuildError('Build failed', { cause: toError(err), errors: [] })\n * }\n * ```\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Extracts a human-readable message from any thrown value.\n *\n * @example\n * ```ts\n * getErrorMessage(new Error('oops')) // 'oops'\n * getErrorMessage('plain string') // 'plain string'\n * ```\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extracts the `.cause` of an `Error` as an `Error`, or `undefined` when absent or not an `Error`.\n *\n * @example\n * ```ts\n * const cause = toCause(buildError) // Error | undefined\n * ```\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,QAAQ,OAAuB;CAC7C,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;;;;;;;;;;;AAYlE,SAAgB,gBAAgB,OAAwB;CACtD,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;;;;;;;;;;AAW/D,SAAgB,QAAQ,OAAiC;CACvD,OAAO,MAAM,iBAAiB,QAAQ,MAAM,QAAQ,KAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./chunk
|
|
2
|
-
import { n as defineCommand } from "./define-
|
|
1
|
+
import "./chunk-BvFE5Tac.js";
|
|
2
|
+
import { n as defineCommand } from "./define-m_fp-Aqm.js";
|
|
3
3
|
//#region src/commands/generate.ts
|
|
4
4
|
const command = defineCommand({
|
|
5
5
|
name: "generate",
|
|
@@ -57,8 +57,8 @@ const command = defineCommand({
|
|
|
57
57
|
},
|
|
58
58
|
async run({ values, positionals }) {
|
|
59
59
|
const logLevel = values.debug ? "debug" : values.verbose ? "verbose" : values.silent ? "silent" : values.logLevel;
|
|
60
|
-
const {
|
|
61
|
-
await
|
|
60
|
+
const { run } = await import("./run-BAJubgdA.js");
|
|
61
|
+
await run({
|
|
62
62
|
input: positionals[0],
|
|
63
63
|
configPath: values.config,
|
|
64
64
|
logLevel,
|
|
@@ -69,4 +69,4 @@ const command = defineCommand({
|
|
|
69
69
|
//#endregion
|
|
70
70
|
export { command };
|
|
71
71
|
|
|
72
|
-
//# sourceMappingURL=generate-
|
|
72
|
+
//# sourceMappingURL=generate-BY-juRdH.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-
|
|
1
|
+
{"version":3,"file":"generate-BY-juRdH.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"}
|
|
@@ -56,8 +56,8 @@ const command = require("./define-Bdn8j5VM.cjs").defineCommand({
|
|
|
56
56
|
},
|
|
57
57
|
async run({ values, positionals }) {
|
|
58
58
|
const logLevel = values.debug ? "debug" : values.verbose ? "verbose" : values.silent ? "silent" : values.logLevel;
|
|
59
|
-
const {
|
|
60
|
-
await
|
|
59
|
+
const { run } = await Promise.resolve().then(() => require("./run-CqKd6JNc.cjs"));
|
|
60
|
+
await run({
|
|
61
61
|
input: positionals[0],
|
|
62
62
|
configPath: values.config,
|
|
63
63
|
logLevel,
|
|
@@ -68,4 +68,4 @@ const command = require("./define-Bdn8j5VM.cjs").defineCommand({
|
|
|
68
68
|
//#endregion
|
|
69
69
|
exports.command = command;
|
|
70
70
|
|
|
71
|
-
//# sourceMappingURL=generate-
|
|
71
|
+
//# sourceMappingURL=generate-Bod9YCbF.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-
|
|
1
|
+
{"version":3,"file":"generate-Bod9YCbF.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"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./chunk-ByKO4r7w.cjs");
|
|
3
3
|
const require_define = require("./define-Bdn8j5VM.cjs");
|
|
4
|
-
const require_telemetry = require("./telemetry-
|
|
5
|
-
const require_package = require("./package-
|
|
6
|
-
const require_constants = require("./constants-
|
|
4
|
+
const require_telemetry = require("./telemetry-B2iWkY5e.cjs");
|
|
5
|
+
const require_package = require("./package-DrUndPET.cjs");
|
|
6
|
+
const require_constants = require("./constants-BINTA5VZ.cjs");
|
|
7
7
|
let node_util = require("node:util");
|
|
8
8
|
//#region ../../internals/utils/src/cli/schema.ts
|
|
9
9
|
/**
|
|
@@ -235,7 +235,7 @@ function createCLI(options) {
|
|
|
235
235
|
} };
|
|
236
236
|
}
|
|
237
237
|
//#endregion
|
|
238
|
-
//#region
|
|
238
|
+
//#region ../../internals/utils/src/isFlag.ts
|
|
239
239
|
/**
|
|
240
240
|
* Type guard that confirms `value` is a member of `set`. Avoids type assertions with `Set<T extends string>`.
|
|
241
241
|
*/
|
|
@@ -254,11 +254,11 @@ function shouldShowTelemetryNotice(argv) {
|
|
|
254
254
|
}
|
|
255
255
|
async function run(argv = process.argv) {
|
|
256
256
|
if (shouldShowTelemetryNotice(argv)) console.log(`${(0, node_util.styleText)("yellow", "Notice:")} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \nTo disable, set ${(0, node_util.styleText)("cyan", "KUBB_DISABLE_TELEMETRY=1")}.\n`);
|
|
257
|
-
const { command: generateCommand } = await Promise.resolve().then(() => require("./generate-
|
|
258
|
-
const { command: validateCommand } = await Promise.resolve().then(() => require("./validate-
|
|
259
|
-
const { command: mcpCommand } = await Promise.resolve().then(() => require("./mcp-
|
|
260
|
-
const { command: agentCommand } = await Promise.resolve().then(() => require("./agent-
|
|
261
|
-
const { command: initCommand } = await Promise.resolve().then(() => require("./init-
|
|
257
|
+
const { command: generateCommand } = await Promise.resolve().then(() => require("./generate-Bod9YCbF.cjs"));
|
|
258
|
+
const { command: validateCommand } = await Promise.resolve().then(() => require("./validate-Bfpf_UIh.cjs"));
|
|
259
|
+
const { command: mcpCommand } = await Promise.resolve().then(() => require("./mcp-DcSrFhhP.cjs"));
|
|
260
|
+
const { command: agentCommand } = await Promise.resolve().then(() => require("./agent-Fm9_8BBH.cjs"));
|
|
261
|
+
const { command: initCommand } = await Promise.resolve().then(() => require("./init-BIkZU6mB.cjs"));
|
|
262
262
|
await cli.run([
|
|
263
263
|
generateCommand,
|
|
264
264
|
validateCommand,
|