@kubb/mcp 5.0.0-beta.99 → 5.0.0
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 +4 -5
- package/dist/index.cjs +14 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +26 -18
- package/dist/index.js.map +1 -1
- package/dist/{rolldown-runtime-G2anUtha.js → rolldown-runtime-2jQ0FbkC.js} +1 -1
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as __toESM, r as __require, t as __commonJSMin } from "./rolldown-runtime-
|
|
1
|
+
import { i as __toESM, r as __require, t as __commonJSMin } from "./rolldown-runtime-2jQ0FbkC.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { ValibotJsonSchemaAdapter } from "@tmcp/adapter-valibot";
|
|
4
4
|
import { StdioTransport } from "@tmcp/transport-stdio";
|
|
@@ -11,7 +11,7 @@ import fs, { existsSync } from "node:fs";
|
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import process$1 from "node:process";
|
|
13
13
|
//#region package.json
|
|
14
|
-
var version = "5.0.0
|
|
14
|
+
var version = "5.0.0";
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/schemas/generateSchema.ts
|
|
17
17
|
const generateSchema = v.object({
|
|
@@ -6175,6 +6175,13 @@ const generateTool = defineTool({
|
|
|
6175
6175
|
hooks.hook("kubb:generation:start", async () => {
|
|
6176
6176
|
await notify("GENERATION_START", "Generation started");
|
|
6177
6177
|
});
|
|
6178
|
+
hooks.hook("kubb:setup:start", async () => {
|
|
6179
|
+
await notify("SETUP_START", "Setting up Kubb");
|
|
6180
|
+
});
|
|
6181
|
+
hooks.hook("kubb:setup:end", async () => {
|
|
6182
|
+
await notify("SETUP_END", "Kubb setup complete");
|
|
6183
|
+
await notify("BUILD_START", "Starting build");
|
|
6184
|
+
});
|
|
6178
6185
|
hooks.hook("kubb:generation:end", async () => {
|
|
6179
6186
|
await notify("GENERATION_END", "Generation ended");
|
|
6180
6187
|
});
|
|
@@ -6203,37 +6210,35 @@ const generateTool = defineTool({
|
|
|
6203
6210
|
} : userConfig.output
|
|
6204
6211
|
};
|
|
6205
6212
|
await notify("CONFIG_READY", "Configuration ready");
|
|
6206
|
-
await
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
await notify("SETUP_END", "Kubb setup complete");
|
|
6210
|
-
await notify("BUILD_START", "Starting build");
|
|
6211
|
-
const { files, diagnostics } = await kubb.safeBuild();
|
|
6212
|
-
await notify("BUILD_END", `Build complete - Generated ${files.length} files`);
|
|
6213
|
-
const problems = diagnostics.filter(Diagnostics.isProblem);
|
|
6213
|
+
const result = await createKubb(config, { hooks }).generate();
|
|
6214
|
+
await notify("BUILD_END", `Build complete - Generated ${result.files.length} files`);
|
|
6215
|
+
const problems = result.diagnostics.filter(Diagnostics.isProblem);
|
|
6214
6216
|
const errors = problems.filter((diagnostic) => diagnostic.severity === "error");
|
|
6215
6217
|
if (errors.length > 0) {
|
|
6216
6218
|
await notify("BUILD_FAILED", `Build failed with ${errors.length} diagnostic(s)`);
|
|
6217
6219
|
const serialized = problems.map((diagnostic) => Diagnostics.serialize(diagnostic));
|
|
6218
6220
|
return tool.error(`Build failed:\n${formatDiagnostics(serialized)}\n\n\`\`\`json\n${JSON.stringify(serialized, null, 2)}\n\`\`\``);
|
|
6219
6221
|
}
|
|
6220
|
-
await notify("BUILD_SUCCESS", `Build completed successfully - Generated ${files.length} files`);
|
|
6221
|
-
return tool.text(`Build completed successfully!\n\nGenerated ${files.length} files\n\n${messages.join("\n")}`);
|
|
6222
|
+
await notify("BUILD_SUCCESS", `Build completed successfully - Generated ${result.files.length} files`);
|
|
6223
|
+
return tool.text(`Build completed successfully!\n\nGenerated ${result.files.length} files\n\n${messages.join("\n")}`);
|
|
6222
6224
|
} catch (caughtError) {
|
|
6223
6225
|
const serialized = Diagnostics.serialize(Diagnostics.from(caughtError));
|
|
6224
6226
|
return tool.error(`Build error:\n${formatDiagnostics([serialized])}\n\n\`\`\`json\n${JSON.stringify(serialized, null, 2)}\n\`\`\``);
|
|
6225
6227
|
}
|
|
6226
6228
|
});
|
|
6227
6229
|
//#endregion
|
|
6230
|
+
//#region src/schemas/initSchema.ts
|
|
6231
|
+
const initSchema = v.object({
|
|
6232
|
+
input: v.optional(v.pipe(v.string(), v.minLength(1), v.description("Path to OpenAPI spec (default: ./openapi.yaml)"))),
|
|
6233
|
+
output: v.optional(v.pipe(v.string(), v.minLength(1), v.description("Output directory (default: ./src/gen)"))),
|
|
6234
|
+
plugins: v.optional(v.pipe(v.string(), v.minLength(1), v.description("Comma-separated list of plugins: plugin-ts,plugin-zod,...")))
|
|
6235
|
+
});
|
|
6236
|
+
//#endregion
|
|
6228
6237
|
//#region src/tools/init.ts
|
|
6229
6238
|
const initTool = defineTool({
|
|
6230
6239
|
name: "init",
|
|
6231
6240
|
description: "Scaffold a kubb.config.ts in the current directory (non-interactive). Does not install packages.",
|
|
6232
|
-
schema:
|
|
6233
|
-
input: v.optional(v.pipe(v.string(), v.minLength(1), v.description("Path to OpenAPI spec (default: ./openapi.yaml)"))),
|
|
6234
|
-
output: v.optional(v.pipe(v.string(), v.minLength(1), v.description("Output directory (default: ./src/gen)"))),
|
|
6235
|
-
plugins: v.optional(v.pipe(v.string(), v.minLength(1), v.description("Comma-separated list of plugins: plugin-ts,plugin-zod,...")))
|
|
6236
|
-
})
|
|
6241
|
+
schema: initSchema
|
|
6237
6242
|
}, async ({ input = "./openapi.yaml", output = "./src/gen", plugins }) => {
|
|
6238
6243
|
const selected = resolvePlugins(plugins);
|
|
6239
6244
|
const content = generateConfigFile({
|
|
@@ -6248,11 +6253,14 @@ const initTool = defineTool({
|
|
|
6248
6253
|
return tool.text(`Created kubb.config.ts\n\nInstall packages:\n npm install ${packageList}\n\nThen run:\n npx kubb generate`);
|
|
6249
6254
|
});
|
|
6250
6255
|
//#endregion
|
|
6256
|
+
//#region src/schemas/validateSchema.ts
|
|
6257
|
+
const validateSchema = v.object({ input: v.pipe(v.string(), v.minLength(1), v.description("Path or URL to the OpenAPI/Swagger specification")) });
|
|
6258
|
+
//#endregion
|
|
6251
6259
|
//#region src/tools/validate.ts
|
|
6252
6260
|
const validateTool = defineTool({
|
|
6253
6261
|
name: "validate",
|
|
6254
6262
|
description: "Validate an OpenAPI/Swagger specification file or URL",
|
|
6255
|
-
schema:
|
|
6263
|
+
schema: validateSchema
|
|
6256
6264
|
}, async ({ input }) => {
|
|
6257
6265
|
let mod;
|
|
6258
6266
|
try {
|