@kubb/cli 4.12.6 → 4.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-B857a-xb.js";
1
+ import { t as version } from "./package-V7YSB1bN.js";
2
2
  import { defineCommand, runCommand, runMain } from "citty";
3
3
 
4
4
  //#region src/index.ts
@@ -25,12 +25,12 @@ const main = defineCommand({
25
25
  "validate",
26
26
  "mcp"
27
27
  ].includes(rawArgs[0])) {
28
- await runCommand(await import("./generate-M-5j2zqa.js").then((r) => r.default), { rawArgs });
28
+ await runCommand(await import("./generate--x91ECr5.js").then((r) => r.default), { rawArgs });
29
29
  process.exit(0);
30
30
  }
31
31
  },
32
32
  subCommands: {
33
- generate: () => import("./generate-M-5j2zqa.js").then((r) => r.default),
33
+ generate: () => import("./generate--x91ECr5.js").then((r) => r.default),
34
34
  validate: () => import("./validate-Bt922JN-.js").then((r) => r.default),
35
35
  mcp: () => import("./mcp-B5FWDVjp.js").then((r) => r.default)
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-B5FWDVjp.js","names":["mod: any"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import type { ArgsDef, ParsedArgs } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport { createJiti } from 'jiti'\nimport pc from 'picocolors'\n\nconst jiti = createJiti(import.meta.url, {\n sourceMaps: true,\n})\n\nconst args = {\n help: {\n type: 'boolean',\n description: 'Show help',\n alias: 'h',\n default: false,\n },\n} as const satisfies ArgsDef\n\nexport type Args = ParsedArgs<typeof args>\n\nconst command = defineCommand({\n meta: {\n name: 'mcp',\n description: 'Start the server to enable the MCP client to interact with the LLM.',\n },\n args,\n async run(commandContext) {\n const { args } = commandContext\n\n if (args.help) {\n return showUsage(command)\n }\n\n let mod: any\n try {\n mod = await jiti.import('@kubb/mcp', { default: true })\n } catch (_e) {\n console.error(`Import of '@kubb/mcp' is required to start the MCP server`)\n }\n\n const { startServer } = mod\n try {\n console.log('⏳ Starting MCP server...')\n console.warn(pc.yellow('This feature is still under development — use with caution'))\n await startServer()\n } catch (error) {\n console.error((error as Error)?.message)\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;AAKA,MAAM,OAAO,WAAW,OAAO,KAAK,KAAK,EACvC,YAAY,MACb,CAAC;AAaF,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAhBW,EACX,MAAM;EACJ,MAAM;EACN,aAAa;EACb,OAAO;EACP,SAAS;EACV,EACF;CAUC,MAAM,IAAI,gBAAgB;EACxB,MAAM,EAAE,SAAS;AAEjB,MAAI,KAAK,KACP,QAAO,UAAU,QAAQ;EAG3B,IAAIA;AACJ,MAAI;AACF,SAAM,MAAM,KAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;WAChD,IAAI;AACX,WAAQ,MAAM,4DAA4D;;EAG5E,MAAM,EAAE,gBAAgB;AACxB,MAAI;AACF,WAAQ,IAAI,2BAA2B;AACvC,WAAQ,KAAK,GAAG,OAAO,6DAA6D,CAAC;AACrF,SAAM,aAAa;WACZ,OAAO;AACd,WAAQ,MAAO,OAAiB,QAAQ;;;CAG7C,CAAC;AAEF,kBAAe"}
1
+ {"version":3,"file":"mcp-B5FWDVjp.js","names":["mod: any"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import type { ArgsDef } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport { createJiti } from 'jiti'\nimport pc from 'picocolors'\n\nconst jiti = createJiti(import.meta.url, {\n sourceMaps: true,\n})\n\nconst args = {\n help: {\n type: 'boolean',\n description: 'Show help',\n alias: 'h',\n default: false,\n },\n} as const satisfies ArgsDef\n\nconst command = defineCommand({\n meta: {\n name: 'mcp',\n description: 'Start the server to enable the MCP client to interact with the LLM.',\n },\n args,\n async run(commandContext) {\n const { args } = commandContext\n\n if (args.help) {\n return showUsage(command)\n }\n\n let mod: any\n try {\n mod = await jiti.import('@kubb/mcp', { default: true })\n } catch (_e) {\n console.error(`Import of '@kubb/mcp' is required to start the MCP server`)\n }\n\n const { startServer } = mod\n try {\n console.log('⏳ Starting MCP server...')\n console.warn(pc.yellow('This feature is still under development — use with caution'))\n await startServer()\n } catch (error) {\n console.error((error as Error)?.message)\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;AAKA,MAAM,OAAO,WAAW,OAAO,KAAK,KAAK,EACvC,YAAY,MACb,CAAC;AAWF,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAdW,EACX,MAAM;EACJ,MAAM;EACN,aAAa;EACb,OAAO;EACP,SAAS;EACV,EACF;CAQC,MAAM,IAAI,gBAAgB;EACxB,MAAM,EAAE,SAAS;AAEjB,MAAI,KAAK,KACP,QAAO,UAAU,QAAQ;EAG3B,IAAIA;AACJ,MAAI;AACF,SAAM,MAAM,KAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;WAChD,IAAI;AACX,WAAQ,MAAM,4DAA4D;;EAG5E,MAAM,EAAE,gBAAgB;AACxB,MAAI;AACF,WAAQ,IAAI,2BAA2B;AACvC,WAAQ,KAAK,GAAG,OAAO,6DAA6D,CAAC;AACrF,SAAM,aAAa;WACZ,OAAO;AACd,WAAQ,MAAO,OAAiB,QAAQ;;;CAG7C,CAAC;AAEF,kBAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-D7d_8Bma.cjs","names":["jiti","mod: any","pc"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import type { ArgsDef, ParsedArgs } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport { createJiti } from 'jiti'\nimport pc from 'picocolors'\n\nconst jiti = createJiti(import.meta.url, {\n sourceMaps: true,\n})\n\nconst args = {\n help: {\n type: 'boolean',\n description: 'Show help',\n alias: 'h',\n default: false,\n },\n} as const satisfies ArgsDef\n\nexport type Args = ParsedArgs<typeof args>\n\nconst command = defineCommand({\n meta: {\n name: 'mcp',\n description: 'Start the server to enable the MCP client to interact with the LLM.',\n },\n args,\n async run(commandContext) {\n const { args } = commandContext\n\n if (args.help) {\n return showUsage(command)\n }\n\n let mod: any\n try {\n mod = await jiti.import('@kubb/mcp', { default: true })\n } catch (_e) {\n console.error(`Import of '@kubb/mcp' is required to start the MCP server`)\n }\n\n const { startServer } = mod\n try {\n console.log('⏳ Starting MCP server...')\n console.warn(pc.yellow('This feature is still under development — use with caution'))\n await startServer()\n } catch (error) {\n console.error((error as Error)?.message)\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;;;AAKA,MAAMA,6EAAmC,EACvC,YAAY,MACb,CAAC;AAaF,MAAM,mCAAwB;CAC5B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAhBW,EACX,MAAM;EACJ,MAAM;EACN,aAAa;EACb,OAAO;EACP,SAAS;EACV,EACF;CAUC,MAAM,IAAI,gBAAgB;EACxB,MAAM,EAAE,SAAS;AAEjB,MAAI,KAAK,KACP,6BAAiB,QAAQ;EAG3B,IAAIC;AACJ,MAAI;AACF,SAAM,MAAMD,OAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;WAChD,IAAI;AACX,WAAQ,MAAM,4DAA4D;;EAG5E,MAAM,EAAE,gBAAgB;AACxB,MAAI;AACF,WAAQ,IAAI,2BAA2B;AACvC,WAAQ,KAAKE,mBAAG,OAAO,6DAA6D,CAAC;AACrF,SAAM,aAAa;WACZ,OAAO;AACd,WAAQ,MAAO,OAAiB,QAAQ;;;CAG7C,CAAC;AAEF,kBAAe"}
1
+ {"version":3,"file":"mcp-D7d_8Bma.cjs","names":["jiti","mod: any","pc"],"sources":["../src/commands/mcp.ts"],"sourcesContent":["import type { ArgsDef } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport { createJiti } from 'jiti'\nimport pc from 'picocolors'\n\nconst jiti = createJiti(import.meta.url, {\n sourceMaps: true,\n})\n\nconst args = {\n help: {\n type: 'boolean',\n description: 'Show help',\n alias: 'h',\n default: false,\n },\n} as const satisfies ArgsDef\n\nconst command = defineCommand({\n meta: {\n name: 'mcp',\n description: 'Start the server to enable the MCP client to interact with the LLM.',\n },\n args,\n async run(commandContext) {\n const { args } = commandContext\n\n if (args.help) {\n return showUsage(command)\n }\n\n let mod: any\n try {\n mod = await jiti.import('@kubb/mcp', { default: true })\n } catch (_e) {\n console.error(`Import of '@kubb/mcp' is required to start the MCP server`)\n }\n\n const { startServer } = mod\n try {\n console.log('⏳ Starting MCP server...')\n console.warn(pc.yellow('This feature is still under development — use with caution'))\n await startServer()\n } catch (error) {\n console.error((error as Error)?.message)\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;;;AAKA,MAAMA,6EAAmC,EACvC,YAAY,MACb,CAAC;AAWF,MAAM,mCAAwB;CAC5B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAdW,EACX,MAAM;EACJ,MAAM;EACN,aAAa;EACb,OAAO;EACP,SAAS;EACV,EACF;CAQC,MAAM,IAAI,gBAAgB;EACxB,MAAM,EAAE,SAAS;AAEjB,MAAI,KAAK,KACP,6BAAiB,QAAQ;EAG3B,IAAIC;AACJ,MAAI;AACF,SAAM,MAAMD,OAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;WAChD,IAAI;AACX,WAAQ,MAAM,4DAA4D;;EAG5E,MAAM,EAAE,gBAAgB;AACxB,MAAI;AACF,WAAQ,IAAI,2BAA2B;AACvC,WAAQ,KAAKE,mBAAG,OAAO,6DAA6D,CAAC;AACrF,SAAM,aAAa;WACZ,OAAO;AACd,WAAQ,MAAO,OAAiB,QAAQ;;;CAG7C,CAAC;AAEF,kBAAe"}
@@ -1,6 +1,6 @@
1
1
 
2
2
  //#region package.json
3
- var version = "4.12.6";
3
+ var version = "4.12.7";
4
4
 
5
5
  //#endregion
6
6
  Object.defineProperty(exports, 'version', {
@@ -9,4 +9,4 @@ Object.defineProperty(exports, 'version', {
9
9
  return version;
10
10
  }
11
11
  });
12
- //# sourceMappingURL=package-4h1lfDoB.cjs.map
12
+ //# sourceMappingURL=package-CrqsFX0R.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-CrqsFX0R.cjs","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -0,0 +1,6 @@
1
+ //#region package.json
2
+ var version = "4.12.7";
3
+
4
+ //#endregion
5
+ export { version as t };
6
+ //# sourceMappingURL=package-V7YSB1bN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-V7YSB1bN.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"validate-Bt922JN-.js","names":["mod: any"],"sources":["../src/commands/validate.ts"],"sourcesContent":["import process from 'node:process'\nimport type { ArgsDef, ParsedArgs } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport { createJiti } from 'jiti'\n\nconst jiti = createJiti(import.meta.url, {\n sourceMaps: true,\n})\n\nconst args = {\n input: {\n type: 'string',\n description: 'Path to Swagger/OpenAPI file',\n alias: 'i',\n },\n help: {\n type: 'boolean',\n description: 'Show help',\n alias: 'h',\n default: false,\n },\n} as const satisfies ArgsDef\n\nexport type Args = ParsedArgs<typeof args>\n\nconst command = defineCommand({\n meta: {\n name: 'validate',\n description: 'Validate a Swagger/OpenAPI file',\n },\n args,\n async run(commandContext) {\n const { args } = commandContext\n\n if (args.help) {\n return showUsage(command)\n }\n\n if (args.input) {\n let mod: any\n try {\n mod = await jiti.import('@kubb/oas', { default: true })\n } catch (_e) {\n console.error(`Import of '@kubb/oas' is required to do validation`)\n }\n\n const { parse } = mod\n try {\n const oas = await parse(args.input)\n await oas.valdiate()\n\n console.log('✅ Validation success')\n } catch (error) {\n console.error('❌ Validation failed')\n console.log((error as Error)?.message)\n process.exit(1)\n }\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;AAKA,MAAM,OAAO,WAAW,OAAO,KAAK,KAAK,EACvC,YAAY,MACb,CAAC;AAkBF,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MArBW;EACX,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACF;CAUC,MAAM,IAAI,gBAAgB;EACxB,MAAM,EAAE,SAAS;AAEjB,MAAI,KAAK,KACP,QAAO,UAAU,QAAQ;AAG3B,MAAI,KAAK,OAAO;GACd,IAAIA;AACJ,OAAI;AACF,UAAM,MAAM,KAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;YAChD,IAAI;AACX,YAAQ,MAAM,qDAAqD;;GAGrE,MAAM,EAAE,UAAU;AAClB,OAAI;AAEF,WADY,MAAM,MAAM,KAAK,MAAM,EACzB,UAAU;AAEpB,YAAQ,IAAI,uBAAuB;YAC5B,OAAO;AACd,YAAQ,MAAM,sBAAsB;AACpC,YAAQ,IAAK,OAAiB,QAAQ;AACtC,YAAQ,KAAK,EAAE;;;;CAItB,CAAC;AAEF,uBAAe"}
1
+ {"version":3,"file":"validate-Bt922JN-.js","names":["mod: any"],"sources":["../src/commands/validate.ts"],"sourcesContent":["import process from 'node:process'\nimport type { ArgsDef } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport { createJiti } from 'jiti'\n\nconst jiti = createJiti(import.meta.url, {\n sourceMaps: true,\n})\n\nconst args = {\n input: {\n type: 'string',\n description: 'Path to Swagger/OpenAPI file',\n alias: 'i',\n },\n help: {\n type: 'boolean',\n description: 'Show help',\n alias: 'h',\n default: false,\n },\n} as const satisfies ArgsDef\n\nconst command = defineCommand({\n meta: {\n name: 'validate',\n description: 'Validate a Swagger/OpenAPI file',\n },\n args,\n async run(commandContext) {\n const { args } = commandContext\n\n if (args.help) {\n return showUsage(command)\n }\n\n if (args.input) {\n let mod: any\n try {\n mod = await jiti.import('@kubb/oas', { default: true })\n } catch (_e) {\n console.error(`Import of '@kubb/oas' is required to do validation`)\n }\n\n const { parse } = mod\n try {\n const oas = await parse(args.input)\n await oas.valdiate()\n\n console.log('✅ Validation success')\n } catch (error) {\n console.error('❌ Validation failed')\n console.log((error as Error)?.message)\n process.exit(1)\n }\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;AAKA,MAAM,OAAO,WAAW,OAAO,KAAK,KAAK,EACvC,YAAY,MACb,CAAC;AAgBF,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAnBW;EACX,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACF;CAQC,MAAM,IAAI,gBAAgB;EACxB,MAAM,EAAE,SAAS;AAEjB,MAAI,KAAK,KACP,QAAO,UAAU,QAAQ;AAG3B,MAAI,KAAK,OAAO;GACd,IAAIA;AACJ,OAAI;AACF,UAAM,MAAM,KAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;YAChD,IAAI;AACX,YAAQ,MAAM,qDAAqD;;GAGrE,MAAM,EAAE,UAAU;AAClB,OAAI;AAEF,WADY,MAAM,MAAM,KAAK,MAAM,EACzB,UAAU;AAEpB,YAAQ,IAAI,uBAAuB;YAC5B,OAAO;AACd,YAAQ,MAAM,sBAAsB;AACpC,YAAQ,IAAK,OAAiB,QAAQ;AACtC,YAAQ,KAAK,EAAE;;;;CAItB,CAAC;AAEF,uBAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"validate-D9LPzg3-.cjs","names":["jiti","mod: any"],"sources":["../src/commands/validate.ts"],"sourcesContent":["import process from 'node:process'\nimport type { ArgsDef, ParsedArgs } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport { createJiti } from 'jiti'\n\nconst jiti = createJiti(import.meta.url, {\n sourceMaps: true,\n})\n\nconst args = {\n input: {\n type: 'string',\n description: 'Path to Swagger/OpenAPI file',\n alias: 'i',\n },\n help: {\n type: 'boolean',\n description: 'Show help',\n alias: 'h',\n default: false,\n },\n} as const satisfies ArgsDef\n\nexport type Args = ParsedArgs<typeof args>\n\nconst command = defineCommand({\n meta: {\n name: 'validate',\n description: 'Validate a Swagger/OpenAPI file',\n },\n args,\n async run(commandContext) {\n const { args } = commandContext\n\n if (args.help) {\n return showUsage(command)\n }\n\n if (args.input) {\n let mod: any\n try {\n mod = await jiti.import('@kubb/oas', { default: true })\n } catch (_e) {\n console.error(`Import of '@kubb/oas' is required to do validation`)\n }\n\n const { parse } = mod\n try {\n const oas = await parse(args.input)\n await oas.valdiate()\n\n console.log('✅ Validation success')\n } catch (error) {\n console.error('❌ Validation failed')\n console.log((error as Error)?.message)\n process.exit(1)\n }\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;;;AAKA,MAAMA,6EAAmC,EACvC,YAAY,MACb,CAAC;AAkBF,MAAM,mCAAwB;CAC5B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MArBW;EACX,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACF;CAUC,MAAM,IAAI,gBAAgB;EACxB,MAAM,EAAE,SAAS;AAEjB,MAAI,KAAK,KACP,6BAAiB,QAAQ;AAG3B,MAAI,KAAK,OAAO;GACd,IAAIC;AACJ,OAAI;AACF,UAAM,MAAMD,OAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;YAChD,IAAI;AACX,YAAQ,MAAM,qDAAqD;;GAGrE,MAAM,EAAE,UAAU;AAClB,OAAI;AAEF,WADY,MAAM,MAAM,KAAK,MAAM,EACzB,UAAU;AAEpB,YAAQ,IAAI,uBAAuB;YAC5B,OAAO;AACd,YAAQ,MAAM,sBAAsB;AACpC,YAAQ,IAAK,OAAiB,QAAQ;AACtC,yBAAQ,KAAK,EAAE;;;;CAItB,CAAC;AAEF,uBAAe"}
1
+ {"version":3,"file":"validate-D9LPzg3-.cjs","names":["jiti","mod: any"],"sources":["../src/commands/validate.ts"],"sourcesContent":["import process from 'node:process'\nimport type { ArgsDef } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport { createJiti } from 'jiti'\n\nconst jiti = createJiti(import.meta.url, {\n sourceMaps: true,\n})\n\nconst args = {\n input: {\n type: 'string',\n description: 'Path to Swagger/OpenAPI file',\n alias: 'i',\n },\n help: {\n type: 'boolean',\n description: 'Show help',\n alias: 'h',\n default: false,\n },\n} as const satisfies ArgsDef\n\nconst command = defineCommand({\n meta: {\n name: 'validate',\n description: 'Validate a Swagger/OpenAPI file',\n },\n args,\n async run(commandContext) {\n const { args } = commandContext\n\n if (args.help) {\n return showUsage(command)\n }\n\n if (args.input) {\n let mod: any\n try {\n mod = await jiti.import('@kubb/oas', { default: true })\n } catch (_e) {\n console.error(`Import of '@kubb/oas' is required to do validation`)\n }\n\n const { parse } = mod\n try {\n const oas = await parse(args.input)\n await oas.valdiate()\n\n console.log('✅ Validation success')\n } catch (error) {\n console.error('❌ Validation failed')\n console.log((error as Error)?.message)\n process.exit(1)\n }\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;;;AAKA,MAAMA,6EAAmC,EACvC,YAAY,MACb,CAAC;AAgBF,MAAM,mCAAwB;CAC5B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAnBW;EACX,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACF;CAQC,MAAM,IAAI,gBAAgB;EACxB,MAAM,EAAE,SAAS;AAEjB,MAAI,KAAK,KACP,6BAAiB,QAAQ;AAG3B,MAAI,KAAK,OAAO;GACd,IAAIC;AACJ,OAAI;AACF,UAAM,MAAMD,OAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;YAChD,IAAI;AACX,YAAQ,MAAM,qDAAqD;;GAGrE,MAAM,EAAE,UAAU;AAClB,OAAI;AAEF,WADY,MAAM,MAAM,KAAK,MAAM,EACzB,UAAU;AAEpB,YAAQ,IAAI,uBAAuB;YAC5B,OAAO;AACd,YAAQ,MAAM,sBAAsB;AACpC,YAAQ,IAAK,OAAiB,QAAQ;AACtC,yBAAQ,KAAK,EAAE;;;;CAItB,CAAC;AAEF,uBAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/cli",
3
- "version": "4.12.6",
3
+ "version": "4.12.7",
4
4
  "description": "Command-line interface for Kubb, enabling easy generation of TypeScript, React-Query, Zod, and other code from OpenAPI specifications.",
5
5
  "keywords": [
6
6
  "cli",
@@ -62,14 +62,14 @@
62
62
  "seedrandom": "^3.0.5",
63
63
  "semver": "^7.7.3",
64
64
  "string-argv": "^0.3.2",
65
- "@kubb/core": "4.12.6"
65
+ "@kubb/core": "4.12.7"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/seedrandom": "^3.0.8",
69
69
  "@types/semver": "^7.7.1",
70
70
  "source-map-support": "^0.5.21",
71
- "@kubb/mcp": "4.12.6",
72
- "@kubb/oas": "4.12.6"
71
+ "@kubb/oas": "4.12.7",
72
+ "@kubb/mcp": "4.12.7"
73
73
  },
74
74
  "engines": {
75
75
  "node": ">=20"
@@ -1,4 +1,4 @@
1
- import type { ArgsDef, ParsedArgs } from 'citty'
1
+ import type { ArgsDef } from 'citty'
2
2
  import { defineCommand, showUsage } from 'citty'
3
3
  import { createJiti } from 'jiti'
4
4
  import pc from 'picocolors'
@@ -16,8 +16,6 @@ const args = {
16
16
  },
17
17
  } as const satisfies ArgsDef
18
18
 
19
- export type Args = ParsedArgs<typeof args>
20
-
21
19
  const command = defineCommand({
22
20
  meta: {
23
21
  name: 'mcp',
@@ -1,5 +1,5 @@
1
1
  import process from 'node:process'
2
- import type { ArgsDef, ParsedArgs } from 'citty'
2
+ import type { ArgsDef } from 'citty'
3
3
  import { defineCommand, showUsage } from 'citty'
4
4
  import { createJiti } from 'jiti'
5
5
 
@@ -21,8 +21,6 @@ const args = {
21
21
  },
22
22
  } as const satisfies ArgsDef
23
23
 
24
- export type Args = ParsedArgs<typeof args>
25
-
26
24
  const command = defineCommand({
27
25
  meta: {
28
26
  name: 'validate',
@@ -1,10 +1,11 @@
1
1
  import { relative } from 'node:path'
2
+ import process from 'node:process'
2
3
  import * as clack from '@clack/prompts'
3
4
  import { defineLogger, LogLevel } from '@kubb/core'
5
+ import { formatHrtime, formatMs } from '@kubb/core/utils'
4
6
  import { execa } from 'execa'
5
7
  import { default as gradientString } from 'gradient-string'
6
8
  import pc from 'picocolors'
7
-
8
9
  import { getSummary } from '../utils/getSummary.ts'
9
10
  import { ClackWritable } from '../utils/Writables.ts'
10
11
 
@@ -16,9 +17,43 @@ export const clackLogger = defineLogger({
16
17
  name: 'clack',
17
18
  install(context, options) {
18
19
  const logLevel = options?.logLevel || LogLevel.info
19
- const activeProgress = new Map<string, { interval?: NodeJS.Timeout; progressBar: clack.ProgressResult }>()
20
- const spinner = clack.spinner()
21
- let isSpinning = false
20
+ const state = {
21
+ totalPlugins: 0,
22
+ completedPlugins: 0,
23
+ failedPlugins: 0,
24
+ totalFiles: 0,
25
+ processedFiles: 0,
26
+ hrStart: process.hrtime(),
27
+ spinner: clack.spinner(),
28
+ isSpinning: false,
29
+ activeProgress: new Map<string, { interval?: NodeJS.Timeout; progressBar: clack.ProgressResult }>(),
30
+ }
31
+
32
+ function showProgressStep() {
33
+ if (logLevel <= LogLevel.silent) {
34
+ return
35
+ }
36
+
37
+ const parts: string[] = []
38
+ const duration = formatHrtime(state.hrStart)
39
+
40
+ if (state.totalPlugins > 0) {
41
+ const pluginStr =
42
+ state.failedPlugins > 0
43
+ ? `Plugins ${pc.green(state.completedPlugins.toString())}/${state.totalPlugins} ${pc.red(`(${state.failedPlugins} failed)`)}`
44
+ : `Plugins ${pc.green(state.completedPlugins.toString())}/${state.totalPlugins}`
45
+ parts.push(pluginStr)
46
+ }
47
+
48
+ if (state.totalFiles > 0) {
49
+ parts.push(`Files ${pc.green(state.processedFiles.toString())}/${state.totalFiles}`)
50
+ }
51
+
52
+ if (parts.length > 0) {
53
+ parts.push(pc.green(duration))
54
+ clack.log.step(parts.join(pc.dim(' | ')))
55
+ }
56
+ }
22
57
 
23
58
  function getMessage(message: string): string {
24
59
  if (logLevel >= LogLevel.verbose) {
@@ -36,13 +71,13 @@ export const clackLogger = defineLogger({
36
71
  }
37
72
 
38
73
  function startSpinner(text?: string) {
39
- spinner.start(text)
40
- isSpinning = true
74
+ state.spinner.start(text)
75
+ state.isSpinning = true
41
76
  }
42
77
 
43
78
  function stopSpinner(text?: string) {
44
- spinner.stop(text)
45
- isSpinning = false
79
+ state.spinner.stop(text)
80
+ state.isSpinning = false
46
81
  }
47
82
 
48
83
  context.on('info', (message, info = '') => {
@@ -52,8 +87,8 @@ export const clackLogger = defineLogger({
52
87
 
53
88
  const text = getMessage([pc.blue('ℹ'), message, pc.dim(info)].join(' '))
54
89
 
55
- if (isSpinning) {
56
- spinner.message(text)
90
+ if (state.isSpinning) {
91
+ state.spinner.message(text)
57
92
  } else {
58
93
  clack.log.info(text)
59
94
  }
@@ -66,7 +101,7 @@ export const clackLogger = defineLogger({
66
101
 
67
102
  const text = getMessage([pc.blue('✓'), message, logLevel >= LogLevel.info ? pc.dim(info) : undefined].filter(Boolean).join(' '))
68
103
 
69
- if (isSpinning) {
104
+ if (state.isSpinning) {
70
105
  stopSpinner(text)
71
106
  } else {
72
107
  clack.log.success(text)
@@ -88,7 +123,7 @@ export const clackLogger = defineLogger({
88
123
 
89
124
  const text = [pc.red('✗'), error.message].join(' ')
90
125
 
91
- if (isSpinning) {
126
+ if (state.isSpinning) {
92
127
  stopSpinner(getMessage(text))
93
128
  } else {
94
129
  clack.log.error(getMessage(text))
@@ -147,7 +182,7 @@ Run \`npm install -g @kubb/cli\` to update`,
147
182
  startSpinner(getMessage('Configuration loading'))
148
183
  })
149
184
 
150
- context.on('config:end', () => {
185
+ context.on('config:end', (_configs) => {
151
186
  if (logLevel <= LogLevel.silent) {
152
187
  return
153
188
  }
@@ -158,6 +193,12 @@ Run \`npm install -g @kubb/cli\` to update`,
158
193
  })
159
194
 
160
195
  context.on('generation:start', (config) => {
196
+ // Initialize progress tracking
197
+ state.totalPlugins = config.plugins?.length || 0
198
+ state.completedPlugins = 0
199
+ state.failedPlugins = 0
200
+ state.hrStart = process.hrtime()
201
+
161
202
  const text = getMessage(['Generation started', config.name ? `for ${pc.dim(config.name)}` : undefined].filter(Boolean).join(' '))
162
203
 
163
204
  clack.intro(text)
@@ -182,13 +223,13 @@ Run \`npm install -g @kubb/cli\` to update`,
182
223
  progressBar.advance()
183
224
  }, 50)
184
225
 
185
- activeProgress.set(plugin.name, { progressBar, interval })
226
+ state.activeProgress.set(plugin.name, { progressBar, interval })
186
227
  })
187
228
 
188
- context.on('plugin:end', (plugin, duration) => {
229
+ context.on('plugin:end', (plugin, { duration, success }) => {
189
230
  stopSpinner()
190
231
 
191
- const active = activeProgress.get(plugin.name)
232
+ const active = state.activeProgress.get(plugin.name)
192
233
 
193
234
  if (!active || logLevel === LogLevel.silent) {
194
235
  return
@@ -196,11 +237,22 @@ Run \`npm install -g @kubb/cli\` to update`,
196
237
 
197
238
  clearInterval(active.interval)
198
239
 
199
- const durationStr = duration >= 1000 ? `${(duration / 1000).toFixed(2)}s` : `${duration}ms`
200
- const text = getMessage(`${pc.bold(plugin.name)} completed in ${pc.green(durationStr)}`)
240
+ if (success) {
241
+ state.completedPlugins++
242
+ } else {
243
+ state.failedPlugins++
244
+ }
245
+
246
+ const durationStr = formatMs(duration)
247
+ const text = getMessage(
248
+ success ? `${pc.bold(plugin.name)} completed in ${pc.green(durationStr)}` : `${pc.bold(plugin.name)} failed in ${pc.red(durationStr)}`,
249
+ )
201
250
 
202
251
  active.progressBar.stop(text)
203
- activeProgress.delete(plugin.name)
252
+ state.activeProgress.delete(plugin.name)
253
+
254
+ // Show progress step after each plugin
255
+ showProgressStep()
204
256
  })
205
257
 
206
258
  context.on('files:processing:start', (files) => {
@@ -210,6 +262,9 @@ Run \`npm install -g @kubb/cli\` to update`,
210
262
 
211
263
  stopSpinner()
212
264
 
265
+ state.totalFiles = files.length
266
+ state.processedFiles = 0
267
+
213
268
  const text = `Writing ${files.length} files`
214
269
  const progressBar = clack.progress({
215
270
  style: 'block',
@@ -219,7 +274,7 @@ Run \`npm install -g @kubb/cli\` to update`,
219
274
 
220
275
  context.emit('info', text)
221
276
  progressBar.start(getMessage(text))
222
- activeProgress.set('files', { progressBar })
277
+ state.activeProgress.set('files', { progressBar })
223
278
  })
224
279
 
225
280
  context.on('file:processing:update', ({ file, config }) => {
@@ -229,8 +284,10 @@ Run \`npm install -g @kubb/cli\` to update`,
229
284
 
230
285
  stopSpinner()
231
286
 
287
+ state.processedFiles++
288
+
232
289
  const text = `Writing ${relative(config.root, file.path)}`
233
- const active = activeProgress.get('files')
290
+ const active = state.activeProgress.get('files')
234
291
 
235
292
  if (!active) {
236
293
  return
@@ -246,14 +303,17 @@ Run \`npm install -g @kubb/cli\` to update`,
246
303
  stopSpinner()
247
304
 
248
305
  const text = getMessage('Files written successfully')
249
- const active = activeProgress.get('files')
306
+ const active = state.activeProgress.get('files')
250
307
 
251
308
  if (!active) {
252
309
  return
253
310
  }
254
311
 
255
312
  active.progressBar.stop(text)
256
- activeProgress.delete('files')
313
+ state.activeProgress.delete('files')
314
+
315
+ // Show final progress step after files are written
316
+ showProgressStep()
257
317
  })
258
318
 
259
319
  context.on('generation:end', (config) => {
@@ -421,13 +481,13 @@ Run \`npm install -g @kubb/cli\` to update`,
421
481
  })
422
482
 
423
483
  context.on('lifecycle:end', () => {
424
- for (const [_key, active] of activeProgress) {
484
+ for (const [_key, active] of state.activeProgress) {
425
485
  if (active.interval) {
426
486
  clearInterval(active.interval)
427
487
  }
428
488
  active.progressBar?.stop()
429
489
  }
430
- activeProgress.clear()
490
+ state.activeProgress.clear()
431
491
  })
432
492
  },
433
493
  })
@@ -1,4 +1,5 @@
1
1
  import { type Config, defineLogger, LogLevel } from '@kubb/core'
2
+ import { formatHrtime, formatMs } from '@kubb/core/utils'
2
3
  import { execa } from 'execa'
3
4
  import pc from 'picocolors'
4
5
 
@@ -10,7 +11,41 @@ export const githubActionsLogger = defineLogger({
10
11
  name: 'github-actions',
11
12
  install(context, options) {
12
13
  const logLevel = options?.logLevel || LogLevel.info
13
- let currentConfigs: Array<Config> = []
14
+ const state = {
15
+ totalPlugins: 0,
16
+ completedPlugins: 0,
17
+ failedPlugins: 0,
18
+ totalFiles: 0,
19
+ processedFiles: 0,
20
+ hrStart: process.hrtime(),
21
+ currentConfigs: [] as Array<Config>,
22
+ }
23
+
24
+ function showProgressStep() {
25
+ if (logLevel <= LogLevel.silent) {
26
+ return
27
+ }
28
+
29
+ const parts: string[] = []
30
+ const duration = formatHrtime(state.hrStart)
31
+
32
+ if (state.totalPlugins > 0) {
33
+ const pluginStr =
34
+ state.failedPlugins > 0
35
+ ? `Plugins ${pc.green(state.completedPlugins.toString())}/${state.totalPlugins} ${pc.red(`(${state.failedPlugins} failed)`)}`
36
+ : `Plugins ${pc.green(state.completedPlugins.toString())}/${state.totalPlugins}`
37
+ parts.push(pluginStr)
38
+ }
39
+
40
+ if (state.totalFiles > 0) {
41
+ parts.push(`Files ${pc.green(state.processedFiles.toString())}/${state.totalFiles}`)
42
+ }
43
+
44
+ if (parts.length > 0) {
45
+ parts.push(pc.green(duration))
46
+ console.log(parts.join(pc.dim(' | ')))
47
+ }
48
+ }
14
49
 
15
50
  function getMessage(message: string): string {
16
51
  if (logLevel >= LogLevel.verbose) {
@@ -90,7 +125,7 @@ export const githubActionsLogger = defineLogger({
90
125
  })
91
126
 
92
127
  context.on('config:end', (configs) => {
93
- currentConfigs = configs
128
+ state.currentConfigs = configs
94
129
 
95
130
  if (logLevel <= LogLevel.silent) {
96
131
  return
@@ -104,13 +139,19 @@ export const githubActionsLogger = defineLogger({
104
139
  })
105
140
 
106
141
  context.on('generation:start', (config) => {
142
+ // Initialize progress tracking
143
+ state.totalPlugins = config.plugins?.length || 0
144
+ state.completedPlugins = 0
145
+ state.failedPlugins = 0
146
+ state.hrStart = process.hrtime()
147
+
107
148
  const text = config.name ? `Generation for ${pc.bold(config.name)}` : 'Generation'
108
149
 
109
- if (currentConfigs.length > 1) {
150
+ if (state.currentConfigs.length > 1) {
110
151
  openGroup(text)
111
152
  }
112
153
 
113
- if (currentConfigs.length === 1) {
154
+ if (state.currentConfigs.length === 1) {
114
155
  console.log(getMessage(text))
115
156
  }
116
157
  })
@@ -121,35 +162,51 @@ export const githubActionsLogger = defineLogger({
121
162
  }
122
163
  const text = getMessage(`Generating ${pc.bold(plugin.name)}`)
123
164
 
124
- if (currentConfigs.length === 1) {
165
+ if (state.currentConfigs.length === 1) {
125
166
  openGroup(`Plugin: ${plugin.name}`)
126
167
  }
127
168
 
128
169
  console.log(text)
129
170
  })
130
171
 
131
- context.on('plugin:end', (plugin, duration) => {
172
+ context.on('plugin:end', (plugin, { duration, success }) => {
132
173
  if (logLevel <= LogLevel.silent) {
133
174
  return
134
175
  }
135
- const durationStr = duration >= 1000 ? `${(duration / 1000).toFixed(2)}s` : `${duration}ms`
136
- const text = getMessage(`${pc.bold(plugin.name)} completed in ${pc.green(durationStr)}`)
176
+
177
+ if (success) {
178
+ state.completedPlugins++
179
+ } else {
180
+ state.failedPlugins++
181
+ }
182
+
183
+ const durationStr = formatMs(duration)
184
+ const text = getMessage(
185
+ success ? `${pc.bold(plugin.name)} completed in ${pc.green(durationStr)}` : `${pc.bold(plugin.name)} failed in ${pc.red(durationStr)}`,
186
+ )
137
187
 
138
188
  console.log(text)
139
- if (currentConfigs.length > 1) {
189
+ if (state.currentConfigs.length > 1) {
140
190
  console.log(' ')
141
191
  }
142
192
 
143
- if (currentConfigs.length === 1) {
193
+ if (state.currentConfigs.length === 1) {
144
194
  closeGroup(`Plugin: ${plugin.name}`)
145
195
  }
196
+
197
+ // Show progress step after each plugin
198
+ showProgressStep()
146
199
  })
147
200
 
148
201
  context.on('files:processing:start', (files) => {
149
202
  if (logLevel <= LogLevel.silent) {
150
203
  return
151
204
  }
152
- if (currentConfigs.length === 1) {
205
+
206
+ state.totalFiles = files.length
207
+ state.processedFiles = 0
208
+
209
+ if (state.currentConfigs.length === 1) {
153
210
  openGroup('File Generation')
154
211
  }
155
212
  const text = getMessage(`Writing ${files.length} files`)
@@ -165,11 +222,28 @@ export const githubActionsLogger = defineLogger({
165
222
 
166
223
  console.log(text)
167
224
 
168
- if (currentConfigs.length === 1) {
225
+ if (state.currentConfigs.length === 1) {
169
226
  closeGroup('File Generation')
170
227
  }
171
228
  })
172
229
 
230
+ context.on('file:processing:update', () => {
231
+ if (logLevel <= LogLevel.silent) {
232
+ return
233
+ }
234
+
235
+ state.processedFiles++
236
+ })
237
+
238
+ context.on('files:processing:end', () => {
239
+ if (logLevel <= LogLevel.silent) {
240
+ return
241
+ }
242
+
243
+ // Show final progress step after files are written
244
+ showProgressStep()
245
+ })
246
+
173
247
  context.on('generation:end', (config) => {
174
248
  const text = getMessage(config.name ? `${pc.blue('✓')} Generation completed for ${pc.dim(config.name)}` : `${pc.blue('✓')} Generation completed`)
175
249
 
@@ -211,7 +285,7 @@ export const githubActionsLogger = defineLogger({
211
285
 
212
286
  const text = getMessage('Format started')
213
287
 
214
- if (currentConfigs.length === 1) {
288
+ if (state.currentConfigs.length === 1) {
215
289
  openGroup('Formatting')
216
290
  }
217
291
 
@@ -227,7 +301,7 @@ export const githubActionsLogger = defineLogger({
227
301
 
228
302
  console.log(text)
229
303
 
230
- if (currentConfigs.length === 1) {
304
+ if (state.currentConfigs.length === 1) {
231
305
  closeGroup('Formatting')
232
306
  }
233
307
  })
@@ -239,7 +313,7 @@ export const githubActionsLogger = defineLogger({
239
313
 
240
314
  const text = getMessage('Lint started')
241
315
 
242
- if (currentConfigs.length === 1) {
316
+ if (state.currentConfigs.length === 1) {
243
317
  openGroup('Linting')
244
318
  }
245
319
 
@@ -255,7 +329,7 @@ export const githubActionsLogger = defineLogger({
255
329
 
256
330
  console.log(text)
257
331
 
258
- if (currentConfigs.length === 1) {
332
+ if (state.currentConfigs.length === 1) {
259
333
  closeGroup('Linting')
260
334
  }
261
335
  })
@@ -267,7 +341,7 @@ export const githubActionsLogger = defineLogger({
267
341
 
268
342
  const text = getMessage(`Hook ${pc.dim(command)} started`)
269
343
 
270
- if (currentConfigs.length === 1) {
344
+ if (state.currentConfigs.length === 1) {
271
345
  openGroup(`Hook ${command}`)
272
346
  }
273
347
 
@@ -283,7 +357,7 @@ export const githubActionsLogger = defineLogger({
283
357
 
284
358
  console.log(text)
285
359
 
286
- if (currentConfigs.length === 1) {
360
+ if (state.currentConfigs.length === 1) {
287
361
  closeGroup(`Hook ${command}`)
288
362
  }
289
363
  })
@@ -292,7 +366,7 @@ export const githubActionsLogger = defineLogger({
292
366
  const pluginsCount = config.plugins?.length || 0
293
367
  const successCount = pluginsCount - failedPlugins.size
294
368
 
295
- if (currentConfigs.length > 1) {
369
+ if (state.currentConfigs.length > 1) {
296
370
  console.log(' ')
297
371
  }
298
372
 
@@ -302,7 +376,7 @@ export const githubActionsLogger = defineLogger({
302
376
  : `Kubb Summary: ${pc.blue('✓')} ${`${successCount} successful`}, ✗ ${`${failedPlugins.size} failed`}, ${pluginsCount} total`,
303
377
  )
304
378
 
305
- if (currentConfigs.length > 1) {
379
+ if (state.currentConfigs.length > 1) {
306
380
  closeGroup(config.name ? `Generation for ${pc.bold(config.name)}` : 'Generation')
307
381
  }
308
382
  })
@@ -1,5 +1,6 @@
1
1
  import { relative } from 'node:path'
2
2
  import { defineLogger, LogLevel } from '@kubb/core'
3
+ import { formatMs } from '@kubb/core/utils'
3
4
  import { execa } from 'execa'
4
5
  import { getSummary } from '../utils/getSummary.ts'
5
6
 
@@ -121,13 +122,13 @@ export const plainLogger = defineLogger({
121
122
  console.log(text)
122
123
  })
123
124
 
124
- context.on('plugin:end', (plugin, duration) => {
125
+ context.on('plugin:end', (plugin, { duration, success }) => {
125
126
  if (logLevel <= LogLevel.silent) {
126
127
  return
127
128
  }
128
129
 
129
- const durationStr = duration >= 1000 ? `${(duration / 1000).toFixed(2)}s` : `${duration}ms`
130
- const text = getMessage(`${plugin.name} completed in ${durationStr}`)
130
+ const durationStr = formatMs(duration)
131
+ const text = getMessage(success ? `${plugin.name} completed in ${durationStr}` : `${plugin.name} failed in ${durationStr}`)
131
132
 
132
133
  console.log(text)
133
134
  })
@@ -15,11 +15,3 @@ export class ClackWritable extends Writable {
15
15
  callback()
16
16
  }
17
17
  }
18
-
19
- export class StdoutWritable extends Writable {
20
- _write(chunk: any, _encoding: BufferEncoding, callback: (error?: Error | null) => void): void {
21
- process.stdout.write(`${pc.dim(chunk?.toString())}`)
22
-
23
- callback()
24
- }
25
- }