@kubb/cli 5.0.0-beta.4 → 5.0.0-beta.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +209 -51
- package/dist/agent-D3K_-kiv.js +68 -0
- package/dist/agent-D3K_-kiv.js.map +1 -0
- package/dist/agent-DTqKBULa.cjs +70 -0
- package/dist/agent-DTqKBULa.cjs.map +1 -0
- package/dist/{chunk--u3MIqq1.js → chunk-CRm0XQPb.js} +1 -0
- package/dist/constants-84a47qA-.js +35 -0
- package/dist/constants-84a47qA-.js.map +1 -0
- package/dist/constants-AHhyFH15.cjs +139 -0
- package/dist/constants-AHhyFH15.cjs.map +1 -0
- package/dist/constants-BtmponZ3.cjs +58 -0
- package/dist/constants-BtmponZ3.cjs.map +1 -0
- package/dist/constants-C94RKp3A.js +116 -0
- package/dist/constants-C94RKp3A.js.map +1 -0
- package/dist/{define-Bdn8j5VM.cjs → define-C4AB3POr.cjs} +2 -2
- package/dist/{define-Bdn8j5VM.cjs.map → define-C4AB3POr.cjs.map} +1 -1
- package/dist/{define-Ctii4bel.js → define-DNG1U8ha.js} +2 -2
- package/dist/{define-Ctii4bel.js.map → define-DNG1U8ha.js.map} +1 -1
- package/dist/{errors-CjPmyZHy.js → errors-CoxrNXaA.js} +2 -2
- package/dist/{errors-CjPmyZHy.js.map → errors-CoxrNXaA.js.map} +1 -1
- package/dist/{errors-CLCjoSg0.cjs → errors-DykI11xo.cjs} +2 -2
- package/dist/{errors-CLCjoSg0.cjs.map → errors-DykI11xo.cjs.map} +1 -1
- package/dist/generate-CZYIOngX.cjs +76 -0
- package/dist/generate-CZYIOngX.cjs.map +1 -0
- package/dist/generate-HcvbU80u.js +77 -0
- package/dist/generate-HcvbU80u.js.map +1 -0
- package/dist/index.cjs +23 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -14
- package/dist/index.js.map +1 -1
- package/dist/init-BMtuczv8.js +53 -0
- package/dist/init-BMtuczv8.js.map +1 -0
- package/dist/init-DybfkgNy.cjs +53 -0
- package/dist/init-DybfkgNy.cjs.map +1 -0
- package/dist/mcp-BF9dnH_F.js +39 -0
- package/dist/mcp-BF9dnH_F.js.map +1 -0
- package/dist/mcp-YzKoU6_l.cjs +39 -0
- package/dist/mcp-YzKoU6_l.cjs.map +1 -0
- package/dist/package-BCwMApnr.js +6 -0
- package/dist/package-BCwMApnr.js.map +1 -0
- package/dist/{package-BapVyQ-w.cjs → package-DPe5CA4S.cjs} +2 -2
- package/dist/package-DPe5CA4S.cjs.map +1 -0
- package/dist/{agent-sdYBBgrd.js → run-BQ3Qj0xB.js} +46 -43
- package/dist/run-BQ3Qj0xB.js.map +1 -0
- package/dist/run-BQzoaxjR.js +32 -0
- package/dist/run-BQzoaxjR.js.map +1 -0
- package/dist/run-CGf0KEts.js +51 -0
- package/dist/run-CGf0KEts.js.map +1 -0
- package/dist/{init-CZ5Xq2Hd.cjs → run-C_NMctua.cjs} +107 -149
- package/dist/run-C_NMctua.cjs.map +1 -0
- package/dist/run-CkTpemme.cjs +52 -0
- package/dist/run-CkTpemme.cjs.map +1 -0
- package/dist/run-Cl4SrSob.cjs +33 -0
- package/dist/run-Cl4SrSob.cjs.map +1 -0
- package/dist/{agent-B4cAAab2.cjs → run-D-s2LdlW.cjs} +46 -43
- package/dist/run-D-s2LdlW.cjs.map +1 -0
- package/dist/{init-eNRlotJK.js → run-D8dCWepS.js} +107 -149
- package/dist/run-D8dCWepS.js.map +1 -0
- package/dist/run-DaV_NiKR.js +1509 -0
- package/dist/run-DaV_NiKR.js.map +1 -0
- package/dist/run-UWQ9wImP.cjs +1512 -0
- package/dist/run-UWQ9wImP.cjs.map +1 -0
- package/dist/{shell-DLzN4fRo.js → shell-BrqyJdB7.js} +2 -2
- package/dist/{shell-DLzN4fRo.js.map → shell-BrqyJdB7.js.map} +1 -1
- package/dist/{shell-475fQKaX.cjs → shell-Lh-vLWwH.cjs} +2 -2
- package/dist/{shell-475fQKaX.cjs.map → shell-Lh-vLWwH.cjs.map} +1 -1
- package/dist/validate-BHc3lUKB.js +26 -0
- package/dist/validate-BHc3lUKB.js.map +1 -0
- package/dist/validate-CqRqJxmQ.cjs +26 -0
- package/dist/validate-CqRqJxmQ.cjs.map +1 -0
- package/package.json +16 -15
- package/src/commands/agent/start.ts +10 -7
- package/src/commands/agent.ts +3 -1
- package/src/commands/generate.ts +21 -13
- 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 +3 -74
- package/src/index.ts +6 -4
- package/src/loggers/clackLogger.ts +137 -178
- package/src/loggers/plainLogger.ts +49 -102
- package/src/loggers/types.ts +6 -1
- package/src/loggers/utils.ts +141 -26
- package/src/runners/agent/run.ts +113 -0
- package/src/runners/agent/utils.ts +98 -0
- package/src/runners/generate/run.ts +404 -0
- package/src/runners/generate/utils.ts +219 -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/dist/agent-B4cAAab2.cjs.map +0 -1
- package/dist/agent-CR6Z96og.js +0 -56
- package/dist/agent-CR6Z96og.js.map +0 -1
- package/dist/agent-Dmxzqg4d.cjs +0 -58
- package/dist/agent-Dmxzqg4d.cjs.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-B1Pa2ho-.cjs +0 -1756
- package/dist/generate-B1Pa2ho-.cjs.map +0 -1
- package/dist/generate-BDGOOsBM.cjs +0 -65
- package/dist/generate-BDGOOsBM.cjs.map +0 -1
- package/dist/generate-CNrRLY4n.js +0 -1753
- package/dist/generate-CNrRLY4n.js.map +0 -1
- package/dist/generate-DuhxPLGr.js +0 -66
- package/dist/generate-DuhxPLGr.js.map +0 -1
- package/dist/init-CZ5Xq2Hd.cjs.map +0 -1
- package/dist/init-CnZXHrbq.js +0 -25
- package/dist/init-CnZXHrbq.js.map +0 -1
- package/dist/init-NYJSZJSb.cjs +0 -25
- package/dist/init-NYJSZJSb.cjs.map +0 -1
- package/dist/init-eNRlotJK.js.map +0 -1
- package/dist/mcp-CYOgxB82.cjs +0 -47
- package/dist/mcp-CYOgxB82.cjs.map +0 -1
- package/dist/mcp-CdFWyrwi.cjs +0 -16
- package/dist/mcp-CdFWyrwi.cjs.map +0 -1
- package/dist/mcp-DhSxuDMD.js +0 -16
- package/dist/mcp-DhSxuDMD.js.map +0 -1
- package/dist/mcp-DmJm3TrU.js +0 -46
- package/dist/mcp-DmJm3TrU.js.map +0 -1
- package/dist/package-BapVyQ-w.cjs.map +0 -1
- package/dist/package-DyJE-qNq.js +0 -6
- package/dist/package-DyJE-qNq.js.map +0 -1
- package/dist/telemetry-DN95_2pF.cjs +0 -282
- package/dist/telemetry-DN95_2pF.cjs.map +0 -1
- package/dist/telemetry-LgT_sdPe.js +0 -245
- package/dist/telemetry-LgT_sdPe.js.map +0 -1
- package/dist/validate-C6npXzel.cjs +0 -25
- package/dist/validate-C6npXzel.cjs.map +0 -1
- package/dist/validate-kLJoT_hi.js +0 -33
- package/dist/validate-kLJoT_hi.js.map +0 -1
- package/dist/validate-n38Rh-Y7.js +0 -25
- package/dist/validate-n38Rh-Y7.js.map +0 -1
- package/dist/validate-yKKzqEZ5.cjs +0 -34
- package/dist/validate-yKKzqEZ5.cjs.map +0 -1
- package/src/loggers/fileSystemLogger.ts +0 -138
- package/src/loggers/githubActionsLogger.ts +0 -379
- 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/telemetry.ts +0 -273
- package/src/utils/watcher.ts +0 -19
- /package/dist/{chunk-ByKO4r7w.cjs → chunk-Bx3C2hgW.cjs} +0 -0
package/src/commands/mcp.ts
CHANGED
|
@@ -3,10 +3,34 @@ import { version } from '../../package.json'
|
|
|
3
3
|
|
|
4
4
|
export const command = defineCommand({
|
|
5
5
|
name: 'mcp',
|
|
6
|
-
description:
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
description:
|
|
7
|
+
'Start a Model Context Protocol (MCP) server that exposes Kubb code generation as tools for AI assistants. Once running, configure your AI client (Claude, Cursor, Windsurf, etc.) to connect to it — the assistant can then call kubb generate directly without leaving the chat.',
|
|
8
|
+
examples: [
|
|
9
|
+
'kubb mcp',
|
|
10
|
+
'kubb mcp --port 3001',
|
|
11
|
+
'# Then add to your MCP client config:',
|
|
12
|
+
'# { "mcpServers": { "kubb": { "command": "npx", "args": ["kubb", "mcp"] } } }',
|
|
13
|
+
],
|
|
14
|
+
options: {
|
|
15
|
+
port: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
short: 'p',
|
|
18
|
+
description: 'Port for HTTP MCP server (omit for stdio)',
|
|
19
|
+
hint: 'number',
|
|
20
|
+
},
|
|
21
|
+
host: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
description: 'Hostname to bind to (HTTP mode only)',
|
|
24
|
+
default: 'localhost',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
async run({ values }) {
|
|
28
|
+
const { run } = await import('../runners/mcp/run.ts')
|
|
9
29
|
|
|
10
|
-
await
|
|
30
|
+
await run({
|
|
31
|
+
version,
|
|
32
|
+
port: values.port,
|
|
33
|
+
host: values.host,
|
|
34
|
+
})
|
|
11
35
|
},
|
|
12
36
|
})
|
package/src/commands/validate.ts
CHANGED
|
@@ -3,18 +3,20 @@ import { version } from '../../package.json'
|
|
|
3
3
|
|
|
4
4
|
export const command = defineCommand({
|
|
5
5
|
name: 'validate',
|
|
6
|
-
description:
|
|
6
|
+
description:
|
|
7
|
+
'Parse and validate an OpenAPI/Swagger file for structural correctness. Reports schema errors, missing required fields, and malformed references. Use this before running generate to catch spec issues early.',
|
|
8
|
+
examples: ['kubb validate --input ./openapi.yaml', 'kubb validate --input https://petstore3.swagger.io/api/v3/openapi.json'],
|
|
7
9
|
options: {
|
|
8
10
|
input: {
|
|
9
11
|
type: 'string',
|
|
10
|
-
description: 'Path to Swagger
|
|
12
|
+
description: 'Path or URL to the OpenAPI/Swagger file to validate',
|
|
11
13
|
short: 'i',
|
|
12
14
|
required: true,
|
|
13
15
|
},
|
|
14
16
|
},
|
|
15
17
|
async run({ values }) {
|
|
16
|
-
const {
|
|
18
|
+
const { run } = await import('../runners/validate/run.ts')
|
|
17
19
|
|
|
18
|
-
await
|
|
20
|
+
await run({ input: values.input, version })
|
|
19
21
|
},
|
|
20
22
|
})
|
package/src/constants.ts
CHANGED
|
@@ -1,42 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
* Default filename for the Kubb configuration file.
|
|
3
|
-
*
|
|
4
|
-
* Used by the `init` command when scaffolding new projects and by the `agent` default config.
|
|
5
|
-
*/
|
|
6
|
-
export const KUBB_CONFIG_FILENAME = 'kubb.config.ts' as const
|
|
1
|
+
import { KUBB_CONFIG_FILENAME } from '@internals/shared'
|
|
7
2
|
|
|
8
3
|
/**
|
|
9
4
|
* NPM registry endpoint used to check for @kubb/cli updates.
|
|
10
5
|
*/
|
|
11
6
|
export const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const
|
|
12
7
|
|
|
13
|
-
/**
|
|
14
|
-
* OpenTelemetry ingestion endpoint for anonymous usage telemetry.
|
|
15
|
-
*/
|
|
16
|
-
export const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const
|
|
17
|
-
|
|
18
8
|
/**
|
|
19
9
|
* Horizontal rule rendered above/below the plain-logger generation summary.
|
|
20
10
|
*/
|
|
21
11
|
export const SUMMARY_SEPARATOR = '─'.repeat(27)
|
|
22
12
|
|
|
23
|
-
/**
|
|
24
|
-
* Maximum number of █ characters in a plugin timing bar.
|
|
25
|
-
*/
|
|
26
|
-
export const SUMMARY_MAX_BAR_LENGTH = 10 as const
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Divides elapsed milliseconds into bar-length units (1 block per 100 ms).
|
|
30
|
-
*/
|
|
31
|
-
export const SUMMARY_TIME_SCALE_DIVISOR = 100 as const
|
|
32
|
-
|
|
33
13
|
/**
|
|
34
14
|
* Glob pattern for paths the file watcher ignores.
|
|
35
15
|
*/
|
|
36
16
|
export const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const
|
|
37
17
|
|
|
38
18
|
/**
|
|
39
|
-
* Flags that short-circuit execution (help/version)
|
|
19
|
+
* Flags that short-circuit execution (help/version), no telemetry notice is shown.
|
|
40
20
|
*/
|
|
41
21
|
export const QUIET_FLAGS = new Set(['--help', '-h', '--version', '-v'] as const)
|
|
42
22
|
|
|
@@ -45,60 +25,9 @@ export const agentDefaults = {
|
|
|
45
25
|
host: 'localhost',
|
|
46
26
|
configFile: KUBB_CONFIG_FILENAME,
|
|
47
27
|
retryTimeout: '30000',
|
|
48
|
-
studioUrl: 'https://
|
|
28
|
+
studioUrl: 'https://kubb.studio',
|
|
49
29
|
/**
|
|
50
30
|
* Relative path from the @kubb/agent package root to the server entry.
|
|
51
31
|
*/
|
|
52
32
|
serverEntryPath: '.output/server/index.mjs',
|
|
53
33
|
} as const
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Default values used during interactive `init` scaffolding.
|
|
57
|
-
*/
|
|
58
|
-
export const initDefaults = {
|
|
59
|
-
inputPath: './openapi.yaml',
|
|
60
|
-
outputPath: './src/gen',
|
|
61
|
-
plugins: ['plugin-ts'],
|
|
62
|
-
} as const
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Maps each plugin value to the default config snippet inserted by `init`.
|
|
66
|
-
* The `satisfies` constraint ensures all values remain plain strings while
|
|
67
|
-
* `as const` keeps the object deeply immutable.
|
|
68
|
-
*/
|
|
69
|
-
export const pluginDefaultConfigs = {
|
|
70
|
-
'plugin-ts': `pluginTs({
|
|
71
|
-
output: { path: 'models' },
|
|
72
|
-
})`,
|
|
73
|
-
'plugin-client': `pluginClient({
|
|
74
|
-
output: { path: 'clients' },
|
|
75
|
-
})`,
|
|
76
|
-
'plugin-react-query': `pluginReactQuery({
|
|
77
|
-
output: { path: 'hooks' },
|
|
78
|
-
})`,
|
|
79
|
-
'plugin-vue-query': `pluginVueQuery({
|
|
80
|
-
output: { path: 'hooks' },
|
|
81
|
-
})`,
|
|
82
|
-
'plugin-zod': `pluginZod({
|
|
83
|
-
output: { path: 'zod' },
|
|
84
|
-
})`,
|
|
85
|
-
'plugin-faker': `pluginFaker({
|
|
86
|
-
output: { path: 'mocks' },
|
|
87
|
-
})`,
|
|
88
|
-
'plugin-msw': `pluginMsw({
|
|
89
|
-
output: { path: 'msw' },
|
|
90
|
-
})`,
|
|
91
|
-
'plugin-cypress': `pluginCypress({
|
|
92
|
-
output: { path: 'cypress' },
|
|
93
|
-
})`,
|
|
94
|
-
'plugin-mcp': `pluginMcp({
|
|
95
|
-
output: { path: 'mcp' },
|
|
96
|
-
})`,
|
|
97
|
-
'plugin-redoc': `pluginRedoc({
|
|
98
|
-
output: { path: 'redoc' },
|
|
99
|
-
})`,
|
|
100
|
-
} as const satisfies Record<string, string>
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Color palette used by randomCliColor() for deterministic plugin name coloring.
|
|
104
|
-
*/
|
package/src/index.ts
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { styleText } from 'node:util'
|
|
2
|
-
import { createCLI } from '@internals/utils'
|
|
2
|
+
import { createCLI, isFlag } from '@internals/utils'
|
|
3
|
+
import { Telemetry } from '@kubb/core'
|
|
3
4
|
import { version } from '../package.json'
|
|
4
5
|
import { QUIET_FLAGS } from './constants.ts'
|
|
5
|
-
import { isFlag } from './utils/flags.ts'
|
|
6
|
-
import { isTelemetryDisabled } from './utils/telemetry.ts'
|
|
7
6
|
|
|
8
7
|
const cli = createCLI()
|
|
9
8
|
|
|
10
9
|
function shouldShowTelemetryNotice(argv: Array<string>): boolean {
|
|
11
|
-
if (
|
|
10
|
+
if (Telemetry.isDisabled()) {
|
|
12
11
|
return false
|
|
13
12
|
}
|
|
13
|
+
|
|
14
14
|
// Skip when the user is just asking for help or version info
|
|
15
15
|
if (argv.some((arg) => isFlag(QUIET_FLAGS, arg))) {
|
|
16
16
|
return false
|
|
17
17
|
}
|
|
18
|
+
|
|
18
19
|
// Skip in non-interactive / scripting contexts
|
|
19
20
|
if (!process.stdout.isTTY) {
|
|
20
21
|
return false
|
|
21
22
|
}
|
|
23
|
+
|
|
22
24
|
return true
|
|
23
25
|
}
|
|
24
26
|
|