@kubb/cli 4.32.3 → 4.33.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.
Files changed (137) hide show
  1. package/dist/agent-CJ69TqoO.js +87 -0
  2. package/dist/agent-CJ69TqoO.js.map +1 -0
  3. package/dist/agent-CduUX7Ye.cjs +91 -0
  4. package/dist/agent-CduUX7Ye.cjs.map +1 -0
  5. package/dist/agent-D0A3RQho.js +57 -0
  6. package/dist/agent-D0A3RQho.js.map +1 -0
  7. package/dist/agent-DrnwQBZf.cjs +60 -0
  8. package/dist/agent-DrnwQBZf.cjs.map +1 -0
  9. package/dist/constants-CEKRremI.js +79 -0
  10. package/dist/constants-CEKRremI.js.map +1 -0
  11. package/dist/constants-CnPOlsJq.cjs +126 -0
  12. package/dist/constants-CnPOlsJq.cjs.map +1 -0
  13. package/dist/errors-BUjJsNoe.cjs +44 -0
  14. package/dist/errors-BUjJsNoe.cjs.map +1 -0
  15. package/dist/errors-bSLTEh4e.js +27 -0
  16. package/dist/errors-bSLTEh4e.js.map +1 -0
  17. package/dist/{generate-DFdkL6Kp.cjs → generate-ByMgAV76.cjs} +423 -577
  18. package/dist/generate-ByMgAV76.cjs.map +1 -0
  19. package/dist/generate-CiUPO5ds.cjs +65 -0
  20. package/dist/generate-CiUPO5ds.cjs.map +1 -0
  21. package/dist/generate-DIIxtkWT.js +66 -0
  22. package/dist/generate-DIIxtkWT.js.map +1 -0
  23. package/dist/{generate-zZuxBP8z.js → generate-HP5ySfjV.js} +422 -577
  24. package/dist/generate-HP5ySfjV.js.map +1 -0
  25. package/dist/index.cjs +226 -35
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +226 -35
  29. package/dist/index.js.map +1 -1
  30. package/dist/init-Cd1hCb7q.cjs +296 -0
  31. package/dist/init-Cd1hCb7q.cjs.map +1 -0
  32. package/dist/init-DLNrkDF4.js +25 -0
  33. package/dist/init-DLNrkDF4.js.map +1 -0
  34. package/dist/init-Df_aXezV.cjs +24 -0
  35. package/dist/init-Df_aXezV.cjs.map +1 -0
  36. package/dist/init-DyKK2fTp.js +291 -0
  37. package/dist/init-DyKK2fTp.js.map +1 -0
  38. package/dist/jiti-BdskUHhD.cjs +16 -0
  39. package/dist/jiti-BdskUHhD.cjs.map +1 -0
  40. package/dist/jiti-Cl7t20dO.js +11 -0
  41. package/dist/jiti-Cl7t20dO.js.map +1 -0
  42. package/dist/mcp-B73FC8dF.cjs +42 -0
  43. package/dist/mcp-B73FC8dF.cjs.map +1 -0
  44. package/dist/mcp-Bd9LITaI.js +16 -0
  45. package/dist/mcp-Bd9LITaI.js.map +1 -0
  46. package/dist/mcp-Cf-1dsB-.js +41 -0
  47. package/dist/mcp-Cf-1dsB-.js.map +1 -0
  48. package/dist/mcp-Clg-Qnkr.cjs +15 -0
  49. package/dist/mcp-Clg-Qnkr.cjs.map +1 -0
  50. package/dist/package-681jTtCk.js +6 -0
  51. package/dist/package-681jTtCk.js.map +1 -0
  52. package/dist/{package-C2pulzfz.cjs → package-aKgzEJtp.cjs} +2 -2
  53. package/dist/package-aKgzEJtp.cjs.map +1 -0
  54. package/dist/{telemetry-DYWvlxqs.js → telemetry-C4gOKX2x.js} +31 -10
  55. package/dist/telemetry-C4gOKX2x.js.map +1 -0
  56. package/dist/{telemetry-BDSSqUiG.cjs → telemetry-T5IA2dWA.cjs} +40 -7
  57. package/dist/telemetry-T5IA2dWA.cjs.map +1 -0
  58. package/dist/types-CLtz0jem.js +25 -0
  59. package/dist/types-CLtz0jem.js.map +1 -0
  60. package/dist/types-Ck2lzFON.cjs +36 -0
  61. package/dist/types-Ck2lzFON.cjs.map +1 -0
  62. package/dist/validate-Chjg23AE.js +41 -0
  63. package/dist/validate-Chjg23AE.js.map +1 -0
  64. package/dist/validate-Cr26q5xX.js +25 -0
  65. package/dist/validate-Cr26q5xX.js.map +1 -0
  66. package/dist/validate-DURmg-2Q.cjs +24 -0
  67. package/dist/validate-DURmg-2Q.cjs.map +1 -0
  68. package/dist/validate-Dqi9T_c4.cjs +42 -0
  69. package/dist/validate-Dqi9T_c4.cjs.map +1 -0
  70. package/package.json +5 -6
  71. package/src/cli/adapters/nodeAdapter.ts +159 -0
  72. package/src/cli/help.ts +36 -0
  73. package/src/cli/index.ts +16 -0
  74. package/src/cli/parse.ts +18 -0
  75. package/src/cli/schema.ts +38 -0
  76. package/src/cli/types.ts +95 -0
  77. package/src/commands/agent/start.ts +27 -136
  78. package/src/commands/agent.ts +6 -25
  79. package/src/commands/generate.ts +26 -158
  80. package/src/commands/init.ts +9 -360
  81. package/src/commands/mcp.ts +7 -52
  82. package/src/commands/validate.ts +9 -60
  83. package/src/constants.ts +77 -0
  84. package/src/index.ts +36 -42
  85. package/src/loggers/clackLogger.ts +42 -140
  86. package/src/loggers/fileSystemLogger.ts +1 -12
  87. package/src/loggers/githubActionsLogger.ts +36 -101
  88. package/src/loggers/plainLogger.ts +23 -70
  89. package/src/loggers/utils.ts +66 -2
  90. package/src/runners/agent.ts +100 -0
  91. package/src/runners/generate.ts +208 -100
  92. package/src/runners/init.ts +322 -0
  93. package/src/runners/mcp.ts +32 -0
  94. package/src/runners/validate.ts +35 -0
  95. package/src/utils/Writables.ts +2 -2
  96. package/src/utils/envDetection.ts +34 -0
  97. package/src/utils/errors.ts +23 -0
  98. package/src/utils/executeHooks.ts +18 -6
  99. package/src/utils/getCosmiConfig.ts +10 -11
  100. package/src/utils/getIntro.ts +17 -18
  101. package/src/utils/getSummary.ts +11 -15
  102. package/src/utils/jiti.ts +9 -0
  103. package/src/utils/packageManager.ts +3 -3
  104. package/src/utils/randomColor.ts +3 -12
  105. package/src/utils/runHook.ts +75 -0
  106. package/src/utils/spawnAsync.ts +47 -0
  107. package/src/utils/telemetry.ts +8 -25
  108. package/src/utils/watcher.ts +2 -4
  109. package/dist/agent-BuijLPSZ.cjs +0 -20
  110. package/dist/agent-BuijLPSZ.cjs.map +0 -1
  111. package/dist/agent-Dswt_kxP.js +0 -20
  112. package/dist/agent-Dswt_kxP.js.map +0 -1
  113. package/dist/generate-DFdkL6Kp.cjs.map +0 -1
  114. package/dist/generate-zZuxBP8z.js.map +0 -1
  115. package/dist/init-CNLk2fNd.js +0 -304
  116. package/dist/init-CNLk2fNd.js.map +0 -1
  117. package/dist/init-CSP6FGaW.cjs +0 -308
  118. package/dist/init-CSP6FGaW.cjs.map +0 -1
  119. package/dist/mcp-44Od-yig.cjs +0 -57
  120. package/dist/mcp-44Od-yig.cjs.map +0 -1
  121. package/dist/mcp-CgaHrkDs.js +0 -57
  122. package/dist/mcp-CgaHrkDs.js.map +0 -1
  123. package/dist/package--eaEMq2R.js +0 -6
  124. package/dist/package--eaEMq2R.js.map +0 -1
  125. package/dist/package-C2pulzfz.cjs.map +0 -1
  126. package/dist/start-CB8afXV6.cjs +0 -134
  127. package/dist/start-CB8afXV6.cjs.map +0 -1
  128. package/dist/start-DHPjtHJj.js +0 -131
  129. package/dist/start-DHPjtHJj.js.map +0 -1
  130. package/dist/telemetry-BDSSqUiG.cjs.map +0 -1
  131. package/dist/telemetry-DYWvlxqs.js.map +0 -1
  132. package/dist/validate-C7s0cFnp.cjs +0 -66
  133. package/dist/validate-C7s0cFnp.cjs.map +0 -1
  134. package/dist/validate-_7cmvjg_.js +0 -66
  135. package/dist/validate-_7cmvjg_.js.map +0 -1
  136. package/src/loggers/envDetection.ts +0 -28
  137. package/src/loggers/index.ts +0 -5
@@ -0,0 +1,87 @@
1
+ import "./chunk--u3MIqq1.js";
2
+ import { a as agentDefaults } from "./constants-CEKRremI.js";
3
+ import { r as sendTelemetry, t as buildTelemetryEvent } from "./telemetry-C4gOKX2x.js";
4
+ import { t as spawnAsync } from "./init-DyKK2fTp.js";
5
+ import { styleText } from "node:util";
6
+ import * as process$1 from "node:process";
7
+ import path from "node:path";
8
+ import net from "node:net";
9
+ import { fileURLToPath } from "node:url";
10
+ import * as clack from "@clack/prompts";
11
+ //#region src/runners/agent.ts
12
+ function isPortAvailable(port, host) {
13
+ return new Promise((resolve) => {
14
+ const server = net.createServer();
15
+ server.once("error", () => resolve(false));
16
+ server.once("listening", () => {
17
+ server.close();
18
+ resolve(true);
19
+ });
20
+ server.listen(port, host);
21
+ });
22
+ }
23
+ async function runAgentStart({ port, host, configPath, allowWrite, allowAll, version }) {
24
+ const hrStart = process$1.hrtime();
25
+ try {
26
+ try {
27
+ process$1.loadEnvFile();
28
+ } catch {}
29
+ const agentPkgPath = fileURLToPath(import.meta.resolve("@kubb/agent/package.json"));
30
+ const agentDir = path.dirname(agentPkgPath);
31
+ const serverPath = path.join(agentDir, agentDefaults.serverEntryPath);
32
+ const PORT = port !== void 0 ? port : process$1.env.PORT ?? agentDefaults.port;
33
+ const HOST = host !== agentDefaults.host ? host : process$1.env.HOST ?? agentDefaults.host;
34
+ const KUBB_AGENT_ROOT = process$1.env.KUBB_AGENT_ROOT ?? process$1.cwd();
35
+ const KUBB_AGENT_CONFIG = configPath !== agentDefaults.configFile ? configPath : process$1.env.KUBB_AGENT_CONFIG ?? agentDefaults.configFile;
36
+ const KUBB_AGENT_ALLOW_WRITE = allowAll || allowWrite ? "true" : process$1.env.KUBB_AGENT_ALLOW_WRITE ?? "false";
37
+ const KUBB_AGENT_ALLOW_ALL = allowAll ? "true" : process$1.env.KUBB_AGENT_ALLOW_ALL ?? "false";
38
+ const KUBB_AGENT_TOKEN = process$1.env.KUBB_AGENT_TOKEN;
39
+ const KUBB_AGENT_RETRY_TIMEOUT = process$1.env.KUBB_AGENT_RETRY_TIMEOUT ?? agentDefaults.retryTimeout;
40
+ const KUBB_STUDIO_URL = process$1.env.KUBB_STUDIO_URL ?? agentDefaults.studioUrl;
41
+ const env = {
42
+ ...process$1.env,
43
+ PORT,
44
+ HOST,
45
+ KUBB_AGENT_ROOT,
46
+ KUBB_AGENT_CONFIG,
47
+ KUBB_AGENT_ALLOW_WRITE,
48
+ KUBB_AGENT_ALLOW_ALL,
49
+ KUBB_AGENT_TOKEN,
50
+ KUBB_AGENT_RETRY_TIMEOUT,
51
+ KUBB_STUDIO_URL
52
+ };
53
+ clack.log.step(styleText("cyan", "Starting agent server..."));
54
+ clack.log.info(styleText("dim", `Config: ${KUBB_AGENT_CONFIG}`));
55
+ clack.log.info(styleText("dim", `Host: ${HOST}`));
56
+ clack.log.info(styleText("dim", `Port: ${PORT}`));
57
+ if (!KUBB_AGENT_ALLOW_WRITE && !KUBB_AGENT_ALLOW_ALL) clack.log.warn(styleText("yellow", "Filesystem writes disabled. Use --allow-write or --allow-all to enable."));
58
+ if (!await isPortAvailable(Number(PORT), HOST)) {
59
+ clack.log.error(styleText("red", `Port ${PORT} is already in use. Stop the existing process or choose a different port with --port.`));
60
+ process$1.exit(1);
61
+ }
62
+ await spawnAsync("node", [serverPath], {
63
+ env,
64
+ cwd: process$1.cwd()
65
+ });
66
+ await sendTelemetry(buildTelemetryEvent({
67
+ command: "agent",
68
+ kubbVersion: version,
69
+ hrStart,
70
+ status: "success"
71
+ }));
72
+ } catch (error) {
73
+ await sendTelemetry(buildTelemetryEvent({
74
+ command: "agent",
75
+ kubbVersion: version,
76
+ hrStart,
77
+ status: "failed"
78
+ }));
79
+ clack.log.error(styleText("red", "Failed to start agent server"));
80
+ console.error(error);
81
+ process$1.exit(1);
82
+ }
83
+ }
84
+ //#endregion
85
+ export { runAgentStart };
86
+
87
+ //# sourceMappingURL=agent-CJ69TqoO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-CJ69TqoO.js","names":["process"],"sources":["../src/runners/agent.ts"],"sourcesContent":["import net from 'node:net'\nimport path from 'node:path'\nimport * as process from 'node:process'\nimport { fileURLToPath } from 'node:url'\nimport { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport { agentDefaults } from '../constants.ts'\nimport { spawnAsync } from '../utils/spawnAsync.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype AgentStartOptions = {\n port: string | undefined\n host: string\n configPath: string\n allowWrite: boolean\n allowAll: boolean\n version: string\n}\n\nfunction 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\nexport async function runAgentStart({ port, host, configPath, allowWrite, allowAll, version }: AgentStartOptions): Promise<void> {\n const hrStart = process.hrtime()\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\n const agentPkgUrl = import.meta.resolve('@kubb/agent/package.json')\n const agentPkgPath = fileURLToPath(agentPkgUrl)\n const agentDir = path.dirname(agentPkgPath)\n const serverPath = path.join(agentDir, agentDefaults.serverEntryPath)\n\n // CLI params take priority over process.env; process.env fills in what the CLI didn't specify;\n // agentDefaults are the last resort. Build env as: defaults ← process.env ← CLI.\n const PORT = port !== undefined ? port : (process.env.PORT ?? agentDefaults.port)\n const HOST = host !== agentDefaults.host ? host : (process.env.HOST ?? agentDefaults.host)\n const KUBB_AGENT_ROOT = process.env.KUBB_AGENT_ROOT ?? process.cwd()\n const KUBB_AGENT_CONFIG = configPath !== agentDefaults.configFile ? configPath : (process.env.KUBB_AGENT_CONFIG ?? agentDefaults.configFile)\n const KUBB_AGENT_ALLOW_WRITE = allowAll || allowWrite ? 'true' : (process.env.KUBB_AGENT_ALLOW_WRITE ?? 'false')\n const KUBB_AGENT_ALLOW_ALL = allowAll ? 'true' : (process.env.KUBB_AGENT_ALLOW_ALL ?? 'false')\n const KUBB_AGENT_TOKEN = process.env.KUBB_AGENT_TOKEN\n const KUBB_AGENT_RETRY_TIMEOUT = process.env.KUBB_AGENT_RETRY_TIMEOUT ?? agentDefaults.retryTimeout\n const KUBB_STUDIO_URL = process.env.KUBB_STUDIO_URL ?? agentDefaults.studioUrl\n\n const env = {\n ...process.env,\n PORT,\n HOST,\n KUBB_AGENT_ROOT,\n KUBB_AGENT_CONFIG,\n KUBB_AGENT_ALLOW_WRITE,\n KUBB_AGENT_ALLOW_ALL,\n KUBB_AGENT_TOKEN,\n KUBB_AGENT_RETRY_TIMEOUT,\n KUBB_STUDIO_URL,\n }\n\n clack.log.step(styleText('cyan', 'Starting agent server...'))\n clack.log.info(styleText('dim', `Config: ${KUBB_AGENT_CONFIG}`))\n clack.log.info(styleText('dim', `Host: ${HOST}`))\n clack.log.info(styleText('dim', `Port: ${PORT}`))\n if (!KUBB_AGENT_ALLOW_WRITE && !KUBB_AGENT_ALLOW_ALL) {\n clack.log.warn(styleText('yellow', 'Filesystem writes disabled. Use --allow-write or --allow-all to enable.'))\n }\n\n if (!(await isPortAvailable(Number(PORT), HOST))) {\n clack.log.error(styleText('red', `Port ${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,\n cwd: process.cwd(),\n })\n\n await sendTelemetry(buildTelemetryEvent({ command: 'agent', kubbVersion: version, hrStart, status: 'success' }))\n } catch (error) {\n await sendTelemetry(buildTelemetryEvent({ command: 'agent', kubbVersion: version, hrStart, status: 'failed' }))\n clack.log.error(styleText('red', 'Failed to start agent server'))\n console.error(error)\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;AAmBA,SAAS,gBAAgB,MAAc,MAAgC;AACrE,QAAO,IAAI,SAAS,YAAY;EAC9B,MAAM,SAAS,IAAI,cAAc;AACjC,SAAO,KAAK,eAAe,QAAQ,MAAM,CAAC;AAC1C,SAAO,KAAK,mBAAmB;AAC7B,UAAO,OAAO;AACd,WAAQ,KAAK;IACb;AACF,SAAO,OAAO,MAAM,KAAK;GACzB;;AAGJ,eAAsB,cAAc,EAAE,MAAM,MAAM,YAAY,YAAY,UAAU,WAA6C;CAC/H,MAAM,UAAUA,UAAQ,QAAQ;AAEhC,KAAI;AAEF,MAAI;AACF,aAAQ,aAAa;UACf;EAMR,MAAM,eAAe,cADD,OAAO,KAAK,QAAQ,2BAA2B,CACpB;EAC/C,MAAM,WAAW,KAAK,QAAQ,aAAa;EAC3C,MAAM,aAAa,KAAK,KAAK,UAAU,cAAc,gBAAgB;EAIrE,MAAM,OAAO,SAAS,KAAA,IAAY,OAAQA,UAAQ,IAAI,QAAQ,cAAc;EAC5E,MAAM,OAAO,SAAS,cAAc,OAAO,OAAQA,UAAQ,IAAI,QAAQ,cAAc;EACrF,MAAM,kBAAkBA,UAAQ,IAAI,mBAAmBA,UAAQ,KAAK;EACpE,MAAM,oBAAoB,eAAe,cAAc,aAAa,aAAcA,UAAQ,IAAI,qBAAqB,cAAc;EACjI,MAAM,yBAAyB,YAAY,aAAa,SAAUA,UAAQ,IAAI,0BAA0B;EACxG,MAAM,uBAAuB,WAAW,SAAUA,UAAQ,IAAI,wBAAwB;EACtF,MAAM,mBAAmBA,UAAQ,IAAI;EACrC,MAAM,2BAA2BA,UAAQ,IAAI,4BAA4B,cAAc;EACvF,MAAM,kBAAkBA,UAAQ,IAAI,mBAAmB,cAAc;EAErE,MAAM,MAAM;GACV,GAAGA,UAAQ;GACX;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;AAED,QAAM,IAAI,KAAK,UAAU,QAAQ,2BAA2B,CAAC;AAC7D,QAAM,IAAI,KAAK,UAAU,OAAO,WAAW,oBAAoB,CAAC;AAChE,QAAM,IAAI,KAAK,UAAU,OAAO,SAAS,OAAO,CAAC;AACjD,QAAM,IAAI,KAAK,UAAU,OAAO,SAAS,OAAO,CAAC;AACjD,MAAI,CAAC,0BAA0B,CAAC,qBAC9B,OAAM,IAAI,KAAK,UAAU,UAAU,0EAA0E,CAAC;AAGhH,MAAI,CAAE,MAAM,gBAAgB,OAAO,KAAK,EAAE,KAAK,EAAG;AAChD,SAAM,IAAI,MAAM,UAAU,OAAO,QAAQ,KAAK,uFAAuF,CAAC;AACtI,aAAQ,KAAK,EAAE;;AAIjB,QAAM,WAAW,QAAQ,CAAC,WAAW,EAAE;GACrC;GACA,KAAKA,UAAQ,KAAK;GACnB,CAAC;AAEF,QAAM,cAAc,oBAAoB;GAAE,SAAS;GAAS,aAAa;GAAS;GAAS,QAAQ;GAAW,CAAC,CAAC;UACzG,OAAO;AACd,QAAM,cAAc,oBAAoB;GAAE,SAAS;GAAS,aAAa;GAAS;GAAS,QAAQ;GAAU,CAAC,CAAC;AAC/G,QAAM,IAAI,MAAM,UAAU,OAAO,+BAA+B,CAAC;AACjE,UAAQ,MAAM,MAAM;AACpB,YAAQ,KAAK,EAAE"}
@@ -0,0 +1,91 @@
1
+ const require_chunk = require("./chunk-ByKO4r7w.cjs");
2
+ const require_constants = require("./constants-CnPOlsJq.cjs");
3
+ const require_telemetry = require("./telemetry-T5IA2dWA.cjs");
4
+ const require_init = require("./init-Cd1hCb7q.cjs");
5
+ let node_util = require("node:util");
6
+ let node_process = require("node:process");
7
+ node_process = require_chunk.__toESM(node_process);
8
+ let node_path = require("node:path");
9
+ node_path = require_chunk.__toESM(node_path);
10
+ let node_net = require("node:net");
11
+ node_net = require_chunk.__toESM(node_net);
12
+ let node_url = require("node:url");
13
+ let _clack_prompts = require("@clack/prompts");
14
+ _clack_prompts = require_chunk.__toESM(_clack_prompts);
15
+ //#region src/runners/agent.ts
16
+ function isPortAvailable(port, host) {
17
+ return new Promise((resolve) => {
18
+ const server = node_net.default.createServer();
19
+ server.once("error", () => resolve(false));
20
+ server.once("listening", () => {
21
+ server.close();
22
+ resolve(true);
23
+ });
24
+ server.listen(port, host);
25
+ });
26
+ }
27
+ async function runAgentStart({ port, host, configPath, allowWrite, allowAll, version }) {
28
+ const hrStart = node_process.hrtime();
29
+ try {
30
+ try {
31
+ node_process.loadEnvFile();
32
+ } catch {}
33
+ const agentPkgPath = (0, node_url.fileURLToPath)({}.resolve("@kubb/agent/package.json"));
34
+ const agentDir = node_path.default.dirname(agentPkgPath);
35
+ const serverPath = node_path.default.join(agentDir, require_constants.agentDefaults.serverEntryPath);
36
+ const PORT = port !== void 0 ? port : node_process.env.PORT ?? require_constants.agentDefaults.port;
37
+ const HOST = host !== require_constants.agentDefaults.host ? host : node_process.env.HOST ?? require_constants.agentDefaults.host;
38
+ const KUBB_AGENT_ROOT = node_process.env.KUBB_AGENT_ROOT ?? node_process.cwd();
39
+ const KUBB_AGENT_CONFIG = configPath !== require_constants.agentDefaults.configFile ? configPath : node_process.env.KUBB_AGENT_CONFIG ?? require_constants.agentDefaults.configFile;
40
+ const KUBB_AGENT_ALLOW_WRITE = allowAll || allowWrite ? "true" : node_process.env.KUBB_AGENT_ALLOW_WRITE ?? "false";
41
+ const KUBB_AGENT_ALLOW_ALL = allowAll ? "true" : node_process.env.KUBB_AGENT_ALLOW_ALL ?? "false";
42
+ const KUBB_AGENT_TOKEN = node_process.env.KUBB_AGENT_TOKEN;
43
+ const KUBB_AGENT_RETRY_TIMEOUT = node_process.env.KUBB_AGENT_RETRY_TIMEOUT ?? require_constants.agentDefaults.retryTimeout;
44
+ const KUBB_STUDIO_URL = node_process.env.KUBB_STUDIO_URL ?? require_constants.agentDefaults.studioUrl;
45
+ const env = {
46
+ ...node_process.env,
47
+ PORT,
48
+ HOST,
49
+ KUBB_AGENT_ROOT,
50
+ KUBB_AGENT_CONFIG,
51
+ KUBB_AGENT_ALLOW_WRITE,
52
+ KUBB_AGENT_ALLOW_ALL,
53
+ KUBB_AGENT_TOKEN,
54
+ KUBB_AGENT_RETRY_TIMEOUT,
55
+ KUBB_STUDIO_URL
56
+ };
57
+ _clack_prompts.log.step((0, node_util.styleText)("cyan", "Starting agent server..."));
58
+ _clack_prompts.log.info((0, node_util.styleText)("dim", `Config: ${KUBB_AGENT_CONFIG}`));
59
+ _clack_prompts.log.info((0, node_util.styleText)("dim", `Host: ${HOST}`));
60
+ _clack_prompts.log.info((0, node_util.styleText)("dim", `Port: ${PORT}`));
61
+ if (!KUBB_AGENT_ALLOW_WRITE && !KUBB_AGENT_ALLOW_ALL) _clack_prompts.log.warn((0, node_util.styleText)("yellow", "Filesystem writes disabled. Use --allow-write or --allow-all to enable."));
62
+ if (!await isPortAvailable(Number(PORT), HOST)) {
63
+ _clack_prompts.log.error((0, node_util.styleText)("red", `Port ${PORT} is already in use. Stop the existing process or choose a different port with --port.`));
64
+ node_process.exit(1);
65
+ }
66
+ await require_init.spawnAsync("node", [serverPath], {
67
+ env,
68
+ cwd: node_process.cwd()
69
+ });
70
+ await require_telemetry.sendTelemetry(require_telemetry.buildTelemetryEvent({
71
+ command: "agent",
72
+ kubbVersion: version,
73
+ hrStart,
74
+ status: "success"
75
+ }));
76
+ } catch (error) {
77
+ await require_telemetry.sendTelemetry(require_telemetry.buildTelemetryEvent({
78
+ command: "agent",
79
+ kubbVersion: version,
80
+ hrStart,
81
+ status: "failed"
82
+ }));
83
+ _clack_prompts.log.error((0, node_util.styleText)("red", "Failed to start agent server"));
84
+ console.error(error);
85
+ node_process.exit(1);
86
+ }
87
+ }
88
+ //#endregion
89
+ exports.runAgentStart = runAgentStart;
90
+
91
+ //# sourceMappingURL=agent-CduUX7Ye.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-CduUX7Ye.cjs","names":["net","process","path","agentDefaults","spawnAsync","sendTelemetry","buildTelemetryEvent"],"sources":["../src/runners/agent.ts"],"sourcesContent":["import net from 'node:net'\nimport path from 'node:path'\nimport * as process from 'node:process'\nimport { fileURLToPath } from 'node:url'\nimport { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport { agentDefaults } from '../constants.ts'\nimport { spawnAsync } from '../utils/spawnAsync.ts'\nimport { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'\n\ntype AgentStartOptions = {\n port: string | undefined\n host: string\n configPath: string\n allowWrite: boolean\n allowAll: boolean\n version: string\n}\n\nfunction 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\nexport async function runAgentStart({ port, host, configPath, allowWrite, allowAll, version }: AgentStartOptions): Promise<void> {\n const hrStart = process.hrtime()\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\n const agentPkgUrl = import.meta.resolve('@kubb/agent/package.json')\n const agentPkgPath = fileURLToPath(agentPkgUrl)\n const agentDir = path.dirname(agentPkgPath)\n const serverPath = path.join(agentDir, agentDefaults.serverEntryPath)\n\n // CLI params take priority over process.env; process.env fills in what the CLI didn't specify;\n // agentDefaults are the last resort. Build env as: defaults ← process.env ← CLI.\n const PORT = port !== undefined ? port : (process.env.PORT ?? agentDefaults.port)\n const HOST = host !== agentDefaults.host ? host : (process.env.HOST ?? agentDefaults.host)\n const KUBB_AGENT_ROOT = process.env.KUBB_AGENT_ROOT ?? process.cwd()\n const KUBB_AGENT_CONFIG = configPath !== agentDefaults.configFile ? configPath : (process.env.KUBB_AGENT_CONFIG ?? agentDefaults.configFile)\n const KUBB_AGENT_ALLOW_WRITE = allowAll || allowWrite ? 'true' : (process.env.KUBB_AGENT_ALLOW_WRITE ?? 'false')\n const KUBB_AGENT_ALLOW_ALL = allowAll ? 'true' : (process.env.KUBB_AGENT_ALLOW_ALL ?? 'false')\n const KUBB_AGENT_TOKEN = process.env.KUBB_AGENT_TOKEN\n const KUBB_AGENT_RETRY_TIMEOUT = process.env.KUBB_AGENT_RETRY_TIMEOUT ?? agentDefaults.retryTimeout\n const KUBB_STUDIO_URL = process.env.KUBB_STUDIO_URL ?? agentDefaults.studioUrl\n\n const env = {\n ...process.env,\n PORT,\n HOST,\n KUBB_AGENT_ROOT,\n KUBB_AGENT_CONFIG,\n KUBB_AGENT_ALLOW_WRITE,\n KUBB_AGENT_ALLOW_ALL,\n KUBB_AGENT_TOKEN,\n KUBB_AGENT_RETRY_TIMEOUT,\n KUBB_STUDIO_URL,\n }\n\n clack.log.step(styleText('cyan', 'Starting agent server...'))\n clack.log.info(styleText('dim', `Config: ${KUBB_AGENT_CONFIG}`))\n clack.log.info(styleText('dim', `Host: ${HOST}`))\n clack.log.info(styleText('dim', `Port: ${PORT}`))\n if (!KUBB_AGENT_ALLOW_WRITE && !KUBB_AGENT_ALLOW_ALL) {\n clack.log.warn(styleText('yellow', 'Filesystem writes disabled. Use --allow-write or --allow-all to enable.'))\n }\n\n if (!(await isPortAvailable(Number(PORT), HOST))) {\n clack.log.error(styleText('red', `Port ${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,\n cwd: process.cwd(),\n })\n\n await sendTelemetry(buildTelemetryEvent({ command: 'agent', kubbVersion: version, hrStart, status: 'success' }))\n } catch (error) {\n await sendTelemetry(buildTelemetryEvent({ command: 'agent', kubbVersion: version, hrStart, status: 'failed' }))\n clack.log.error(styleText('red', 'Failed to start agent server'))\n console.error(error)\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,SAAS,gBAAgB,MAAc,MAAgC;AACrE,QAAO,IAAI,SAAS,YAAY;EAC9B,MAAM,SAASA,SAAAA,QAAI,cAAc;AACjC,SAAO,KAAK,eAAe,QAAQ,MAAM,CAAC;AAC1C,SAAO,KAAK,mBAAmB;AAC7B,UAAO,OAAO;AACd,WAAQ,KAAK;IACb;AACF,SAAO,OAAO,MAAM,KAAK;GACzB;;AAGJ,eAAsB,cAAc,EAAE,MAAM,MAAM,YAAY,YAAY,UAAU,WAA6C;CAC/H,MAAM,UAAUC,aAAQ,QAAQ;AAEhC,KAAI;AAEF,MAAI;AACF,gBAAQ,aAAa;UACf;EAMR,MAAM,gBAAA,GAAA,SAAA,eAAA,EAAA,CAD0B,QAAQ,2BAA2B,CACpB;EAC/C,MAAM,WAAWC,UAAAA,QAAK,QAAQ,aAAa;EAC3C,MAAM,aAAaA,UAAAA,QAAK,KAAK,UAAUC,kBAAAA,cAAc,gBAAgB;EAIrE,MAAM,OAAO,SAAS,KAAA,IAAY,OAAQF,aAAQ,IAAI,QAAQE,kBAAAA,cAAc;EAC5E,MAAM,OAAO,SAASA,kBAAAA,cAAc,OAAO,OAAQF,aAAQ,IAAI,QAAQE,kBAAAA,cAAc;EACrF,MAAM,kBAAkBF,aAAQ,IAAI,mBAAmBA,aAAQ,KAAK;EACpE,MAAM,oBAAoB,eAAeE,kBAAAA,cAAc,aAAa,aAAcF,aAAQ,IAAI,qBAAqBE,kBAAAA,cAAc;EACjI,MAAM,yBAAyB,YAAY,aAAa,SAAUF,aAAQ,IAAI,0BAA0B;EACxG,MAAM,uBAAuB,WAAW,SAAUA,aAAQ,IAAI,wBAAwB;EACtF,MAAM,mBAAmBA,aAAQ,IAAI;EACrC,MAAM,2BAA2BA,aAAQ,IAAI,4BAA4BE,kBAAAA,cAAc;EACvF,MAAM,kBAAkBF,aAAQ,IAAI,mBAAmBE,kBAAAA,cAAc;EAErE,MAAM,MAAM;GACV,GAAGF,aAAQ;GACX;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;AAED,iBAAM,IAAI,MAAA,GAAA,UAAA,WAAe,QAAQ,2BAA2B,CAAC;AAC7D,iBAAM,IAAI,MAAA,GAAA,UAAA,WAAe,OAAO,WAAW,oBAAoB,CAAC;AAChE,iBAAM,IAAI,MAAA,GAAA,UAAA,WAAe,OAAO,SAAS,OAAO,CAAC;AACjD,iBAAM,IAAI,MAAA,GAAA,UAAA,WAAe,OAAO,SAAS,OAAO,CAAC;AACjD,MAAI,CAAC,0BAA0B,CAAC,qBAC9B,gBAAM,IAAI,MAAA,GAAA,UAAA,WAAe,UAAU,0EAA0E,CAAC;AAGhH,MAAI,CAAE,MAAM,gBAAgB,OAAO,KAAK,EAAE,KAAK,EAAG;AAChD,kBAAM,IAAI,OAAA,GAAA,UAAA,WAAgB,OAAO,QAAQ,KAAK,uFAAuF,CAAC;AACtI,gBAAQ,KAAK,EAAE;;AAIjB,QAAMG,aAAAA,WAAW,QAAQ,CAAC,WAAW,EAAE;GACrC;GACA,KAAKH,aAAQ,KAAK;GACnB,CAAC;AAEF,QAAMI,kBAAAA,cAAcC,kBAAAA,oBAAoB;GAAE,SAAS;GAAS,aAAa;GAAS;GAAS,QAAQ;GAAW,CAAC,CAAC;UACzG,OAAO;AACd,QAAMD,kBAAAA,cAAcC,kBAAAA,oBAAoB;GAAE,SAAS;GAAS,aAAa;GAAS;GAAS,QAAQ;GAAU,CAAC,CAAC;AAC/G,iBAAM,IAAI,OAAA,GAAA,UAAA,WAAgB,OAAO,+BAA+B,CAAC;AACjE,UAAQ,MAAM,MAAM;AACpB,eAAQ,KAAK,EAAE"}
@@ -0,0 +1,57 @@
1
+ import "./chunk--u3MIqq1.js";
2
+ import { t as version } from "./package-681jTtCk.js";
3
+ import { n as defineCommand } from "./types-CLtz0jem.js";
4
+ import { a as agentDefaults } from "./constants-CEKRremI.js";
5
+ import path from "node:path";
6
+ //#endregion
7
+ //#region src/commands/agent.ts
8
+ const command = defineCommand({
9
+ name: "agent",
10
+ description: "Manage the Kubb Agent server",
11
+ subCommands: [defineCommand({
12
+ name: "start",
13
+ description: "Start the Agent server",
14
+ options: {
15
+ config: {
16
+ type: "string",
17
+ description: "Path to the Kubb config",
18
+ short: "c"
19
+ },
20
+ port: {
21
+ type: "string",
22
+ description: `Port for the server (default: ${agentDefaults.port})`,
23
+ short: "p"
24
+ },
25
+ host: {
26
+ type: "string",
27
+ description: "Host for the server",
28
+ default: agentDefaults.host
29
+ },
30
+ "allow-write": {
31
+ type: "boolean",
32
+ description: "Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.",
33
+ default: false
34
+ },
35
+ "allow-all": {
36
+ type: "boolean",
37
+ description: "Grant all permissions (implies --allow-write).",
38
+ default: false
39
+ }
40
+ },
41
+ async run({ values }) {
42
+ const { runAgentStart } = await import("./agent-CJ69TqoO.js");
43
+ await runAgentStart({
44
+ port: values.port !== void 0 ? values.port : void 0,
45
+ host: values.host,
46
+ configPath: path.resolve(process.cwd(), values.config ?? agentDefaults.configFile),
47
+ allowWrite: values["allow-write"],
48
+ allowAll: values["allow-all"],
49
+ version
50
+ });
51
+ }
52
+ })]
53
+ });
54
+ //#endregion
55
+ export { command };
56
+
57
+ //# sourceMappingURL=agent-D0A3RQho.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-D0A3RQho.js","names":["command","startCommand"],"sources":["../src/commands/agent/start.ts","../src/commands/agent.ts"],"sourcesContent":["import path from 'node:path'\nimport { version } from '../../../package.json'\nimport { defineCommand } from '../../cli/index.ts'\nimport { agentDefaults } from '../../constants.ts'\n\nexport const command = defineCommand({\n name: 'start',\n description: 'Start the Agent server',\n options: {\n config: { type: 'string', description: 'Path to the Kubb config', short: 'c' },\n port: { type: 'string', description: `Port for the server (default: ${agentDefaults.port})`, short: 'p' },\n host: { type: 'string', description: 'Host for the server', default: agentDefaults.host },\n 'allow-write': {\n type: 'boolean',\n description: 'Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.',\n default: false,\n },\n 'allow-all': { type: 'boolean', description: 'Grant all permissions (implies --allow-write).', default: false },\n },\n async run({ values }) {\n const { runAgentStart } = await import('../../runners/agent.ts')\n\n await runAgentStart({\n port: values.port !== undefined ? values.port : undefined,\n host: values.host,\n configPath: path.resolve(process.cwd(), values.config ?? agentDefaults.configFile),\n allowWrite: values['allow-write'],\n allowAll: values['allow-all'],\n version,\n })\n },\n})\n","import { defineCommand } from '../cli/index.ts'\nimport { command as startCommand } from './agent/start.ts'\n\nexport const command = defineCommand({\n name: 'agent',\n description: 'Manage the Kubb Agent server',\n subCommands: [startCommand],\n})\n"],"mappings":";;;;;;;ACGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,aAAa,CDDQ,cAAc;EACnC,MAAM;EACN,aAAa;EACb,SAAS;GACP,QAAQ;IAAE,MAAM;IAAU,aAAa;IAA2B,OAAO;IAAK;GAC9E,MAAM;IAAE,MAAM;IAAU,aAAa,iCAAiC,cAAc,KAAK;IAAI,OAAO;IAAK;GACzG,MAAM;IAAE,MAAM;IAAU,aAAa;IAAuB,SAAS,cAAc;IAAM;GACzF,eAAe;IACb,MAAM;IACN,aAAa;IACb,SAAS;IACV;GACD,aAAa;IAAE,MAAM;IAAW,aAAa;IAAkD,SAAS;IAAO;GAChH;EACD,MAAM,IAAI,EAAE,UAAU;GACpB,MAAM,EAAE,kBAAkB,MAAM,OAAO;AAEvC,SAAM,cAAc;IAClB,MAAM,OAAO,SAAS,KAAA,IAAY,OAAO,OAAO,KAAA;IAChD,MAAM,OAAO;IACb,YAAY,KAAK,QAAQ,QAAQ,KAAK,EAAE,OAAO,UAAU,cAAc,WAAW;IAClF,YAAY,OAAO;IACnB,UAAU,OAAO;IACjB;IACD,CAAC;;EAEL,CAAC,CCzB2B;CAC5B,CAAC"}
@@ -0,0 +1,60 @@
1
+ const require_chunk = require("./chunk-ByKO4r7w.cjs");
2
+ const require_package = require("./package-aKgzEJtp.cjs");
3
+ const require_types = require("./types-Ck2lzFON.cjs");
4
+ const require_constants = require("./constants-CnPOlsJq.cjs");
5
+ let node_path = require("node:path");
6
+ node_path = require_chunk.__toESM(node_path);
7
+ //#region src/commands/agent/start.ts
8
+ const command$1 = require_types.defineCommand({
9
+ name: "start",
10
+ description: "Start the Agent server",
11
+ options: {
12
+ config: {
13
+ type: "string",
14
+ description: "Path to the Kubb config",
15
+ short: "c"
16
+ },
17
+ port: {
18
+ type: "string",
19
+ description: `Port for the server (default: ${require_constants.agentDefaults.port})`,
20
+ short: "p"
21
+ },
22
+ host: {
23
+ type: "string",
24
+ description: "Host for the server",
25
+ default: require_constants.agentDefaults.host
26
+ },
27
+ "allow-write": {
28
+ type: "boolean",
29
+ description: "Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.",
30
+ default: false
31
+ },
32
+ "allow-all": {
33
+ type: "boolean",
34
+ description: "Grant all permissions (implies --allow-write).",
35
+ default: false
36
+ }
37
+ },
38
+ async run({ values }) {
39
+ const { runAgentStart } = await Promise.resolve().then(() => require("./agent-CduUX7Ye.cjs"));
40
+ await runAgentStart({
41
+ port: values.port !== void 0 ? values.port : void 0,
42
+ host: values.host,
43
+ configPath: node_path.default.resolve(process.cwd(), values.config ?? require_constants.agentDefaults.configFile),
44
+ allowWrite: values["allow-write"],
45
+ allowAll: values["allow-all"],
46
+ version: require_package.version
47
+ });
48
+ }
49
+ });
50
+ //#endregion
51
+ //#region src/commands/agent.ts
52
+ const command = require_types.defineCommand({
53
+ name: "agent",
54
+ description: "Manage the Kubb Agent server",
55
+ subCommands: [command$1]
56
+ });
57
+ //#endregion
58
+ exports.command = command;
59
+
60
+ //# sourceMappingURL=agent-DrnwQBZf.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-DrnwQBZf.cjs","names":["command","defineCommand","agentDefaults","path","defineCommand","startCommand"],"sources":["../src/commands/agent/start.ts","../src/commands/agent.ts"],"sourcesContent":["import path from 'node:path'\nimport { version } from '../../../package.json'\nimport { defineCommand } from '../../cli/index.ts'\nimport { agentDefaults } from '../../constants.ts'\n\nexport const command = defineCommand({\n name: 'start',\n description: 'Start the Agent server',\n options: {\n config: { type: 'string', description: 'Path to the Kubb config', short: 'c' },\n port: { type: 'string', description: `Port for the server (default: ${agentDefaults.port})`, short: 'p' },\n host: { type: 'string', description: 'Host for the server', default: agentDefaults.host },\n 'allow-write': {\n type: 'boolean',\n description: 'Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.',\n default: false,\n },\n 'allow-all': { type: 'boolean', description: 'Grant all permissions (implies --allow-write).', default: false },\n },\n async run({ values }) {\n const { runAgentStart } = await import('../../runners/agent.ts')\n\n await runAgentStart({\n port: values.port !== undefined ? values.port : undefined,\n host: values.host,\n configPath: path.resolve(process.cwd(), values.config ?? agentDefaults.configFile),\n allowWrite: values['allow-write'],\n allowAll: values['allow-all'],\n version,\n })\n },\n})\n","import { defineCommand } from '../cli/index.ts'\nimport { command as startCommand } from './agent/start.ts'\n\nexport const command = defineCommand({\n name: 'agent',\n description: 'Manage the Kubb Agent server',\n subCommands: [startCommand],\n})\n"],"mappings":";;;;;;;AAKA,MAAaA,YAAUC,cAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,SAAS;EACP,QAAQ;GAAE,MAAM;GAAU,aAAa;GAA2B,OAAO;GAAK;EAC9E,MAAM;GAAE,MAAM;GAAU,aAAa,iCAAiCC,kBAAAA,cAAc,KAAK;GAAI,OAAO;GAAK;EACzG,MAAM;GAAE,MAAM;GAAU,aAAa;GAAuB,SAASA,kBAAAA,cAAc;GAAM;EACzF,eAAe;GACb,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACD,aAAa;GAAE,MAAM;GAAW,aAAa;GAAkD,SAAS;GAAO;EAChH;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,kBAAkB,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,uBAAA,CAAA;AAEhC,QAAM,cAAc;GAClB,MAAM,OAAO,SAAS,KAAA,IAAY,OAAO,OAAO,KAAA;GAChD,MAAM,OAAO;GACb,YAAYC,UAAAA,QAAK,QAAQ,QAAQ,KAAK,EAAE,OAAO,UAAUD,kBAAAA,cAAc,WAAW;GAClF,YAAY,OAAO;GACnB,UAAU,OAAO;GACjB,SAAA,gBAAA;GACD,CAAC;;CAEL,CAAC;;;AC5BF,MAAa,UAAUE,cAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,aAAa,CAACC,UAAa;CAC5B,CAAC"}
@@ -0,0 +1,79 @@
1
+ //#region src/constants.ts
2
+ /** NPM registry endpoint used to check for @kubb/cli updates. */
3
+ const KUBB_NPM_PACKAGE_URL = "https://registry.npmjs.org/@kubb/cli/latest";
4
+ /** OpenTelemetry ingestion endpoint for anonymous usage telemetry. */
5
+ const OTLP_ENDPOINT = "https://otlp.kubb.dev";
6
+ /** Horizontal rule rendered above/below the plain-logger generation summary. */
7
+ const SUMMARY_SEPARATOR = "─".repeat(27);
8
+ /** Glob pattern for paths the file watcher ignores. */
9
+ const WATCHER_IGNORED_PATHS = "**/{.git,node_modules}/**";
10
+ /** Default runtime values for the `agent start` command. */
11
+ const agentDefaults = {
12
+ port: "3000",
13
+ host: "localhost",
14
+ configFile: "kubb.config.ts",
15
+ retryTimeout: "30000",
16
+ studioUrl: "https://studio.kubb.dev",
17
+ serverEntryPath: ".output/server/index.mjs"
18
+ };
19
+ /** Default values used during interactive `init` scaffolding. */
20
+ const initDefaults = {
21
+ inputPath: "./openapi.yaml",
22
+ outputPath: "./src/gen",
23
+ plugins: ["plugin-oas", "plugin-ts"]
24
+ };
25
+ /**
26
+ * Maps each plugin value to the default config snippet inserted by `init`.
27
+ * The `satisfies` constraint ensures all values remain plain strings while
28
+ * `as const` keeps the object deeply immutable.
29
+ */
30
+ const pluginDefaultConfigs = {
31
+ "plugin-oas": "pluginOas()",
32
+ "plugin-ts": `pluginTs({
33
+ output: { path: 'models' },
34
+ })`,
35
+ "plugin-client": `pluginClient({
36
+ output: { path: 'clients' },
37
+ })`,
38
+ "plugin-react-query": `pluginReactQuery({
39
+ output: { path: 'hooks' },
40
+ })`,
41
+ "plugin-solid-query": `pluginSolidQuery({
42
+ output: { path: 'hooks' },
43
+ })`,
44
+ "plugin-svelte-query": `pluginSvelteQuery({
45
+ output: { path: 'hooks' },
46
+ })`,
47
+ "plugin-vue-query": `pluginVueQuery({
48
+ output: { path: 'hooks' },
49
+ })`,
50
+ "plugin-swr": `pluginSwr({
51
+ output: { path: 'hooks' },
52
+ })`,
53
+ "plugin-zod": `pluginZod({
54
+ output: { path: 'zod' },
55
+ })`,
56
+ "plugin-faker": `pluginFaker({
57
+ output: { path: 'mocks' },
58
+ })`,
59
+ "plugin-msw": `pluginMsw({
60
+ output: { path: 'msw' },
61
+ })`
62
+ };
63
+ /** Color palette used by randomCliColor() for deterministic plugin name coloring. */
64
+ const randomColors = [
65
+ "black",
66
+ "red",
67
+ "green",
68
+ "yellow",
69
+ "blue",
70
+ "white",
71
+ "magenta",
72
+ "cyan",
73
+ "gray",
74
+ "blue"
75
+ ];
76
+ //#endregion
77
+ export { agentDefaults as a, randomColors as c, WATCHER_IGNORED_PATHS as i, OTLP_ENDPOINT as n, initDefaults as o, SUMMARY_SEPARATOR as r, pluginDefaultConfigs as s, KUBB_NPM_PACKAGE_URL as t };
78
+
79
+ //# sourceMappingURL=constants-CEKRremI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-CEKRremI.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/** NPM registry endpoint used to check for @kubb/cli updates. */\nexport const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const\n\n/** OpenTelemetry ingestion endpoint for anonymous usage telemetry. */\nexport const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const\n\n/** Horizontal rule rendered above/below the plain-logger generation summary. */\nexport const SUMMARY_SEPARATOR = '─'.repeat(27)\n\n/** Maximum number of █ characters in a plugin timing bar. */\nexport const SUMMARY_MAX_BAR_LENGTH = 10 as const\n\n/** Divides elapsed milliseconds into bar-length units (1 block per 100 ms). */\nexport const SUMMARY_TIME_SCALE_DIVISOR = 100 as const\n\n/** Glob pattern for paths the file watcher ignores. */\nexport const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/** Default runtime values for the `agent start` command. */\nexport const agentDefaults = {\n port: '3000',\n host: 'localhost',\n configFile: 'kubb.config.ts',\n retryTimeout: '30000',\n studioUrl: 'https://studio.kubb.dev',\n /** Relative path from the @kubb/agent package root to the server entry. */\n serverEntryPath: '.output/server/index.mjs',\n} as const\n\n/** Default values used during interactive `init` scaffolding. */\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-oas', 'plugin-ts'],\n} as const\n\n/**\n * Maps each plugin value to the default config snippet inserted by `init`.\n * The `satisfies` constraint ensures all values remain plain strings while\n * `as const` keeps the object deeply immutable.\n */\nexport const pluginDefaultConfigs = {\n 'plugin-oas': 'pluginOas()',\n 'plugin-ts': `pluginTs({\n output: { path: 'models' },\n })`,\n 'plugin-client': `pluginClient({\n output: { path: 'clients' },\n })`,\n 'plugin-react-query': `pluginReactQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-solid-query': `pluginSolidQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-svelte-query': `pluginSvelteQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-swr': `pluginSwr({\n output: { path: 'hooks' },\n })`,\n 'plugin-zod': `pluginZod({\n output: { path: 'zod' },\n })`,\n 'plugin-faker': `pluginFaker({\n output: { path: 'mocks' },\n })`,\n 'plugin-msw': `pluginMsw({\n output: { path: 'msw' },\n })`,\n} as const satisfies Record<string, string>\n\n/** Color palette used by randomCliColor() for deterministic plugin name coloring. */\nexport const randomColors = ['black', 'red', 'green', 'yellow', 'blue', 'white', 'magenta', 'cyan', 'gray', 'blue'] as const\n"],"mappings":";;AACA,MAAa,uBAAuB;;AAGpC,MAAa,gBAAgB;;AAG7B,MAAa,oBAAoB,IAAI,OAAO,GAAG;;AAS/C,MAAa,wBAAwB;;AAGrC,MAAa,gBAAgB;CAC3B,MAAM;CACN,MAAM;CACN,YAAY;CACZ,cAAc;CACd,WAAW;CAEX,iBAAiB;CAClB;;AAGD,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,cAAc,YAAY;CACrC;;;;;;AAOD,MAAa,uBAAuB;CAClC,cAAc;CACd,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,sBAAsB;;;CAGtB,uBAAuB;;;CAGvB,oBAAoB;;;CAGpB,cAAc;;;CAGd,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGf;;AAGD,MAAa,eAAe;CAAC;CAAS;CAAO;CAAS;CAAU;CAAQ;CAAS;CAAW;CAAQ;CAAQ;CAAO"}
@@ -0,0 +1,126 @@
1
+ //#region src/constants.ts
2
+ /** NPM registry endpoint used to check for @kubb/cli updates. */
3
+ const KUBB_NPM_PACKAGE_URL = "https://registry.npmjs.org/@kubb/cli/latest";
4
+ /** OpenTelemetry ingestion endpoint for anonymous usage telemetry. */
5
+ const OTLP_ENDPOINT = "https://otlp.kubb.dev";
6
+ /** Horizontal rule rendered above/below the plain-logger generation summary. */
7
+ const SUMMARY_SEPARATOR = "─".repeat(27);
8
+ /** Glob pattern for paths the file watcher ignores. */
9
+ const WATCHER_IGNORED_PATHS = "**/{.git,node_modules}/**";
10
+ /** Default runtime values for the `agent start` command. */
11
+ const agentDefaults = {
12
+ port: "3000",
13
+ host: "localhost",
14
+ configFile: "kubb.config.ts",
15
+ retryTimeout: "30000",
16
+ studioUrl: "https://studio.kubb.dev",
17
+ serverEntryPath: ".output/server/index.mjs"
18
+ };
19
+ /** Default values used during interactive `init` scaffolding. */
20
+ const initDefaults = {
21
+ inputPath: "./openapi.yaml",
22
+ outputPath: "./src/gen",
23
+ plugins: ["plugin-oas", "plugin-ts"]
24
+ };
25
+ /**
26
+ * Maps each plugin value to the default config snippet inserted by `init`.
27
+ * The `satisfies` constraint ensures all values remain plain strings while
28
+ * `as const` keeps the object deeply immutable.
29
+ */
30
+ const pluginDefaultConfigs = {
31
+ "plugin-oas": "pluginOas()",
32
+ "plugin-ts": `pluginTs({
33
+ output: { path: 'models' },
34
+ })`,
35
+ "plugin-client": `pluginClient({
36
+ output: { path: 'clients' },
37
+ })`,
38
+ "plugin-react-query": `pluginReactQuery({
39
+ output: { path: 'hooks' },
40
+ })`,
41
+ "plugin-solid-query": `pluginSolidQuery({
42
+ output: { path: 'hooks' },
43
+ })`,
44
+ "plugin-svelte-query": `pluginSvelteQuery({
45
+ output: { path: 'hooks' },
46
+ })`,
47
+ "plugin-vue-query": `pluginVueQuery({
48
+ output: { path: 'hooks' },
49
+ })`,
50
+ "plugin-swr": `pluginSwr({
51
+ output: { path: 'hooks' },
52
+ })`,
53
+ "plugin-zod": `pluginZod({
54
+ output: { path: 'zod' },
55
+ })`,
56
+ "plugin-faker": `pluginFaker({
57
+ output: { path: 'mocks' },
58
+ })`,
59
+ "plugin-msw": `pluginMsw({
60
+ output: { path: 'msw' },
61
+ })`
62
+ };
63
+ /** Color palette used by randomCliColor() for deterministic plugin name coloring. */
64
+ const randomColors = [
65
+ "black",
66
+ "red",
67
+ "green",
68
+ "yellow",
69
+ "blue",
70
+ "white",
71
+ "magenta",
72
+ "cyan",
73
+ "gray",
74
+ "blue"
75
+ ];
76
+ //#endregion
77
+ Object.defineProperty(exports, "KUBB_NPM_PACKAGE_URL", {
78
+ enumerable: true,
79
+ get: function() {
80
+ return KUBB_NPM_PACKAGE_URL;
81
+ }
82
+ });
83
+ Object.defineProperty(exports, "OTLP_ENDPOINT", {
84
+ enumerable: true,
85
+ get: function() {
86
+ return OTLP_ENDPOINT;
87
+ }
88
+ });
89
+ Object.defineProperty(exports, "SUMMARY_SEPARATOR", {
90
+ enumerable: true,
91
+ get: function() {
92
+ return SUMMARY_SEPARATOR;
93
+ }
94
+ });
95
+ Object.defineProperty(exports, "WATCHER_IGNORED_PATHS", {
96
+ enumerable: true,
97
+ get: function() {
98
+ return WATCHER_IGNORED_PATHS;
99
+ }
100
+ });
101
+ Object.defineProperty(exports, "agentDefaults", {
102
+ enumerable: true,
103
+ get: function() {
104
+ return agentDefaults;
105
+ }
106
+ });
107
+ Object.defineProperty(exports, "initDefaults", {
108
+ enumerable: true,
109
+ get: function() {
110
+ return initDefaults;
111
+ }
112
+ });
113
+ Object.defineProperty(exports, "pluginDefaultConfigs", {
114
+ enumerable: true,
115
+ get: function() {
116
+ return pluginDefaultConfigs;
117
+ }
118
+ });
119
+ Object.defineProperty(exports, "randomColors", {
120
+ enumerable: true,
121
+ get: function() {
122
+ return randomColors;
123
+ }
124
+ });
125
+
126
+ //# sourceMappingURL=constants-CnPOlsJq.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-CnPOlsJq.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/** NPM registry endpoint used to check for @kubb/cli updates. */\nexport const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const\n\n/** OpenTelemetry ingestion endpoint for anonymous usage telemetry. */\nexport const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const\n\n/** Horizontal rule rendered above/below the plain-logger generation summary. */\nexport const SUMMARY_SEPARATOR = '─'.repeat(27)\n\n/** Maximum number of █ characters in a plugin timing bar. */\nexport const SUMMARY_MAX_BAR_LENGTH = 10 as const\n\n/** Divides elapsed milliseconds into bar-length units (1 block per 100 ms). */\nexport const SUMMARY_TIME_SCALE_DIVISOR = 100 as const\n\n/** Glob pattern for paths the file watcher ignores. */\nexport const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/** Default runtime values for the `agent start` command. */\nexport const agentDefaults = {\n port: '3000',\n host: 'localhost',\n configFile: 'kubb.config.ts',\n retryTimeout: '30000',\n studioUrl: 'https://studio.kubb.dev',\n /** Relative path from the @kubb/agent package root to the server entry. */\n serverEntryPath: '.output/server/index.mjs',\n} as const\n\n/** Default values used during interactive `init` scaffolding. */\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-oas', 'plugin-ts'],\n} as const\n\n/**\n * Maps each plugin value to the default config snippet inserted by `init`.\n * The `satisfies` constraint ensures all values remain plain strings while\n * `as const` keeps the object deeply immutable.\n */\nexport const pluginDefaultConfigs = {\n 'plugin-oas': 'pluginOas()',\n 'plugin-ts': `pluginTs({\n output: { path: 'models' },\n })`,\n 'plugin-client': `pluginClient({\n output: { path: 'clients' },\n })`,\n 'plugin-react-query': `pluginReactQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-solid-query': `pluginSolidQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-svelte-query': `pluginSvelteQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-swr': `pluginSwr({\n output: { path: 'hooks' },\n })`,\n 'plugin-zod': `pluginZod({\n output: { path: 'zod' },\n })`,\n 'plugin-faker': `pluginFaker({\n output: { path: 'mocks' },\n })`,\n 'plugin-msw': `pluginMsw({\n output: { path: 'msw' },\n })`,\n} as const satisfies Record<string, string>\n\n/** Color palette used by randomCliColor() for deterministic plugin name coloring. */\nexport const randomColors = ['black', 'red', 'green', 'yellow', 'blue', 'white', 'magenta', 'cyan', 'gray', 'blue'] as const\n"],"mappings":";;AACA,MAAa,uBAAuB;;AAGpC,MAAa,gBAAgB;;AAG7B,MAAa,oBAAoB,IAAI,OAAO,GAAG;;AAS/C,MAAa,wBAAwB;;AAGrC,MAAa,gBAAgB;CAC3B,MAAM;CACN,MAAM;CACN,YAAY;CACZ,cAAc;CACd,WAAW;CAEX,iBAAiB;CAClB;;AAGD,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,cAAc,YAAY;CACrC;;;;;;AAOD,MAAa,uBAAuB;CAClC,cAAc;CACd,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,sBAAsB;;;CAGtB,uBAAuB;;;CAGvB,oBAAoB;;;CAGpB,cAAc;;;CAGd,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGf;;AAGD,MAAa,eAAe;CAAC;CAAS;CAAO;CAAS;CAAU;CAAQ;CAAS;CAAW;CAAQ;CAAQ;CAAO"}
@@ -0,0 +1,44 @@
1
+ require("./chunk-ByKO4r7w.cjs");
2
+ //#region src/utils/errors.ts
3
+ /**
4
+ * Coerce an unknown thrown value to an `Error` instance.
5
+ * When the value is already an `Error` it is returned as-is;
6
+ * otherwise a new `Error` is created whose message is `String(value)`.
7
+ */
8
+ function toError(value) {
9
+ return value instanceof Error ? value : new Error(String(value));
10
+ }
11
+ /**
12
+ * Safely extract a human-readable message from any thrown value.
13
+ */
14
+ function getErrorMessage(value) {
15
+ return value instanceof Error ? value.message : String(value);
16
+ }
17
+ /**
18
+ * Extract the `.cause` property of an `Error` as an `Error | undefined`.
19
+ * Returns `undefined` when the cause is absent or is not an `Error`.
20
+ */
21
+ function toCause(error) {
22
+ return error.cause instanceof Error ? error.cause : void 0;
23
+ }
24
+ //#endregion
25
+ Object.defineProperty(exports, "getErrorMessage", {
26
+ enumerable: true,
27
+ get: function() {
28
+ return getErrorMessage;
29
+ }
30
+ });
31
+ Object.defineProperty(exports, "toCause", {
32
+ enumerable: true,
33
+ get: function() {
34
+ return toCause;
35
+ }
36
+ });
37
+ Object.defineProperty(exports, "toError", {
38
+ enumerable: true,
39
+ get: function() {
40
+ return toError;
41
+ }
42
+ });
43
+
44
+ //# sourceMappingURL=errors-BUjJsNoe.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-BUjJsNoe.cjs","names":[],"sources":["../src/utils/errors.ts"],"sourcesContent":["/**\n * Coerce an unknown thrown value to an `Error` instance.\n * When the value is already an `Error` it is returned as-is;\n * otherwise a new `Error` is created whose message is `String(value)`.\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Safely extract a human-readable message from any thrown value.\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extract the `.cause` property of an `Error` as an `Error | undefined`.\n * Returns `undefined` when the cause is absent or is not an `Error`.\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n"],"mappings":";;;;;;;AAKA,SAAgB,QAAQ,OAAuB;AAC7C,QAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;;;;;AAMlE,SAAgB,gBAAgB,OAAwB;AACtD,QAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;;;;;;AAO/D,SAAgB,QAAQ,OAAiC;AACvD,QAAO,MAAM,iBAAiB,QAAQ,MAAM,QAAQ,KAAA"}
@@ -0,0 +1,27 @@
1
+ import "./chunk--u3MIqq1.js";
2
+ //#region src/utils/errors.ts
3
+ /**
4
+ * Coerce an unknown thrown value to an `Error` instance.
5
+ * When the value is already an `Error` it is returned as-is;
6
+ * otherwise a new `Error` is created whose message is `String(value)`.
7
+ */
8
+ function toError(value) {
9
+ return value instanceof Error ? value : new Error(String(value));
10
+ }
11
+ /**
12
+ * Safely extract a human-readable message from any thrown value.
13
+ */
14
+ function getErrorMessage(value) {
15
+ return value instanceof Error ? value.message : String(value);
16
+ }
17
+ /**
18
+ * Extract the `.cause` property of an `Error` as an `Error | undefined`.
19
+ * Returns `undefined` when the cause is absent or is not an `Error`.
20
+ */
21
+ function toCause(error) {
22
+ return error.cause instanceof Error ? error.cause : void 0;
23
+ }
24
+ //#endregion
25
+ export { toCause as n, toError as r, getErrorMessage as t };
26
+
27
+ //# sourceMappingURL=errors-bSLTEh4e.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-bSLTEh4e.js","names":[],"sources":["../src/utils/errors.ts"],"sourcesContent":["/**\n * Coerce an unknown thrown value to an `Error` instance.\n * When the value is already an `Error` it is returned as-is;\n * otherwise a new `Error` is created whose message is `String(value)`.\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Safely extract a human-readable message from any thrown value.\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extract the `.cause` property of an `Error` as an `Error | undefined`.\n * Returns `undefined` when the cause is absent or is not an `Error`.\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n"],"mappings":";;;;;;;AAKA,SAAgB,QAAQ,OAAuB;AAC7C,QAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;;;;;AAMlE,SAAgB,gBAAgB,OAAwB;AACtD,QAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;;;;;;AAO/D,SAAgB,QAAQ,OAAiC;AACvD,QAAO,MAAM,iBAAiB,QAAQ,MAAM,QAAQ,KAAA"}