@kubb/cli 5.0.0-beta.3 → 5.0.0-beta.31
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-BAAO2W7u.cjs +70 -0
- package/dist/agent-BAAO2W7u.cjs.map +1 -0
- package/dist/agent-WLRLgsEM.js +68 -0
- package/dist/agent-WLRLgsEM.js.map +1 -0
- package/dist/{chunk--u3MIqq1.js → chunk-BvFE5Tac.js} +1 -0
- package/dist/constants-B2JTeRBb.js +42 -0
- package/dist/constants-B2JTeRBb.js.map +1 -0
- package/dist/constants-BINTA5VZ.cjs +77 -0
- package/dist/constants-BINTA5VZ.cjs.map +1 -0
- package/dist/constants-BYGmiFs0.cjs +139 -0
- package/dist/constants-BYGmiFs0.cjs.map +1 -0
- package/dist/constants-DSJ-Xrbv.js +116 -0
- package/dist/constants-DSJ-Xrbv.js.map +1 -0
- package/dist/define-Bdn8j5VM.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/errors-CLCjoSg0.cjs.map +1 -1
- package/dist/{generate-CTdVvIaP.js → generate-C4iw5Nou.js} +12 -6
- package/dist/generate-C4iw5Nou.js.map +1 -0
- package/dist/{generate-BzCMyyNN.cjs → generate-DKtBY8eR.cjs} +10 -4
- package/dist/generate-DKtBY8eR.cjs.map +1 -0
- package/dist/index.cjs +20 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +22 -13
- package/dist/index.js.map +1 -1
- package/dist/init-DE_judaK.js +53 -0
- package/dist/init-DE_judaK.js.map +1 -0
- package/dist/init-berpsF2G.cjs +53 -0
- package/dist/init-berpsF2G.cjs.map +1 -0
- package/dist/mcp-Ce6errt_.js +39 -0
- package/dist/mcp-Ce6errt_.js.map +1 -0
- package/dist/mcp-DcohdQTl.cjs +39 -0
- package/dist/mcp-DcohdQTl.cjs.map +1 -0
- package/dist/package-C0vNpFXU.js +6 -0
- package/dist/package-C0vNpFXU.js.map +1 -0
- package/dist/{package-DcmDg_mw.cjs → package-DZDnoPgZ.cjs} +2 -2
- package/dist/package-DZDnoPgZ.cjs.map +1 -0
- package/dist/run-B11-UaUs.cjs +33 -0
- package/dist/run-B11-UaUs.cjs.map +1 -0
- package/dist/{init-eNRlotJK.js → run-BNqMQygv.js} +107 -149
- package/dist/run-BNqMQygv.js.map +1 -0
- package/dist/{generate-BL-Kp5GY.js → run-BgM41TQT.js} +561 -493
- package/dist/run-BgM41TQT.js.map +1 -0
- package/dist/{init-CZ5Xq2Hd.cjs → run-BnGfi7Cp.cjs} +105 -147
- package/dist/run-BnGfi7Cp.cjs.map +1 -0
- package/dist/{agent-sdYBBgrd.js → run-BzpYYOQs.js} +46 -43
- package/dist/run-BzpYYOQs.js.map +1 -0
- package/dist/run-CCZ24VKk.js +51 -0
- package/dist/run-CCZ24VKk.js.map +1 -0
- package/dist/run-CQbj3ley.cjs +52 -0
- package/dist/run-CQbj3ley.cjs.map +1 -0
- package/dist/{generate-DMqdAYqy.cjs → run-DeWgpA6S.cjs} +558 -490
- package/dist/run-DeWgpA6S.cjs.map +1 -0
- package/dist/{agent-B4cAAab2.cjs → run-DwdAwnLG.cjs} +44 -41
- package/dist/run-DwdAwnLG.cjs.map +1 -0
- package/dist/run-PSA9X7ci.js +32 -0
- package/dist/run-PSA9X7ci.js.map +1 -0
- package/dist/shell-475fQKaX.cjs.map +1 -1
- 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-DN95_2pF.cjs → telemetry-B2iWkY5e.cjs} +5 -7
- package/dist/telemetry-B2iWkY5e.cjs.map +1 -0
- package/dist/{telemetry-LgT_sdPe.js → telemetry-BkektVz6.js} +6 -8
- package/dist/telemetry-BkektVz6.js.map +1 -0
- package/dist/validate-DVeCYyIS.js +26 -0
- package/dist/validate-DVeCYyIS.js.map +1 -0
- package/dist/validate-ymG_XDSU.cjs +26 -0
- package/dist/validate-ymG_XDSU.cjs.map +1 -0
- package/package.json +14 -14
- package/src/commands/agent/start.ts +10 -7
- package/src/commands/agent.ts +3 -1
- package/src/commands/generate.ts +5 -3
- package/src/commands/init.ts +34 -3
- package/src/commands/mcp.ts +28 -4
- package/src/commands/validate.ts +6 -4
- package/src/constants.ts +2 -58
- package/src/index.ts +5 -3
- package/src/loggers/clackLogger.ts +85 -118
- package/src/loggers/fileSystemLogger.ts +28 -15
- package/src/loggers/githubActionsLogger.ts +87 -96
- package/src/loggers/plainLogger.ts +48 -81
- package/src/loggers/types.ts +6 -0
- package/src/loggers/utils.ts +235 -11
- package/src/runners/agent/run.ts +113 -0
- package/src/runners/agent/utils.ts +98 -0
- package/src/runners/generate/run.ts +321 -0
- package/src/runners/generate/utils.ts +225 -0
- package/src/runners/init/run.ts +212 -0
- package/src/{utils/packageManager.ts → runners/init/utils.ts} +12 -2
- package/src/runners/mcp/run.ts +37 -0
- package/src/runners/validate/run.ts +63 -0
- package/src/{utils/telemetry.ts → telemetry.ts} +27 -20
- package/dist/agent-B4cAAab2.cjs.map +0 -1
- package/dist/agent-BFACosbG.cjs +0 -58
- package/dist/agent-BFACosbG.cjs.map +0 -1
- package/dist/agent-s7TqqoTg.js +0 -56
- package/dist/agent-s7TqqoTg.js.map +0 -1
- package/dist/agent-sdYBBgrd.js.map +0 -1
- package/dist/constants-CnDXa1R6.cjs +0 -148
- package/dist/constants-CnDXa1R6.cjs.map +0 -1
- package/dist/constants-aL3CP_Wq.js +0 -95
- package/dist/constants-aL3CP_Wq.js.map +0 -1
- package/dist/generate-BL-Kp5GY.js.map +0 -1
- package/dist/generate-BzCMyyNN.cjs.map +0 -1
- package/dist/generate-CTdVvIaP.js.map +0 -1
- package/dist/generate-DMqdAYqy.cjs.map +0 -1
- package/dist/init-BHMGbly9.cjs +0 -25
- package/dist/init-BHMGbly9.cjs.map +0 -1
- package/dist/init-CZ5Xq2Hd.cjs.map +0 -1
- package/dist/init-eNRlotJK.js.map +0 -1
- package/dist/init-qgpg-iRW.js +0 -25
- package/dist/init-qgpg-iRW.js.map +0 -1
- package/dist/mcp-BRp-2Rdc.js +0 -16
- package/dist/mcp-BRp-2Rdc.js.map +0 -1
- package/dist/mcp-CYOgxB82.cjs +0 -47
- package/dist/mcp-CYOgxB82.cjs.map +0 -1
- package/dist/mcp-DmJm3TrU.js +0 -46
- package/dist/mcp-DmJm3TrU.js.map +0 -1
- package/dist/mcp-N3mRyVuO.cjs +0 -16
- package/dist/mcp-N3mRyVuO.cjs.map +0 -1
- package/dist/package-DcmDg_mw.cjs.map +0 -1
- package/dist/package-DtuyzAVW.js +0 -6
- package/dist/package-DtuyzAVW.js.map +0 -1
- package/dist/telemetry-DN95_2pF.cjs.map +0 -1
- package/dist/telemetry-LgT_sdPe.js.map +0 -1
- package/dist/validate-CJpTOzKA.js +0 -25
- package/dist/validate-CJpTOzKA.js.map +0 -1
- package/dist/validate-DyTbv7Bc.cjs +0 -25
- package/dist/validate-DyTbv7Bc.cjs.map +0 -1
- package/dist/validate-kLJoT_hi.js +0 -33
- package/dist/validate-kLJoT_hi.js.map +0 -1
- package/dist/validate-yKKzqEZ5.cjs +0 -34
- package/dist/validate-yKKzqEZ5.cjs.map +0 -1
- package/src/runners/agent.ts +0 -155
- package/src/runners/generate.ts +0 -333
- package/src/runners/init.ts +0 -296
- package/src/runners/mcp.ts +0 -51
- package/src/runners/validate.ts +0 -39
- 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 -80
- package/src/utils/getSummary.ts +0 -68
- package/src/utils/runHook.ts +0 -91
- package/src/utils/watcher.ts +0 -19
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import process from 'node:process'
|
|
4
|
+
import { styleText } from 'node:util'
|
|
5
|
+
import * as clack from '@clack/prompts'
|
|
6
|
+
import { detectPackageManager } from '@internals/utils'
|
|
7
|
+
import { availablePlugins, generateConfigFile, initDefaults, KUBB_CONFIG_FILENAME, type PluginOption } from '@internals/shared'
|
|
8
|
+
import { hasPackageJson, initPackageJson, installPackages } from './utils.ts'
|
|
9
|
+
|
|
10
|
+
function cancelAndExit(message = 'Operation cancelled.'): never {
|
|
11
|
+
clack.cancel(message)
|
|
12
|
+
process.exit(0)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type InitOptions = {
|
|
16
|
+
/**
|
|
17
|
+
* When `true`, skips all interactive prompts and uses default values.
|
|
18
|
+
*/
|
|
19
|
+
yes: boolean
|
|
20
|
+
/**
|
|
21
|
+
* Current `@kubb/cli` version string, shown in the outro and used for package installation.
|
|
22
|
+
*/
|
|
23
|
+
version: string
|
|
24
|
+
/**
|
|
25
|
+
* Input path flag value from `--input`. When provided, skips the input prompt.
|
|
26
|
+
*/
|
|
27
|
+
input?: string
|
|
28
|
+
/**
|
|
29
|
+
* Output directory flag value from `--output`. When provided, skips the output prompt.
|
|
30
|
+
*/
|
|
31
|
+
output?: string
|
|
32
|
+
/**
|
|
33
|
+
* Comma-separated plugin list from `--plugins`, e.g. `'plugin-ts,plugin-zod'`. When provided, skips the plugin selection prompt.
|
|
34
|
+
*/
|
|
35
|
+
plugins?: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Runs the interactive Kubb scaffolding wizard.
|
|
40
|
+
* Detects the package manager, prompts for input/output paths and plugins, installs packages, and writes `kubb.config.ts`.
|
|
41
|
+
* Pass `yes: true` to skip all prompts and use defaults.
|
|
42
|
+
*/
|
|
43
|
+
export async function run({ yes, version, input: inputFlag, output: outputFlag, plugins: pluginsFlag }: InitOptions): Promise<void> {
|
|
44
|
+
const cwd = process.cwd()
|
|
45
|
+
|
|
46
|
+
clack.intro(styleText('bgCyan', styleText('black', ' Kubb Init ')))
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Returns `flag` when provided, the `defaultValue` when `yes` is set,
|
|
50
|
+
* or calls `prompt()` for interactive input. Exits on cancellation.
|
|
51
|
+
*/
|
|
52
|
+
async function resolveOrPrompt<T>(flag: T | undefined, defaultValue: T, logLabel: string, prompt: () => Promise<T | symbol>): Promise<T> {
|
|
53
|
+
if (flag !== undefined) {
|
|
54
|
+
clack.log.info(`${logLabel}: ${styleText('cyan', String(flag))}`)
|
|
55
|
+
return flag
|
|
56
|
+
}
|
|
57
|
+
if (yes) {
|
|
58
|
+
clack.log.info(`${logLabel}: ${styleText('cyan', String(defaultValue))}`)
|
|
59
|
+
return defaultValue
|
|
60
|
+
}
|
|
61
|
+
const result = await prompt()
|
|
62
|
+
if (clack.isCancel(result)) cancelAndExit()
|
|
63
|
+
return result as T
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
// Check/create package.json — detect package manager once after the block
|
|
68
|
+
if (!hasPackageJson(cwd)) {
|
|
69
|
+
if (!yes) {
|
|
70
|
+
const shouldInit = await clack.confirm({
|
|
71
|
+
message: 'No package.json found. Would you like to create one?',
|
|
72
|
+
initialValue: true,
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
if (clack.isCancel(shouldInit) || !shouldInit) {
|
|
76
|
+
cancelAndExit()
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const packageManager = detectPackageManager(cwd)
|
|
81
|
+
const spinner = clack.spinner()
|
|
82
|
+
spinner.start(`Initializing package.json with ${packageManager.name}`)
|
|
83
|
+
await initPackageJson(cwd, packageManager)
|
|
84
|
+
spinner.stop(`Created package.json with ${packageManager.name}`)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const packageManager = detectPackageManager(cwd)
|
|
88
|
+
if (hasPackageJson(cwd)) {
|
|
89
|
+
clack.log.info(`Detected package manager: ${styleText('cyan', packageManager.name)}`)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Prompt for OpenAPI spec path
|
|
93
|
+
const inputPath = await resolveOrPrompt(inputFlag, initDefaults.inputPath, 'Using input path', () =>
|
|
94
|
+
clack.text({
|
|
95
|
+
message: 'Where is your OpenAPI specification located?',
|
|
96
|
+
placeholder: initDefaults.inputPath,
|
|
97
|
+
defaultValue: initDefaults.inputPath,
|
|
98
|
+
validate: (value) => {
|
|
99
|
+
if (!value) return 'Input path is required'
|
|
100
|
+
},
|
|
101
|
+
}),
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
// Prompt for output directory
|
|
105
|
+
const outputPath = await resolveOrPrompt(outputFlag, initDefaults.outputPath, 'Using output path', () =>
|
|
106
|
+
clack.text({
|
|
107
|
+
message: 'Where should the generated files be output?',
|
|
108
|
+
placeholder: initDefaults.outputPath,
|
|
109
|
+
defaultValue: initDefaults.outputPath,
|
|
110
|
+
validate: (value) => {
|
|
111
|
+
if (!value) return 'Output path is required'
|
|
112
|
+
},
|
|
113
|
+
}),
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
// Plugin selection
|
|
117
|
+
const defaultPlugins = availablePlugins.filter((p) => (initDefaults.plugins as ReadonlyArray<string>).includes(p.value))
|
|
118
|
+
const pluginLabel = (plugins: Array<PluginOption>) => styleText('cyan', plugins.map((p) => p.label).join(', '))
|
|
119
|
+
|
|
120
|
+
const selectedPlugins: Array<PluginOption> = await (async () => {
|
|
121
|
+
if (pluginsFlag) {
|
|
122
|
+
const requested = pluginsFlag
|
|
123
|
+
.split(',')
|
|
124
|
+
.map((v) => v.trim())
|
|
125
|
+
.filter(Boolean)
|
|
126
|
+
const plugins = availablePlugins.filter((p) => requested.includes(p.value))
|
|
127
|
+
if (plugins.length === 0) {
|
|
128
|
+
clack.log.warn(`No valid plugins found in --plugins value; falling back to default: ${pluginLabel(defaultPlugins)}`)
|
|
129
|
+
return defaultPlugins
|
|
130
|
+
}
|
|
131
|
+
clack.log.info(`Using plugins: ${pluginLabel(plugins)}`)
|
|
132
|
+
return plugins
|
|
133
|
+
}
|
|
134
|
+
if (yes) {
|
|
135
|
+
clack.log.info(`Using plugins: ${pluginLabel(defaultPlugins)}`)
|
|
136
|
+
return defaultPlugins
|
|
137
|
+
}
|
|
138
|
+
const values = await clack.multiselect({
|
|
139
|
+
message: 'Select plugins to use:',
|
|
140
|
+
options: availablePlugins.map(({ value, label, hint }) => ({ value, label, hint })),
|
|
141
|
+
initialValues: [...initDefaults.plugins],
|
|
142
|
+
required: true,
|
|
143
|
+
})
|
|
144
|
+
if (clack.isCancel(values)) cancelAndExit()
|
|
145
|
+
return availablePlugins.filter((p) => (values as Array<string>).includes(p.value))
|
|
146
|
+
})()
|
|
147
|
+
|
|
148
|
+
// Install packages
|
|
149
|
+
const packagesToInstall = ['kubb', ...selectedPlugins.map((p) => p.packageName)]
|
|
150
|
+
|
|
151
|
+
const spinner = clack.spinner()
|
|
152
|
+
spinner.start(`Installing ${packagesToInstall.length} packages with ${packageManager.name}`)
|
|
153
|
+
|
|
154
|
+
try {
|
|
155
|
+
await installPackages(packagesToInstall, packageManager, cwd)
|
|
156
|
+
spinner.stop(`Installed ${packagesToInstall.length} packages`)
|
|
157
|
+
} catch (error) {
|
|
158
|
+
spinner.stop('Installation failed')
|
|
159
|
+
throw error
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Generate config file
|
|
163
|
+
const configSpinner = clack.spinner()
|
|
164
|
+
configSpinner.start(`Creating ${KUBB_CONFIG_FILENAME}`)
|
|
165
|
+
|
|
166
|
+
const configContent = generateConfigFile({ selectedPlugins, inputPath, outputPath })
|
|
167
|
+
const configPath = path.join(cwd, KUBB_CONFIG_FILENAME)
|
|
168
|
+
|
|
169
|
+
if (fs.existsSync(configPath)) {
|
|
170
|
+
configSpinner.stop(`${KUBB_CONFIG_FILENAME} already exists`)
|
|
171
|
+
|
|
172
|
+
if (!yes) {
|
|
173
|
+
const shouldOverwrite = await clack.confirm({
|
|
174
|
+
message: `${KUBB_CONFIG_FILENAME} already exists. Overwrite?`,
|
|
175
|
+
initialValue: false,
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
if (clack.isCancel(shouldOverwrite) || !shouldOverwrite) {
|
|
179
|
+
cancelAndExit('Keeping existing configuration. Packages have been installed.')
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
configSpinner.start(`Overwriting ${KUBB_CONFIG_FILENAME}`)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
await fs.promises.writeFile(configPath, configContent, 'utf-8')
|
|
187
|
+
|
|
188
|
+
configSpinner.stop(`Created ${KUBB_CONFIG_FILENAME}`)
|
|
189
|
+
|
|
190
|
+
clack.outro(
|
|
191
|
+
styleText('green', '✓ All set!') +
|
|
192
|
+
'\n\n' +
|
|
193
|
+
styleText('dim', 'Next steps:') +
|
|
194
|
+
'\n' +
|
|
195
|
+
styleText('cyan', ` 1. Make sure your OpenAPI spec is at: ${inputPath}`) +
|
|
196
|
+
'\n' +
|
|
197
|
+
styleText('cyan', ' 2. Generate code with: npx kubb generate') +
|
|
198
|
+
'\n' +
|
|
199
|
+
styleText('cyan', ' Or start a stream server with: npx kubb agent start') +
|
|
200
|
+
'\n' +
|
|
201
|
+
styleText('cyan', ` 3. Find generated files in: ${outputPath}`) +
|
|
202
|
+
'\n\n' +
|
|
203
|
+
styleText('dim', `Using ${packageManager.name} • Kubb v${version}`),
|
|
204
|
+
)
|
|
205
|
+
} catch (error) {
|
|
206
|
+
clack.log.error(styleText('red', 'An error occurred during initialization'))
|
|
207
|
+
if (error instanceof Error) {
|
|
208
|
+
clack.log.error(error.message)
|
|
209
|
+
}
|
|
210
|
+
process.exit(1)
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import fs from 'node:fs'
|
|
2
2
|
import path from 'node:path'
|
|
3
|
+
import process from 'node:process'
|
|
3
4
|
import type { PackageManagerInfo, PackageManagerName } from '@internals/utils'
|
|
4
5
|
import { spawnAsync } from '@internals/utils'
|
|
5
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Returns `true` when a `package.json` exists at `cwd`.
|
|
9
|
+
*/
|
|
6
10
|
export function hasPackageJson(cwd: string = process.cwd()): boolean {
|
|
7
11
|
return fs.existsSync(path.join(cwd, 'package.json'))
|
|
8
12
|
}
|
|
9
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Initializes a new `package.json` at `cwd` using the detected package manager.
|
|
16
|
+
*/
|
|
10
17
|
export async function initPackageJson(cwd: string, packageManager: PackageManagerInfo): Promise<void> {
|
|
11
|
-
const commands: Record<PackageManagerName, string
|
|
18
|
+
const commands: Record<PackageManagerName, Array<string>> = {
|
|
12
19
|
npm: ['init', '-y'],
|
|
13
20
|
pnpm: ['init'],
|
|
14
21
|
yarn: ['init', '-y'],
|
|
@@ -18,6 +25,9 @@ export async function initPackageJson(cwd: string, packageManager: PackageManage
|
|
|
18
25
|
await spawnAsync(packageManager.name, commands[packageManager.name], { cwd })
|
|
19
26
|
}
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Installs the given packages at `cwd` using the detected package manager.
|
|
30
|
+
*/
|
|
31
|
+
export async function installPackages(packages: Array<string>, packageManager: PackageManagerInfo, cwd: string = process.cwd()): Promise<void> {
|
|
22
32
|
await spawnAsync(packageManager.name, [...packageManager.installCommand, ...packages], { cwd })
|
|
23
33
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import process from 'node:process'
|
|
2
|
+
import { styleText } from 'node:util'
|
|
3
|
+
import { getErrorMessage } from '@internals/utils'
|
|
4
|
+
import type * as McpModule from '@kubb/mcp'
|
|
5
|
+
import { buildTelemetryEvent, sendTelemetry } from '../../telemetry.ts'
|
|
6
|
+
|
|
7
|
+
type McpOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* Current `@kubb/cli` version string, used for the telemetry payload.
|
|
10
|
+
*/
|
|
11
|
+
version: string
|
|
12
|
+
/**
|
|
13
|
+
* TCP port for the HTTP MCP server. When `undefined`, the server uses stdio transport.
|
|
14
|
+
*/
|
|
15
|
+
port?: string
|
|
16
|
+
/**
|
|
17
|
+
* Hostname to bind to when running in HTTP mode.
|
|
18
|
+
*
|
|
19
|
+
* @default 'localhost'
|
|
20
|
+
*/
|
|
21
|
+
host?: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function run({ version, port, host }: McpOptions): Promise<void> {
|
|
25
|
+
const { run: startMcpServer } = (await import('@kubb/mcp')) as typeof McpModule
|
|
26
|
+
const hrStart = process.hrtime()
|
|
27
|
+
const report = (status: 'success' | 'failed') => sendTelemetry(buildTelemetryEvent({ command: 'mcp', kubbVersion: version, hrStart, status }))
|
|
28
|
+
try {
|
|
29
|
+
console.log(styleText('cyan', '⏳ Starting MCP server...'))
|
|
30
|
+
console.warn(styleText('yellow', 'This feature is still under development, use with caution'))
|
|
31
|
+
await startMcpServer(undefined, { port: port !== undefined ? Number(port) : undefined, host })
|
|
32
|
+
await report('success')
|
|
33
|
+
} catch (error) {
|
|
34
|
+
await report('failed')
|
|
35
|
+
console.error(getErrorMessage(error))
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import process from 'node:process'
|
|
2
|
+
import { styleText } from 'node:util'
|
|
3
|
+
import { getErrorMessage } from '@internals/utils'
|
|
4
|
+
import { buildTelemetryEvent, sendTelemetry } from '../../telemetry.ts'
|
|
5
|
+
|
|
6
|
+
type ValidateOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* Path or URL to the OpenAPI/Swagger file to validate.
|
|
9
|
+
*/
|
|
10
|
+
input: string
|
|
11
|
+
/**
|
|
12
|
+
* Current `@kubb/cli` version string, used for the telemetry payload.
|
|
13
|
+
*/
|
|
14
|
+
version: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type ValidateModule = typeof import('@kubb/adapter-oas')
|
|
18
|
+
type ValidateDependencies = {
|
|
19
|
+
/**
|
|
20
|
+
* Loads `@kubb/adapter-oas`. Injected so tests can substitute a mock.
|
|
21
|
+
*/
|
|
22
|
+
loadValidateModule: () => Promise<ValidateModule>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Dynamically loads `@kubb/adapter-oas` for OpenAPI validation.
|
|
27
|
+
*/
|
|
28
|
+
export function loadValidateModule(): Promise<ValidateModule> {
|
|
29
|
+
return import('@kubb/adapter-oas') as Promise<ValidateModule>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Validates an OpenAPI/Swagger file at `input` using `@kubb/adapter-oas`.
|
|
34
|
+
* Exits the process with code 1 on validation failure or missing dependency.
|
|
35
|
+
*/
|
|
36
|
+
export async function run({ input, version }: ValidateOptions, dependencies: ValidateDependencies = { loadValidateModule }): Promise<void> {
|
|
37
|
+
const hrStart = process.hrtime()
|
|
38
|
+
const report = (status: 'success' | 'failed') => sendTelemetry(buildTelemetryEvent({ command: 'validate', kubbVersion: version, hrStart, status }))
|
|
39
|
+
try {
|
|
40
|
+
const { adapterOas } = await dependencies.loadValidateModule()
|
|
41
|
+
const adapter = adapterOas()
|
|
42
|
+
if (!adapter.validate) {
|
|
43
|
+
throw new Error('The loaded adapter does not support validation.')
|
|
44
|
+
}
|
|
45
|
+
await adapter.validate(input, { throwOnError: true })
|
|
46
|
+
await report('success')
|
|
47
|
+
console.log('✅ Validation success')
|
|
48
|
+
} catch (error) {
|
|
49
|
+
await report('failed')
|
|
50
|
+
if (error instanceof Error && /@kubb\/adapter-oas/.test(error.message)) {
|
|
51
|
+
console.error(styleText('red', 'The @kubb/adapter-oas package is not installed.'))
|
|
52
|
+
console.error('')
|
|
53
|
+
console.error('Install it with:')
|
|
54
|
+
console.error(styleText('cyan', ' npm install @kubb/adapter-oas'))
|
|
55
|
+
console.error(styleText('cyan', ' # or'))
|
|
56
|
+
console.error(styleText('cyan', ' pnpm install @kubb/adapter-oas'))
|
|
57
|
+
console.error('')
|
|
58
|
+
}
|
|
59
|
+
console.error('❌ Validation failed')
|
|
60
|
+
console.error(getErrorMessage(error))
|
|
61
|
+
process.exit(1)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -2,7 +2,7 @@ import { randomBytes } from 'node:crypto'
|
|
|
2
2
|
import os from 'node:os'
|
|
3
3
|
import process from 'node:process'
|
|
4
4
|
import { executeIfOnline, isCIEnvironment } from '@internals/utils'
|
|
5
|
-
import { OTLP_ENDPOINT } from '
|
|
5
|
+
import { OTLP_ENDPOINT } from './constants.ts'
|
|
6
6
|
|
|
7
7
|
// OpenTelemetry OTLP JSON types
|
|
8
8
|
// https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto
|
|
@@ -13,8 +13,8 @@ type OtlpBoolValue = { boolValue: boolean }
|
|
|
13
13
|
type OtlpIntValue = { intValue: number }
|
|
14
14
|
type OtlpDoubleValue = { doubleValue: number }
|
|
15
15
|
type OtlpBytesValue = { bytesValue: string }
|
|
16
|
-
type OtlpArrayValue = { arrayValue: { values: OtlpAnyValue
|
|
17
|
-
type OtlpKvListValue = { kvlistValue: { values: OtlpKeyValue
|
|
16
|
+
type OtlpArrayValue = { arrayValue: { values: Array<OtlpAnyValue> } }
|
|
17
|
+
type OtlpKvListValue = { kvlistValue: { values: Array<OtlpKeyValue> } }
|
|
18
18
|
|
|
19
19
|
type OtlpAnyValue = OtlpStringValue | OtlpBoolValue | OtlpIntValue | OtlpDoubleValue | OtlpBytesValue | OtlpArrayValue | OtlpKvListValue
|
|
20
20
|
|
|
@@ -24,14 +24,14 @@ type OtlpKeyValue = {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
type OtlpResource = {
|
|
27
|
-
attributes: OtlpKeyValue
|
|
27
|
+
attributes: Array<OtlpKeyValue>
|
|
28
28
|
droppedAttributesCount?: number
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
type OtlpInstrumentationScope = {
|
|
32
32
|
name: string
|
|
33
33
|
version?: string
|
|
34
|
-
attributes?: OtlpKeyValue
|
|
34
|
+
attributes?: Array<OtlpKeyValue>
|
|
35
35
|
droppedAttributesCount?: number
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -55,11 +55,11 @@ type OtlpSpan = {
|
|
|
55
55
|
kind: OtlpSpanKind
|
|
56
56
|
startTimeUnixNano: string
|
|
57
57
|
endTimeUnixNano: string
|
|
58
|
-
attributes?: OtlpKeyValue
|
|
58
|
+
attributes?: Array<OtlpKeyValue>
|
|
59
59
|
droppedAttributesCount?: number
|
|
60
|
-
events?: OtlpSpanEvent
|
|
60
|
+
events?: Array<OtlpSpanEvent>
|
|
61
61
|
droppedEventsCount?: number
|
|
62
|
-
links?: OtlpSpanLink
|
|
62
|
+
links?: Array<OtlpSpanLink>
|
|
63
63
|
droppedLinksCount?: number
|
|
64
64
|
status?: OtlpStatus
|
|
65
65
|
}
|
|
@@ -67,7 +67,7 @@ type OtlpSpan = {
|
|
|
67
67
|
type OtlpSpanEvent = {
|
|
68
68
|
timeUnixNano: string
|
|
69
69
|
name: string
|
|
70
|
-
attributes?: OtlpKeyValue
|
|
70
|
+
attributes?: Array<OtlpKeyValue>
|
|
71
71
|
droppedAttributesCount?: number
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -75,29 +75,38 @@ type OtlpSpanLink = {
|
|
|
75
75
|
traceId: string
|
|
76
76
|
spanId: string
|
|
77
77
|
traceState?: string
|
|
78
|
-
attributes?: OtlpKeyValue
|
|
78
|
+
attributes?: Array<OtlpKeyValue>
|
|
79
79
|
droppedAttributesCount?: number
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
type OtlpScopeSpans = {
|
|
83
83
|
scope: OtlpInstrumentationScope
|
|
84
|
-
spans: OtlpSpan
|
|
84
|
+
spans: Array<OtlpSpan>
|
|
85
85
|
schemaUrl?: string
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
type OtlpResourceSpans = {
|
|
89
89
|
resource: OtlpResource
|
|
90
|
-
scopeSpans: OtlpScopeSpans
|
|
90
|
+
scopeSpans: Array<OtlpScopeSpans>
|
|
91
91
|
schemaUrl?: string
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/** Root payload sent to POST /v1/traces */
|
|
95
95
|
type OtlpExportTraceServiceRequest = {
|
|
96
|
-
resourceSpans: OtlpResourceSpans
|
|
96
|
+
resourceSpans: Array<OtlpResourceSpans>
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Anonymous plugin name and options snapshot sent with each telemetry event.
|
|
101
|
+
*/
|
|
99
102
|
export type TelemetryPlugin = {
|
|
103
|
+
/**
|
|
104
|
+
* Plugin name as registered in the Kubb config, e.g. `'@kubb/plugin-ts'`.
|
|
105
|
+
*/
|
|
100
106
|
name: string
|
|
107
|
+
/**
|
|
108
|
+
* anonymized plugin options snapshot — values are included but cannot be traced back to the user.
|
|
109
|
+
*/
|
|
101
110
|
options: Record<string, unknown>
|
|
102
111
|
}
|
|
103
112
|
|
|
@@ -107,23 +116,21 @@ type TelemetryEvent = {
|
|
|
107
116
|
nodeVersion: string
|
|
108
117
|
platform: string
|
|
109
118
|
ci: boolean
|
|
110
|
-
plugins: TelemetryPlugin
|
|
119
|
+
plugins: Array<TelemetryPlugin>
|
|
111
120
|
duration: number
|
|
112
121
|
filesCreated: number
|
|
113
122
|
status: 'success' | 'failed'
|
|
114
123
|
}
|
|
115
124
|
|
|
116
125
|
/**
|
|
117
|
-
*
|
|
118
|
-
* Delegates to the canonical isCIEnvironment() from envDetection.
|
|
126
|
+
* Returns `true` when the current process runs inside a CI environment.
|
|
119
127
|
*/
|
|
120
128
|
export function isCi(): boolean {
|
|
121
129
|
return isCIEnvironment()
|
|
122
130
|
}
|
|
123
131
|
|
|
124
132
|
/**
|
|
125
|
-
*
|
|
126
|
-
* Respects the standard DO_NOT_TRACK convention used across development tools.
|
|
133
|
+
* Returns `true` when telemetry is disabled via `DO_NOT_TRACK` or `KUBB_DISABLE_TELEMETRY`.
|
|
127
134
|
*/
|
|
128
135
|
export function isTelemetryDisabled(): boolean {
|
|
129
136
|
return (
|
|
@@ -144,7 +151,7 @@ export function buildOtlpPayload(event: TelemetryEvent): OtlpExportTraceServiceR
|
|
|
144
151
|
const endTimeNs = BigInt(Date.now()) * 1_000_000n
|
|
145
152
|
const startTimeNs = endTimeNs - BigInt(event.duration) * 1_000_000n
|
|
146
153
|
|
|
147
|
-
const attributes: OtlpKeyValue
|
|
154
|
+
const attributes: Array<OtlpKeyValue> = [
|
|
148
155
|
{ key: 'kubb.command', value: { stringValue: event.command } },
|
|
149
156
|
{ key: 'kubb.version', value: { stringValue: event.kubbVersion } },
|
|
150
157
|
{ key: 'kubb.node_version', value: { stringValue: event.nodeVersion } },
|
|
@@ -251,7 +258,7 @@ export async function sendTelemetry(event: TelemetryEvent): Promise<void> {
|
|
|
251
258
|
export function buildTelemetryEvent(options: {
|
|
252
259
|
command: 'generate' | 'mcp' | 'validate' | 'agent'
|
|
253
260
|
kubbVersion: string
|
|
254
|
-
plugins?: TelemetryPlugin
|
|
261
|
+
plugins?: Array<TelemetryPlugin>
|
|
255
262
|
hrStart: [number, number]
|
|
256
263
|
filesCreated?: number
|
|
257
264
|
status: 'success' | 'failed'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-B4cAAab2.cjs","names":["process","agentDefaults","path","net","spawnAsync","sendTelemetry","buildTelemetryEvent"],"sources":["../src/runners/agent.ts"],"sourcesContent":["import net from 'node:net'\nimport path from 'node:path'\nimport * as process from 'node:process'\nimport { fileURLToPath } from 'node:url'\nimport { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport { spawnAsync } from '@internals/utils'\nimport { agentDefaults } from '../constants.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype AgentStartOptions = {\n port: string | undefined\n host: string\n configPath: string | undefined\n allowWrite: boolean\n allowAll: boolean\n version: string\n}\n\ntype ResolvedAgentStartEnvironment = {\n port: string\n host: string\n allowWrite: boolean\n allowAll: boolean\n agentConfigPath: string\n env: NodeJS.ProcessEnv\n}\n\n/**\n * Resolves the environment passed to the detached agent process using CLI values first, then environment values, then CLI defaults.\n */\nfunction resolveAgentStartEnvironment({ port, host, configPath, allowWrite, allowAll }: Omit<AgentStartOptions, 'version'>): ResolvedAgentStartEnvironment {\n const resolvedPort = port ?? process.env.PORT ?? agentDefaults.port\n const resolvedHost = host !== agentDefaults.host ? host : (process.env.HOST ?? agentDefaults.host)\n const resolvedAllowAll = allowAll || process.env.KUBB_AGENT_ALLOW_ALL === 'true'\n const resolvedAllowWrite = resolvedAllowAll || allowWrite || process.env.KUBB_AGENT_ALLOW_WRITE === 'true'\n const agentRoot = process.env.KUBB_AGENT_ROOT ?? process.cwd()\n const agentConfigPath = path.resolve(process.cwd(), configPath || process.env.KUBB_AGENT_CONFIG || agentDefaults.configFile)\n\n return {\n port: resolvedPort,\n host: resolvedHost,\n allowWrite: resolvedAllowWrite,\n allowAll: resolvedAllowAll,\n agentConfigPath,\n env: {\n ...process.env,\n PORT: resolvedPort,\n HOST: resolvedHost,\n KUBB_AGENT_ROOT: agentRoot,\n KUBB_AGENT_CONFIG: agentConfigPath,\n KUBB_AGENT_ALLOW_WRITE: String(resolvedAllowWrite),\n KUBB_AGENT_ALLOW_ALL: String(resolvedAllowAll),\n KUBB_AGENT_TOKEN: process.env.KUBB_AGENT_TOKEN,\n KUBB_AGENT_RETRY_TIMEOUT: process.env.KUBB_AGENT_RETRY_TIMEOUT ?? agentDefaults.retryTimeout,\n KUBB_STUDIO_URL: process.env.KUBB_STUDIO_URL ?? agentDefaults.studioUrl,\n },\n }\n}\n\nfunction isPortAvailable(port: number, host: string): Promise<boolean> {\n return new Promise((resolve) => {\n const server = net.createServer()\n server.once('error', () => resolve(false))\n server.once('listening', () => {\n server.close()\n resolve(true)\n })\n server.listen(port, host)\n })\n}\n\nexport async function runAgentStart({ port, host, configPath, allowWrite, allowAll, version }: AgentStartOptions): Promise<void> {\n const hrStart = process.hrtime()\n\n try {\n // Load .env file into process.env using Node.js built-in (v20.12.0+)\n try {\n process.loadEnvFile()\n } catch {\n // .env file may not exist; ignore\n }\n\n // Resolve the @kubb/agent package path\n let agentPkgUrl: string\n try {\n agentPkgUrl = import.meta.resolve('@kubb/agent/package.json')\n } catch (_e) {\n console.error(styleText('red', 'The @kubb/agent package is not installed.'))\n console.error('')\n console.error('Install it with:')\n console.error(styleText('cyan', ' npm install @kubb/agent'))\n console.error(styleText('cyan', ' # or'))\n console.error(styleText('cyan', ' pnpm install @kubb/agent'))\n console.error('')\n process.exit(1)\n }\n const agentPkgPath = fileURLToPath(agentPkgUrl)\n const agentDir = path.dirname(agentPkgPath)\n const serverPath = path.join(agentDir, agentDefaults.serverEntryPath)\n\n const resolvedEnv = resolveAgentStartEnvironment({\n port,\n host,\n configPath,\n allowWrite,\n allowAll,\n })\n const numericPort = Number(resolvedEnv.port)\n\n if (!Number.isInteger(numericPort) || numericPort <= 0) {\n throw new Error(`Invalid port \"${resolvedEnv.port}\". Provide a positive integer with --port or PORT.`)\n }\n\n clack.log.step(styleText('cyan', 'Starting agent server...'))\n clack.log.info(styleText('dim', `Config: ${resolvedEnv.agentConfigPath}`))\n clack.log.info(styleText('dim', `Host: ${resolvedEnv.host}`))\n clack.log.info(styleText('dim', `Port: ${resolvedEnv.port}`))\n if (!resolvedEnv.allowWrite && !resolvedEnv.allowAll) {\n clack.log.warn(styleText('yellow', 'Filesystem writes disabled. Use --allow-write or --allow-all to enable.'))\n }\n\n if (!(await isPortAvailable(numericPort, resolvedEnv.host))) {\n clack.log.error(styleText('red', `Port ${resolvedEnv.port} is already in use. Stop the existing process or choose a different port with --port.`))\n process.exit(1)\n }\n\n // Spawns the server as a detached background process so the CLI can exit independently.\n await spawnAsync('node', [serverPath], {\n env: resolvedEnv.env,\n cwd: process.cwd(),\n })\n\n await sendTelemetry(\n buildTelemetryEvent({\n command: 'agent',\n kubbVersion: version,\n hrStart,\n status: 'success',\n }),\n )\n } catch (error) {\n await sendTelemetry(\n buildTelemetryEvent({\n command: 'agent',\n kubbVersion: version,\n hrStart,\n status: 'failed',\n }),\n )\n clack.log.error(styleText('red', 'Failed to start agent server'))\n console.error(error)\n process.exit(1)\n }\n}\n"],"mappings":"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"}
|
package/dist/agent-BFACosbG.cjs
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
require("./chunk-ByKO4r7w.cjs");
|
|
2
|
-
const require_define = require("./define-Bdn8j5VM.cjs");
|
|
3
|
-
const require_package = require("./package-DcmDg_mw.cjs");
|
|
4
|
-
const require_constants = require("./constants-CnDXa1R6.cjs");
|
|
5
|
-
//#region src/commands/agent/start.ts
|
|
6
|
-
const command$1 = require_define.defineCommand({
|
|
7
|
-
name: "start",
|
|
8
|
-
description: "Start the Agent server",
|
|
9
|
-
options: {
|
|
10
|
-
config: {
|
|
11
|
-
type: "string",
|
|
12
|
-
description: "Path to the Kubb config",
|
|
13
|
-
short: "c"
|
|
14
|
-
},
|
|
15
|
-
port: {
|
|
16
|
-
type: "string",
|
|
17
|
-
description: `Port for the server (default: ${require_constants.agentDefaults.port})`,
|
|
18
|
-
short: "p"
|
|
19
|
-
},
|
|
20
|
-
host: {
|
|
21
|
-
type: "string",
|
|
22
|
-
description: "Host for the server",
|
|
23
|
-
default: require_constants.agentDefaults.host
|
|
24
|
-
},
|
|
25
|
-
"allow-write": {
|
|
26
|
-
type: "boolean",
|
|
27
|
-
description: "Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.",
|
|
28
|
-
default: false
|
|
29
|
-
},
|
|
30
|
-
"allow-all": {
|
|
31
|
-
type: "boolean",
|
|
32
|
-
description: "Grant all permissions (implies --allow-write).",
|
|
33
|
-
default: false
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
async run({ values }) {
|
|
37
|
-
const { runAgentStart } = await Promise.resolve().then(() => require("./agent-B4cAAab2.cjs"));
|
|
38
|
-
await runAgentStart({
|
|
39
|
-
port: values.port !== void 0 ? values.port : void 0,
|
|
40
|
-
host: values.host,
|
|
41
|
-
configPath: values.config,
|
|
42
|
-
allowWrite: values["allow-write"],
|
|
43
|
-
allowAll: values["allow-all"],
|
|
44
|
-
version: require_package.version
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/commands/agent.ts
|
|
50
|
-
const command = require_define.defineCommand({
|
|
51
|
-
name: "agent",
|
|
52
|
-
description: "Manage the Kubb Agent server",
|
|
53
|
-
subCommands: [command$1]
|
|
54
|
-
});
|
|
55
|
-
//#endregion
|
|
56
|
-
exports.command = command;
|
|
57
|
-
|
|
58
|
-
//# sourceMappingURL=agent-BFACosbG.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-BFACosbG.cjs","names":["command","defineCommand","agentDefaults","defineCommand","startCommand"],"sources":["../src/commands/agent/start.ts","../src/commands/agent.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../../package.json'\nimport { agentDefaults } from '../../constants.ts'\n\nexport const command = defineCommand({\n name: 'start',\n description: 'Start the Agent server',\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n port: {\n type: 'string',\n description: `Port for the server (default: ${agentDefaults.port})`,\n short: 'p',\n },\n host: {\n type: 'string',\n description: 'Host for the server',\n default: agentDefaults.host,\n },\n 'allow-write': {\n type: 'boolean',\n description: 'Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.',\n default: false,\n },\n 'allow-all': {\n type: 'boolean',\n description: 'Grant all permissions (implies --allow-write).',\n default: false,\n },\n },\n async run({ values }) {\n const { runAgentStart } = await import('../../runners/agent.ts')\n\n await runAgentStart({\n port: values.port !== undefined ? values.port : undefined,\n host: values.host,\n configPath: values.config,\n allowWrite: values['allow-write'],\n allowAll: values['allow-all'],\n version,\n })\n },\n})\n","import { defineCommand } from '@internals/utils'\nimport { command as startCommand } from './agent/start.ts'\n\nexport const command = defineCommand({\n name: 'agent',\n description: 'Manage the Kubb Agent server',\n subCommands: [startCommand],\n})\n"],"mappings":";;;;;AAIA,MAAaA,YAAUC,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa,iCAAiCC,kBAAAA,cAAc,KAAK;GACjE,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACb,SAASA,kBAAAA,cAAc;GACxB;EACD,eAAe;GACb,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACD,aAAa;GACX,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACF;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,kBAAkB,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,uBAAA,CAAA;AAEhC,QAAM,cAAc;GAClB,MAAM,OAAO,SAAS,KAAA,IAAY,OAAO,OAAO,KAAA;GAChD,MAAM,OAAO;GACb,YAAY,OAAO;GACnB,YAAY,OAAO;GACnB,UAAU,OAAO;GACjB,SAAA,gBAAA;GACD,CAAC;;CAEL,CAAC;;;AC3CF,MAAa,UAAUC,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,aAAa,CAACC,UAAa;CAC5B,CAAC"}
|
package/dist/agent-s7TqqoTg.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import "./chunk--u3MIqq1.js";
|
|
2
|
-
import { n as defineCommand } from "./define-Ctii4bel.js";
|
|
3
|
-
import { t as version } from "./package-DtuyzAVW.js";
|
|
4
|
-
import { s as agentDefaults } from "./constants-aL3CP_Wq.js";
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/commands/agent.ts
|
|
7
|
-
const command = defineCommand({
|
|
8
|
-
name: "agent",
|
|
9
|
-
description: "Manage the Kubb Agent server",
|
|
10
|
-
subCommands: [defineCommand({
|
|
11
|
-
name: "start",
|
|
12
|
-
description: "Start the Agent server",
|
|
13
|
-
options: {
|
|
14
|
-
config: {
|
|
15
|
-
type: "string",
|
|
16
|
-
description: "Path to the Kubb config",
|
|
17
|
-
short: "c"
|
|
18
|
-
},
|
|
19
|
-
port: {
|
|
20
|
-
type: "string",
|
|
21
|
-
description: `Port for the server (default: ${agentDefaults.port})`,
|
|
22
|
-
short: "p"
|
|
23
|
-
},
|
|
24
|
-
host: {
|
|
25
|
-
type: "string",
|
|
26
|
-
description: "Host for the server",
|
|
27
|
-
default: agentDefaults.host
|
|
28
|
-
},
|
|
29
|
-
"allow-write": {
|
|
30
|
-
type: "boolean",
|
|
31
|
-
description: "Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.",
|
|
32
|
-
default: false
|
|
33
|
-
},
|
|
34
|
-
"allow-all": {
|
|
35
|
-
type: "boolean",
|
|
36
|
-
description: "Grant all permissions (implies --allow-write).",
|
|
37
|
-
default: false
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
async run({ values }) {
|
|
41
|
-
const { runAgentStart } = await import("./agent-sdYBBgrd.js");
|
|
42
|
-
await runAgentStart({
|
|
43
|
-
port: values.port !== void 0 ? values.port : void 0,
|
|
44
|
-
host: values.host,
|
|
45
|
-
configPath: values.config,
|
|
46
|
-
allowWrite: values["allow-write"],
|
|
47
|
-
allowAll: values["allow-all"],
|
|
48
|
-
version
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
})]
|
|
52
|
-
});
|
|
53
|
-
//#endregion
|
|
54
|
-
export { command };
|
|
55
|
-
|
|
56
|
-
//# sourceMappingURL=agent-s7TqqoTg.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-s7TqqoTg.js","names":["command","startCommand"],"sources":["../src/commands/agent/start.ts","../src/commands/agent.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../../package.json'\nimport { agentDefaults } from '../../constants.ts'\n\nexport const command = defineCommand({\n name: 'start',\n description: 'Start the Agent server',\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n port: {\n type: 'string',\n description: `Port for the server (default: ${agentDefaults.port})`,\n short: 'p',\n },\n host: {\n type: 'string',\n description: 'Host for the server',\n default: agentDefaults.host,\n },\n 'allow-write': {\n type: 'boolean',\n description: 'Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.',\n default: false,\n },\n 'allow-all': {\n type: 'boolean',\n description: 'Grant all permissions (implies --allow-write).',\n default: false,\n },\n },\n async run({ values }) {\n const { runAgentStart } = await import('../../runners/agent.ts')\n\n await runAgentStart({\n port: values.port !== undefined ? values.port : undefined,\n host: values.host,\n configPath: values.config,\n allowWrite: values['allow-write'],\n allowAll: values['allow-all'],\n version,\n })\n },\n})\n","import { defineCommand } from '@internals/utils'\nimport { command as startCommand } from './agent/start.ts'\n\nexport const command = defineCommand({\n name: 'agent',\n description: 'Manage the Kubb Agent server',\n subCommands: [startCommand],\n})\n"],"mappings":";;;;;;ACGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,aAAa,CDFQ,cAAc;EACnC,MAAM;EACN,aAAa;EACb,SAAS;GACP,QAAQ;IACN,MAAM;IACN,aAAa;IACb,OAAO;IACR;GACD,MAAM;IACJ,MAAM;IACN,aAAa,iCAAiC,cAAc,KAAK;IACjE,OAAO;IACR;GACD,MAAM;IACJ,MAAM;IACN,aAAa;IACb,SAAS,cAAc;IACxB;GACD,eAAe;IACb,MAAM;IACN,aAAa;IACb,SAAS;IACV;GACD,aAAa;IACX,MAAM;IACN,aAAa;IACb,SAAS;IACV;GACF;EACD,MAAM,IAAI,EAAE,UAAU;GACpB,MAAM,EAAE,kBAAkB,MAAM,OAAO;AAEvC,SAAM,cAAc;IAClB,MAAM,OAAO,SAAS,KAAA,IAAY,OAAO,OAAO,KAAA;IAChD,MAAM,OAAO;IACb,YAAY,OAAO;IACnB,YAAY,OAAO;IACnB,UAAU,OAAO;IACjB;IACD,CAAC;;EAEL,CCxCeC,CAAa;CAC5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-sdYBBgrd.js","names":["process"],"sources":["../src/runners/agent.ts"],"sourcesContent":["import net from 'node:net'\nimport path from 'node:path'\nimport * as process from 'node:process'\nimport { fileURLToPath } from 'node:url'\nimport { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport { spawnAsync } from '@internals/utils'\nimport { agentDefaults } from '../constants.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype AgentStartOptions = {\n port: string | undefined\n host: string\n configPath: string | undefined\n allowWrite: boolean\n allowAll: boolean\n version: string\n}\n\ntype ResolvedAgentStartEnvironment = {\n port: string\n host: string\n allowWrite: boolean\n allowAll: boolean\n agentConfigPath: string\n env: NodeJS.ProcessEnv\n}\n\n/**\n * Resolves the environment passed to the detached agent process using CLI values first, then environment values, then CLI defaults.\n */\nfunction resolveAgentStartEnvironment({ port, host, configPath, allowWrite, allowAll }: Omit<AgentStartOptions, 'version'>): ResolvedAgentStartEnvironment {\n const resolvedPort = port ?? process.env.PORT ?? agentDefaults.port\n const resolvedHost = host !== agentDefaults.host ? host : (process.env.HOST ?? agentDefaults.host)\n const resolvedAllowAll = allowAll || process.env.KUBB_AGENT_ALLOW_ALL === 'true'\n const resolvedAllowWrite = resolvedAllowAll || allowWrite || process.env.KUBB_AGENT_ALLOW_WRITE === 'true'\n const agentRoot = process.env.KUBB_AGENT_ROOT ?? process.cwd()\n const agentConfigPath = path.resolve(process.cwd(), configPath || process.env.KUBB_AGENT_CONFIG || agentDefaults.configFile)\n\n return {\n port: resolvedPort,\n host: resolvedHost,\n allowWrite: resolvedAllowWrite,\n allowAll: resolvedAllowAll,\n agentConfigPath,\n env: {\n ...process.env,\n PORT: resolvedPort,\n HOST: resolvedHost,\n KUBB_AGENT_ROOT: agentRoot,\n KUBB_AGENT_CONFIG: agentConfigPath,\n KUBB_AGENT_ALLOW_WRITE: String(resolvedAllowWrite),\n KUBB_AGENT_ALLOW_ALL: String(resolvedAllowAll),\n KUBB_AGENT_TOKEN: process.env.KUBB_AGENT_TOKEN,\n KUBB_AGENT_RETRY_TIMEOUT: process.env.KUBB_AGENT_RETRY_TIMEOUT ?? agentDefaults.retryTimeout,\n KUBB_STUDIO_URL: process.env.KUBB_STUDIO_URL ?? agentDefaults.studioUrl,\n },\n }\n}\n\nfunction isPortAvailable(port: number, host: string): Promise<boolean> {\n return new Promise((resolve) => {\n const server = net.createServer()\n server.once('error', () => resolve(false))\n server.once('listening', () => {\n server.close()\n resolve(true)\n })\n server.listen(port, host)\n })\n}\n\nexport async function runAgentStart({ port, host, configPath, allowWrite, allowAll, version }: AgentStartOptions): Promise<void> {\n const hrStart = process.hrtime()\n\n try {\n // Load .env file into process.env using Node.js built-in (v20.12.0+)\n try {\n process.loadEnvFile()\n } catch {\n // .env file may not exist; ignore\n }\n\n // Resolve the @kubb/agent package path\n let agentPkgUrl: string\n try {\n agentPkgUrl = import.meta.resolve('@kubb/agent/package.json')\n } catch (_e) {\n console.error(styleText('red', 'The @kubb/agent package is not installed.'))\n console.error('')\n console.error('Install it with:')\n console.error(styleText('cyan', ' npm install @kubb/agent'))\n console.error(styleText('cyan', ' # or'))\n console.error(styleText('cyan', ' pnpm install @kubb/agent'))\n console.error('')\n process.exit(1)\n }\n const agentPkgPath = fileURLToPath(agentPkgUrl)\n const agentDir = path.dirname(agentPkgPath)\n const serverPath = path.join(agentDir, agentDefaults.serverEntryPath)\n\n const resolvedEnv = resolveAgentStartEnvironment({\n port,\n host,\n configPath,\n allowWrite,\n allowAll,\n })\n const numericPort = Number(resolvedEnv.port)\n\n if (!Number.isInteger(numericPort) || numericPort <= 0) {\n throw new Error(`Invalid port \"${resolvedEnv.port}\". Provide a positive integer with --port or PORT.`)\n }\n\n clack.log.step(styleText('cyan', 'Starting agent server...'))\n clack.log.info(styleText('dim', `Config: ${resolvedEnv.agentConfigPath}`))\n clack.log.info(styleText('dim', `Host: ${resolvedEnv.host}`))\n clack.log.info(styleText('dim', `Port: ${resolvedEnv.port}`))\n if (!resolvedEnv.allowWrite && !resolvedEnv.allowAll) {\n clack.log.warn(styleText('yellow', 'Filesystem writes disabled. Use --allow-write or --allow-all to enable.'))\n }\n\n if (!(await isPortAvailable(numericPort, resolvedEnv.host))) {\n clack.log.error(styleText('red', `Port ${resolvedEnv.port} is already in use. Stop the existing process or choose a different port with --port.`))\n process.exit(1)\n }\n\n // Spawns the server as a detached background process so the CLI can exit independently.\n await spawnAsync('node', [serverPath], {\n env: resolvedEnv.env,\n cwd: process.cwd(),\n })\n\n await sendTelemetry(\n buildTelemetryEvent({\n command: 'agent',\n kubbVersion: version,\n hrStart,\n status: 'success',\n }),\n )\n } catch (error) {\n await sendTelemetry(\n buildTelemetryEvent({\n command: 'agent',\n kubbVersion: version,\n hrStart,\n status: 'failed',\n }),\n )\n clack.log.error(styleText('red', 'Failed to start agent server'))\n console.error(error)\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,SAAS,6BAA6B,EAAE,MAAM,MAAM,YAAY,YAAY,YAA+E;CACzJ,MAAM,eAAe,QAAQA,UAAQ,IAAI,QAAQ,cAAc;CAC/D,MAAM,eAAe,SAAS,cAAc,OAAO,OAAQA,UAAQ,IAAI,QAAQ,cAAc;CAC7F,MAAM,mBAAmB,YAAYA,UAAQ,IAAI,yBAAyB;CAC1E,MAAM,qBAAqB,oBAAoB,cAAcA,UAAQ,IAAI,2BAA2B;CACpG,MAAM,YAAYA,UAAQ,IAAI,mBAAmBA,UAAQ,KAAK;CAC9D,MAAM,kBAAkB,KAAK,QAAQA,UAAQ,KAAK,EAAE,cAAcA,UAAQ,IAAI,qBAAqB,cAAc,WAAW;AAE5H,QAAO;EACL,MAAM;EACN,MAAM;EACN,YAAY;EACZ,UAAU;EACV;EACA,KAAK;GACH,GAAGA,UAAQ;GACX,MAAM;GACN,MAAM;GACN,iBAAiB;GACjB,mBAAmB;GACnB,wBAAwB,OAAO,mBAAmB;GAClD,sBAAsB,OAAO,iBAAiB;GAC9C,kBAAkBA,UAAQ,IAAI;GAC9B,0BAA0BA,UAAQ,IAAI,4BAA4B,cAAc;GAChF,iBAAiBA,UAAQ,IAAI,mBAAmB,cAAc;GAC/D;EACF;;AAGH,SAAS,gBAAgB,MAAc,MAAgC;AACrE,QAAO,IAAI,SAAS,YAAY;EAC9B,MAAM,SAAS,IAAI,cAAc;AACjC,SAAO,KAAK,eAAe,QAAQ,MAAM,CAAC;AAC1C,SAAO,KAAK,mBAAmB;AAC7B,UAAO,OAAO;AACd,WAAQ,KAAK;IACb;AACF,SAAO,OAAO,MAAM,KAAK;GACzB;;AAGJ,eAAsB,cAAc,EAAE,MAAM,MAAM,YAAY,YAAY,UAAU,WAA6C;CAC/H,MAAM,UAAUA,UAAQ,QAAQ;AAEhC,KAAI;AAEF,MAAI;AACF,aAAQ,aAAa;UACf;EAKR,IAAI;AACJ,MAAI;AACF,iBAAc,OAAO,KAAK,QAAQ,2BAA2B;WACtD,IAAI;AACX,WAAQ,MAAM,UAAU,OAAO,4CAA4C,CAAC;AAC5E,WAAQ,MAAM,GAAG;AACjB,WAAQ,MAAM,mBAAmB;AACjC,WAAQ,MAAM,UAAU,QAAQ,4BAA4B,CAAC;AAC7D,WAAQ,MAAM,UAAU,QAAQ,SAAS,CAAC;AAC1C,WAAQ,MAAM,UAAU,QAAQ,6BAA6B,CAAC;AAC9D,WAAQ,MAAM,GAAG;AACjB,aAAQ,KAAK,EAAE;;EAEjB,MAAM,eAAe,cAAc,YAAY;EAC/C,MAAM,WAAW,KAAK,QAAQ,aAAa;EAC3C,MAAM,aAAa,KAAK,KAAK,UAAU,cAAc,gBAAgB;EAErE,MAAM,cAAc,6BAA6B;GAC/C;GACA;GACA;GACA;GACA;GACD,CAAC;EACF,MAAM,cAAc,OAAO,YAAY,KAAK;AAE5C,MAAI,CAAC,OAAO,UAAU,YAAY,IAAI,eAAe,EACnD,OAAM,IAAI,MAAM,iBAAiB,YAAY,KAAK,oDAAoD;AAGxG,QAAM,IAAI,KAAK,UAAU,QAAQ,2BAA2B,CAAC;AAC7D,QAAM,IAAI,KAAK,UAAU,OAAO,WAAW,YAAY,kBAAkB,CAAC;AAC1E,QAAM,IAAI,KAAK,UAAU,OAAO,SAAS,YAAY,OAAO,CAAC;AAC7D,QAAM,IAAI,KAAK,UAAU,OAAO,SAAS,YAAY,OAAO,CAAC;AAC7D,MAAI,CAAC,YAAY,cAAc,CAAC,YAAY,SAC1C,OAAM,IAAI,KAAK,UAAU,UAAU,0EAA0E,CAAC;AAGhH,MAAI,CAAE,MAAM,gBAAgB,aAAa,YAAY,KAAK,EAAG;AAC3D,SAAM,IAAI,MAAM,UAAU,OAAO,QAAQ,YAAY,KAAK,uFAAuF,CAAC;AAClJ,aAAQ,KAAK,EAAE;;AAIjB,QAAM,WAAW,QAAQ,CAAC,WAAW,EAAE;GACrC,KAAK,YAAY;GACjB,KAAKA,UAAQ,KAAK;GACnB,CAAC;AAEF,QAAM,cACJ,oBAAoB;GAClB,SAAS;GACT,aAAa;GACb;GACA,QAAQ;GACT,CAAC,CACH;UACM,OAAO;AACd,QAAM,cACJ,oBAAoB;GAClB,SAAS;GACT,aAAa;GACb;GACA,QAAQ;GACT,CAAC,CACH;AACD,QAAM,IAAI,MAAM,UAAU,OAAO,+BAA+B,CAAC;AACjE,UAAQ,MAAM,MAAM;AACpB,YAAQ,KAAK,EAAE"}
|