@kubb/cli 4.37.12 → 4.38.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 (73) hide show
  1. package/LICENSE +17 -10
  2. package/dist/{constants-CM3dJzjK.js → constants-CR-BDIf6.js} +2 -11
  3. package/dist/constants-CR-BDIf6.js.map +1 -0
  4. package/dist/{constants-BTUap0zs.cjs → constants-DYL5YQqt.cjs} +1 -16
  5. package/dist/constants-DYL5YQqt.cjs.map +1 -0
  6. package/dist/{generate-BV2cctNa.cjs → generate-BKFQErdj.cjs} +4 -4
  7. package/dist/{generate-BV2cctNa.cjs.map → generate-BKFQErdj.cjs.map} +1 -1
  8. package/dist/{generate-ukGpmX5d.js → generate-CzGZWR26.js} +2 -2
  9. package/dist/{generate-ukGpmX5d.js.map → generate-CzGZWR26.js.map} +1 -1
  10. package/dist/{generate-BWIckh_f.js → generate-D9WGRoua.js} +4 -4
  11. package/dist/{generate-BWIckh_f.js.map → generate-D9WGRoua.js.map} +1 -1
  12. package/dist/{generate-DRyl1ngg.cjs → generate-Dk-uEljm.cjs} +2 -2
  13. package/dist/{generate-DRyl1ngg.cjs.map → generate-Dk-uEljm.cjs.map} +1 -1
  14. package/dist/index.cjs +7 -9
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.js +7 -9
  17. package/dist/index.js.map +1 -1
  18. package/dist/{init-hmolV6B4.cjs → init-BaM_F3d_.cjs} +2 -3
  19. package/dist/{init-hmolV6B4.cjs.map → init-BaM_F3d_.cjs.map} +1 -1
  20. package/dist/{init-BS6XuccC.cjs → init-BppS7lGq.cjs} +3 -3
  21. package/dist/{init-BS6XuccC.cjs.map → init-BppS7lGq.cjs.map} +1 -1
  22. package/dist/{init-C-InrmSY.js → init-Cf6fA41K.js} +2 -3
  23. package/dist/{init-C-InrmSY.js.map → init-Cf6fA41K.js.map} +1 -1
  24. package/dist/{init-CR-_WPUY.js → init-DrFtOgvZ.js} +3 -3
  25. package/dist/{init-CR-_WPUY.js.map → init-DrFtOgvZ.js.map} +1 -1
  26. package/dist/{jiti-e08mD2Ph.js → jiti-D5qMw1UC.js} +1 -1
  27. package/dist/{jiti-e08mD2Ph.js.map → jiti-D5qMw1UC.js.map} +1 -1
  28. package/dist/{jiti-Cd3S0xwr.cjs → jiti-EgzFa-0e.cjs} +1 -1
  29. package/dist/{jiti-Cd3S0xwr.cjs.map → jiti-EgzFa-0e.cjs.map} +1 -1
  30. package/dist/{mcp-Decr7Ndy.cjs → mcp-34XslSuW.cjs} +3 -3
  31. package/dist/{mcp-Decr7Ndy.cjs.map → mcp-34XslSuW.cjs.map} +1 -1
  32. package/dist/{mcp-X8kKSlov.cjs → mcp-CFaF2OMK.cjs} +3 -3
  33. package/dist/{mcp-X8kKSlov.cjs.map → mcp-CFaF2OMK.cjs.map} +1 -1
  34. package/dist/{mcp-Cwbv3dfC.js → mcp-Cc7G7a6r.js} +3 -3
  35. package/dist/{mcp-Cwbv3dfC.js.map → mcp-Cc7G7a6r.js.map} +1 -1
  36. package/dist/{mcp-C2LVu0IJ.js → mcp-DaK3ey7W.js} +3 -3
  37. package/dist/{mcp-C2LVu0IJ.js.map → mcp-DaK3ey7W.js.map} +1 -1
  38. package/dist/{package-Vn5neIqs.cjs → package-Bri2J9tx.cjs} +2 -2
  39. package/dist/package-Bri2J9tx.cjs.map +1 -0
  40. package/dist/package-CKHXivYd.js +6 -0
  41. package/dist/package-CKHXivYd.js.map +1 -0
  42. package/dist/{telemetry-CEm85k_X.cjs → telemetry-Cj4VP-SC.cjs} +2 -2
  43. package/dist/{telemetry-CEm85k_X.cjs.map → telemetry-Cj4VP-SC.cjs.map} +1 -1
  44. package/dist/{telemetry-CHWsjyeK.js → telemetry-DTy9TjCN.js} +2 -2
  45. package/dist/{telemetry-CHWsjyeK.js.map → telemetry-DTy9TjCN.js.map} +1 -1
  46. package/dist/{validate-DYVo8-Fj.cjs → validate-CBVnOSEe.cjs} +3 -3
  47. package/dist/{validate-DYVo8-Fj.cjs.map → validate-CBVnOSEe.cjs.map} +1 -1
  48. package/dist/{validate-Ccyz_eeH.js → validate-Cc7mwoms.js} +3 -3
  49. package/dist/{validate-Ccyz_eeH.js.map → validate-Cc7mwoms.js.map} +1 -1
  50. package/dist/{validate-BGyxLev8.js → validate-Cn4KXS03.js} +3 -3
  51. package/dist/{validate-BGyxLev8.js.map → validate-Cn4KXS03.js.map} +1 -1
  52. package/dist/{validate-DeCglMLZ.cjs → validate-VSgcmd7F.cjs} +3 -3
  53. package/dist/{validate-DeCglMLZ.cjs.map → validate-VSgcmd7F.cjs.map} +1 -1
  54. package/package.json +4 -5
  55. package/src/constants.ts +0 -11
  56. package/src/index.ts +7 -9
  57. package/src/runners/init.ts +1 -1
  58. package/dist/agent-Y6OHPv5y.js +0 -56
  59. package/dist/agent-Y6OHPv5y.js.map +0 -1
  60. package/dist/agent-bJ5FNFnA.cjs +0 -92
  61. package/dist/agent-bJ5FNFnA.cjs.map +0 -1
  62. package/dist/agent-fcClds-t.js +0 -88
  63. package/dist/agent-fcClds-t.js.map +0 -1
  64. package/dist/agent-nAi13AeU.cjs +0 -58
  65. package/dist/agent-nAi13AeU.cjs.map +0 -1
  66. package/dist/constants-BTUap0zs.cjs.map +0 -1
  67. package/dist/constants-CM3dJzjK.js.map +0 -1
  68. package/dist/package--04z8AtK.js +0 -6
  69. package/dist/package--04z8AtK.js.map +0 -1
  70. package/dist/package-Vn5neIqs.cjs.map +0 -1
  71. package/src/commands/agent/start.ts +0 -31
  72. package/src/commands/agent.ts +0 -8
  73. package/src/runners/agent.ts +0 -102
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-bJ5FNFnA.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 | undefined\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 = path.resolve(process.cwd(), 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 console.log(env)\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,oBAAoBC,UAAAA,QAAK,QAAQD,aAAQ,KAAK,EAAE,cAAcA,aAAQ,IAAI,qBAAqBE,kBAAAA,cAAc,WAAW;EAC9H,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;;AAGjB,UAAQ,IAAI,IAAI;AAGhB,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,88 +0,0 @@
1
- import "./chunk--u3MIqq1.js";
2
- import { r as sendTelemetry, t as buildTelemetryEvent } from "./telemetry-CHWsjyeK.js";
3
- import { t as spawnAsync } from "./shell-DqqWsHCD.js";
4
- import { a as agentDefaults } from "./constants-CM3dJzjK.js";
5
- import { styleText } from "node:util";
6
- import path from "node:path";
7
- import * as process$1 from "node:process";
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 = path.resolve(process$1.cwd(), 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
- console.log(env);
63
- await spawnAsync("node", [serverPath], {
64
- env,
65
- cwd: process$1.cwd()
66
- });
67
- await sendTelemetry(buildTelemetryEvent({
68
- command: "agent",
69
- kubbVersion: version,
70
- hrStart,
71
- status: "success"
72
- }));
73
- } catch (error) {
74
- await sendTelemetry(buildTelemetryEvent({
75
- command: "agent",
76
- kubbVersion: version,
77
- hrStart,
78
- status: "failed"
79
- }));
80
- clack.log.error(styleText("red", "Failed to start agent server"));
81
- console.error(error);
82
- process$1.exit(1);
83
- }
84
- }
85
- //#endregion
86
- export { runAgentStart };
87
-
88
- //# sourceMappingURL=agent-fcClds-t.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-fcClds-t.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 | undefined\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 = path.resolve(process.cwd(), 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 console.log(env)\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,KAAK,QAAQA,UAAQ,KAAK,EAAE,cAAcA,UAAQ,IAAI,qBAAqB,cAAc,WAAW;EAC9H,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;;AAGjB,UAAQ,IAAI,IAAI;AAGhB,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"}
@@ -1,58 +0,0 @@
1
- require("./chunk-ByKO4r7w.cjs");
2
- const require_define = require("./define-D6Kfm7-Z.cjs");
3
- const require_package = require("./package-Vn5neIqs.cjs");
4
- const require_constants = require("./constants-BTUap0zs.cjs");
5
- //#region src/commands/agent/start.ts
6
- const command$1 = require_define.defineCommand({
7
- name: "start",
8
- description: "Start the Agent server",
9
- options: {
10
- config: {
11
- type: "string",
12
- description: "Path to the Kubb config",
13
- short: "c"
14
- },
15
- port: {
16
- type: "string",
17
- description: `Port for the server (default: ${require_constants.agentDefaults.port})`,
18
- short: "p"
19
- },
20
- host: {
21
- type: "string",
22
- description: "Host for the server",
23
- default: require_constants.agentDefaults.host
24
- },
25
- "allow-write": {
26
- type: "boolean",
27
- description: "Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.",
28
- default: false
29
- },
30
- "allow-all": {
31
- type: "boolean",
32
- description: "Grant all permissions (implies --allow-write).",
33
- default: false
34
- }
35
- },
36
- async run({ values }) {
37
- const { runAgentStart } = await Promise.resolve().then(() => require("./agent-bJ5FNFnA.cjs"));
38
- await runAgentStart({
39
- port: values.port !== void 0 ? values.port : void 0,
40
- host: values.host,
41
- configPath: values.config,
42
- allowWrite: values["allow-write"],
43
- allowAll: values["allow-all"],
44
- version: require_package.version
45
- });
46
- }
47
- });
48
- //#endregion
49
- //#region src/commands/agent.ts
50
- const command = require_define.defineCommand({
51
- name: "agent",
52
- description: "Manage the Kubb Agent server",
53
- subCommands: [command$1]
54
- });
55
- //#endregion
56
- exports.command = command;
57
-
58
- //# sourceMappingURL=agent-nAi13AeU.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-nAi13AeU.cjs","names":["command","defineCommand","agentDefaults","defineCommand","startCommand"],"sources":["../src/commands/agent/start.ts","../src/commands/agent.ts"],"sourcesContent":["import { 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: values.config,\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":";;;;;AAIA,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,YAAY,OAAO;GACnB,YAAY,OAAO;GACnB,UAAU,OAAO;GACjB,SAAA,gBAAA;GACD,CAAC;;CAEL,CAAC;;;AC3BF,MAAa,UAAUC,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,aAAa,CAACC,UAAa;CAC5B,CAAC"}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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,6 +0,0 @@
1
- //#region package.json
2
- var version = "4.37.12";
3
- //#endregion
4
- export { version as t };
5
-
6
- //# sourceMappingURL=package--04z8AtK.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"package--04z8AtK.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"package-Vn5neIqs.cjs","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1,31 +0,0 @@
1
- import { defineCommand } from '@internals/utils'
2
- import { version } from '../../../package.json'
3
- import { agentDefaults } from '../../constants.ts'
4
-
5
- export const command = defineCommand({
6
- name: 'start',
7
- description: 'Start the Agent server',
8
- options: {
9
- config: { type: 'string', description: 'Path to the Kubb config', short: 'c' },
10
- port: { type: 'string', description: `Port for the server (default: ${agentDefaults.port})`, short: 'p' },
11
- host: { type: 'string', description: 'Host for the server', default: agentDefaults.host },
12
- 'allow-write': {
13
- type: 'boolean',
14
- description: 'Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.',
15
- default: false,
16
- },
17
- 'allow-all': { type: 'boolean', description: 'Grant all permissions (implies --allow-write).', default: false },
18
- },
19
- async run({ values }) {
20
- const { runAgentStart } = await import('../../runners/agent.ts')
21
-
22
- await runAgentStart({
23
- port: values.port !== undefined ? values.port : undefined,
24
- host: values.host,
25
- configPath: values.config,
26
- allowWrite: values['allow-write'],
27
- allowAll: values['allow-all'],
28
- version,
29
- })
30
- },
31
- })
@@ -1,8 +0,0 @@
1
- import { defineCommand } from '@internals/utils'
2
- import { command as startCommand } from './agent/start.ts'
3
-
4
- export const command = defineCommand({
5
- name: 'agent',
6
- description: 'Manage the Kubb Agent server',
7
- subCommands: [startCommand],
8
- })
@@ -1,102 +0,0 @@
1
- import net from 'node:net'
2
- import path from 'node:path'
3
- import * as process from 'node:process'
4
- import { fileURLToPath } from 'node:url'
5
- import { styleText } from 'node:util'
6
- import * as clack from '@clack/prompts'
7
- import { spawnAsync } from '@internals/utils'
8
- import { agentDefaults } from '../constants.ts'
9
- import { buildTelemetryEvent, sendTelemetry } from '../utils/telemetry.ts'
10
-
11
- type AgentStartOptions = {
12
- port: string | undefined
13
- host: string
14
- configPath: string | undefined
15
- allowWrite: boolean
16
- allowAll: boolean
17
- version: string
18
- }
19
-
20
- function isPortAvailable(port: number, host: string): Promise<boolean> {
21
- return new Promise((resolve) => {
22
- const server = net.createServer()
23
- server.once('error', () => resolve(false))
24
- server.once('listening', () => {
25
- server.close()
26
- resolve(true)
27
- })
28
- server.listen(port, host)
29
- })
30
- }
31
-
32
- export async function runAgentStart({ port, host, configPath, allowWrite, allowAll, version }: AgentStartOptions): Promise<void> {
33
- const hrStart = process.hrtime()
34
-
35
- try {
36
- // Load .env file into process.env using Node.js built-in (v20.12.0+)
37
- try {
38
- process.loadEnvFile()
39
- } catch {
40
- // .env file may not exist; ignore
41
- }
42
-
43
- // Resolve the @kubb/agent package path
44
- const agentPkgUrl = import.meta.resolve('@kubb/agent/package.json')
45
- const agentPkgPath = fileURLToPath(agentPkgUrl)
46
- const agentDir = path.dirname(agentPkgPath)
47
- const serverPath = path.join(agentDir, agentDefaults.serverEntryPath)
48
-
49
- // CLI params take priority over process.env; process.env fills in what the CLI didn't specify;
50
- // agentDefaults are the last resort. Build env as: defaults ← process.env ← CLI.
51
- const PORT = port !== undefined ? port : (process.env.PORT ?? agentDefaults.port)
52
- const HOST = host !== agentDefaults.host ? host : (process.env.HOST ?? agentDefaults.host)
53
- const KUBB_AGENT_ROOT = process.env.KUBB_AGENT_ROOT ?? process.cwd()
54
- const KUBB_AGENT_CONFIG = path.resolve(process.cwd(), configPath || process.env.KUBB_AGENT_CONFIG || agentDefaults.configFile)
55
- const KUBB_AGENT_ALLOW_WRITE = allowAll || allowWrite ? 'true' : (process.env.KUBB_AGENT_ALLOW_WRITE ?? 'false')
56
- const KUBB_AGENT_ALLOW_ALL = allowAll ? 'true' : (process.env.KUBB_AGENT_ALLOW_ALL ?? 'false')
57
- const KUBB_AGENT_TOKEN = process.env.KUBB_AGENT_TOKEN
58
- const KUBB_AGENT_RETRY_TIMEOUT = process.env.KUBB_AGENT_RETRY_TIMEOUT ?? agentDefaults.retryTimeout
59
- const KUBB_STUDIO_URL = process.env.KUBB_STUDIO_URL ?? agentDefaults.studioUrl
60
-
61
- const env = {
62
- ...process.env,
63
- PORT,
64
- HOST,
65
- KUBB_AGENT_ROOT,
66
- KUBB_AGENT_CONFIG,
67
- KUBB_AGENT_ALLOW_WRITE,
68
- KUBB_AGENT_ALLOW_ALL,
69
- KUBB_AGENT_TOKEN,
70
- KUBB_AGENT_RETRY_TIMEOUT,
71
- KUBB_STUDIO_URL,
72
- }
73
-
74
- clack.log.step(styleText('cyan', 'Starting agent server...'))
75
- clack.log.info(styleText('dim', `Config: ${KUBB_AGENT_CONFIG}`))
76
- clack.log.info(styleText('dim', `Host: ${HOST}`))
77
- clack.log.info(styleText('dim', `Port: ${PORT}`))
78
- if (!KUBB_AGENT_ALLOW_WRITE && !KUBB_AGENT_ALLOW_ALL) {
79
- clack.log.warn(styleText('yellow', 'Filesystem writes disabled. Use --allow-write or --allow-all to enable.'))
80
- }
81
-
82
- if (!(await isPortAvailable(Number(PORT), HOST))) {
83
- clack.log.error(styleText('red', `Port ${PORT} is already in use. Stop the existing process or choose a different port with --port.`))
84
- process.exit(1)
85
- }
86
-
87
- console.log(env)
88
-
89
- // Spawns the server as a detached background process so the CLI can exit independently.
90
- await spawnAsync('node', [serverPath], {
91
- env,
92
- cwd: process.cwd(),
93
- })
94
-
95
- await sendTelemetry(buildTelemetryEvent({ command: 'agent', kubbVersion: version, hrStart, status: 'success' }))
96
- } catch (error) {
97
- await sendTelemetry(buildTelemetryEvent({ command: 'agent', kubbVersion: version, hrStart, status: 'failed' }))
98
- clack.log.error(styleText('red', 'Failed to start agent server'))
99
- console.error(error)
100
- process.exit(1)
101
- }
102
- }