@kubb/cli 5.0.0-beta.9 → 5.0.0-beta.91

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.
Files changed (136) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +48 -79
  3. package/bin/kubb.js +9 -3
  4. package/dist/Telemetry-7z2tIqPm.js +282 -0
  5. package/dist/Telemetry-7z2tIqPm.js.map +1 -0
  6. package/dist/{telemetry-B2iWkY5e.cjs → Telemetry-xcWb-UWT.cjs} +167 -116
  7. package/dist/Telemetry-xcWb-UWT.cjs.map +1 -0
  8. package/dist/{errors-CINO1EIv.js → errors-CMvLO2NE.js} +3 -15
  9. package/dist/{errors-CINO1EIv.js.map → errors-CMvLO2NE.js.map} +1 -1
  10. package/dist/{errors-CLCjoSg0.cjs → errors-DNxBUo3k.cjs} +2 -20
  11. package/dist/{errors-CLCjoSg0.cjs.map → errors-DNxBUo3k.cjs.map} +1 -1
  12. package/dist/generate-C9fJvlhv.js +87 -0
  13. package/dist/generate-C9fJvlhv.js.map +1 -0
  14. package/dist/generate-CIVRaeeA.cjs +87 -0
  15. package/dist/generate-CIVRaeeA.cjs.map +1 -0
  16. package/dist/index.cjs +33 -261
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.ts +6 -1
  19. package/dist/index.js +34 -262
  20. package/dist/index.js.map +1 -1
  21. package/dist/{init-bKtEOvhK.cjs → init-BBmle7Oc.cjs} +12 -13
  22. package/dist/init-BBmle7Oc.cjs.map +1 -0
  23. package/dist/{init-DOSXtcyb.js → init-DXjubhO6.js} +13 -13
  24. package/dist/init-DXjubhO6.js.map +1 -0
  25. package/dist/mcp-DLKKD_8s.js +21 -0
  26. package/dist/mcp-DLKKD_8s.js.map +1 -0
  27. package/dist/mcp-Dzgpeor_.cjs +20 -0
  28. package/dist/mcp-Dzgpeor_.cjs.map +1 -0
  29. package/dist/{package-DHGhrRW-.cjs → package-Bsc6NeTU.cjs} +2 -2
  30. package/dist/package-Bsc6NeTU.cjs.map +1 -0
  31. package/dist/package-CaBsNdoM.js +6 -0
  32. package/dist/package-CaBsNdoM.js.map +1 -0
  33. package/dist/{chunk-BvFE5Tac.js → rolldown-runtime-C0LytTxp.js} +0 -1
  34. package/dist/run-BBS4Sc38.js +1256 -0
  35. package/dist/run-BBS4Sc38.js.map +1 -0
  36. package/dist/{run-YsoCk5we.cjs → run-BNOCBw2y.cjs} +152 -98
  37. package/dist/run-BNOCBw2y.cjs.map +1 -0
  38. package/dist/{run-CQbj3ley.cjs → run-BdtVrLKu.cjs} +9 -15
  39. package/dist/run-BdtVrLKu.cjs.map +1 -0
  40. package/dist/run-Bgn3IPJt.cjs +1259 -0
  41. package/dist/run-Bgn3IPJt.cjs.map +1 -0
  42. package/dist/{run-CF97BWVa.js → run-CINOocLR.js} +138 -84
  43. package/dist/run-CINOocLR.js.map +1 -0
  44. package/dist/{run-CCZ24VKk.js → run-CaOjZRiQ.js} +7 -13
  45. package/dist/run-CaOjZRiQ.js.map +1 -0
  46. package/dist/run-D2vd34xp.cjs +33 -0
  47. package/dist/run-D2vd34xp.cjs.map +1 -0
  48. package/dist/run-lgrTO14E.js +32 -0
  49. package/dist/run-lgrTO14E.js.map +1 -0
  50. package/dist/tools-B23ltmWP.js +152 -0
  51. package/dist/tools-B23ltmWP.js.map +1 -0
  52. package/dist/tools-CeIABV0T.cjs +175 -0
  53. package/dist/tools-CeIABV0T.cjs.map +1 -0
  54. package/dist/{validate-Bj8vbvPt.cjs → validate-DaxZu9c3.cjs} +9 -10
  55. package/dist/validate-DaxZu9c3.cjs.map +1 -0
  56. package/dist/{validate-bHUrnYBv.js → validate-ugxFStuH.js} +10 -10
  57. package/dist/validate-ugxFStuH.js.map +1 -0
  58. package/package.json +14 -28
  59. package/dist/agent-C5F4itrc.js +0 -68
  60. package/dist/agent-C5F4itrc.js.map +0 -1
  61. package/dist/agent-d-lmeOr1.cjs +0 -70
  62. package/dist/agent-d-lmeOr1.cjs.map +0 -1
  63. package/dist/constants-B2JTeRBb.js +0 -42
  64. package/dist/constants-B2JTeRBb.js.map +0 -1
  65. package/dist/constants-BINTA5VZ.cjs +0 -77
  66. package/dist/constants-BINTA5VZ.cjs.map +0 -1
  67. package/dist/constants-BYGmiFs0.cjs +0 -139
  68. package/dist/constants-BYGmiFs0.cjs.map +0 -1
  69. package/dist/constants-DSJ-Xrbv.js +0 -116
  70. package/dist/constants-DSJ-Xrbv.js.map +0 -1
  71. package/dist/define-Bdn8j5VM.cjs +0 -54
  72. package/dist/define-Bdn8j5VM.cjs.map +0 -1
  73. package/dist/define-m_fp-Aqm.js +0 -43
  74. package/dist/define-m_fp-Aqm.js.map +0 -1
  75. package/dist/generate-BhfRufgh.js +0 -72
  76. package/dist/generate-BhfRufgh.js.map +0 -1
  77. package/dist/generate-BvuSxNYj.cjs +0 -71
  78. package/dist/generate-BvuSxNYj.cjs.map +0 -1
  79. package/dist/init-DOSXtcyb.js.map +0 -1
  80. package/dist/init-bKtEOvhK.cjs.map +0 -1
  81. package/dist/mcp-CKkbG0kp.cjs +0 -39
  82. package/dist/mcp-CKkbG0kp.cjs.map +0 -1
  83. package/dist/mcp-DzOfqX_j.js +0 -39
  84. package/dist/mcp-DzOfqX_j.js.map +0 -1
  85. package/dist/package-BgAYWN7y.js +0 -6
  86. package/dist/package-BgAYWN7y.js.map +0 -1
  87. package/dist/package-DHGhrRW-.cjs.map +0 -1
  88. package/dist/run-BObDb2qe.cjs +0 -1741
  89. package/dist/run-BObDb2qe.cjs.map +0 -1
  90. package/dist/run-BzpYYOQs.js +0 -121
  91. package/dist/run-BzpYYOQs.js.map +0 -1
  92. package/dist/run-CCZ24VKk.js.map +0 -1
  93. package/dist/run-CF97BWVa.js.map +0 -1
  94. package/dist/run-CQbj3ley.cjs.map +0 -1
  95. package/dist/run-D0hmRpHy.js +0 -49
  96. package/dist/run-D0hmRpHy.js.map +0 -1
  97. package/dist/run-DwdAwnLG.cjs +0 -125
  98. package/dist/run-DwdAwnLG.cjs.map +0 -1
  99. package/dist/run-Lr0Ctnu0.cjs +0 -50
  100. package/dist/run-Lr0Ctnu0.cjs.map +0 -1
  101. package/dist/run-P6D8TnXf.js +0 -1738
  102. package/dist/run-P6D8TnXf.js.map +0 -1
  103. package/dist/run-YsoCk5we.cjs.map +0 -1
  104. package/dist/shell-475fQKaX.cjs +0 -62
  105. package/dist/shell-475fQKaX.cjs.map +0 -1
  106. package/dist/shell-CN6DNqeC.js +0 -51
  107. package/dist/shell-CN6DNqeC.js.map +0 -1
  108. package/dist/telemetry-B2iWkY5e.cjs.map +0 -1
  109. package/dist/telemetry-BkektVz6.js +0 -243
  110. package/dist/telemetry-BkektVz6.js.map +0 -1
  111. package/dist/validate-Bj8vbvPt.cjs.map +0 -1
  112. package/dist/validate-bHUrnYBv.js.map +0 -1
  113. package/src/commands/agent/start.ts +0 -50
  114. package/src/commands/agent.ts +0 -10
  115. package/src/commands/generate.ts +0 -59
  116. package/src/commands/init.ts +0 -51
  117. package/src/commands/mcp.ts +0 -36
  118. package/src/commands/validate.ts +0 -22
  119. package/src/constants.ts +0 -48
  120. package/src/index.ts +0 -45
  121. package/src/loggers/clackLogger.ts +0 -460
  122. package/src/loggers/fileSystemLogger.ts +0 -151
  123. package/src/loggers/githubActionsLogger.ts +0 -367
  124. package/src/loggers/plainLogger.ts +0 -243
  125. package/src/loggers/types.ts +0 -7
  126. package/src/loggers/utils.ts +0 -252
  127. package/src/runners/agent/run.ts +0 -113
  128. package/src/runners/agent/utils.ts +0 -98
  129. package/src/runners/generate/run.ts +0 -276
  130. package/src/runners/generate/utils.ts +0 -209
  131. package/src/runners/init/run.ts +0 -211
  132. package/src/runners/init/utils.ts +0 -33
  133. package/src/runners/mcp/run.ts +0 -55
  134. package/src/runners/validate/run.ts +0 -63
  135. package/src/telemetry.ts +0 -280
  136. /package/dist/{chunk-ByKO4r7w.cjs → rolldown-runtime-Bx3C2hgW.cjs} +0 -0
@@ -1,125 +0,0 @@
1
- const require_chunk = require("./chunk-ByKO4r7w.cjs");
2
- const require_errors = require("./errors-CLCjoSg0.cjs");
3
- const require_telemetry = require("./telemetry-B2iWkY5e.cjs");
4
- const require_shell = require("./shell-475fQKaX.cjs");
5
- const require_constants = require("./constants-BINTA5VZ.cjs");
6
- let node_util = require("node:util");
7
- let node_path = require("node:path");
8
- node_path = require_chunk.__toESM(node_path, 1);
9
- let node_process = require("node:process");
10
- node_process = require_chunk.__toESM(node_process, 1);
11
- let node_module = require("node:module");
12
- let _clack_prompts = require("@clack/prompts");
13
- _clack_prompts = require_chunk.__toESM(_clack_prompts, 1);
14
- let node_net = require("node:net");
15
- node_net = require_chunk.__toESM(node_net, 1);
16
- //#region src/runners/agent/utils.ts
17
- /**
18
- * Resolves the environment passed to the detached agent process using CLI values first, then environment values, then CLI defaults.
19
- */
20
- function resolveAgentStartEnvironment({ port, host, configPath, allowWrite, allowAll }) {
21
- const resolvedPort = port ?? node_process.default.env.PORT ?? require_constants.agentDefaults.port;
22
- const resolvedHost = host !== require_constants.agentDefaults.host ? host : node_process.default.env.HOST ?? require_constants.agentDefaults.host;
23
- const resolvedAllowAll = allowAll || node_process.default.env.KUBB_AGENT_ALLOW_ALL === "true";
24
- const resolvedAllowWrite = resolvedAllowAll || allowWrite || node_process.default.env.KUBB_AGENT_ALLOW_WRITE === "true";
25
- const agentRoot = node_process.default.env.KUBB_AGENT_ROOT ?? node_process.default.cwd();
26
- const agentConfigPath = node_path.default.resolve(node_process.default.cwd(), configPath || node_process.default.env.KUBB_AGENT_CONFIG || require_constants.agentDefaults.configFile);
27
- return {
28
- port: resolvedPort,
29
- host: resolvedHost,
30
- allowWrite: resolvedAllowWrite,
31
- allowAll: resolvedAllowAll,
32
- agentConfigPath,
33
- env: {
34
- ...node_process.default.env,
35
- PORT: resolvedPort,
36
- HOST: resolvedHost,
37
- KUBB_AGENT_ROOT: agentRoot,
38
- KUBB_AGENT_CONFIG: agentConfigPath,
39
- KUBB_AGENT_ALLOW_WRITE: String(resolvedAllowWrite),
40
- KUBB_AGENT_ALLOW_ALL: String(resolvedAllowAll),
41
- KUBB_AGENT_TOKEN: node_process.default.env.KUBB_AGENT_TOKEN,
42
- KUBB_AGENT_RETRY_TIMEOUT: node_process.default.env.KUBB_AGENT_RETRY_TIMEOUT ?? require_constants.agentDefaults.retryTimeout,
43
- KUBB_STUDIO_URL: node_process.default.env.KUBB_STUDIO_URL ?? require_constants.agentDefaults.studioUrl
44
- }
45
- };
46
- }
47
- function isPortAvailable(port, host) {
48
- return new Promise((resolve) => {
49
- const server = node_net.default.createServer();
50
- server.once("error", () => resolve(false));
51
- server.once("listening", () => {
52
- server.close();
53
- resolve(true);
54
- });
55
- server.listen(port, host);
56
- });
57
- }
58
- //#endregion
59
- //#region src/runners/agent/run.ts
60
- /**
61
- * Spawns the Kubb Agent HTTP server as a Node.js subprocess.
62
- * Resolves config from CLI flags and environment variables, validates the port, and exits with code 1 on failure.
63
- */
64
- async function run({ port, host, configPath, allowWrite, allowAll, version }) {
65
- const hrStart = node_process.default.hrtime();
66
- const report = (status) => require_telemetry.sendTelemetry(require_telemetry.buildTelemetryEvent({
67
- command: "agent",
68
- kubbVersion: version,
69
- hrStart,
70
- status
71
- }));
72
- try {
73
- try {
74
- node_process.default.loadEnvFile();
75
- } catch {}
76
- const require = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
77
- let agentPkgPath;
78
- try {
79
- agentPkgPath = require.resolve("@kubb/agent/package.json");
80
- } catch (_e) {
81
- console.error((0, node_util.styleText)("red", "The @kubb/agent package is not installed."));
82
- console.error("");
83
- console.error("Install it with:");
84
- console.error((0, node_util.styleText)("cyan", " npm install @kubb/agent"));
85
- console.error((0, node_util.styleText)("cyan", " # or"));
86
- console.error((0, node_util.styleText)("cyan", " pnpm install @kubb/agent"));
87
- console.error("");
88
- node_process.default.exit(1);
89
- }
90
- const agentDir = node_path.default.dirname(agentPkgPath);
91
- const serverPath = node_path.default.join(agentDir, require_constants.agentDefaults.serverEntryPath);
92
- const resolvedEnv = resolveAgentStartEnvironment({
93
- port,
94
- host,
95
- configPath,
96
- allowWrite,
97
- allowAll
98
- });
99
- const numericPort = Number(resolvedEnv.port);
100
- if (!Number.isInteger(numericPort) || numericPort <= 0) throw new Error(`Invalid port "${resolvedEnv.port}". Provide a positive integer with --port or PORT.`);
101
- _clack_prompts.log.step((0, node_util.styleText)("cyan", "Starting agent server..."));
102
- _clack_prompts.log.info((0, node_util.styleText)("dim", `Config: ${resolvedEnv.agentConfigPath}`));
103
- _clack_prompts.log.info((0, node_util.styleText)("dim", `Host: ${resolvedEnv.host}`));
104
- _clack_prompts.log.info((0, node_util.styleText)("dim", `Port: ${resolvedEnv.port}`));
105
- if (!resolvedEnv.allowWrite && !resolvedEnv.allowAll) _clack_prompts.log.warn((0, node_util.styleText)("yellow", "Filesystem writes disabled. Use --allow-write or --allow-all to enable."));
106
- if (!await isPortAvailable(numericPort, resolvedEnv.host)) {
107
- _clack_prompts.log.error((0, node_util.styleText)("red", `Port ${resolvedEnv.port} is already in use. Stop the existing process or choose a different port with --port.`));
108
- node_process.default.exit(1);
109
- }
110
- await require_shell.spawnAsync("node", [serverPath], {
111
- env: resolvedEnv.env,
112
- cwd: node_process.default.cwd()
113
- });
114
- await report("success");
115
- } catch (error) {
116
- await report("failed");
117
- _clack_prompts.log.error((0, node_util.styleText)("red", "Failed to start agent server"));
118
- _clack_prompts.log.error(require_errors.getErrorMessage(error));
119
- node_process.default.exit(1);
120
- }
121
- }
122
- //#endregion
123
- exports.run = run;
124
-
125
- //# sourceMappingURL=run-DwdAwnLG.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-DwdAwnLG.cjs","names":["process","agentDefaults","path","net","process","sendTelemetry","buildTelemetryEvent","path","agentDefaults","spawnAsync","getErrorMessage"],"sources":["../src/runners/agent/utils.ts","../src/runners/agent/run.ts"],"sourcesContent":["import net from 'node:net'\nimport path from 'node:path'\nimport process from 'node:process'\nimport { agentDefaults } from '../../constants.ts'\n\ntype AgentStartEnvironmentInput = {\n /**\n * TCP port for the HTTP server. When `undefined`, falls back to `PORT` env var or the default (`3000`).\n */\n port: string | undefined\n /**\n * Hostname the HTTP server binds to.\n */\n host: string\n /**\n * Explicit path to the Kubb config file. When `undefined`, falls back to `KUBB_AGENT_CONFIG` or the default filename.\n */\n configPath: string | undefined\n /**\n * Grants the agent permission to write generated files to the filesystem.\n */\n allowWrite: boolean\n /**\n * Grants all agent permissions, including filesystem writes. Implies `allowWrite`.\n */\n allowAll: boolean\n}\n\ntype ResolvedAgentStartEnvironment = {\n /**\n * Final port string after merging CLI flag, `PORT` env var, and the default.\n */\n port: string\n /**\n * Final hostname after merging CLI flag, `HOST` env var, and the default.\n */\n host: string\n /**\n * Effective write-permission flag, accounting for `allowAll` and `KUBB_AGENT_ALLOW_WRITE`.\n */\n allowWrite: boolean\n /**\n * Effective all-permissions flag, accounting for `KUBB_AGENT_ALLOW_ALL`.\n */\n allowAll: boolean\n /**\n * Absolute path to the Kubb config file passed to the agent subprocess.\n */\n agentConfigPath: string\n /**\n * Merged `process.env` object with all resolved agent environment variables applied.\n */\n env: NodeJS.ProcessEnv\n}\n\n/**\n * Resolves the environment passed to the detached agent process using CLI values first, then environment values, then CLI defaults.\n */\nexport function resolveAgentStartEnvironment({ port, host, configPath, allowWrite, allowAll }: AgentStartEnvironmentInput): ResolvedAgentStartEnvironment {\n const resolvedPort = port ?? process.env.PORT ?? agentDefaults.port\n const resolvedHost = host !== agentDefaults.host ? host : (process.env.HOST ?? agentDefaults.host)\n const resolvedAllowAll = allowAll || process.env.KUBB_AGENT_ALLOW_ALL === 'true'\n const resolvedAllowWrite = resolvedAllowAll || allowWrite || process.env.KUBB_AGENT_ALLOW_WRITE === 'true'\n const agentRoot = process.env.KUBB_AGENT_ROOT ?? process.cwd()\n const agentConfigPath = path.resolve(process.cwd(), configPath || process.env.KUBB_AGENT_CONFIG || agentDefaults.configFile)\n\n return {\n port: resolvedPort,\n host: resolvedHost,\n allowWrite: resolvedAllowWrite,\n allowAll: resolvedAllowAll,\n agentConfigPath,\n env: {\n ...process.env,\n PORT: resolvedPort,\n HOST: resolvedHost,\n KUBB_AGENT_ROOT: agentRoot,\n KUBB_AGENT_CONFIG: agentConfigPath,\n KUBB_AGENT_ALLOW_WRITE: String(resolvedAllowWrite),\n KUBB_AGENT_ALLOW_ALL: String(resolvedAllowAll),\n KUBB_AGENT_TOKEN: process.env.KUBB_AGENT_TOKEN,\n KUBB_AGENT_RETRY_TIMEOUT: process.env.KUBB_AGENT_RETRY_TIMEOUT ?? agentDefaults.retryTimeout,\n KUBB_STUDIO_URL: process.env.KUBB_STUDIO_URL ?? agentDefaults.studioUrl,\n },\n }\n}\n\nexport function isPortAvailable(port: number, host: string): Promise<boolean> {\n return new Promise((resolve) => {\n const server = net.createServer()\n server.once('error', () => resolve(false))\n server.once('listening', () => {\n server.close()\n resolve(true)\n })\n server.listen(port, host)\n })\n}\n","import { createRequire } from 'node:module'\nimport path from 'node:path'\nimport process from 'node:process'\nimport { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport { spawnAsync, getErrorMessage } from '@internals/utils'\nimport { agentDefaults } from '../../constants.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../../telemetry.ts'\nimport { isPortAvailable, resolveAgentStartEnvironment } from './utils.ts'\n\ntype AgentStartOptions = {\n /**\n * TCP port for the HTTP server. When `undefined`, falls back to `PORT` env var or the default (`3000`).\n */\n port: string | undefined\n /**\n * Hostname the HTTP server binds to.\n *\n * @default 'localhost'\n */\n host: string\n /**\n * Explicit path to the Kubb config file. When `undefined`, falls back to `KUBB_AGENT_CONFIG` or the default filename.\n */\n configPath: string | undefined\n /**\n * Grants the agent permission to write generated files to the filesystem.\n */\n allowWrite: boolean\n /**\n * Grants all agent permissions, including filesystem writes. Implies `allowWrite`.\n */\n allowAll: boolean\n /**\n * Current `@kubb/cli` version string, used for the telemetry payload.\n */\n version: string\n}\n\n/**\n * Spawns the Kubb Agent HTTP server as a Node.js subprocess.\n * Resolves config from CLI flags and environment variables, validates the port, and exits with code 1 on failure.\n */\nexport async function run({ port, host, configPath, allowWrite, allowAll, version }: AgentStartOptions): Promise<void> {\n const hrStart = process.hrtime()\n const report = (status: 'success' | 'failed') => sendTelemetry(buildTelemetryEvent({ command: 'agent', kubbVersion: version, hrStart, status }))\n\n try {\n // Load .env file into process.env using Node.js built-in (v20.12.0+)\n try {\n process.loadEnvFile()\n } catch {\n // .env file may not exist; ignore\n }\n\n // Resolve the @kubb/agent package path — createRequire is CJS/ESM compatible (import.meta.resolve is ESM-only)\n const require = createRequire(import.meta.url)\n let agentPkgPath: string\n try {\n agentPkgPath = require.resolve('@kubb/agent/package.json')\n } catch (_e) {\n console.error(styleText('red', 'The @kubb/agent package is not installed.'))\n console.error('')\n console.error('Install it with:')\n console.error(styleText('cyan', ' npm install @kubb/agent'))\n console.error(styleText('cyan', ' # or'))\n console.error(styleText('cyan', ' pnpm install @kubb/agent'))\n console.error('')\n process.exit(1)\n }\n const agentDir = path.dirname(agentPkgPath)\n const serverPath = path.join(agentDir, agentDefaults.serverEntryPath)\n\n const resolvedEnv = resolveAgentStartEnvironment({\n port,\n host,\n configPath,\n allowWrite,\n allowAll,\n })\n const numericPort = Number(resolvedEnv.port)\n\n if (!Number.isInteger(numericPort) || numericPort <= 0) {\n throw new Error(`Invalid port \"${resolvedEnv.port}\". Provide a positive integer with --port or PORT.`)\n }\n\n clack.log.step(styleText('cyan', 'Starting agent server...'))\n clack.log.info(styleText('dim', `Config: ${resolvedEnv.agentConfigPath}`))\n clack.log.info(styleText('dim', `Host: ${resolvedEnv.host}`))\n clack.log.info(styleText('dim', `Port: ${resolvedEnv.port}`))\n if (!resolvedEnv.allowWrite && !resolvedEnv.allowAll) {\n clack.log.warn(styleText('yellow', 'Filesystem writes disabled. Use --allow-write or --allow-all to enable.'))\n }\n\n if (!(await isPortAvailable(numericPort, resolvedEnv.host))) {\n clack.log.error(styleText('red', `Port ${resolvedEnv.port} is already in use. Stop the existing process or choose a different port with --port.`))\n process.exit(1)\n }\n\n // Spawns the server as a detached background process so the CLI can exit independently.\n await spawnAsync('node', [serverPath], {\n env: resolvedEnv.env,\n cwd: process.cwd(),\n })\n\n await report('success')\n } catch (error) {\n await report('failed')\n clack.log.error(styleText('red', 'Failed to start agent server'))\n clack.log.error(getErrorMessage(error))\n process.exit(1)\n }\n}\n"],"mappings":"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"}
@@ -1,50 +0,0 @@
1
- const require_chunk = require("./chunk-ByKO4r7w.cjs");
2
- const require_errors = require("./errors-CLCjoSg0.cjs");
3
- const require_telemetry = require("./telemetry-B2iWkY5e.cjs");
4
- let node_util = require("node:util");
5
- let node_process = require("node:process");
6
- node_process = require_chunk.__toESM(node_process, 1);
7
- //#region src/runners/mcp/run.ts
8
- /**
9
- * Starts the Kubb MCP server using `@kubb/mcp`.
10
- * Exits the process with code 1 if `@kubb/mcp` is not installed.
11
- */
12
- async function run({ version, port, host }) {
13
- let mod;
14
- try {
15
- mod = await import("@kubb/mcp");
16
- } catch (_e) {
17
- console.error((0, node_util.styleText)("red", "The @kubb/mcp package is not installed."));
18
- console.error("");
19
- console.error("Install it with:");
20
- console.error((0, node_util.styleText)("cyan", " npm install @kubb/mcp"));
21
- console.error((0, node_util.styleText)("cyan", " # or"));
22
- console.error((0, node_util.styleText)("cyan", " pnpm install @kubb/mcp"));
23
- console.error("");
24
- node_process.default.exit(1);
25
- }
26
- const { run: startMcpServer } = mod;
27
- const hrStart = node_process.default.hrtime();
28
- const report = (status) => require_telemetry.sendTelemetry(require_telemetry.buildTelemetryEvent({
29
- command: "mcp",
30
- kubbVersion: version,
31
- hrStart,
32
- status
33
- }));
34
- try {
35
- console.log((0, node_util.styleText)("cyan", "⏳ Starting MCP server..."));
36
- console.warn((0, node_util.styleText)("yellow", "This feature is still under development, use with caution"));
37
- await startMcpServer(void 0, {
38
- port: port !== void 0 ? Number(port) : void 0,
39
- host
40
- });
41
- await report("success");
42
- } catch (error) {
43
- await report("failed");
44
- console.error(require_errors.getErrorMessage(error));
45
- }
46
- }
47
- //#endregion
48
- exports.run = run;
49
-
50
- //# sourceMappingURL=run-Lr0Ctnu0.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-Lr0Ctnu0.cjs","names":["process","sendTelemetry","buildTelemetryEvent","getErrorMessage"],"sources":["../src/runners/mcp/run.ts"],"sourcesContent":["import process from 'node:process'\nimport { styleText } from 'node:util'\nimport { getErrorMessage } from '@internals/utils'\nimport type * as McpModule from '@kubb/mcp'\nimport { buildTelemetryEvent, sendTelemetry } from '../../telemetry.ts'\n\ntype McpOptions = {\n /**\n * Current `@kubb/cli` version string, used for the telemetry payload.\n */\n version: string\n /**\n * TCP port for the HTTP MCP server. When `undefined`, the server uses stdio transport.\n */\n port?: string\n /**\n * Hostname to bind to when running in HTTP mode.\n *\n * @default 'localhost'\n */\n host?: string\n}\n\n/**\n * Starts the Kubb MCP server using `@kubb/mcp`.\n * Exits the process with code 1 if `@kubb/mcp` is not installed.\n */\nexport async function run({ version, port, host }: McpOptions): Promise<void> {\n let mod: typeof McpModule\n try {\n mod = (await import('@kubb/mcp')) as typeof McpModule\n } catch (_e) {\n console.error(styleText('red', 'The @kubb/mcp package is not installed.'))\n console.error('')\n console.error('Install it with:')\n console.error(styleText('cyan', ' npm install @kubb/mcp'))\n console.error(styleText('cyan', ' # or'))\n console.error(styleText('cyan', ' pnpm install @kubb/mcp'))\n console.error('')\n process.exit(1)\n }\n\n const { run: startMcpServer } = mod\n const hrStart = process.hrtime()\n const report = (status: 'success' | 'failed') => sendTelemetry(buildTelemetryEvent({ command: 'mcp', kubbVersion: version, hrStart, status }))\n try {\n console.log(styleText('cyan', '⏳ Starting MCP server...'))\n console.warn(styleText('yellow', 'This feature is still under development, use with caution'))\n await startMcpServer(undefined, { port: port !== undefined ? Number(port) : undefined, host })\n await report('success')\n } catch (error) {\n await report('failed')\n console.error(getErrorMessage(error))\n }\n}\n"],"mappings":";;;;;;;;;;;AA2BA,eAAsB,IAAI,EAAE,SAAS,MAAM,QAAmC;CAC5E,IAAI;CACJ,IAAI;EACF,MAAO,MAAM,OAAO;UACb,IAAI;EACX,QAAQ,OAAA,GAAA,UAAA,WAAgB,OAAO,0CAA0C,CAAC;EAC1E,QAAQ,MAAM,GAAG;EACjB,QAAQ,MAAM,mBAAmB;EACjC,QAAQ,OAAA,GAAA,UAAA,WAAgB,QAAQ,0BAA0B,CAAC;EAC3D,QAAQ,OAAA,GAAA,UAAA,WAAgB,QAAQ,SAAS,CAAC;EAC1C,QAAQ,OAAA,GAAA,UAAA,WAAgB,QAAQ,2BAA2B,CAAC;EAC5D,QAAQ,MAAM,GAAG;EACjB,aAAA,QAAQ,KAAK,EAAE;;CAGjB,MAAM,EAAE,KAAK,mBAAmB;CAChC,MAAM,UAAUA,aAAAA,QAAQ,QAAQ;CAChC,MAAM,UAAU,WAAiCC,kBAAAA,cAAcC,kBAAAA,oBAAoB;EAAE,SAAS;EAAO,aAAa;EAAS;EAAS;EAAQ,CAAC,CAAC;CAC9I,IAAI;EACF,QAAQ,KAAA,GAAA,UAAA,WAAc,QAAQ,2BAA2B,CAAC;EAC1D,QAAQ,MAAA,GAAA,UAAA,WAAe,UAAU,4DAA4D,CAAC;EAC9F,MAAM,eAAe,KAAA,GAAW;GAAE,MAAM,SAAS,KAAA,IAAY,OAAO,KAAK,GAAG,KAAA;GAAW;GAAM,CAAC;EAC9F,MAAM,OAAO,UAAU;UAChB,OAAO;EACd,MAAM,OAAO,SAAS;EACtB,QAAQ,MAAMC,eAAAA,gBAAgB,MAAM,CAAC"}