@kubb/cli 4.33.0 → 4.33.2

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-D0A3RQho.js → agent-BGWY8Iow.js} +5 -5
  2. package/dist/agent-BGWY8Iow.js.map +1 -0
  3. package/dist/{agent-CduUX7Ye.cjs → agent-Bd1QdPVV.cjs} +7 -7
  4. package/dist/agent-Bd1QdPVV.cjs.map +1 -0
  5. package/dist/{agent-DrnwQBZf.cjs → agent-CmQJU9h7.cjs} +7 -7
  6. package/dist/agent-CmQJU9h7.cjs.map +1 -0
  7. package/dist/{agent-CJ69TqoO.js → agent-u_Ehwz6r.js} +5 -5
  8. package/dist/agent-u_Ehwz6r.js.map +1 -0
  9. package/dist/{constants-CnPOlsJq.cjs → constants-BTUap0zs.cjs} +1 -19
  10. package/dist/{constants-CnPOlsJq.cjs.map → constants-BTUap0zs.cjs.map} +1 -1
  11. package/dist/{constants-CEKRremI.js → constants-CM3dJzjK.js} +2 -14
  12. package/dist/{constants-CEKRremI.js.map → constants-CM3dJzjK.js.map} +1 -1
  13. package/dist/{types-CLtz0jem.js → define--M_JMcDC.js} +6 -6
  14. package/dist/define--M_JMcDC.js.map +1 -0
  15. package/dist/{types-Ck2lzFON.cjs → define-D6Kfm7-Z.cjs} +6 -6
  16. package/dist/define-D6Kfm7-Z.cjs.map +1 -0
  17. package/dist/{errors-bSLTEh4e.js → errors-6mF_WKxg.js} +5 -5
  18. package/dist/errors-6mF_WKxg.js.map +1 -0
  19. package/dist/{errors-BUjJsNoe.cjs → errors-DBW0N9w4.cjs} +5 -5
  20. package/dist/errors-DBW0N9w4.cjs.map +1 -0
  21. package/dist/{generate-ByMgAV76.cjs → generate-6Cm1AK2n.cjs} +275 -153
  22. package/dist/generate-6Cm1AK2n.cjs.map +1 -0
  23. package/dist/{generate-HP5ySfjV.js → generate-DcNp9Owd.js} +271 -149
  24. package/dist/generate-DcNp9Owd.js.map +1 -0
  25. package/dist/{generate-CiUPO5ds.cjs → generate-DqmjK5Lc.cjs} +3 -3
  26. package/dist/generate-DqmjK5Lc.cjs.map +1 -0
  27. package/dist/{generate-DIIxtkWT.js → generate-rtsmgWhO.js} +3 -3
  28. package/dist/generate-rtsmgWhO.js.map +1 -0
  29. package/dist/index.cjs +13 -13
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.js +12 -12
  32. package/dist/index.js.map +1 -1
  33. package/dist/{init-DLNrkDF4.js → init--9nMhvx6.js} +4 -4
  34. package/dist/init--9nMhvx6.js.map +1 -0
  35. package/dist/{init-Df_aXezV.cjs → init-BvjtU-sC.cjs} +5 -4
  36. package/dist/init-BvjtU-sC.cjs.map +1 -0
  37. package/dist/{init-DyKK2fTp.js → init-C-InrmSY.js} +42 -31
  38. package/dist/init-C-InrmSY.js.map +1 -0
  39. package/dist/{init-Cd1hCb7q.cjs → init-hmolV6B4.cjs} +47 -37
  40. package/dist/init-hmolV6B4.cjs.map +1 -0
  41. package/dist/{jiti-BdskUHhD.cjs → jiti-Cd3S0xwr.cjs} +1 -1
  42. package/dist/{jiti-BdskUHhD.cjs.map → jiti-Cd3S0xwr.cjs.map} +1 -1
  43. package/dist/{jiti-Cl7t20dO.js → jiti-e08mD2Ph.js} +1 -1
  44. package/dist/{jiti-Cl7t20dO.js.map → jiti-e08mD2Ph.js.map} +1 -1
  45. package/dist/{mcp-Clg-Qnkr.cjs → mcp-Bd-DXHWV.cjs} +5 -4
  46. package/dist/mcp-Bd-DXHWV.cjs.map +1 -0
  47. package/dist/{mcp-Bd9LITaI.js → mcp-CZzxfbHW.js} +4 -4
  48. package/dist/mcp-CZzxfbHW.js.map +1 -0
  49. package/dist/{mcp-B73FC8dF.cjs → mcp-ChHFPRzD.cjs} +4 -4
  50. package/dist/mcp-ChHFPRzD.cjs.map +1 -0
  51. package/dist/{mcp-Cf-1dsB-.js → mcp-D2SHEg_d.js} +4 -4
  52. package/dist/mcp-D2SHEg_d.js.map +1 -0
  53. package/dist/{package-aKgzEJtp.cjs → package-BXijqaX5.cjs} +2 -2
  54. package/dist/package-BXijqaX5.cjs.map +1 -0
  55. package/dist/package-DeOlqJ31.js +6 -0
  56. package/dist/package-DeOlqJ31.js.map +1 -0
  57. package/dist/shell-7HPrTCJ5.cjs +57 -0
  58. package/dist/shell-7HPrTCJ5.cjs.map +1 -0
  59. package/dist/shell-DqqWsHCD.js +46 -0
  60. package/dist/shell-DqqWsHCD.js.map +1 -0
  61. package/dist/{telemetry-T5IA2dWA.cjs → telemetry-Cn9X1I5B.cjs} +46 -9
  62. package/dist/telemetry-Cn9X1I5B.cjs.map +1 -0
  63. package/dist/{telemetry-C4gOKX2x.js → telemetry-DxiR7clS.js} +40 -9
  64. package/dist/telemetry-DxiR7clS.js.map +1 -0
  65. package/dist/{validate-Cr26q5xX.js → validate-BH2Ysgxr.js} +4 -4
  66. package/dist/validate-BH2Ysgxr.js.map +1 -0
  67. package/dist/{validate-DURmg-2Q.cjs → validate-BQvsoQz-.cjs} +5 -4
  68. package/dist/validate-BQvsoQz-.cjs.map +1 -0
  69. package/dist/{validate-Dqi9T_c4.cjs → validate-Bbrn3Q-A.cjs} +4 -4
  70. package/dist/validate-Bbrn3Q-A.cjs.map +1 -0
  71. package/dist/{validate-Chjg23AE.js → validate-l8vLmwKA.js} +4 -4
  72. package/dist/validate-l8vLmwKA.js.map +1 -0
  73. package/package.json +6 -5
  74. package/src/commands/agent/start.ts +1 -1
  75. package/src/commands/agent.ts +1 -1
  76. package/src/commands/generate.ts +1 -1
  77. package/src/commands/init.ts +1 -1
  78. package/src/commands/mcp.ts +1 -1
  79. package/src/commands/validate.ts +1 -1
  80. package/src/constants.ts +0 -1
  81. package/src/index.ts +1 -1
  82. package/src/loggers/clackLogger.ts +26 -28
  83. package/src/loggers/fileSystemLogger.ts +1 -2
  84. package/src/loggers/githubActionsLogger.ts +26 -28
  85. package/src/loggers/plainLogger.ts +25 -26
  86. package/src/loggers/utils.ts +4 -5
  87. package/src/runners/agent.ts +1 -1
  88. package/src/runners/generate.ts +20 -7
  89. package/src/runners/init.ts +2 -1
  90. package/src/runners/mcp.ts +1 -1
  91. package/src/runners/validate.ts +1 -1
  92. package/src/utils/executeHooks.ts +2 -2
  93. package/src/utils/getIntro.ts +1 -80
  94. package/src/utils/getSummary.ts +1 -2
  95. package/src/utils/packageManager.ts +2 -2
  96. package/src/utils/runHook.ts +2 -2
  97. package/src/utils/telemetry.ts +1 -2
  98. package/dist/agent-CJ69TqoO.js.map +0 -1
  99. package/dist/agent-CduUX7Ye.cjs.map +0 -1
  100. package/dist/agent-D0A3RQho.js.map +0 -1
  101. package/dist/agent-DrnwQBZf.cjs.map +0 -1
  102. package/dist/errors-BUjJsNoe.cjs.map +0 -1
  103. package/dist/errors-bSLTEh4e.js.map +0 -1
  104. package/dist/generate-ByMgAV76.cjs.map +0 -1
  105. package/dist/generate-CiUPO5ds.cjs.map +0 -1
  106. package/dist/generate-DIIxtkWT.js.map +0 -1
  107. package/dist/generate-HP5ySfjV.js.map +0 -1
  108. package/dist/init-Cd1hCb7q.cjs.map +0 -1
  109. package/dist/init-DLNrkDF4.js.map +0 -1
  110. package/dist/init-Df_aXezV.cjs.map +0 -1
  111. package/dist/init-DyKK2fTp.js.map +0 -1
  112. package/dist/mcp-B73FC8dF.cjs.map +0 -1
  113. package/dist/mcp-Bd9LITaI.js.map +0 -1
  114. package/dist/mcp-Cf-1dsB-.js.map +0 -1
  115. package/dist/mcp-Clg-Qnkr.cjs.map +0 -1
  116. package/dist/package-681jTtCk.js +0 -6
  117. package/dist/package-681jTtCk.js.map +0 -1
  118. package/dist/package-aKgzEJtp.cjs.map +0 -1
  119. package/dist/telemetry-C4gOKX2x.js.map +0 -1
  120. package/dist/telemetry-T5IA2dWA.cjs.map +0 -1
  121. package/dist/types-CLtz0jem.js.map +0 -1
  122. package/dist/types-Ck2lzFON.cjs.map +0 -1
  123. package/dist/validate-Chjg23AE.js.map +0 -1
  124. package/dist/validate-Cr26q5xX.js.map +0 -1
  125. package/dist/validate-DURmg-2Q.cjs.map +0 -1
  126. package/dist/validate-Dqi9T_c4.cjs.map +0 -1
  127. package/src/cli/adapters/nodeAdapter.ts +0 -159
  128. package/src/cli/help.ts +0 -36
  129. package/src/cli/index.ts +0 -16
  130. package/src/cli/parse.ts +0 -18
  131. package/src/cli/schema.ts +0 -38
  132. package/src/cli/types.ts +0 -95
  133. package/src/utils/envDetection.ts +0 -34
  134. package/src/utils/errors.ts +0 -23
  135. package/src/utils/formatMsWithColor.ts +0 -22
  136. package/src/utils/randomColor.ts +0 -14
  137. package/src/utils/spawnAsync.ts +0 -47
@@ -1,7 +1,7 @@
1
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";
2
+ import { n as defineCommand } from "./define--M_JMcDC.js";
3
+ import { t as version } from "./package-DeOlqJ31.js";
4
+ import { a as agentDefaults } from "./constants-CM3dJzjK.js";
5
5
  import path from "node:path";
6
6
  //#endregion
7
7
  //#region src/commands/agent.ts
@@ -39,7 +39,7 @@ const command = defineCommand({
39
39
  }
40
40
  },
41
41
  async run({ values }) {
42
- const { runAgentStart } = await import("./agent-CJ69TqoO.js");
42
+ const { runAgentStart } = await import("./agent-u_Ehwz6r.js");
43
43
  await runAgentStart({
44
44
  port: values.port !== void 0 ? values.port : void 0,
45
45
  host: values.host,
@@ -54,4 +54,4 @@ const command = defineCommand({
54
54
  //#endregion
55
55
  export { command };
56
56
 
57
- //# sourceMappingURL=agent-D0A3RQho.js.map
57
+ //# sourceMappingURL=agent-BGWY8Iow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-BGWY8Iow.js","names":["command","startCommand"],"sources":["../src/commands/agent/start.ts","../src/commands/agent.ts"],"sourcesContent":["import path from 'node:path'\nimport { defineCommand } from '@internals/utils'\nimport { version } from '../../../package.json'\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 '@internals/utils'\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"}
@@ -1,12 +1,12 @@
1
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");
2
+ const require_telemetry = require("./telemetry-Cn9X1I5B.cjs");
3
+ const require_shell = require("./shell-7HPrTCJ5.cjs");
4
+ const require_constants = require("./constants-BTUap0zs.cjs");
5
5
  let node_util = require("node:util");
6
- let node_process = require("node:process");
7
- node_process = require_chunk.__toESM(node_process);
8
6
  let node_path = require("node:path");
9
7
  node_path = require_chunk.__toESM(node_path);
8
+ let node_process = require("node:process");
9
+ node_process = require_chunk.__toESM(node_process);
10
10
  let node_net = require("node:net");
11
11
  node_net = require_chunk.__toESM(node_net);
12
12
  let node_url = require("node:url");
@@ -63,7 +63,7 @@ async function runAgentStart({ port, host, configPath, allowWrite, allowAll, ver
63
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
64
  node_process.exit(1);
65
65
  }
66
- await require_init.spawnAsync("node", [serverPath], {
66
+ await require_shell.spawnAsync("node", [serverPath], {
67
67
  env,
68
68
  cwd: node_process.cwd()
69
69
  });
@@ -88,4 +88,4 @@ async function runAgentStart({ port, host, configPath, allowWrite, allowAll, ver
88
88
  //#endregion
89
89
  exports.runAgentStart = runAgentStart;
90
90
 
91
- //# sourceMappingURL=agent-CduUX7Ye.cjs.map
91
+ //# sourceMappingURL=agent-Bd1QdPVV.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-Bd1QdPVV.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 { spawnAsync } from '@internals/utils'\nimport { agentDefaults } from '../constants.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,cAAAA,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"}
@@ -1,11 +1,11 @@
1
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");
2
+ const require_define = require("./define-D6Kfm7-Z.cjs");
3
+ const require_package = require("./package-BXijqaX5.cjs");
4
+ const require_constants = require("./constants-BTUap0zs.cjs");
5
5
  let node_path = require("node:path");
6
6
  node_path = require_chunk.__toESM(node_path);
7
7
  //#region src/commands/agent/start.ts
8
- const command$1 = require_types.defineCommand({
8
+ const command$1 = require_define.defineCommand({
9
9
  name: "start",
10
10
  description: "Start the Agent server",
11
11
  options: {
@@ -36,7 +36,7 @@ const command$1 = require_types.defineCommand({
36
36
  }
37
37
  },
38
38
  async run({ values }) {
39
- const { runAgentStart } = await Promise.resolve().then(() => require("./agent-CduUX7Ye.cjs"));
39
+ const { runAgentStart } = await Promise.resolve().then(() => require("./agent-Bd1QdPVV.cjs"));
40
40
  await runAgentStart({
41
41
  port: values.port !== void 0 ? values.port : void 0,
42
42
  host: values.host,
@@ -49,7 +49,7 @@ const command$1 = require_types.defineCommand({
49
49
  });
50
50
  //#endregion
51
51
  //#region src/commands/agent.ts
52
- const command = require_types.defineCommand({
52
+ const command = require_define.defineCommand({
53
53
  name: "agent",
54
54
  description: "Manage the Kubb Agent server",
55
55
  subCommands: [command$1]
@@ -57,4 +57,4 @@ const command = require_types.defineCommand({
57
57
  //#endregion
58
58
  exports.command = command;
59
59
 
60
- //# sourceMappingURL=agent-DrnwQBZf.cjs.map
60
+ //# sourceMappingURL=agent-CmQJU9h7.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-CmQJU9h7.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 { defineCommand } from '@internals/utils'\nimport { version } from '../../../package.json'\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 '@internals/utils'\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,eAAAA,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,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,aAAa,CAACC,UAAa;CAC5B,CAAC"}
@@ -1,10 +1,10 @@
1
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";
2
+ import { r as sendTelemetry, t as buildTelemetryEvent } from "./telemetry-DxiR7clS.js";
3
+ import { t as spawnAsync } from "./shell-DqqWsHCD.js";
4
+ import { a as agentDefaults } from "./constants-CM3dJzjK.js";
5
5
  import { styleText } from "node:util";
6
- import * as process$1 from "node:process";
7
6
  import path from "node:path";
7
+ import * as process$1 from "node:process";
8
8
  import net from "node:net";
9
9
  import { fileURLToPath } from "node:url";
10
10
  import * as clack from "@clack/prompts";
@@ -84,4 +84,4 @@ async function runAgentStart({ port, host, configPath, allowWrite, allowAll, ver
84
84
  //#endregion
85
85
  export { runAgentStart };
86
86
 
87
- //# sourceMappingURL=agent-CJ69TqoO.js.map
87
+ //# sourceMappingURL=agent-u_Ehwz6r.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-u_Ehwz6r.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 { spawnAsync } from '@internals/utils'\nimport { agentDefaults } from '../constants.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"}
@@ -61,18 +61,6 @@ const pluginDefaultConfigs = {
61
61
  })`
62
62
  };
63
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
64
  //#endregion
77
65
  Object.defineProperty(exports, "KUBB_NPM_PACKAGE_URL", {
78
66
  enumerable: true,
@@ -116,11 +104,5 @@ Object.defineProperty(exports, "pluginDefaultConfigs", {
116
104
  return pluginDefaultConfigs;
117
105
  }
118
106
  });
119
- Object.defineProperty(exports, "randomColors", {
120
- enumerable: true,
121
- get: function() {
122
- return randomColors;
123
- }
124
- });
125
107
 
126
- //# sourceMappingURL=constants-CnPOlsJq.cjs.map
108
+ //# sourceMappingURL=constants-BTUap0zs.cjs.map
@@ -1 +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"}
1
+ {"version":3,"file":"constants-BTUap0zs.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. */\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"}
@@ -61,19 +61,7 @@ const pluginDefaultConfigs = {
61
61
  })`
62
62
  };
63
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
64
  //#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 };
65
+ export { agentDefaults as a, 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
66
 
79
- //# sourceMappingURL=constants-CEKRremI.js.map
67
+ //# sourceMappingURL=constants-CM3dJzjK.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"constants-CM3dJzjK.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. */\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"}
@@ -1,5 +1,9 @@
1
1
  import "./chunk--u3MIqq1.js";
2
- //#region src/cli/types.ts
2
+ //#region ../../internals/utils/src/cli/define.ts
3
+ /** Returns a `CLIAdapter` with type inference. Pass a different adapter to `createCLI` to swap the CLI engine. */
4
+ function defineCLIAdapter(adapter) {
5
+ return adapter;
6
+ }
3
7
  /**
4
8
  * Returns a `CommandDefinition` with typed `values` in `run()`.
5
9
  * The callback receives `values` typed from the declared options — no casts needed.
@@ -15,11 +19,7 @@ function defineCommand(def) {
15
19
  })
16
20
  };
17
21
  }
18
- /** Returns a `CLIAdapter` with type inference. Pass a different adapter to `createCLI` to swap the CLI engine. */
19
- function defineCLIAdapter(adapter) {
20
- return adapter;
21
- }
22
22
  //#endregion
23
23
  export { defineCommand as n, defineCLIAdapter as t };
24
24
 
25
- //# sourceMappingURL=types-CLtz0jem.js.map
25
+ //# sourceMappingURL=define--M_JMcDC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define--M_JMcDC.js","names":[],"sources":["../../../internals/utils/src/cli/define.ts"],"sourcesContent":["import type { CLIAdapter, CommandDefinition, OptionDefinition } from './types.ts'\n\ntype OptionTypeMap = { string: string; boolean: boolean }\n\ntype IsRequired<O extends OptionDefinition> = O['default'] extends string | boolean ? true : O['required'] extends true ? true : false\n\n/** Infers typed values from an options record. Options with a `default` or `required: true` are always defined. */\ntype InferValues<O extends Record<string, OptionDefinition>> = {\n [K in keyof O as IsRequired<O[K]> extends true ? K : never]: OptionTypeMap[O[K]['type']]\n} & {\n [K in keyof O as IsRequired<O[K]> extends true ? never : K]?: OptionTypeMap[O[K]['type']]\n}\n\n/** Returns a `CLIAdapter` with type inference. Pass a different adapter to `createCLI` to swap the CLI engine. */\nexport function defineCLIAdapter(adapter: CLIAdapter): CLIAdapter {\n return adapter\n}\n\n/**\n * Returns a `CommandDefinition` with typed `values` in `run()`.\n * The callback receives `values` typed from the declared options — no casts needed.\n */\nexport function defineCommand<O extends Record<string, OptionDefinition>>(def: {\n name: string\n description: string\n arguments?: string[]\n options?: O\n subCommands?: CommandDefinition[]\n run?: (args: { values: InferValues<O>; positionals: string[] }) => Promise<void>\n}): CommandDefinition {\n const { run, ...rest } = def\n if (!run) return rest\n return {\n ...rest,\n run: (args) => run({ values: args.values as InferValues<O>, positionals: args.positionals }),\n }\n}\n"],"mappings":";;;AAcA,SAAgB,iBAAiB,SAAiC;AAChE,QAAO;;;;;;AAOT,SAAgB,cAA0D,KAOpD;CACpB,MAAM,EAAE,KAAK,GAAG,SAAS;AACzB,KAAI,CAAC,IAAK,QAAO;AACjB,QAAO;EACL,GAAG;EACH,MAAM,SAAS,IAAI;GAAE,QAAQ,KAAK;GAA0B,aAAa,KAAK;GAAa,CAAC;EAC7F"}
@@ -1,5 +1,9 @@
1
1
  require("./chunk-ByKO4r7w.cjs");
2
- //#region src/cli/types.ts
2
+ //#region ../../internals/utils/src/cli/define.ts
3
+ /** Returns a `CLIAdapter` with type inference. Pass a different adapter to `createCLI` to swap the CLI engine. */
4
+ function defineCLIAdapter(adapter) {
5
+ return adapter;
6
+ }
3
7
  /**
4
8
  * Returns a `CommandDefinition` with typed `values` in `run()`.
5
9
  * The callback receives `values` typed from the declared options — no casts needed.
@@ -15,10 +19,6 @@ function defineCommand(def) {
15
19
  })
16
20
  };
17
21
  }
18
- /** Returns a `CLIAdapter` with type inference. Pass a different adapter to `createCLI` to swap the CLI engine. */
19
- function defineCLIAdapter(adapter) {
20
- return adapter;
21
- }
22
22
  //#endregion
23
23
  Object.defineProperty(exports, "defineCLIAdapter", {
24
24
  enumerable: true,
@@ -33,4 +33,4 @@ Object.defineProperty(exports, "defineCommand", {
33
33
  }
34
34
  });
35
35
 
36
- //# sourceMappingURL=types-Ck2lzFON.cjs.map
36
+ //# sourceMappingURL=define-D6Kfm7-Z.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-D6Kfm7-Z.cjs","names":[],"sources":["../../../internals/utils/src/cli/define.ts"],"sourcesContent":["import type { CLIAdapter, CommandDefinition, OptionDefinition } from './types.ts'\n\ntype OptionTypeMap = { string: string; boolean: boolean }\n\ntype IsRequired<O extends OptionDefinition> = O['default'] extends string | boolean ? true : O['required'] extends true ? true : false\n\n/** Infers typed values from an options record. Options with a `default` or `required: true` are always defined. */\ntype InferValues<O extends Record<string, OptionDefinition>> = {\n [K in keyof O as IsRequired<O[K]> extends true ? K : never]: OptionTypeMap[O[K]['type']]\n} & {\n [K in keyof O as IsRequired<O[K]> extends true ? never : K]?: OptionTypeMap[O[K]['type']]\n}\n\n/** Returns a `CLIAdapter` with type inference. Pass a different adapter to `createCLI` to swap the CLI engine. */\nexport function defineCLIAdapter(adapter: CLIAdapter): CLIAdapter {\n return adapter\n}\n\n/**\n * Returns a `CommandDefinition` with typed `values` in `run()`.\n * The callback receives `values` typed from the declared options — no casts needed.\n */\nexport function defineCommand<O extends Record<string, OptionDefinition>>(def: {\n name: string\n description: string\n arguments?: string[]\n options?: O\n subCommands?: CommandDefinition[]\n run?: (args: { values: InferValues<O>; positionals: string[] }) => Promise<void>\n}): CommandDefinition {\n const { run, ...rest } = def\n if (!run) return rest\n return {\n ...rest,\n run: (args) => run({ values: args.values as InferValues<O>, positionals: args.positionals }),\n }\n}\n"],"mappings":";;;AAcA,SAAgB,iBAAiB,SAAiC;AAChE,QAAO;;;;;;AAOT,SAAgB,cAA0D,KAOpD;CACpB,MAAM,EAAE,KAAK,GAAG,SAAS;AACzB,KAAI,CAAC,IAAK,QAAO;AACjB,QAAO;EACL,GAAG;EACH,MAAM,SAAS,IAAI;GAAE,QAAQ,KAAK;GAA0B,aAAa,KAAK;GAAa,CAAC;EAC7F"}
@@ -1,7 +1,7 @@
1
1
  import "./chunk--u3MIqq1.js";
2
- //#region src/utils/errors.ts
2
+ //#region ../../internals/utils/src/errors.ts
3
3
  /**
4
- * Coerce an unknown thrown value to an `Error` instance.
4
+ * Coerces an unknown thrown value to an `Error` instance.
5
5
  * When the value is already an `Error` it is returned as-is;
6
6
  * otherwise a new `Error` is created whose message is `String(value)`.
7
7
  */
@@ -9,13 +9,13 @@ function toError(value) {
9
9
  return value instanceof Error ? value : new Error(String(value));
10
10
  }
11
11
  /**
12
- * Safely extract a human-readable message from any thrown value.
12
+ * Safely extracts a human-readable message from any thrown value.
13
13
  */
14
14
  function getErrorMessage(value) {
15
15
  return value instanceof Error ? value.message : String(value);
16
16
  }
17
17
  /**
18
- * Extract the `.cause` property of an `Error` as an `Error | undefined`.
18
+ * Extracts the `.cause` of an `Error` as an `Error | undefined`.
19
19
  * Returns `undefined` when the cause is absent or is not an `Error`.
20
20
  */
21
21
  function toCause(error) {
@@ -24,4 +24,4 @@ function toCause(error) {
24
24
  //#endregion
25
25
  export { toCause as n, toError as r, getErrorMessage as t };
26
26
 
27
- //# sourceMappingURL=errors-bSLTEh4e.js.map
27
+ //# sourceMappingURL=errors-6mF_WKxg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-6mF_WKxg.js","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/** Thrown when a plugin's configuration or input fails validation. */\nexport class ValidationPluginError extends Error {}\n\n/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces 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 extracts 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 * Extracts the `.cause` 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":";;;;;;;AAsBA,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"}
@@ -1,7 +1,7 @@
1
1
  require("./chunk-ByKO4r7w.cjs");
2
- //#region src/utils/errors.ts
2
+ //#region ../../internals/utils/src/errors.ts
3
3
  /**
4
- * Coerce an unknown thrown value to an `Error` instance.
4
+ * Coerces an unknown thrown value to an `Error` instance.
5
5
  * When the value is already an `Error` it is returned as-is;
6
6
  * otherwise a new `Error` is created whose message is `String(value)`.
7
7
  */
@@ -9,13 +9,13 @@ function toError(value) {
9
9
  return value instanceof Error ? value : new Error(String(value));
10
10
  }
11
11
  /**
12
- * Safely extract a human-readable message from any thrown value.
12
+ * Safely extracts a human-readable message from any thrown value.
13
13
  */
14
14
  function getErrorMessage(value) {
15
15
  return value instanceof Error ? value.message : String(value);
16
16
  }
17
17
  /**
18
- * Extract the `.cause` property of an `Error` as an `Error | undefined`.
18
+ * Extracts the `.cause` of an `Error` as an `Error | undefined`.
19
19
  * Returns `undefined` when the cause is absent or is not an `Error`.
20
20
  */
21
21
  function toCause(error) {
@@ -41,4 +41,4 @@ Object.defineProperty(exports, "toError", {
41
41
  }
42
42
  });
43
43
 
44
- //# sourceMappingURL=errors-BUjJsNoe.cjs.map
44
+ //# sourceMappingURL=errors-DBW0N9w4.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-DBW0N9w4.cjs","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/** Thrown when a plugin's configuration or input fails validation. */\nexport class ValidationPluginError extends Error {}\n\n/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces 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 extracts 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 * Extracts the `.cause` 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":";;;;;;;AAsBA,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"}