@kubb/cli 5.0.0-beta.7 → 5.0.0-beta.71
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/LICENSE +17 -10
- package/README.md +45 -77
- package/bin/kubb.js +9 -3
- package/dist/Telemetry-CfPP7MYq.cjs +321 -0
- package/dist/Telemetry-CfPP7MYq.cjs.map +1 -0
- package/dist/Telemetry-uAr3lK_-.js +284 -0
- package/dist/Telemetry-uAr3lK_-.js.map +1 -0
- package/dist/{define-Bdn8j5VM.cjs → defineCommand-Bo3yZTWI.cjs} +3 -21
- package/dist/defineCommand-Bo3yZTWI.cjs.map +1 -0
- package/dist/{define-m_fp-Aqm.js → defineCommand-DMEeqliP.js} +4 -16
- package/dist/defineCommand-DMEeqliP.js.map +1 -0
- package/dist/{errors-CINO1EIv.js → errors-Dc_d7BfX.js} +2 -2
- package/dist/{errors-CINO1EIv.js.map → errors-Dc_d7BfX.js.map} +1 -1
- package/dist/{errors-CLCjoSg0.cjs → errors-gxFK0vrp.cjs} +2 -2
- package/dist/{errors-CLCjoSg0.cjs.map → errors-gxFK0vrp.cjs.map} +1 -1
- package/dist/{generate-Bod9YCbF.cjs → generate-Dj_ztXAk.cjs} +21 -16
- package/dist/generate-Dj_ztXAk.cjs.map +1 -0
- package/dist/{generate-BY-juRdH.js → generate-DqE96-AW.js} +21 -16
- package/dist/generate-DqE96-AW.js.map +1 -0
- package/dist/index.cjs +34 -81
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +34 -81
- package/dist/index.js.map +1 -1
- package/dist/{init-BIkZU6mB.cjs → init-CT0QBOJR.cjs} +6 -6
- package/dist/{init-BIkZU6mB.cjs.map → init-CT0QBOJR.cjs.map} +1 -1
- package/dist/{init-Cs3Fp6nN.js → init-Dj-yuBT4.js} +5 -5
- package/dist/{init-Cs3Fp6nN.js.map → init-Dj-yuBT4.js.map} +1 -1
- package/dist/mcp-Bx5bWdkI.cjs +21 -0
- package/dist/mcp-Bx5bWdkI.cjs.map +1 -0
- package/dist/mcp-Dgf2OtCy.js +21 -0
- package/dist/mcp-Dgf2OtCy.js.map +1 -0
- package/dist/{package-DrUndPET.cjs → package-CK8o-iEe.cjs} +2 -2
- package/dist/package-CK8o-iEe.cjs.map +1 -0
- package/dist/package-DC0ALWof.js +6 -0
- package/dist/package-DC0ALWof.js.map +1 -0
- package/dist/{chunk-BvFE5Tac.js → rolldown-runtime-C0LytTxp.js} +0 -1
- package/dist/{run-YsoCk5we.cjs → run-AYlRjIX5.cjs} +136 -98
- package/dist/run-AYlRjIX5.cjs.map +1 -0
- package/dist/run-B9R0rCqJ.cjs +1380 -0
- package/dist/run-B9R0rCqJ.cjs.map +1 -0
- package/dist/run-BM1t8CSM.cjs +33 -0
- package/dist/run-BM1t8CSM.cjs.map +1 -0
- package/dist/run-BlFVmIJl.js +32 -0
- package/dist/run-BlFVmIJl.js.map +1 -0
- package/dist/{run-CQbj3ley.cjs → run-CBc896in.cjs} +6 -6
- package/dist/run-CBc896in.cjs.map +1 -0
- package/dist/run-CxPZ9S4b.js +1377 -0
- package/dist/run-CxPZ9S4b.js.map +1 -0
- package/dist/{run-CF97BWVa.js → run-D9mQoQHA.js} +123 -85
- package/dist/run-D9mQoQHA.js.map +1 -0
- package/dist/{run-CCZ24VKk.js → run-D_dWNFhX.js} +5 -5
- package/dist/run-D_dWNFhX.js.map +1 -0
- package/dist/tools-CZT9wSA6.cjs +175 -0
- package/dist/tools-CZT9wSA6.cjs.map +1 -0
- package/dist/tools-D0UogMU3.js +152 -0
- package/dist/tools-D0UogMU3.js.map +1 -0
- package/dist/{validate-lbUkWQ5o.js → validate-CRXa_v3l.js} +5 -5
- package/dist/{validate-lbUkWQ5o.js.map → validate-CRXa_v3l.js.map} +1 -1
- package/dist/{validate-Bfpf_UIh.cjs → validate-CVqbA1lL.cjs} +6 -6
- package/dist/{validate-Bfpf_UIh.cjs.map → validate-CVqbA1lL.cjs.map} +1 -1
- package/package.json +13 -25
- package/dist/agent-DN7o8nlE.js +0 -68
- package/dist/agent-DN7o8nlE.js.map +0 -1
- package/dist/agent-Fm9_8BBH.cjs +0 -70
- package/dist/agent-Fm9_8BBH.cjs.map +0 -1
- package/dist/constants-B2JTeRBb.js +0 -42
- package/dist/constants-B2JTeRBb.js.map +0 -1
- package/dist/constants-BINTA5VZ.cjs +0 -77
- package/dist/constants-BINTA5VZ.cjs.map +0 -1
- package/dist/constants-BYGmiFs0.cjs +0 -139
- package/dist/constants-BYGmiFs0.cjs.map +0 -1
- package/dist/constants-DSJ-Xrbv.js +0 -116
- package/dist/constants-DSJ-Xrbv.js.map +0 -1
- package/dist/define-Bdn8j5VM.cjs.map +0 -1
- package/dist/define-m_fp-Aqm.js.map +0 -1
- package/dist/generate-BY-juRdH.js.map +0 -1
- package/dist/generate-Bod9YCbF.cjs.map +0 -1
- package/dist/mcp-BSNulBcC.js +0 -39
- package/dist/mcp-BSNulBcC.js.map +0 -1
- package/dist/mcp-DcSrFhhP.cjs +0 -39
- package/dist/mcp-DcSrFhhP.cjs.map +0 -1
- package/dist/package-D5wmvFl4.js +0 -6
- package/dist/package-D5wmvFl4.js.map +0 -1
- package/dist/package-DrUndPET.cjs.map +0 -1
- package/dist/run-BAJubgdA.js +0 -1735
- package/dist/run-BAJubgdA.js.map +0 -1
- package/dist/run-BzpYYOQs.js +0 -121
- package/dist/run-BzpYYOQs.js.map +0 -1
- package/dist/run-CCZ24VKk.js.map +0 -1
- package/dist/run-CF97BWVa.js.map +0 -1
- package/dist/run-CQbj3ley.cjs.map +0 -1
- package/dist/run-CqKd6JNc.cjs +0 -1738
- package/dist/run-CqKd6JNc.cjs.map +0 -1
- package/dist/run-D0hmRpHy.js +0 -49
- package/dist/run-D0hmRpHy.js.map +0 -1
- package/dist/run-DwdAwnLG.cjs +0 -125
- package/dist/run-DwdAwnLG.cjs.map +0 -1
- package/dist/run-Lr0Ctnu0.cjs +0 -50
- package/dist/run-Lr0Ctnu0.cjs.map +0 -1
- package/dist/run-YsoCk5we.cjs.map +0 -1
- package/dist/shell-475fQKaX.cjs +0 -62
- package/dist/shell-475fQKaX.cjs.map +0 -1
- package/dist/shell-CN6DNqeC.js +0 -51
- package/dist/shell-CN6DNqeC.js.map +0 -1
- package/dist/telemetry-B2iWkY5e.cjs +0 -280
- package/dist/telemetry-B2iWkY5e.cjs.map +0 -1
- package/dist/telemetry-BkektVz6.js +0 -243
- package/dist/telemetry-BkektVz6.js.map +0 -1
- package/src/commands/agent/start.ts +0 -50
- package/src/commands/agent.ts +0 -10
- package/src/commands/generate.ts +0 -59
- package/src/commands/init.ts +0 -51
- package/src/commands/mcp.ts +0 -36
- package/src/commands/validate.ts +0 -22
- package/src/constants.ts +0 -48
- package/src/index.ts +0 -45
- package/src/loggers/clackLogger.ts +0 -460
- package/src/loggers/fileSystemLogger.ts +0 -148
- package/src/loggers/githubActionsLogger.ts +0 -367
- package/src/loggers/plainLogger.ts +0 -243
- package/src/loggers/types.ts +0 -7
- package/src/loggers/utils.ts +0 -252
- package/src/runners/agent/run.ts +0 -113
- package/src/runners/agent/utils.ts +0 -98
- package/src/runners/generate/run.ts +0 -276
- package/src/runners/generate/utils.ts +0 -209
- package/src/runners/init/run.ts +0 -211
- package/src/runners/init/utils.ts +0 -33
- package/src/runners/mcp/run.ts +0 -55
- package/src/runners/validate/run.ts +0 -63
- package/src/telemetry.ts +0 -280
- /package/dist/{chunk-ByKO4r7w.cjs → rolldown-runtime-Bx3C2hgW.cjs} +0 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
require("./rolldown-runtime-Bx3C2hgW.cjs");
|
|
2
|
+
let node_child_process = require("node:child_process");
|
|
3
|
+
let node_fs = require("node:fs");
|
|
4
|
+
let node_path = require("node:path");
|
|
5
|
+
//#region ../../internals/utils/src/tools.ts
|
|
6
|
+
/**
|
|
7
|
+
* CLI command descriptors for each supported code formatter.
|
|
8
|
+
*
|
|
9
|
+
* Each entry contains the executable `command`, an `args` factory that maps an
|
|
10
|
+
* output path to the correct argument list, and an `errorMessage` shown when
|
|
11
|
+
* the formatter is not found.
|
|
12
|
+
*/
|
|
13
|
+
const formatters = {
|
|
14
|
+
prettier: {
|
|
15
|
+
command: "prettier",
|
|
16
|
+
args: (outputPath) => [
|
|
17
|
+
"--ignore-unknown",
|
|
18
|
+
"--write",
|
|
19
|
+
outputPath
|
|
20
|
+
],
|
|
21
|
+
errorMessage: "Prettier not found"
|
|
22
|
+
},
|
|
23
|
+
biome: {
|
|
24
|
+
command: "biome",
|
|
25
|
+
args: (outputPath) => [
|
|
26
|
+
"format",
|
|
27
|
+
"--write",
|
|
28
|
+
outputPath
|
|
29
|
+
],
|
|
30
|
+
errorMessage: "Biome not found"
|
|
31
|
+
},
|
|
32
|
+
oxfmt: {
|
|
33
|
+
command: "oxfmt",
|
|
34
|
+
args: (outputPath) => [outputPath],
|
|
35
|
+
errorMessage: "Oxfmt not found"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* CLI command descriptors for each supported linter.
|
|
40
|
+
*
|
|
41
|
+
* Each entry contains the executable `command`, an `args` factory that maps an
|
|
42
|
+
* output path to the correct argument list, and an `errorMessage` shown when
|
|
43
|
+
* the linter is not found.
|
|
44
|
+
*/
|
|
45
|
+
const linters = {
|
|
46
|
+
eslint: {
|
|
47
|
+
command: "eslint",
|
|
48
|
+
args: (outputPath) => [outputPath, "--fix"],
|
|
49
|
+
errorMessage: "Eslint not found"
|
|
50
|
+
},
|
|
51
|
+
biome: {
|
|
52
|
+
command: "biome",
|
|
53
|
+
args: (outputPath) => [
|
|
54
|
+
"lint",
|
|
55
|
+
"--fix",
|
|
56
|
+
outputPath
|
|
57
|
+
],
|
|
58
|
+
errorMessage: "Biome not found"
|
|
59
|
+
},
|
|
60
|
+
oxlint: {
|
|
61
|
+
command: "oxlint",
|
|
62
|
+
args: (outputPath) => [
|
|
63
|
+
"--fix",
|
|
64
|
+
"--no-ignore",
|
|
65
|
+
outputPath
|
|
66
|
+
],
|
|
67
|
+
errorMessage: "Oxlint not found"
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Resolves to `true` when running `tool --version` exits with code 0.
|
|
72
|
+
*/
|
|
73
|
+
async function isToolAvailable(tool) {
|
|
74
|
+
return new Promise((resolve) => {
|
|
75
|
+
const child = (0, node_child_process.spawn)(tool, ["--version"], { stdio: "ignore" });
|
|
76
|
+
child.on("close", (code) => resolve(code === 0));
|
|
77
|
+
child.on("error", () => resolve(false));
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Returns the first installed tool from `candidates`, checked in order, or `null` when none are found.
|
|
82
|
+
*
|
|
83
|
+
* Availability is probed by running `<tool> --version` and checking for a zero exit code.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* const formatter = await detectTool(['oxfmt', 'biome', 'prettier'] as const)
|
|
88
|
+
* const linter = await detectTool(['oxlint', 'biome', 'eslint'] as const)
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
async function detectTool(candidates) {
|
|
92
|
+
for (const tool of candidates) if (await isToolAvailable(tool)) return tool;
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Metadata for each supported package manager, keyed by its short name.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* packageManagers.pnpm.installCommand // ['add', '-D']
|
|
101
|
+
* packageManagers.npm.lockFile // 'package-lock.json'
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
const packageManagers = {
|
|
105
|
+
pnpm: {
|
|
106
|
+
name: "pnpm",
|
|
107
|
+
lockFile: "pnpm-lock.yaml",
|
|
108
|
+
installCommand: ["add", "-D"]
|
|
109
|
+
},
|
|
110
|
+
yarn: {
|
|
111
|
+
name: "yarn",
|
|
112
|
+
lockFile: "yarn.lock",
|
|
113
|
+
installCommand: ["add", "-D"]
|
|
114
|
+
},
|
|
115
|
+
bun: {
|
|
116
|
+
name: "bun",
|
|
117
|
+
lockFile: "bun.lockb",
|
|
118
|
+
installCommand: ["add", "-d"]
|
|
119
|
+
},
|
|
120
|
+
npm: {
|
|
121
|
+
name: "npm",
|
|
122
|
+
lockFile: "package-lock.json",
|
|
123
|
+
installCommand: ["install", "--save-dev"]
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Detects the active package manager for the given directory.
|
|
128
|
+
* Resolution order: `packageManager` field in `package.json`, then presence of a lock file.
|
|
129
|
+
* Falls back to `npm` when no signal is found.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* detectPackageManager('/my/project') // { name: 'pnpm', lockFile: 'pnpm-lock.yaml', ... }
|
|
134
|
+
* detectPackageManager() // falls back to npm when no lock file is found
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
function detectPackageManager(cwd = process.cwd()) {
|
|
138
|
+
const packageJsonPath = (0, node_path.join)(cwd, "package.json");
|
|
139
|
+
if ((0, node_fs.existsSync)(packageJsonPath)) try {
|
|
140
|
+
const pmField = JSON.parse((0, node_fs.readFileSync)(packageJsonPath, "utf-8")).packageManager;
|
|
141
|
+
if (typeof pmField === "string") {
|
|
142
|
+
const name = pmField.split("@")[0];
|
|
143
|
+
if (name && name in packageManagers) return packageManagers[name];
|
|
144
|
+
}
|
|
145
|
+
} catch {}
|
|
146
|
+
for (const pm of Object.values(packageManagers)) if ((0, node_fs.existsSync)((0, node_path.join)(cwd, pm.lockFile))) return pm;
|
|
147
|
+
return packageManagers.npm;
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
Object.defineProperty(exports, "detectPackageManager", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function() {
|
|
153
|
+
return detectPackageManager;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(exports, "detectTool", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function() {
|
|
159
|
+
return detectTool;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, "formatters", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function() {
|
|
165
|
+
return formatters;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
Object.defineProperty(exports, "linters", {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function() {
|
|
171
|
+
return linters;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
//# sourceMappingURL=tools-CZT9wSA6.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools-CZT9wSA6.cjs","names":[],"sources":["../../../internals/utils/src/tools.ts"],"sourcesContent":["import { spawn } from 'node:child_process'\nimport { existsSync, readFileSync } from 'node:fs'\nimport { join } from 'node:path'\n\n/**\n * CLI command descriptors for each supported code formatter.\n *\n * Each entry contains the executable `command`, an `args` factory that maps an\n * output path to the correct argument list, and an `errorMessage` shown when\n * the formatter is not found.\n */\nexport const formatters = {\n prettier: {\n command: 'prettier',\n args: (outputPath: string) => ['--ignore-unknown', '--write', outputPath],\n errorMessage: 'Prettier not found',\n },\n biome: {\n command: 'biome',\n args: (outputPath: string) => ['format', '--write', outputPath],\n errorMessage: 'Biome not found',\n },\n oxfmt: {\n command: 'oxfmt',\n args: (outputPath: string) => [outputPath],\n errorMessage: 'Oxfmt not found',\n },\n} as const\n\n/**\n * CLI command descriptors for each supported linter.\n *\n * Each entry contains the executable `command`, an `args` factory that maps an\n * output path to the correct argument list, and an `errorMessage` shown when\n * the linter is not found.\n */\nexport const linters = {\n eslint: {\n command: 'eslint',\n args: (outputPath: string) => [outputPath, '--fix'],\n errorMessage: 'Eslint not found',\n },\n biome: {\n command: 'biome',\n args: (outputPath: string) => ['lint', '--fix', outputPath],\n errorMessage: 'Biome not found',\n },\n oxlint: {\n command: 'oxlint',\n // --no-ignore so oxlint lints the folder even when it's gitignored (generated output dirs usually are).\n args: (outputPath: string) => ['--fix', '--no-ignore', outputPath],\n errorMessage: 'Oxlint not found',\n },\n} as const\n\n/**\n * Resolves to `true` when running `tool --version` exits with code 0.\n */\nasync function isToolAvailable(tool: string): Promise<boolean> {\n return new Promise((resolve) => {\n const child = spawn(tool, ['--version'], { stdio: 'ignore' })\n child.on('close', (code) => resolve(code === 0))\n child.on('error', () => resolve(false))\n })\n}\n\n/**\n * Returns the first installed tool from `candidates`, checked in order, or `null` when none are found.\n *\n * Availability is probed by running `<tool> --version` and checking for a zero exit code.\n *\n * @example\n * ```ts\n * const formatter = await detectTool(['oxfmt', 'biome', 'prettier'] as const)\n * const linter = await detectTool(['oxlint', 'biome', 'eslint'] as const)\n * ```\n */\nexport async function detectTool<TName extends string>(candidates: ReadonlyArray<TName>): Promise<TName | null> {\n for (const tool of candidates) {\n if (await isToolAvailable(tool)) {\n return tool\n }\n }\n\n return null\n}\n\n/**\n * Supported package manager identifiers.\n *\n * @example\n * ```ts\n * const pm: PackageManagerName = 'pnpm'\n * ```\n */\nexport type PackageManagerName = 'npm' | 'pnpm' | 'yarn' | 'bun'\n\n/**\n * Metadata describing a package manager's lock file and install command.\n */\nexport interface PackageManagerInfo {\n /**\n * Identifier used in CLI commands, e.g. `pnpm`, `yarn`.\n */\n name: PackageManagerName\n /**\n * Lock file name that uniquely identifies this package manager in a project root.\n */\n lockFile: string\n /**\n * Subcommands passed to the package manager binary to install a dev dependency.\n */\n installCommand: ReadonlyArray<string>\n}\n\n/**\n * Metadata for each supported package manager, keyed by its short name.\n *\n * @example\n * ```ts\n * packageManagers.pnpm.installCommand // ['add', '-D']\n * packageManagers.npm.lockFile // 'package-lock.json'\n * ```\n */\nconst packageManagers: Record<PackageManagerName, PackageManagerInfo> = {\n pnpm: {\n name: 'pnpm',\n lockFile: 'pnpm-lock.yaml',\n installCommand: ['add', '-D'],\n },\n yarn: {\n name: 'yarn',\n lockFile: 'yarn.lock',\n installCommand: ['add', '-D'],\n },\n bun: {\n name: 'bun',\n lockFile: 'bun.lockb',\n installCommand: ['add', '-d'],\n },\n npm: {\n name: 'npm',\n lockFile: 'package-lock.json',\n installCommand: ['install', '--save-dev'],\n },\n}\n\n/**\n * Minimal shape of `package.json` fields read during detection.\n */\ntype PackageJson = {\n /**\n * The `packageManager` field from `package.json` (e.g. `\"pnpm@9.0.0\"`).\n */\n packageManager?: string\n}\n\n/**\n * Detects the active package manager for the given directory.\n * Resolution order: `packageManager` field in `package.json`, then presence of a lock file.\n * Falls back to `npm` when no signal is found.\n *\n * @example\n * ```ts\n * detectPackageManager('/my/project') // { name: 'pnpm', lockFile: 'pnpm-lock.yaml', ... }\n * detectPackageManager() // falls back to npm when no lock file is found\n * ```\n */\nexport function detectPackageManager(cwd: string = process.cwd()): PackageManagerInfo {\n const packageJsonPath = join(cwd, 'package.json')\n if (existsSync(packageJsonPath)) {\n try {\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as PackageJson\n const pmField = packageJson.packageManager\n if (typeof pmField === 'string') {\n const name = pmField.split('@')[0]\n if (name && name in packageManagers) {\n return packageManagers[name as PackageManagerName]\n }\n }\n } catch {\n // Continue to lock file detection\n }\n }\n\n for (const pm of Object.values(packageManagers)) {\n if (existsSync(join(cwd, pm.lockFile))) {\n return pm\n }\n }\n\n return packageManagers.npm\n}\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,aAAa;CACxB,UAAU;EACR,SAAS;EACT,OAAO,eAAuB;GAAC;GAAoB;GAAW;EAAU;EACxE,cAAc;CAChB;CACA,OAAO;EACL,SAAS;EACT,OAAO,eAAuB;GAAC;GAAU;GAAW;EAAU;EAC9D,cAAc;CAChB;CACA,OAAO;EACL,SAAS;EACT,OAAO,eAAuB,CAAC,UAAU;EACzC,cAAc;CAChB;AACF;;;;;;;;AASA,MAAa,UAAU;CACrB,QAAQ;EACN,SAAS;EACT,OAAO,eAAuB,CAAC,YAAY,OAAO;EAClD,cAAc;CAChB;CACA,OAAO;EACL,SAAS;EACT,OAAO,eAAuB;GAAC;GAAQ;GAAS;EAAU;EAC1D,cAAc;CAChB;CACA,QAAQ;EACN,SAAS;EAET,OAAO,eAAuB;GAAC;GAAS;GAAe;EAAU;EACjE,cAAc;CAChB;AACF;;;;AAKA,eAAe,gBAAgB,MAAgC;CAC7D,OAAO,IAAI,SAAS,YAAY;EAC9B,MAAM,SAAA,GAAA,mBAAA,MAAA,CAAc,MAAM,CAAC,WAAW,GAAG,EAAE,OAAO,SAAS,CAAC;EAC5D,MAAM,GAAG,UAAU,SAAS,QAAQ,SAAS,CAAC,CAAC;EAC/C,MAAM,GAAG,eAAe,QAAQ,KAAK,CAAC;CACxC,CAAC;AACH;;;;;;;;;;;;AAaA,eAAsB,WAAiC,YAAyD;CAC9G,KAAK,MAAM,QAAQ,YACjB,IAAI,MAAM,gBAAgB,IAAI,GAC5B,OAAO;CAIX,OAAO;AACT;;;;;;;;;;AAuCA,MAAM,kBAAkE;CACtE,MAAM;EACJ,MAAM;EACN,UAAU;EACV,gBAAgB,CAAC,OAAO,IAAI;CAC9B;CACA,MAAM;EACJ,MAAM;EACN,UAAU;EACV,gBAAgB,CAAC,OAAO,IAAI;CAC9B;CACA,KAAK;EACH,MAAM;EACN,UAAU;EACV,gBAAgB,CAAC,OAAO,IAAI;CAC9B;CACA,KAAK;EACH,MAAM;EACN,UAAU;EACV,gBAAgB,CAAC,WAAW,YAAY;CAC1C;AACF;;;;;;;;;;;;AAuBA,SAAgB,qBAAqB,MAAc,QAAQ,IAAI,GAAuB;CACpF,MAAM,mBAAA,GAAA,UAAA,KAAA,CAAuB,KAAK,cAAc;CAChD,KAAA,GAAA,QAAA,WAAA,CAAe,eAAe,GAC5B,IAAI;EAEF,MAAM,UADc,KAAK,OAAA,GAAA,QAAA,aAAA,CAAmB,iBAAiB,OAAO,CAC1C,CAAC,CAAC;EAC5B,IAAI,OAAO,YAAY,UAAU;GAC/B,MAAM,OAAO,QAAQ,MAAM,GAAG,CAAC,CAAC;GAChC,IAAI,QAAQ,QAAQ,iBAClB,OAAO,gBAAgB;EAE3B;CACF,QAAQ,CAER;CAGF,KAAK,MAAM,MAAM,OAAO,OAAO,eAAe,GAC5C,KAAA,GAAA,QAAA,WAAA,EAAA,GAAA,UAAA,KAAA,CAAoB,KAAK,GAAG,QAAQ,CAAC,GACnC,OAAO;CAIX,OAAO,gBAAgB;AACzB"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
//#region ../../internals/utils/src/tools.ts
|
|
6
|
+
/**
|
|
7
|
+
* CLI command descriptors for each supported code formatter.
|
|
8
|
+
*
|
|
9
|
+
* Each entry contains the executable `command`, an `args` factory that maps an
|
|
10
|
+
* output path to the correct argument list, and an `errorMessage` shown when
|
|
11
|
+
* the formatter is not found.
|
|
12
|
+
*/
|
|
13
|
+
const formatters = {
|
|
14
|
+
prettier: {
|
|
15
|
+
command: "prettier",
|
|
16
|
+
args: (outputPath) => [
|
|
17
|
+
"--ignore-unknown",
|
|
18
|
+
"--write",
|
|
19
|
+
outputPath
|
|
20
|
+
],
|
|
21
|
+
errorMessage: "Prettier not found"
|
|
22
|
+
},
|
|
23
|
+
biome: {
|
|
24
|
+
command: "biome",
|
|
25
|
+
args: (outputPath) => [
|
|
26
|
+
"format",
|
|
27
|
+
"--write",
|
|
28
|
+
outputPath
|
|
29
|
+
],
|
|
30
|
+
errorMessage: "Biome not found"
|
|
31
|
+
},
|
|
32
|
+
oxfmt: {
|
|
33
|
+
command: "oxfmt",
|
|
34
|
+
args: (outputPath) => [outputPath],
|
|
35
|
+
errorMessage: "Oxfmt not found"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* CLI command descriptors for each supported linter.
|
|
40
|
+
*
|
|
41
|
+
* Each entry contains the executable `command`, an `args` factory that maps an
|
|
42
|
+
* output path to the correct argument list, and an `errorMessage` shown when
|
|
43
|
+
* the linter is not found.
|
|
44
|
+
*/
|
|
45
|
+
const linters = {
|
|
46
|
+
eslint: {
|
|
47
|
+
command: "eslint",
|
|
48
|
+
args: (outputPath) => [outputPath, "--fix"],
|
|
49
|
+
errorMessage: "Eslint not found"
|
|
50
|
+
},
|
|
51
|
+
biome: {
|
|
52
|
+
command: "biome",
|
|
53
|
+
args: (outputPath) => [
|
|
54
|
+
"lint",
|
|
55
|
+
"--fix",
|
|
56
|
+
outputPath
|
|
57
|
+
],
|
|
58
|
+
errorMessage: "Biome not found"
|
|
59
|
+
},
|
|
60
|
+
oxlint: {
|
|
61
|
+
command: "oxlint",
|
|
62
|
+
args: (outputPath) => [
|
|
63
|
+
"--fix",
|
|
64
|
+
"--no-ignore",
|
|
65
|
+
outputPath
|
|
66
|
+
],
|
|
67
|
+
errorMessage: "Oxlint not found"
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Resolves to `true` when running `tool --version` exits with code 0.
|
|
72
|
+
*/
|
|
73
|
+
async function isToolAvailable(tool) {
|
|
74
|
+
return new Promise((resolve) => {
|
|
75
|
+
const child = spawn(tool, ["--version"], { stdio: "ignore" });
|
|
76
|
+
child.on("close", (code) => resolve(code === 0));
|
|
77
|
+
child.on("error", () => resolve(false));
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Returns the first installed tool from `candidates`, checked in order, or `null` when none are found.
|
|
82
|
+
*
|
|
83
|
+
* Availability is probed by running `<tool> --version` and checking for a zero exit code.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* const formatter = await detectTool(['oxfmt', 'biome', 'prettier'] as const)
|
|
88
|
+
* const linter = await detectTool(['oxlint', 'biome', 'eslint'] as const)
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
async function detectTool(candidates) {
|
|
92
|
+
for (const tool of candidates) if (await isToolAvailable(tool)) return tool;
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Metadata for each supported package manager, keyed by its short name.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* packageManagers.pnpm.installCommand // ['add', '-D']
|
|
101
|
+
* packageManagers.npm.lockFile // 'package-lock.json'
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
const packageManagers = {
|
|
105
|
+
pnpm: {
|
|
106
|
+
name: "pnpm",
|
|
107
|
+
lockFile: "pnpm-lock.yaml",
|
|
108
|
+
installCommand: ["add", "-D"]
|
|
109
|
+
},
|
|
110
|
+
yarn: {
|
|
111
|
+
name: "yarn",
|
|
112
|
+
lockFile: "yarn.lock",
|
|
113
|
+
installCommand: ["add", "-D"]
|
|
114
|
+
},
|
|
115
|
+
bun: {
|
|
116
|
+
name: "bun",
|
|
117
|
+
lockFile: "bun.lockb",
|
|
118
|
+
installCommand: ["add", "-d"]
|
|
119
|
+
},
|
|
120
|
+
npm: {
|
|
121
|
+
name: "npm",
|
|
122
|
+
lockFile: "package-lock.json",
|
|
123
|
+
installCommand: ["install", "--save-dev"]
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Detects the active package manager for the given directory.
|
|
128
|
+
* Resolution order: `packageManager` field in `package.json`, then presence of a lock file.
|
|
129
|
+
* Falls back to `npm` when no signal is found.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* detectPackageManager('/my/project') // { name: 'pnpm', lockFile: 'pnpm-lock.yaml', ... }
|
|
134
|
+
* detectPackageManager() // falls back to npm when no lock file is found
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
function detectPackageManager(cwd = process.cwd()) {
|
|
138
|
+
const packageJsonPath = join(cwd, "package.json");
|
|
139
|
+
if (existsSync(packageJsonPath)) try {
|
|
140
|
+
const pmField = JSON.parse(readFileSync(packageJsonPath, "utf-8")).packageManager;
|
|
141
|
+
if (typeof pmField === "string") {
|
|
142
|
+
const name = pmField.split("@")[0];
|
|
143
|
+
if (name && name in packageManagers) return packageManagers[name];
|
|
144
|
+
}
|
|
145
|
+
} catch {}
|
|
146
|
+
for (const pm of Object.values(packageManagers)) if (existsSync(join(cwd, pm.lockFile))) return pm;
|
|
147
|
+
return packageManagers.npm;
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
export { linters as i, detectTool as n, formatters as r, detectPackageManager as t };
|
|
151
|
+
|
|
152
|
+
//# sourceMappingURL=tools-D0UogMU3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools-D0UogMU3.js","names":[],"sources":["../../../internals/utils/src/tools.ts"],"sourcesContent":["import { spawn } from 'node:child_process'\nimport { existsSync, readFileSync } from 'node:fs'\nimport { join } from 'node:path'\n\n/**\n * CLI command descriptors for each supported code formatter.\n *\n * Each entry contains the executable `command`, an `args` factory that maps an\n * output path to the correct argument list, and an `errorMessage` shown when\n * the formatter is not found.\n */\nexport const formatters = {\n prettier: {\n command: 'prettier',\n args: (outputPath: string) => ['--ignore-unknown', '--write', outputPath],\n errorMessage: 'Prettier not found',\n },\n biome: {\n command: 'biome',\n args: (outputPath: string) => ['format', '--write', outputPath],\n errorMessage: 'Biome not found',\n },\n oxfmt: {\n command: 'oxfmt',\n args: (outputPath: string) => [outputPath],\n errorMessage: 'Oxfmt not found',\n },\n} as const\n\n/**\n * CLI command descriptors for each supported linter.\n *\n * Each entry contains the executable `command`, an `args` factory that maps an\n * output path to the correct argument list, and an `errorMessage` shown when\n * the linter is not found.\n */\nexport const linters = {\n eslint: {\n command: 'eslint',\n args: (outputPath: string) => [outputPath, '--fix'],\n errorMessage: 'Eslint not found',\n },\n biome: {\n command: 'biome',\n args: (outputPath: string) => ['lint', '--fix', outputPath],\n errorMessage: 'Biome not found',\n },\n oxlint: {\n command: 'oxlint',\n // --no-ignore so oxlint lints the folder even when it's gitignored (generated output dirs usually are).\n args: (outputPath: string) => ['--fix', '--no-ignore', outputPath],\n errorMessage: 'Oxlint not found',\n },\n} as const\n\n/**\n * Resolves to `true` when running `tool --version` exits with code 0.\n */\nasync function isToolAvailable(tool: string): Promise<boolean> {\n return new Promise((resolve) => {\n const child = spawn(tool, ['--version'], { stdio: 'ignore' })\n child.on('close', (code) => resolve(code === 0))\n child.on('error', () => resolve(false))\n })\n}\n\n/**\n * Returns the first installed tool from `candidates`, checked in order, or `null` when none are found.\n *\n * Availability is probed by running `<tool> --version` and checking for a zero exit code.\n *\n * @example\n * ```ts\n * const formatter = await detectTool(['oxfmt', 'biome', 'prettier'] as const)\n * const linter = await detectTool(['oxlint', 'biome', 'eslint'] as const)\n * ```\n */\nexport async function detectTool<TName extends string>(candidates: ReadonlyArray<TName>): Promise<TName | null> {\n for (const tool of candidates) {\n if (await isToolAvailable(tool)) {\n return tool\n }\n }\n\n return null\n}\n\n/**\n * Supported package manager identifiers.\n *\n * @example\n * ```ts\n * const pm: PackageManagerName = 'pnpm'\n * ```\n */\nexport type PackageManagerName = 'npm' | 'pnpm' | 'yarn' | 'bun'\n\n/**\n * Metadata describing a package manager's lock file and install command.\n */\nexport interface PackageManagerInfo {\n /**\n * Identifier used in CLI commands, e.g. `pnpm`, `yarn`.\n */\n name: PackageManagerName\n /**\n * Lock file name that uniquely identifies this package manager in a project root.\n */\n lockFile: string\n /**\n * Subcommands passed to the package manager binary to install a dev dependency.\n */\n installCommand: ReadonlyArray<string>\n}\n\n/**\n * Metadata for each supported package manager, keyed by its short name.\n *\n * @example\n * ```ts\n * packageManagers.pnpm.installCommand // ['add', '-D']\n * packageManagers.npm.lockFile // 'package-lock.json'\n * ```\n */\nconst packageManagers: Record<PackageManagerName, PackageManagerInfo> = {\n pnpm: {\n name: 'pnpm',\n lockFile: 'pnpm-lock.yaml',\n installCommand: ['add', '-D'],\n },\n yarn: {\n name: 'yarn',\n lockFile: 'yarn.lock',\n installCommand: ['add', '-D'],\n },\n bun: {\n name: 'bun',\n lockFile: 'bun.lockb',\n installCommand: ['add', '-d'],\n },\n npm: {\n name: 'npm',\n lockFile: 'package-lock.json',\n installCommand: ['install', '--save-dev'],\n },\n}\n\n/**\n * Minimal shape of `package.json` fields read during detection.\n */\ntype PackageJson = {\n /**\n * The `packageManager` field from `package.json` (e.g. `\"pnpm@9.0.0\"`).\n */\n packageManager?: string\n}\n\n/**\n * Detects the active package manager for the given directory.\n * Resolution order: `packageManager` field in `package.json`, then presence of a lock file.\n * Falls back to `npm` when no signal is found.\n *\n * @example\n * ```ts\n * detectPackageManager('/my/project') // { name: 'pnpm', lockFile: 'pnpm-lock.yaml', ... }\n * detectPackageManager() // falls back to npm when no lock file is found\n * ```\n */\nexport function detectPackageManager(cwd: string = process.cwd()): PackageManagerInfo {\n const packageJsonPath = join(cwd, 'package.json')\n if (existsSync(packageJsonPath)) {\n try {\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as PackageJson\n const pmField = packageJson.packageManager\n if (typeof pmField === 'string') {\n const name = pmField.split('@')[0]\n if (name && name in packageManagers) {\n return packageManagers[name as PackageManagerName]\n }\n }\n } catch {\n // Continue to lock file detection\n }\n }\n\n for (const pm of Object.values(packageManagers)) {\n if (existsSync(join(cwd, pm.lockFile))) {\n return pm\n }\n }\n\n return packageManagers.npm\n}\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,aAAa;CACxB,UAAU;EACR,SAAS;EACT,OAAO,eAAuB;GAAC;GAAoB;GAAW;EAAU;EACxE,cAAc;CAChB;CACA,OAAO;EACL,SAAS;EACT,OAAO,eAAuB;GAAC;GAAU;GAAW;EAAU;EAC9D,cAAc;CAChB;CACA,OAAO;EACL,SAAS;EACT,OAAO,eAAuB,CAAC,UAAU;EACzC,cAAc;CAChB;AACF;;;;;;;;AASA,MAAa,UAAU;CACrB,QAAQ;EACN,SAAS;EACT,OAAO,eAAuB,CAAC,YAAY,OAAO;EAClD,cAAc;CAChB;CACA,OAAO;EACL,SAAS;EACT,OAAO,eAAuB;GAAC;GAAQ;GAAS;EAAU;EAC1D,cAAc;CAChB;CACA,QAAQ;EACN,SAAS;EAET,OAAO,eAAuB;GAAC;GAAS;GAAe;EAAU;EACjE,cAAc;CAChB;AACF;;;;AAKA,eAAe,gBAAgB,MAAgC;CAC7D,OAAO,IAAI,SAAS,YAAY;EAC9B,MAAM,QAAQ,MAAM,MAAM,CAAC,WAAW,GAAG,EAAE,OAAO,SAAS,CAAC;EAC5D,MAAM,GAAG,UAAU,SAAS,QAAQ,SAAS,CAAC,CAAC;EAC/C,MAAM,GAAG,eAAe,QAAQ,KAAK,CAAC;CACxC,CAAC;AACH;;;;;;;;;;;;AAaA,eAAsB,WAAiC,YAAyD;CAC9G,KAAK,MAAM,QAAQ,YACjB,IAAI,MAAM,gBAAgB,IAAI,GAC5B,OAAO;CAIX,OAAO;AACT;;;;;;;;;;AAuCA,MAAM,kBAAkE;CACtE,MAAM;EACJ,MAAM;EACN,UAAU;EACV,gBAAgB,CAAC,OAAO,IAAI;CAC9B;CACA,MAAM;EACJ,MAAM;EACN,UAAU;EACV,gBAAgB,CAAC,OAAO,IAAI;CAC9B;CACA,KAAK;EACH,MAAM;EACN,UAAU;EACV,gBAAgB,CAAC,OAAO,IAAI;CAC9B;CACA,KAAK;EACH,MAAM;EACN,UAAU;EACV,gBAAgB,CAAC,WAAW,YAAY;CAC1C;AACF;;;;;;;;;;;;AAuBA,SAAgB,qBAAqB,MAAc,QAAQ,IAAI,GAAuB;CACpF,MAAM,kBAAkB,KAAK,KAAK,cAAc;CAChD,IAAI,WAAW,eAAe,GAC5B,IAAI;EAEF,MAAM,UADc,KAAK,MAAM,aAAa,iBAAiB,OAAO,CAC1C,CAAC,CAAC;EAC5B,IAAI,OAAO,YAAY,UAAU;GAC/B,MAAM,OAAO,QAAQ,MAAM,GAAG,CAAC,CAAC;GAChC,IAAI,QAAQ,QAAQ,iBAClB,OAAO,gBAAgB;EAE3B;CACF,QAAQ,CAER;CAGF,KAAK,MAAM,MAAM,OAAO,OAAO,eAAe,GAC5C,IAAI,WAAW,KAAK,KAAK,GAAG,QAAQ,CAAC,GACnC,OAAO;CAIX,OAAO,gBAAgB;AACzB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import {
|
|
3
|
-
import { t as version } from "./package-
|
|
1
|
+
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
+
import { t as defineCommand } from "./defineCommand-DMEeqliP.js";
|
|
3
|
+
import { t as version } from "./package-DC0ALWof.js";
|
|
4
4
|
//#region src/commands/validate.ts
|
|
5
5
|
const command = defineCommand({
|
|
6
6
|
name: "validate",
|
|
@@ -13,7 +13,7 @@ const command = defineCommand({
|
|
|
13
13
|
required: true
|
|
14
14
|
} },
|
|
15
15
|
async run({ values }) {
|
|
16
|
-
const { run } = await import("./run-
|
|
16
|
+
const { run } = await import("./run-D_dWNFhX.js");
|
|
17
17
|
await run({
|
|
18
18
|
input: values.input,
|
|
19
19
|
version
|
|
@@ -23,4 +23,4 @@ const command = defineCommand({
|
|
|
23
23
|
//#endregion
|
|
24
24
|
export { command };
|
|
25
25
|
|
|
26
|
-
//# sourceMappingURL=validate-
|
|
26
|
+
//# sourceMappingURL=validate-CRXa_v3l.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-
|
|
1
|
+
{"version":3,"file":"validate-CRXa_v3l.js","names":[],"sources":["../src/commands/validate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'validate',\n description:\n '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.',\n examples: ['kubb validate --input ./openapi.yaml', 'kubb validate --input https://petstore3.swagger.io/api/v3/openapi.json'],\n options: {\n input: {\n type: 'string',\n description: 'Path or URL to the OpenAPI/Swagger file to validate',\n short: 'i',\n required: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/validate/run.ts')\n\n await run({ input: values.input, version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU,CAAC,wCAAwC,wEAAwE;CAC3H,SAAS,EACP,OAAO;EACL,MAAM;EACN,aAAa;EACb,OAAO;EACP,UAAU;CACZ,EACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GAAE,OAAO,OAAO;GAAO;EAAQ,CAAC;CAC5C;AACF,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
require("./
|
|
2
|
-
const
|
|
3
|
-
const require_package = require("./package-
|
|
1
|
+
require("./rolldown-runtime-Bx3C2hgW.cjs");
|
|
2
|
+
const require_defineCommand = require("./defineCommand-Bo3yZTWI.cjs");
|
|
3
|
+
const require_package = require("./package-CK8o-iEe.cjs");
|
|
4
4
|
//#region src/commands/validate.ts
|
|
5
|
-
const command =
|
|
5
|
+
const command = require_defineCommand.defineCommand({
|
|
6
6
|
name: "validate",
|
|
7
7
|
description: "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
8
|
examples: ["kubb validate --input ./openapi.yaml", "kubb validate --input https://petstore3.swagger.io/api/v3/openapi.json"],
|
|
@@ -13,7 +13,7 @@ const command = require_define.defineCommand({
|
|
|
13
13
|
required: true
|
|
14
14
|
} },
|
|
15
15
|
async run({ values }) {
|
|
16
|
-
const { run } = await Promise.resolve().then(() => require("./run-
|
|
16
|
+
const { run } = await Promise.resolve().then(() => require("./run-CBc896in.cjs"));
|
|
17
17
|
await run({
|
|
18
18
|
input: values.input,
|
|
19
19
|
version: require_package.version
|
|
@@ -23,4 +23,4 @@ const command = require_define.defineCommand({
|
|
|
23
23
|
//#endregion
|
|
24
24
|
exports.command = command;
|
|
25
25
|
|
|
26
|
-
//# sourceMappingURL=validate-
|
|
26
|
+
//# sourceMappingURL=validate-CVqbA1lL.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-
|
|
1
|
+
{"version":3,"file":"validate-CVqbA1lL.cjs","names":["defineCommand"],"sources":["../src/commands/validate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../package.json'\n\nexport const command = defineCommand({\n name: 'validate',\n description:\n '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.',\n examples: ['kubb validate --input ./openapi.yaml', 'kubb validate --input https://petstore3.swagger.io/api/v3/openapi.json'],\n options: {\n input: {\n type: 'string',\n description: 'Path or URL to the OpenAPI/Swagger file to validate',\n short: 'i',\n required: true,\n },\n },\n async run({ values }) {\n const { run } = await import('../runners/validate/run.ts')\n\n await run({ input: values.input, version })\n },\n})\n"],"mappings":";;;;AAGA,MAAa,UAAUA,sBAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,UAAU,CAAC,wCAAwC,wEAAwE;CAC3H,SAAS,EACP,OAAO;EACL,MAAM;EACN,aAAa;EACb,OAAO;EACP,UAAU;CACZ,EACF;CACA,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;EAEtB,MAAM,IAAI;GAAE,OAAO,OAAO;GAAO,SAAA,gBAAA;EAAQ,CAAC;CAC5C;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/cli",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
4
|
-
"description": "Official CLI for Kubb. Run kubb generate, kubb init, kubb validate,
|
|
3
|
+
"version": "5.0.0-beta.71",
|
|
4
|
+
"description": "Official CLI for Kubb. Run kubb generate, kubb init, kubb validate, and kubb mcp to manage the full code generation lifecycle.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
7
7
|
"code-generator",
|
|
8
8
|
"codegen",
|
|
9
9
|
"kubb",
|
|
10
|
-
"
|
|
10
|
+
"meta-framework",
|
|
11
11
|
"sdk-generator",
|
|
12
|
-
"swagger",
|
|
13
12
|
"typescript"
|
|
14
13
|
],
|
|
15
14
|
"license": "MIT",
|
|
@@ -23,7 +22,6 @@
|
|
|
23
22
|
"kubb": "bin/kubb.js"
|
|
24
23
|
},
|
|
25
24
|
"files": [
|
|
26
|
-
"src",
|
|
27
25
|
"dist",
|
|
28
26
|
"bin",
|
|
29
27
|
"!/**/**.test.**",
|
|
@@ -47,52 +45,42 @@
|
|
|
47
45
|
"registry": "https://registry.npmjs.org/"
|
|
48
46
|
},
|
|
49
47
|
"dependencies": {
|
|
50
|
-
"@clack/prompts": "^1.
|
|
48
|
+
"@clack/prompts": "^1.5.1",
|
|
51
49
|
"chokidar": "^5.0.0",
|
|
52
|
-
"cosmiconfig": "^9.0.1",
|
|
53
50
|
"jiti": "^2.7.0",
|
|
54
|
-
"tinyexec": "^1.
|
|
55
|
-
"
|
|
51
|
+
"tinyexec": "^1.2.4",
|
|
52
|
+
"unconfig": "^7.5.0",
|
|
53
|
+
"@kubb/core": "5.0.0-beta.71"
|
|
56
54
|
},
|
|
57
55
|
"devDependencies": {
|
|
58
56
|
"@internals/shared": "0.0.0",
|
|
59
57
|
"@internals/utils": "0.0.0",
|
|
60
|
-
"@kubb/adapter-oas": "5.0.0-beta.
|
|
58
|
+
"@kubb/adapter-oas": "5.0.0-beta.71"
|
|
61
59
|
},
|
|
62
60
|
"peerDependencies": {
|
|
63
|
-
"@kubb/adapter-oas": "5.0.0-beta.
|
|
64
|
-
"@kubb/
|
|
65
|
-
"@kubb/mcp": "5.0.0-beta.7"
|
|
61
|
+
"@kubb/adapter-oas": "5.0.0-beta.71",
|
|
62
|
+
"@kubb/mcp": "5.0.0-beta.71"
|
|
66
63
|
},
|
|
67
64
|
"peerDependenciesMeta": {
|
|
68
65
|
"@kubb/adapter-oas": {
|
|
69
66
|
"optional": true
|
|
70
67
|
},
|
|
71
|
-
"@kubb/agent": {
|
|
72
|
-
"optional": true
|
|
73
|
-
},
|
|
74
68
|
"@kubb/mcp": {
|
|
75
69
|
"optional": true
|
|
76
70
|
}
|
|
77
71
|
},
|
|
78
|
-
"size-limit": [
|
|
79
|
-
{
|
|
80
|
-
"path": "./dist/*.js",
|
|
81
|
-
"limit": "510 KiB",
|
|
82
|
-
"gzip": true
|
|
83
|
-
}
|
|
84
|
-
],
|
|
85
72
|
"preferGlobal": true,
|
|
86
73
|
"engines": {
|
|
87
74
|
"node": ">=22"
|
|
88
75
|
},
|
|
89
76
|
"scripts": {
|
|
90
|
-
"build": "tsdown
|
|
91
|
-
"clean": "
|
|
77
|
+
"build": "tsdown",
|
|
78
|
+
"clean": "node -e \"require('node:fs').rmSync('./dist', {recursive:true,force:true})\"",
|
|
92
79
|
"lint": "oxlint .",
|
|
93
80
|
"lint:fix": "oxlint --fix .",
|
|
94
81
|
"release": "pnpm publish --no-git-check",
|
|
95
82
|
"release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
|
|
83
|
+
"release:stage": "pnpm stage publish --no-git-check",
|
|
96
84
|
"start": "tsdown --watch",
|
|
97
85
|
"test": "vitest --passWithNoTests",
|
|
98
86
|
"typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"
|
package/dist/agent-DN7o8nlE.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import "./chunk-BvFE5Tac.js";
|
|
2
|
-
import { n as defineCommand } from "./define-m_fp-Aqm.js";
|
|
3
|
-
import { t as version } from "./package-D5wmvFl4.js";
|
|
4
|
-
import { o as agentDefaults } from "./constants-B2JTeRBb.js";
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/commands/agent.ts
|
|
7
|
-
const command = defineCommand({
|
|
8
|
-
name: "agent",
|
|
9
|
-
description: "Manage the Kubb Agent — an HTTP server that lets AI agents trigger code generation programmatically via a REST API. Useful when an AI workflow needs to generate code without direct CLI access.",
|
|
10
|
-
examples: [
|
|
11
|
-
"kubb agent start",
|
|
12
|
-
"kubb agent start --port 4000 --allow-write",
|
|
13
|
-
"kubb agent start --config ./kubb.config.ts --allow-all"
|
|
14
|
-
],
|
|
15
|
-
subCommands: [defineCommand({
|
|
16
|
-
name: "start",
|
|
17
|
-
description: "Start the Kubb Agent HTTP server. Exposes a REST API that accepts a kubb.config.ts patch and returns generated code as a stream. Use --allow-write to also write files to disk.",
|
|
18
|
-
examples: [
|
|
19
|
-
"kubb agent start",
|
|
20
|
-
"kubb agent start --port 4000",
|
|
21
|
-
"kubb agent start --allow-write",
|
|
22
|
-
"kubb agent start --config ./kubb.config.ts --allow-all"
|
|
23
|
-
],
|
|
24
|
-
options: {
|
|
25
|
-
config: {
|
|
26
|
-
type: "string",
|
|
27
|
-
description: "Path to the Kubb config file",
|
|
28
|
-
short: "c"
|
|
29
|
-
},
|
|
30
|
-
port: {
|
|
31
|
-
type: "string",
|
|
32
|
-
description: "Port the HTTP server listens on",
|
|
33
|
-
short: "p",
|
|
34
|
-
default: agentDefaults.port
|
|
35
|
-
},
|
|
36
|
-
host: {
|
|
37
|
-
type: "string",
|
|
38
|
-
description: "Hostname the HTTP server binds to",
|
|
39
|
-
default: agentDefaults.host
|
|
40
|
-
},
|
|
41
|
-
"allow-write": {
|
|
42
|
-
type: "boolean",
|
|
43
|
-
description: "Write generated files to the filesystem. When omitted, output is streamed only and no files are written.",
|
|
44
|
-
default: false
|
|
45
|
-
},
|
|
46
|
-
"allow-all": {
|
|
47
|
-
type: "boolean",
|
|
48
|
-
description: "Grant all permissions (implies --allow-write).",
|
|
49
|
-
default: false
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
async run({ values }) {
|
|
53
|
-
const { run } = await import("./run-BzpYYOQs.js");
|
|
54
|
-
await run({
|
|
55
|
-
port: values.port !== void 0 ? values.port : void 0,
|
|
56
|
-
host: values.host,
|
|
57
|
-
configPath: values.config,
|
|
58
|
-
allowWrite: values["allow-write"],
|
|
59
|
-
allowAll: values["allow-all"],
|
|
60
|
-
version
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
})]
|
|
64
|
-
});
|
|
65
|
-
//#endregion
|
|
66
|
-
export { command };
|
|
67
|
-
|
|
68
|
-
//# sourceMappingURL=agent-DN7o8nlE.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|