@introspection-ai/recipes 0.13.0 → 0.14.1

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 (222) hide show
  1. package/README.md +46 -57
  2. package/dist/{agent-tool.d.ts → agents.d.ts} +4 -1
  3. package/dist/agents.d.ts.map +1 -0
  4. package/dist/{agent-tool.js → agents.js} +1 -1
  5. package/dist/agents.js.map +1 -0
  6. package/dist/api/extensions.d.ts +3 -0
  7. package/dist/api/extensions.d.ts.map +1 -0
  8. package/dist/api/extensions.js +2 -0
  9. package/dist/api/extensions.js.map +1 -0
  10. package/dist/api/mcp.d.ts +4 -0
  11. package/dist/api/mcp.d.ts.map +1 -0
  12. package/dist/api/mcp.js +2 -0
  13. package/dist/api/mcp.js.map +1 -0
  14. package/dist/api/session.d.ts +3 -0
  15. package/dist/api/session.d.ts.map +1 -0
  16. package/dist/api/session.js +2 -0
  17. package/dist/api/session.js.map +1 -0
  18. package/dist/child-agent.d.ts +5 -4
  19. package/dist/child-agent.d.ts.map +1 -1
  20. package/dist/child-agent.js +26 -117
  21. package/dist/child-agent.js.map +1 -1
  22. package/dist/child-session.d.ts +23 -0
  23. package/dist/child-session.d.ts.map +1 -0
  24. package/dist/child-session.js +48 -0
  25. package/dist/child-session.js.map +1 -0
  26. package/dist/extensions.d.ts +29 -0
  27. package/dist/extensions.d.ts.map +1 -0
  28. package/dist/extensions.js +119 -0
  29. package/dist/extensions.js.map +1 -0
  30. package/dist/index.d.ts +4 -13
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +2 -13
  33. package/dist/index.js.map +1 -1
  34. package/dist/inspect.d.ts +38 -5
  35. package/dist/inspect.d.ts.map +1 -1
  36. package/dist/inspect.js +92 -41
  37. package/dist/inspect.js.map +1 -1
  38. package/dist/interactions.d.ts +18 -2
  39. package/dist/interactions.d.ts.map +1 -1
  40. package/dist/interactions.js +41 -10
  41. package/dist/interactions.js.map +1 -1
  42. package/dist/mcp-catalog.d.ts +1 -0
  43. package/dist/mcp-catalog.d.ts.map +1 -1
  44. package/dist/mcp-catalog.js +14 -6
  45. package/dist/mcp-catalog.js.map +1 -1
  46. package/dist/mcp-chunks/auth-command-ZLGYIEUY.js +273 -0
  47. package/dist/mcp-chunks/call-arguments-LU3W6D3K.js +13 -0
  48. package/dist/mcp-chunks/call-command-LKTKSYTH.js +612 -0
  49. package/dist/mcp-chunks/chunk-2U4BSDC4.js +3951 -0
  50. package/dist/mcp-chunks/chunk-2XL7MG7R.js +272 -0
  51. package/dist/mcp-chunks/chunk-3BJA27PY.js +2321 -0
  52. package/dist/mcp-chunks/chunk-4SQKWYFF.js +15 -0
  53. package/dist/mcp-chunks/chunk-5QOSCSQB.js +290 -0
  54. package/dist/mcp-chunks/chunk-6W5QFASN.js +77 -0
  55. package/dist/mcp-chunks/chunk-6XCZGU3G.js +1004 -0
  56. package/dist/mcp-chunks/chunk-7FHEBT5G.js +149 -0
  57. package/dist/mcp-chunks/chunk-7KA2VJVZ.js +114 -0
  58. package/dist/mcp-chunks/chunk-7UDVSOOF.js +138 -0
  59. package/dist/mcp-chunks/chunk-BNV3TPE4.js +66 -0
  60. package/dist/mcp-chunks/chunk-BTLAWHTA.js +129 -0
  61. package/dist/mcp-chunks/chunk-BV56DXPW.js +13 -0
  62. package/dist/mcp-chunks/chunk-BWHIA4PC.js +90 -0
  63. package/dist/mcp-chunks/chunk-BZIQOWE6.js +267 -0
  64. package/dist/mcp-chunks/chunk-D3MRAZ6H.js +16140 -0
  65. package/dist/mcp-chunks/chunk-DHBE7UBH.js +750 -0
  66. package/dist/mcp-chunks/chunk-E22DYOW5.js +251 -0
  67. package/dist/mcp-chunks/chunk-ECIVB7P4.js +139 -0
  68. package/dist/mcp-chunks/chunk-HKRJ6O36.js +1076 -0
  69. package/dist/mcp-chunks/chunk-IABRYROW.js +44 -0
  70. package/dist/mcp-chunks/chunk-J6LYIZXN.js +45 -0
  71. package/dist/mcp-chunks/chunk-L7NTQVYN.js +161 -0
  72. package/dist/mcp-chunks/chunk-LEZSACDE.js +141 -0
  73. package/dist/mcp-chunks/chunk-LKIBAYKU.js +208 -0
  74. package/dist/mcp-chunks/chunk-LNH5LAJD.js +152 -0
  75. package/dist/mcp-chunks/chunk-LQQEYD76.js +124 -0
  76. package/dist/mcp-chunks/chunk-LRKZP7DJ.js +47 -0
  77. package/dist/mcp-chunks/chunk-LS7PMWSR.js +109 -0
  78. package/dist/mcp-chunks/chunk-M3TPODXI.js +95 -0
  79. package/dist/mcp-chunks/chunk-MZ2NARG7.js +400 -0
  80. package/dist/mcp-chunks/chunk-N46NEFAF.js +45 -0
  81. package/dist/mcp-chunks/chunk-NNOEGEUZ.js +17273 -0
  82. package/dist/mcp-chunks/chunk-NRAJX5E4.js +69 -0
  83. package/dist/mcp-chunks/chunk-P3PSC54P.js +869 -0
  84. package/dist/mcp-chunks/chunk-PIIYJR44.js +6341 -0
  85. package/dist/mcp-chunks/chunk-PWYFKGKG.js +385 -0
  86. package/dist/mcp-chunks/chunk-SJCCBNZ4.js +45 -0
  87. package/dist/mcp-chunks/chunk-TATVT5IT.js +194 -0
  88. package/dist/mcp-chunks/chunk-TEUKFFQL.js +29 -0
  89. package/dist/mcp-chunks/chunk-UKYNQGNE.js +150 -0
  90. package/dist/mcp-chunks/chunk-UNKB4SBV.js +37 -0
  91. package/dist/mcp-chunks/chunk-WD6BOD24.js +138 -0
  92. package/dist/mcp-chunks/chunk-WQJZMCJN.js +73 -0
  93. package/dist/mcp-chunks/chunk-XANPGTLI.js +364 -0
  94. package/dist/mcp-chunks/chunk-XQK2JSW4.js +35 -0
  95. package/dist/mcp-chunks/chunk-YHQUTU6L.js +571 -0
  96. package/dist/mcp-chunks/chunk-YVZKMV5H.js +57 -0
  97. package/dist/mcp-chunks/cli-UV4QJZZM.js +929 -0
  98. package/dist/mcp-chunks/client-S7RQUG5U.js +13 -0
  99. package/dist/mcp-chunks/config-command-NLAGKID5.js +1101 -0
  100. package/dist/mcp-chunks/daemon-command-U242Z6VY.js +26 -0
  101. package/dist/mcp-chunks/dist-LK3SHAMX.js +6478 -0
  102. package/dist/mcp-chunks/emit-ts-command-VBXVXO6V.js +386 -0
  103. package/dist/mcp-chunks/generate-cli-runner-6CAZZA3P.js +1426 -0
  104. package/dist/mcp-chunks/inspect-cli-command-3ZORTOR7.js +111 -0
  105. package/dist/mcp-chunks/launch-YKRXHXJI.js +10 -0
  106. package/dist/mcp-chunks/lifecycle-XVKRHPH3.js +16 -0
  107. package/dist/mcp-chunks/list-command-2MEGGNFQ.js +4190 -0
  108. package/dist/mcp-chunks/output-utils-NKESLAJ6.js +12 -0
  109. package/dist/mcp-chunks/prompt-B1Yc1NPt-VGOTWJMN.js +918 -0
  110. package/dist/mcp-chunks/record-command-YXHTTTT5.js +17 -0
  111. package/dist/mcp-chunks/replay-command-25HJ6AQU.js +85 -0
  112. package/dist/mcp-chunks/resource-command-OO4NYF5C.js +97 -0
  113. package/dist/mcp-chunks/result-utils-MOHHLNM7.js +15 -0
  114. package/dist/mcp-chunks/runtime-5WJ3G25Y.js +33 -0
  115. package/dist/mcp-chunks/runtime-wrapper-RPWDIDBF.js +10 -0
  116. package/dist/mcp-chunks/serve-command-DHXJZMMN.js +3302 -0
  117. package/dist/mcp-chunks/timeouts-W2XWCCXR.js +18 -0
  118. package/dist/mcp-chunks/vault-command-PIYIUEZL.js +154 -0
  119. package/dist/mcp-daemon-client.d.ts +6 -1
  120. package/dist/mcp-daemon-client.d.ts.map +1 -1
  121. package/dist/mcp-daemon-client.js +119 -2
  122. package/dist/mcp-daemon-client.js.map +1 -1
  123. package/dist/mcp-daemon-protocol.d.ts +18 -1
  124. package/dist/mcp-daemon-protocol.d.ts.map +1 -1
  125. package/dist/mcp-daemon-protocol.js +31 -0
  126. package/dist/mcp-daemon-protocol.js.map +1 -1
  127. package/dist/mcp-daemon.js +169 -76602
  128. package/dist/mcp-daemon.js.map +1 -1
  129. package/dist/mcp-policy.d.ts +11 -0
  130. package/dist/mcp-policy.d.ts.map +1 -0
  131. package/dist/mcp-policy.js +27 -0
  132. package/dist/mcp-policy.js.map +1 -0
  133. package/dist/mcp-run-worker.js +38 -76540
  134. package/dist/mcp-tools.d.ts +39 -0
  135. package/dist/mcp-tools.d.ts.map +1 -0
  136. package/dist/mcp-tools.js +493 -0
  137. package/dist/mcp-tools.js.map +1 -0
  138. package/dist/mcp.d.ts +21 -9
  139. package/dist/mcp.d.ts.map +1 -1
  140. package/dist/mcp.js +101 -31
  141. package/dist/mcp.js.map +1 -1
  142. package/dist/model-binding.d.ts +39 -0
  143. package/dist/model-binding.d.ts.map +1 -0
  144. package/dist/model-binding.js +103 -0
  145. package/dist/model-binding.js.map +1 -0
  146. package/dist/pi-extension.d.ts +2 -22
  147. package/dist/pi-extension.d.ts.map +1 -1
  148. package/dist/pi-extension.js +296 -71
  149. package/dist/pi-extension.js.map +1 -1
  150. package/dist/recipe/resolve.d.ts +43 -20
  151. package/dist/recipe/resolve.d.ts.map +1 -1
  152. package/dist/recipe/resolve.js +215 -70
  153. package/dist/recipe/resolve.js.map +1 -1
  154. package/dist/recipe-agent.d.ts +24 -27
  155. package/dist/recipe-agent.d.ts.map +1 -1
  156. package/dist/recipe-agent.js +278 -230
  157. package/dist/recipe-agent.js.map +1 -1
  158. package/dist/recipe-check.d.ts +18 -0
  159. package/dist/recipe-check.d.ts.map +1 -0
  160. package/dist/recipe-check.js +261 -0
  161. package/dist/recipe-check.js.map +1 -0
  162. package/dist/recipe-extensions.d.ts.map +1 -1
  163. package/dist/recipe-extensions.js +0 -3
  164. package/dist/recipe-extensions.js.map +1 -1
  165. package/dist/recipe-model.d.ts +3 -1
  166. package/dist/recipe-model.d.ts.map +1 -1
  167. package/dist/recipe-model.js +15 -12
  168. package/dist/recipe-model.js.map +1 -1
  169. package/dist/recipe-package.d.ts +6 -28
  170. package/dist/recipe-package.d.ts.map +1 -1
  171. package/dist/recipe-package.js +248 -191
  172. package/dist/recipe-package.js.map +1 -1
  173. package/dist/recipe-skills.d.ts.map +1 -1
  174. package/dist/recipe-skills.js +42 -29
  175. package/dist/recipe-skills.js.map +1 -1
  176. package/dist/run-controller.d.ts +10 -9
  177. package/dist/run-controller.d.ts.map +1 -1
  178. package/dist/run-controller.js +28 -21
  179. package/dist/run-controller.js.map +1 -1
  180. package/dist/session.d.ts +40 -53
  181. package/dist/session.d.ts.map +1 -1
  182. package/dist/session.js +312 -173
  183. package/dist/session.js.map +1 -1
  184. package/dist/test-utils.d.ts +7 -7
  185. package/dist/test-utils.d.ts.map +1 -1
  186. package/dist/test-utils.js +32 -15
  187. package/dist/test-utils.js.map +1 -1
  188. package/docs/agent-composition.md +41 -35
  189. package/docs/host-api.md +201 -0
  190. package/docs/index.md +9 -14
  191. package/docs/interactions.md +12 -11
  192. package/docs/mcp-auth.md +6 -6
  193. package/docs/mcp-configuration.md +73 -25
  194. package/docs/pi-extension.md +39 -11
  195. package/docs/recipe-flow.md +9 -9
  196. package/docs/recipe-format.md +106 -41
  197. package/docs/recipe-judges.md +24 -36
  198. package/package.json +23 -17
  199. package/vendor/mcp-client/darwin-arm64/mcp-client +0 -0
  200. package/vendor/mcp-client/darwin-x64/mcp-client +0 -0
  201. package/vendor/mcp-client/linux-arm64/mcp-client +0 -0
  202. package/vendor/recipe-check/darwin-arm64/recipe-check +0 -0
  203. package/vendor/recipe-check/darwin-x64/recipe-check +0 -0
  204. package/vendor/recipe-check/linux-arm64/recipe-check +0 -0
  205. package/vendor/recipe-check/linux-x64/recipe-check +0 -0
  206. package/vendor/recipe-check/linux-x64-musl/recipe-check +0 -0
  207. package/vendor/recipe-check/win32-x64/recipe-check.exe +0 -0
  208. package/dist/agent-tool.d.ts.map +0 -1
  209. package/dist/agent-tool.js.map +0 -1
  210. package/dist/run.d.ts +0 -28
  211. package/dist/run.d.ts.map +0 -1
  212. package/dist/run.js +0 -84
  213. package/dist/run.js.map +0 -1
  214. package/dist/testing.d.ts +0 -25
  215. package/dist/testing.d.ts.map +0 -1
  216. package/dist/testing.js +0 -96
  217. package/dist/testing.js.map +0 -1
  218. package/docs/deployment-configuration.md +0 -65
  219. package/docs/migration.md +0 -70
  220. package/docs/python-bindings-release.md +0 -47
  221. package/docs/recipe-evals.md +0 -70
  222. package/docs/runtime-library.md +0 -171
@@ -0,0 +1,1426 @@
1
+ import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+ import {
3
+ extractGeneratorFlags,
4
+ markExecutable,
5
+ readPackageMetadata,
6
+ safeCopyFile,
7
+ stableJsonStringify,
8
+ writeTemplate
9
+ } from "./chunk-DHBE7UBH.js";
10
+ import {
11
+ buildGenerateCliCommand,
12
+ readCliMetadata,
13
+ resolveGenerateRequestFromArtifact,
14
+ serializeDefinition
15
+ } from "./chunk-LKIBAYKU.js";
16
+ import {
17
+ expectValue
18
+ } from "./chunk-XQK2JSW4.js";
19
+ import "./chunk-MZ2NARG7.js";
20
+ import {
21
+ buildToolMetadataList,
22
+ toolsTestHelpers
23
+ } from "./chunk-XANPGTLI.js";
24
+ import "./chunk-N46NEFAF.js";
25
+ import "./chunk-BNV3TPE4.js";
26
+ import {
27
+ splitCommandLine
28
+ } from "./chunk-E22DYOW5.js";
29
+ import {
30
+ extractHttpServerTarget,
31
+ looksLikeHttpUrl,
32
+ normalizeHttpUrl,
33
+ normalizeHttpUrlCandidate,
34
+ splitHttpToolSelector
35
+ } from "./chunk-M3TPODXI.js";
36
+ import {
37
+ createRuntime
38
+ } from "./chunk-NNOEGEUZ.js";
39
+ import "./chunk-7FHEBT5G.js";
40
+ import "./chunk-BZIQOWE6.js";
41
+ import "./chunk-YHQUTU6L.js";
42
+ import "./chunk-TATVT5IT.js";
43
+ import "./chunk-HKRJ6O36.js";
44
+ import {
45
+ MCPORTER_VERSION
46
+ } from "./chunk-4SQKWYFF.js";
47
+ import "./chunk-6W5QFASN.js";
48
+ import {
49
+ loadServerDefinitions
50
+ } from "./chunk-2U4BSDC4.js";
51
+ import "./chunk-UKYNQGNE.js";
52
+ import "./chunk-P3PSC54P.js";
53
+ import "./chunk-2XL7MG7R.js";
54
+ import "./chunk-WQJZMCJN.js";
55
+ import "./chunk-ECIVB7P4.js";
56
+ import {
57
+ resolveLifecycle
58
+ } from "./chunk-LS7PMWSR.js";
59
+ import "./chunk-D3MRAZ6H.js";
60
+ import "./chunk-LRKZP7DJ.js";
61
+
62
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/flags.js
63
+ function parseGenerateFlags(args) {
64
+ const common = extractGeneratorFlags(args);
65
+ let server;
66
+ let name;
67
+ let command;
68
+ let description;
69
+ let output;
70
+ let bundler;
71
+ let bundle;
72
+ let compile;
73
+ const runtime = common.runtime;
74
+ const timeout = common.timeout ?? 3e4;
75
+ let minify;
76
+ let from;
77
+ let dryRun = false;
78
+ let includeTools;
79
+ let excludeTools;
80
+ let index = 0;
81
+ while (index < args.length) {
82
+ const token = args[index];
83
+ if (!token) {
84
+ index += 1;
85
+ continue;
86
+ }
87
+ if (token === "--from") {
88
+ from = expectValue(token, args[index + 1]);
89
+ args.splice(index, 2);
90
+ continue;
91
+ }
92
+ if (token === "--dry-run") {
93
+ dryRun = true;
94
+ args.splice(index, 1);
95
+ continue;
96
+ }
97
+ if (token === "--include-tools") {
98
+ const value = expectValue(token, args[index + 1]);
99
+ includeTools = mergeCsvList(includeTools, value);
100
+ args.splice(index, 2);
101
+ continue;
102
+ }
103
+ if (token === "--exclude-tools") {
104
+ const value = expectValue(token, args[index + 1]);
105
+ excludeTools = mergeCsvList(excludeTools, value);
106
+ args.splice(index, 2);
107
+ continue;
108
+ }
109
+ if (token === "--server") {
110
+ server = expectValue(token, args[index + 1]);
111
+ args.splice(index, 2);
112
+ continue;
113
+ }
114
+ if (token === "--name") {
115
+ name = expectValue(token, args[index + 1]);
116
+ args.splice(index, 2);
117
+ continue;
118
+ }
119
+ if (token === "--command") {
120
+ const value = expectValue(token, args[index + 1]);
121
+ command = normalizeCommandInput(value);
122
+ args.splice(index, 2);
123
+ continue;
124
+ }
125
+ if (token === "--description") {
126
+ description = expectValue(token, args[index + 1]);
127
+ args.splice(index, 2);
128
+ continue;
129
+ }
130
+ if (token === "--output") {
131
+ output = expectValue(token, args[index + 1]);
132
+ args.splice(index, 2);
133
+ continue;
134
+ }
135
+ if (token === "--bundle") {
136
+ const next = args[index + 1];
137
+ if (!next || next.startsWith("--")) {
138
+ bundle = true;
139
+ args.splice(index, 1);
140
+ } else {
141
+ bundle = next;
142
+ args.splice(index, 2);
143
+ }
144
+ continue;
145
+ }
146
+ if (token === "--bundler") {
147
+ const value = expectValue(token, args[index + 1]);
148
+ if (value !== "rolldown" && value !== "bun") {
149
+ throw new Error("--bundler must be 'rolldown' or 'bun'.");
150
+ }
151
+ bundler = value;
152
+ args.splice(index, 2);
153
+ continue;
154
+ }
155
+ if (token === "--compile") {
156
+ const next = args[index + 1];
157
+ if (!next || next.startsWith("--")) {
158
+ compile = true;
159
+ args.splice(index, 1);
160
+ } else {
161
+ compile = next;
162
+ args.splice(index, 2);
163
+ }
164
+ continue;
165
+ }
166
+ if (token === "--minify") {
167
+ minify = true;
168
+ args.splice(index, 1);
169
+ continue;
170
+ }
171
+ if (token === "--no-minify") {
172
+ minify = false;
173
+ args.splice(index, 1);
174
+ continue;
175
+ }
176
+ if (token.startsWith("--")) {
177
+ throw new Error(`Unknown flag '${token}' for generate-cli.`);
178
+ }
179
+ index += 1;
180
+ }
181
+ const positional = !server && !command && !from ? args.find((token) => token && !token.startsWith("--")) : void 0;
182
+ if (positional) {
183
+ const position = args.indexOf(positional);
184
+ if (position !== -1) {
185
+ args.splice(position, 1);
186
+ }
187
+ if (looksLikeInlineCommand(positional)) {
188
+ command = normalizeCommandInput(positional);
189
+ } else if (looksLikeHttpUrl(positional) || positional.includes("://")) {
190
+ command = positional;
191
+ } else {
192
+ server = positional;
193
+ }
194
+ }
195
+ if (!server && !command && common.runtime === "node" && common.timeout && !from && args[0]) {
196
+ const target = extractHttpServerTarget(args[0]);
197
+ if (target) {
198
+ server = target;
199
+ }
200
+ }
201
+ return {
202
+ server,
203
+ name,
204
+ command,
205
+ description,
206
+ output,
207
+ bundler,
208
+ bundle,
209
+ compile,
210
+ runtime,
211
+ timeout,
212
+ minify,
213
+ from,
214
+ dryRun,
215
+ includeTools,
216
+ excludeTools
217
+ };
218
+ }
219
+ function mergeCsvList(existing, value) {
220
+ const parts = value.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
221
+ const base = existing ?? [];
222
+ const merged = [...base, ...parts];
223
+ const seen = /* @__PURE__ */ new Set();
224
+ const result = [];
225
+ for (const name of merged) {
226
+ if (!seen.has(name)) {
227
+ seen.add(name);
228
+ result.push(name);
229
+ }
230
+ }
231
+ return result;
232
+ }
233
+ function normalizeCommandInput(value) {
234
+ const httpCandidate = normalizeHttpUrlCandidate(value);
235
+ if (httpCandidate) {
236
+ const selector = splitHttpToolSelector(httpCandidate);
237
+ if (selector) {
238
+ return selector.baseUrl;
239
+ }
240
+ return httpCandidate;
241
+ }
242
+ if (looksLikeInlineCommand(value)) {
243
+ return parseInlineCommand(value);
244
+ }
245
+ return { command: value };
246
+ }
247
+ function looksLikeInlineCommand(value) {
248
+ if (!value) {
249
+ return false;
250
+ }
251
+ if (!/\s/.test(value)) {
252
+ return false;
253
+ }
254
+ try {
255
+ const parts = splitCommandLine(value.trim());
256
+ return parts.length > 0;
257
+ } catch {
258
+ return false;
259
+ }
260
+ }
261
+ function parseInlineCommand(value) {
262
+ const parts = splitCommandLine(value.trim());
263
+ if (parts.length === 0) {
264
+ throw new Error("--command requires a non-empty value.");
265
+ }
266
+ const [command, ...rest] = parts;
267
+ return { command, args: rest };
268
+ }
269
+
270
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/name-utils.js
271
+ function inferNameFromCommand(command) {
272
+ if (typeof command === "string") {
273
+ const normalizedHttp = normalizeHttpUrlCandidate(command);
274
+ if (normalizedHttp) {
275
+ try {
276
+ const url = new URL(normalizedHttp);
277
+ const segments = url.hostname.split(".").filter(Boolean);
278
+ for (const segment of segments) {
279
+ const lowered = segment.toLowerCase();
280
+ if (lowered === "www" || lowered === "api" || lowered === "mcp") {
281
+ continue;
282
+ }
283
+ const slug = slugify(segment);
284
+ if (slug) {
285
+ return slug;
286
+ }
287
+ }
288
+ const fallback = slugify(segments[0] ?? url.hostname);
289
+ if (fallback) {
290
+ return fallback;
291
+ }
292
+ const derived = deriveNameFromUrl(url);
293
+ const derivedSlug = derived ? slugify(derived) : void 0;
294
+ if (derivedSlug) {
295
+ return derivedSlug;
296
+ }
297
+ } catch {
298
+ }
299
+ }
300
+ const trimmed = command.trim();
301
+ if (looksLikeInlineCommand2(trimmed)) {
302
+ try {
303
+ const parsed = parseInlineCommand2(trimmed);
304
+ const derived = inferNameFromCommand(parsed);
305
+ if (derived) {
306
+ return derived;
307
+ }
308
+ } catch {
309
+ }
310
+ }
311
+ const firstToken = trimmed.split(/\s+/)[0] ?? trimmed;
312
+ const candidateToken = firstToken.split(/[\\/]/).pop() ?? firstToken;
313
+ return slugify(candidateToken.replace(/\.[a-z0-9]+$/i, ""));
314
+ }
315
+ const parts = [command.command, ...command.args ?? []];
316
+ if (parts.length === 0) {
317
+ return void 0;
318
+ }
319
+ const script = parts.find((part) => /\.[cm]?(ts|js)x?$/i.test(part));
320
+ if (script) {
321
+ return slugify(stripExtension(basename(script)));
322
+ }
323
+ const packageArg = parts.find((_part, index) => index > 0 && /[@/]/.test(_part));
324
+ if (packageArg) {
325
+ return slugify(packageArg.replace(/^@/, "").split("@")[0] ?? packageArg);
326
+ }
327
+ const bareArg = findLastPositionalArg(parts);
328
+ if (bareArg) {
329
+ return slugify(bareArg);
330
+ }
331
+ return slugify(basename(parts[0] ?? "command"));
332
+ }
333
+ function looksLikeInlineCommand2(value) {
334
+ if (!value) {
335
+ return false;
336
+ }
337
+ if (!/\s/.test(value)) {
338
+ return false;
339
+ }
340
+ try {
341
+ const parts = splitCommandLine(value.trim());
342
+ return parts.length > 0;
343
+ } catch {
344
+ return false;
345
+ }
346
+ }
347
+ function parseInlineCommand2(value) {
348
+ const parts = splitCommandLine(value.trim());
349
+ if (parts.length === 0) {
350
+ throw new Error("--command requires a non-empty value.");
351
+ }
352
+ const [command, ...rest] = parts;
353
+ return { command, args: rest };
354
+ }
355
+ function slugify(value) {
356
+ const normalized = value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
357
+ return normalized || void 0;
358
+ }
359
+ function basename(value) {
360
+ const segments = value.split(/[\\/]/);
361
+ return segments[segments.length - 1] ?? value;
362
+ }
363
+ function stripExtension(value) {
364
+ const index = value.lastIndexOf(".");
365
+ if (index === -1) {
366
+ return value;
367
+ }
368
+ return value.slice(0, index);
369
+ }
370
+ function findLastPositionalArg(parts) {
371
+ for (let index = parts.length - 1; index >= 1; index -= 1) {
372
+ const part = parts[index];
373
+ if (!part) {
374
+ continue;
375
+ }
376
+ if (part.startsWith("-")) {
377
+ continue;
378
+ }
379
+ if (/^[A-Za-z0-9_]+=/.test(part)) {
380
+ continue;
381
+ }
382
+ if (part.includes("://")) {
383
+ continue;
384
+ }
385
+ return part;
386
+ }
387
+ return void 0;
388
+ }
389
+ function deriveNameFromUrl(url) {
390
+ const genericHosts = /* @__PURE__ */ new Set(["www", "api", "mcp", "service", "services", "app", "localhost"]);
391
+ const knownTlds = /* @__PURE__ */ new Set(["com", "net", "org", "io", "ai", "app", "dev", "co", "cloud"]);
392
+ const parts = url.hostname.split(".").filter(Boolean);
393
+ const filtered = parts.filter((part) => {
394
+ const lower = part.toLowerCase();
395
+ if (genericHosts.has(lower)) {
396
+ return false;
397
+ }
398
+ if (knownTlds.has(lower)) {
399
+ return false;
400
+ }
401
+ if (/^\d+$/.test(part)) {
402
+ return false;
403
+ }
404
+ return true;
405
+ });
406
+ if (filtered.length > 0) {
407
+ const last = filtered[filtered.length - 1];
408
+ if (last) {
409
+ return last;
410
+ }
411
+ }
412
+ const firstSegment = url.pathname.split("/").find(Boolean);
413
+ if (firstSegment) {
414
+ return firstSegment.replace(/[^a-zA-Z0-9-_]/g, "-");
415
+ }
416
+ return void 0;
417
+ }
418
+
419
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/generate-cli.js
420
+ import fs3 from "node:fs/promises";
421
+ import { createHash } from "node:crypto";
422
+ import path3 from "node:path";
423
+
424
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/artifacts.js
425
+ import { execFile as execFile2 } from "node:child_process";
426
+ import fsSync from "node:fs";
427
+ import fs from "node:fs/promises";
428
+ import { builtinModules, createRequire } from "node:module";
429
+ import path from "node:path";
430
+ import { fileURLToPath } from "node:url";
431
+
432
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/runtime.js
433
+ import { execFile } from "node:child_process";
434
+ async function resolveRuntimeKind(runtimeOption, compileOption) {
435
+ if (runtimeOption) {
436
+ return runtimeOption;
437
+ }
438
+ const bunAvailable = await isBunAvailable();
439
+ if (compileOption && !bunAvailable) {
440
+ throw new Error("--compile requires Bun. Install Bun or set BUN_BIN to the bun executable.");
441
+ }
442
+ return bunAvailable ? "bun" : "node";
443
+ }
444
+ async function verifyBunAvailable() {
445
+ const bunBin = process.env.BUN_BIN ?? "bun";
446
+ await new Promise((resolve, reject) => {
447
+ execFile(bunBin, ["--version"], { cwd: process.cwd(), env: process.env }, (error) => {
448
+ if (error) {
449
+ reject(new Error("Unable to locate Bun runtime. Install Bun or set BUN_BIN to the bun executable."));
450
+ return;
451
+ }
452
+ resolve();
453
+ });
454
+ });
455
+ return bunBin;
456
+ }
457
+ async function isBunAvailable() {
458
+ try {
459
+ await verifyBunAvailable();
460
+ return true;
461
+ } catch {
462
+ return false;
463
+ }
464
+ }
465
+
466
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/artifacts.js
467
+ var localRequire = createRequire(import.meta.url);
468
+ var packageRoot = fileURLToPath(new URL("../../..", import.meta.url));
469
+ var BUNDLED_DEPENDENCIES = ["commander", "mcporter", "jsonc-parser"];
470
+ var dependencyAliasPlugin = createLocalDependencyAliasPlugin([...BUNDLED_DEPENDENCIES]);
471
+ var NODE_BUILTIN_SPECIFIERS = new Set(builtinModules.flatMap((specifier) => [specifier, `node:${specifier}`]));
472
+ async function bundleOutput({ sourcePath, targetPath, runtimeKind, minify, bundler }) {
473
+ if (bundler === "bun") {
474
+ return await bundleWithBun({ sourcePath, targetPath, runtimeKind, minify });
475
+ }
476
+ return await bundleWithRolldown({ sourcePath, targetPath, runtimeKind, minify });
477
+ }
478
+ async function bundleWithRolldown({ sourcePath, targetPath, runtimeKind, minify }) {
479
+ let rolldownImpl;
480
+ try {
481
+ ({ rolldown: rolldownImpl } = await import("./dist-LK3SHAMX.js"));
482
+ } catch (error) {
483
+ const message = "Rolldown bundling is unavailable in this build of mcporter; rerun with --bundler bun or install mcporter via npm (Node.js) to use the Rolldown bundler.";
484
+ if (error instanceof Error) {
485
+ error.message = `${message}
486
+
487
+ ${error.message}`;
488
+ throw error;
489
+ }
490
+ throw new Error(message, { cause: error });
491
+ }
492
+ const absTarget = path.resolve(targetPath);
493
+ await fs.mkdir(path.dirname(absTarget), { recursive: true });
494
+ const plugins = dependencyAliasPlugin ? [dependencyAliasPlugin] : void 0;
495
+ const bundle = await rolldownImpl({
496
+ input: sourcePath,
497
+ treeshake: false,
498
+ plugins,
499
+ onLog(level, log, handler) {
500
+ if (typeof log.code === "string" && log.code === "EVAL") {
501
+ return;
502
+ }
503
+ if (isExpectedNodeBuiltinWarning(log)) {
504
+ return;
505
+ }
506
+ handler(level, log);
507
+ }
508
+ });
509
+ const format = outputFormatForTarget(absTarget, runtimeKind);
510
+ await bundle.write({
511
+ file: absTarget,
512
+ format,
513
+ codeSplitting: false,
514
+ sourcemap: false,
515
+ minify,
516
+ ...format === "esm" ? { banner: buildEsmRequireBanner() } : {}
517
+ });
518
+ await markExecutable(absTarget);
519
+ return absTarget;
520
+ }
521
+ function isExpectedNodeBuiltinWarning(log) {
522
+ const record = log;
523
+ if (record.code !== "UNRESOLVED_IMPORT" || typeof record.message !== "string") {
524
+ return false;
525
+ }
526
+ const match = record.message.match(/Could not resolve ['"]([^'"]+)['"]/);
527
+ return Boolean(match?.[1] && NODE_BUILTIN_SPECIFIERS.has(match[1]));
528
+ }
529
+ function buildEsmRequireBanner() {
530
+ return [
531
+ 'import { createRequire as __mcporterCreateRequire } from "node:module";',
532
+ "const require = __mcporterCreateRequire(import.meta.url);"
533
+ ].join("\n");
534
+ }
535
+ function outputFormatForTarget(targetPath, runtimeKind) {
536
+ const extension = path.extname(targetPath).toLowerCase();
537
+ if (extension === ".mjs") {
538
+ return "esm";
539
+ }
540
+ if (extension === ".cjs") {
541
+ return "cjs";
542
+ }
543
+ return runtimeKind === "bun" ? "esm" : "cjs";
544
+ }
545
+ async function bundleWithBun({ sourcePath, targetPath, runtimeKind, minify }) {
546
+ const absTarget = path.resolve(targetPath);
547
+ await fs.mkdir(path.dirname(absTarget), { recursive: true });
548
+ const bunBin = await verifyBunAvailable();
549
+ const tmpRoot = path.join(packageRoot, "tmp");
550
+ await fs.mkdir(tmpRoot, { recursive: true });
551
+ const stagingDir = await fs.mkdtemp(path.join(tmpRoot, "bundle-"));
552
+ const stagingEntry = path.join(stagingDir, path.basename(sourcePath));
553
+ await safeCopyFile(sourcePath, stagingEntry);
554
+ await ensureBundlerDeps(stagingDir);
555
+ try {
556
+ const args = ["build", stagingEntry, "--outfile", absTarget, "--target", runtimeKind === "bun" ? "bun" : "node"];
557
+ if (minify) {
558
+ args.push("--minify");
559
+ }
560
+ await new Promise((resolve, reject) => {
561
+ execFile2(bunBin, args, { cwd: stagingDir, env: process.env }, (error) => {
562
+ if (error) {
563
+ reject(error);
564
+ return;
565
+ }
566
+ resolve();
567
+ });
568
+ });
569
+ } finally {
570
+ await fs.rm(stagingDir, { recursive: true, force: true }).catch(() => {
571
+ });
572
+ }
573
+ await markExecutable(absTarget);
574
+ return absTarget;
575
+ }
576
+ async function compileBundleWithBun(bundlePath, outputPath) {
577
+ const bunBin = await verifyBunAvailable();
578
+ await new Promise((resolve, reject) => {
579
+ execFile2(bunBin, ["build", bundlePath, "--compile", "--outfile", outputPath], { cwd: process.cwd(), env: process.env }, (error) => {
580
+ if (error) {
581
+ reject(error);
582
+ return;
583
+ }
584
+ resolve();
585
+ });
586
+ });
587
+ await markExecutable(outputPath);
588
+ }
589
+ function resolveBundleTarget({ bundle, compile, outputPath }) {
590
+ if (typeof bundle === "string") {
591
+ return bundle;
592
+ }
593
+ if (bundle) {
594
+ throw new Error("--bundle requires an explicit output path when used with --compile.");
595
+ }
596
+ if (typeof compile === "string") {
597
+ const ext = path.extname(compile);
598
+ const base = ext ? path.join(path.dirname(compile), path.basename(compile, ext)) : compile;
599
+ return `${base}.js`;
600
+ }
601
+ if (compile) {
602
+ const tmpDir = path.join(process.cwd(), "tmp", "mcporter-cli-bundles");
603
+ const baseName = path.basename(outputPath, path.extname(outputPath)) || "bundle";
604
+ return path.join(tmpDir, `${baseName}-${Date.now()}.bundle.js`);
605
+ }
606
+ throw new Error("--compile requires an explicit bundle target.");
607
+ }
608
+ function computeCompileTarget(compileOption, _bundlePath, serverName) {
609
+ if (typeof compileOption === "string") {
610
+ return compileOption;
611
+ }
612
+ const baseName = sanitizeFileName(serverName) || "mcporter-cli";
613
+ return resolveUniquePath(process.cwd(), baseName);
614
+ }
615
+ function createLocalDependencyAliasPlugin(specifiers) {
616
+ const resolvedEntries = specifiers.map((specifier) => ({ specifier, path: resolveLocalDependency(specifier) })).filter((entry) => Boolean(entry.path));
617
+ if (resolvedEntries.length === 0) {
618
+ return void 0;
619
+ }
620
+ return {
621
+ name: "mcporter-local-deps",
622
+ resolveId(source) {
623
+ const match = resolvedEntries.find((entry) => entry.specifier === source);
624
+ if (match) {
625
+ return match.path;
626
+ }
627
+ return null;
628
+ }
629
+ };
630
+ }
631
+ function resolveLocalDependency(specifier) {
632
+ try {
633
+ if (specifier === "jsonc-parser") {
634
+ const pkgJsonPath = localRequire.resolve("jsonc-parser/package.json");
635
+ const pkgDir = path.dirname(pkgJsonPath);
636
+ try {
637
+ const pkg = JSON.parse(fsSync.readFileSync(pkgJsonPath, "utf8"));
638
+ if (pkg.module) {
639
+ const esmEntry = path.join(pkgDir, pkg.module);
640
+ if (fsSync.existsSync(esmEntry)) {
641
+ return esmEntry;
642
+ }
643
+ }
644
+ } catch {
645
+ }
646
+ }
647
+ return localRequire.resolve(specifier);
648
+ } catch {
649
+ if (specifier === "mcporter") {
650
+ const fallbacks = [
651
+ path.join(packageRoot, "dist", "index.js"),
652
+ path.join(packageRoot, "dist", "index.mjs"),
653
+ path.join(packageRoot, "src", "index.ts"),
654
+ path.join(packageRoot, "src", "index.js")
655
+ ];
656
+ for (const candidate of fallbacks) {
657
+ if (fsSync.existsSync(candidate)) {
658
+ return candidate;
659
+ }
660
+ }
661
+ }
662
+ }
663
+ return void 0;
664
+ }
665
+ async function ensureBundlerDeps(stagingDir) {
666
+ const nodeModulesDir = path.join(stagingDir, "node_modules");
667
+ await fs.mkdir(nodeModulesDir, { recursive: true });
668
+ await Promise.all(BUNDLED_DEPENDENCIES.map(async (specifier) => {
669
+ const sourceDir = resolveDependencyDirectory(specifier);
670
+ if (!sourceDir) {
671
+ return;
672
+ }
673
+ const target = path.join(nodeModulesDir, specifier);
674
+ await linkOrCopyDependency(sourceDir, target);
675
+ }));
676
+ const missing = await findMissingBundlerDeps(stagingDir);
677
+ if (missing.length > 0) {
678
+ await installPublishedBundlerDeps(stagingDir);
679
+ }
680
+ }
681
+ async function findMissingBundlerDeps(stagingDir) {
682
+ const missing = [];
683
+ for (const specifier of BUNDLED_DEPENDENCIES) {
684
+ const pkgPath = path.join(stagingDir, "node_modules", specifier, "package.json");
685
+ try {
686
+ await fs.access(pkgPath);
687
+ } catch {
688
+ missing.push(specifier);
689
+ }
690
+ }
691
+ return missing;
692
+ }
693
+ async function installPublishedBundlerDeps(stagingDir) {
694
+ const installSpec = process.env.MCPORTER_BUNDLER_DEP_PACKAGE ?? MCPORTER_VERSION;
695
+ if (installSpec === "0.0.0-dev") {
696
+ throw new Error("Unable to resolve generated-CLI bundler dependencies from this standalone mcporter binary. Install mcporter via npm/Homebrew or publish the matching mcporter package before using --compile.");
697
+ }
698
+ await fs.writeFile(path.join(stagingDir, "package.json"), JSON.stringify({ private: true, type: "module", dependencies: { mcporter: installSpec } }, null, 2), "utf8");
699
+ await new Promise((resolve, reject) => {
700
+ execFile2("npm", ["install", "--ignore-scripts", "--no-audit", "--no-fund", "--min-release-age=0"], { cwd: stagingDir, env: process.env }, (error) => {
701
+ if (error) {
702
+ reject(new Error(`Unable to install ${formatMcporterInstallSpec(installSpec)} dependencies needed for Bun compilation from this standalone binary. Install mcporter via npm/Homebrew, or ensure npm can reach the registry.
703
+
704
+ ${error.message}`));
705
+ return;
706
+ }
707
+ resolve();
708
+ });
709
+ });
710
+ }
711
+ function formatMcporterInstallSpec(installSpec) {
712
+ if (installSpec === MCPORTER_VERSION) {
713
+ return `mcporter@${MCPORTER_VERSION}`;
714
+ }
715
+ return `mcporter from ${installSpec}`;
716
+ }
717
+ function resolveDependencyDirectory(specifier) {
718
+ try {
719
+ if (specifier === "mcporter") {
720
+ return packageRoot;
721
+ }
722
+ const pkgPath = localRequire.resolve(path.join(specifier, "package.json"));
723
+ return path.dirname(pkgPath);
724
+ } catch {
725
+ return void 0;
726
+ }
727
+ }
728
+ async function linkOrCopyDependency(sourceDir, targetDir) {
729
+ try {
730
+ await fs.symlink(sourceDir, targetDir, "dir");
731
+ } catch (error) {
732
+ const code = error.code;
733
+ if (code === "EEXIST") {
734
+ return;
735
+ }
736
+ if (code === "ENOENT") {
737
+ return;
738
+ }
739
+ if (code === "EPERM" || code === "EACCES") {
740
+ await fs.cp(sourceDir, targetDir, { recursive: true });
741
+ return;
742
+ }
743
+ throw error;
744
+ }
745
+ }
746
+ function sanitizeFileName(input) {
747
+ const slug = input.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-");
748
+ return slug.replace(/^-+|-+$/g, "");
749
+ }
750
+ function resolveUniquePath(directory, baseName) {
751
+ let attempt = path.join(directory, baseName);
752
+ let suffix = 1;
753
+ while (fsSync.existsSync(attempt)) {
754
+ attempt = path.join(directory, `${baseName}-${suffix}`);
755
+ suffix += 1;
756
+ }
757
+ return attempt;
758
+ }
759
+
760
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/definition.js
761
+ import fs2 from "node:fs/promises";
762
+ import path2 from "node:path";
763
+ function ensureInvocationDefaults(invocation, definition) {
764
+ const serverRef = invocation.serverRef ?? definition.name;
765
+ const configPath = invocation.configPath ?? (definition.source && definition.source.kind === "local" ? definition.source.path : void 0);
766
+ return {
767
+ ...invocation,
768
+ serverRef,
769
+ configPath
770
+ };
771
+ }
772
+ async function resolveServerDefinition(serverRef, configPath, rootDir) {
773
+ const trimmed = serverRef.trim();
774
+ if (trimmed.startsWith("{") && trimmed.endsWith("}")) {
775
+ const parsed = JSON.parse(trimmed);
776
+ if (!parsed.name) {
777
+ throw new Error("Inline server definition must include a 'name' field.");
778
+ }
779
+ return { definition: normalizeDefinition(parsed), name: parsed.name };
780
+ }
781
+ const possiblePath = path2.resolve(trimmed);
782
+ try {
783
+ const buffer = await fs2.readFile(possiblePath, "utf8");
784
+ const parsed = JSON.parse(buffer);
785
+ if (!parsed.mcpServers || typeof parsed.mcpServers !== "object") {
786
+ throw new Error(`Config file ${possiblePath} does not contain mcpServers.`);
787
+ }
788
+ const entries = Object.entries(parsed.mcpServers);
789
+ if (entries.length === 0) {
790
+ throw new Error(`Config file ${possiblePath} does not define any servers.`);
791
+ }
792
+ const first = entries[0];
793
+ if (!first) {
794
+ throw new Error(`Config file ${possiblePath} does not define any servers.`);
795
+ }
796
+ const [name, value] = first;
797
+ return {
798
+ definition: normalizeDefinition({
799
+ name,
800
+ ...value
801
+ }),
802
+ name
803
+ };
804
+ } catch (error) {
805
+ if (error.code !== "ENOENT") {
806
+ throw error;
807
+ }
808
+ }
809
+ const definitions = await loadServerDefinitions({
810
+ configPath,
811
+ rootDir
812
+ });
813
+ const matchByName = definitions.find((def) => def.name === trimmed);
814
+ if (matchByName) {
815
+ return { definition: matchByName, name: matchByName.name };
816
+ }
817
+ const httpTarget = extractHttpServerTarget(trimmed);
818
+ if (httpTarget) {
819
+ const normalizedTarget = normalizeHttpUrl(httpTarget);
820
+ if (normalizedTarget) {
821
+ const matchByUrl = definitions.find((def) => {
822
+ if (def.command.kind !== "http") {
823
+ return false;
824
+ }
825
+ const normalizedDefinitionUrl = normalizeHttpUrl(def.command.url);
826
+ return normalizedDefinitionUrl === normalizedTarget;
827
+ });
828
+ if (matchByUrl) {
829
+ return { definition: matchByUrl, name: matchByUrl.name };
830
+ }
831
+ }
832
+ }
833
+ throw new Error(`Unknown MCP server '${trimmed}'. Provide a name from config, a JSON file, inline JSON, or an HTTP URL that matches a configured server.`);
834
+ }
835
+ async function fetchTools(definition, serverName, configPath, rootDir) {
836
+ const runtime = await createRuntime({
837
+ configPath,
838
+ rootDir,
839
+ servers: configPath ? void 0 : [definition]
840
+ });
841
+ try {
842
+ const tools = await runtime.listTools(serverName, { includeSchema: true });
843
+ const derivedDescription = definition.description ? void 0 : await deriveDefinitionDescription(runtime, serverName);
844
+ return { tools, derivedDescription };
845
+ } finally {
846
+ await runtime.close(serverName).catch(() => {
847
+ });
848
+ }
849
+ }
850
+ async function deriveDefinitionDescription(runtime, serverName) {
851
+ try {
852
+ const context = await runtime.connect(serverName);
853
+ const instructions = typeof context.client.getInstructions === "function" ? context.client.getInstructions() : void 0;
854
+ const serverInfo = typeof context.client.getServerVersion === "function" ? context.client.getServerVersion() : void 0;
855
+ const derived = pickDescription(instructions, serverInfo);
856
+ return derived;
857
+ } catch {
858
+ return void 0;
859
+ }
860
+ }
861
+ function pickDescription(instructions, serverInfo) {
862
+ const ordered = [instructions, serverInfo?.title, serverInfo?.name];
863
+ for (const candidate of ordered) {
864
+ if (typeof candidate === "string") {
865
+ const trimmed = candidate.trim();
866
+ if (trimmed.length > 0) {
867
+ return trimmed;
868
+ }
869
+ }
870
+ }
871
+ return void 0;
872
+ }
873
+ function normalizeDefinition(def) {
874
+ const name = def.name;
875
+ if (typeof name !== "string" || name.trim().length === 0) {
876
+ throw new Error("Server definition must include a name.");
877
+ }
878
+ const description = typeof def.description === "string" ? def.description : void 0;
879
+ const env = toStringRecord(def.env);
880
+ const auth = typeof def.auth === "string" ? def.auth : void 0;
881
+ const tokenCacheDir = typeof def.tokenCacheDir === "string" ? def.tokenCacheDir : void 0;
882
+ const clientName = typeof def.clientName === "string" ? def.clientName : void 0;
883
+ const record = def;
884
+ const oauthClientId = stringFromAliases(record, "oauthClientId", "oauth_client_id");
885
+ const oauthClientSecret = stringFromAliases(record, "oauthClientSecret", "oauth_client_secret");
886
+ const oauthClientSecretEnv = stringFromAliases(record, "oauthClientSecretEnv", "oauth_client_secret_env");
887
+ const oauthTokenEndpointAuthMethod = stringFromAliases(record, "oauthTokenEndpointAuthMethod", "oauth_token_endpoint_auth_method");
888
+ const oauthRedirectUrl = typeof def.oauthRedirectUrl === "string" ? def.oauthRedirectUrl : void 0;
889
+ const oauthScope = typeof def.oauthScope === "string" ? def.oauthScope : void 0;
890
+ const refresh = getRefresh(record.refresh);
891
+ const httpFetch = normalizeHttpFetch(stringFromAliases(record, "httpFetch", "http_fetch"));
892
+ const headers = toStringRecord(def.headers);
893
+ const oauthCommand = getOauthCommand(record.oauthCommand ?? record.oauth_command);
894
+ const rawLifecycle = getRawLifecycle(record.lifecycle);
895
+ const logging = getLogging(record.logging);
896
+ const allowedTools = getOptionalStringArray(record.allowedTools ?? record.allowed_tools, "allowedTools");
897
+ const blockedTools = getOptionalStringArray(record.blockedTools ?? record.blocked_tools, "blockedTools");
898
+ if (allowedTools !== void 0 && blockedTools !== void 0) {
899
+ throw new Error(`Server definition '${name}' cannot specify both allowedTools and blockedTools.`);
900
+ }
901
+ const shared = (command) => ({
902
+ env,
903
+ auth,
904
+ tokenCacheDir,
905
+ clientName,
906
+ oauthClientId,
907
+ oauthClientSecret,
908
+ oauthClientSecretEnv,
909
+ oauthTokenEndpointAuthMethod,
910
+ oauthRedirectUrl,
911
+ oauthScope,
912
+ oauthCommand,
913
+ refresh,
914
+ httpFetch,
915
+ lifecycle: resolveLifecycle(name, rawLifecycle, command),
916
+ logging,
917
+ ...allowedTools !== void 0 ? { allowedTools } : {},
918
+ ...blockedTools !== void 0 ? { blockedTools } : {}
919
+ });
920
+ const commandValue = def.command;
921
+ if (isCommandSpec(commandValue)) {
922
+ const command = normalizeCommand(commandValue, headers);
923
+ return {
924
+ name,
925
+ description,
926
+ command,
927
+ ...shared(command)
928
+ };
929
+ }
930
+ if (typeof commandValue === "string" && commandValue.trim().length > 0) {
931
+ const command = toCommandSpec(commandValue, getStringArray(record.args), headers ? { headers } : void 0);
932
+ return {
933
+ name,
934
+ description,
935
+ command,
936
+ ...shared(command)
937
+ };
938
+ }
939
+ if (Array.isArray(commandValue) && commandValue.length > 0) {
940
+ const [first, ...rest] = commandValue;
941
+ if (typeof first !== "string" || !rest.every((entry) => typeof entry === "string")) {
942
+ throw new Error("Command array must contain only strings.");
943
+ }
944
+ const command = toCommandSpec(first, rest, headers ? { headers } : void 0);
945
+ return {
946
+ name,
947
+ description,
948
+ command,
949
+ ...shared(command)
950
+ };
951
+ }
952
+ throw new Error("Server definition must include command information.");
953
+ }
954
+ function isCommandSpec(value) {
955
+ if (typeof value !== "object" || value === null) {
956
+ return false;
957
+ }
958
+ const candidate = value;
959
+ if (candidate.kind === "http") {
960
+ return "url" in candidate;
961
+ }
962
+ if (candidate.kind === "stdio") {
963
+ return "command" in candidate;
964
+ }
965
+ return false;
966
+ }
967
+ function normalizeCommand(command, headers) {
968
+ if (command.kind === "http") {
969
+ const urlValue = command.url;
970
+ const url = urlValue instanceof URL ? urlValue : new URL(String(urlValue));
971
+ const mergedHeaders = command.headers ? headers ? { ...command.headers, ...headers } : command.headers : headers;
972
+ const normalized = {
973
+ kind: "http",
974
+ url,
975
+ ...mergedHeaders ? { headers: mergedHeaders } : {}
976
+ };
977
+ return normalized;
978
+ }
979
+ return {
980
+ kind: "stdio",
981
+ command: command.command,
982
+ args: [...command.args],
983
+ cwd: command.cwd ?? process.cwd()
984
+ };
985
+ }
986
+ function toCommandSpec(command, args, extra) {
987
+ if (command.startsWith("http://") || command.startsWith("https://")) {
988
+ const httpCommand = {
989
+ kind: "http",
990
+ url: new URL(command),
991
+ ...extra?.headers ? { headers: extra.headers } : {}
992
+ };
993
+ return httpCommand;
994
+ }
995
+ const stdio = {
996
+ kind: "stdio",
997
+ command,
998
+ args: args ?? [],
999
+ cwd: process.cwd()
1000
+ };
1001
+ return stdio;
1002
+ }
1003
+ function getStringArray(value) {
1004
+ if (!Array.isArray(value)) {
1005
+ return void 0;
1006
+ }
1007
+ const entries = value.filter((item) => typeof item === "string");
1008
+ return entries.length > 0 ? entries : void 0;
1009
+ }
1010
+ function getOptionalStringArray(value, fieldName) {
1011
+ if (value === void 0) {
1012
+ return void 0;
1013
+ }
1014
+ if (!Array.isArray(value) || !value.every((item) => typeof item === "string")) {
1015
+ throw new Error(`${fieldName} must be an array of strings.`);
1016
+ }
1017
+ return [...value];
1018
+ }
1019
+ function getRawLifecycle(value) {
1020
+ if (value === "keep-alive" || value === "ephemeral") {
1021
+ return value;
1022
+ }
1023
+ if (typeof value === "object" && value !== null) {
1024
+ const record = value;
1025
+ if (record.mode === "keep-alive" || record.mode === "ephemeral") {
1026
+ return {
1027
+ mode: record.mode,
1028
+ ...typeof record.idleTimeoutMs === "number" ? { idleTimeoutMs: record.idleTimeoutMs } : {}
1029
+ };
1030
+ }
1031
+ }
1032
+ return void 0;
1033
+ }
1034
+ function getLogging(value) {
1035
+ if (typeof value !== "object" || value === null) {
1036
+ return void 0;
1037
+ }
1038
+ const daemon = value.daemon;
1039
+ if (typeof daemon !== "object" || daemon === null) {
1040
+ return void 0;
1041
+ }
1042
+ const enabled = daemon.enabled;
1043
+ return typeof enabled === "boolean" ? { daemon: { enabled } } : { daemon: {} };
1044
+ }
1045
+ function getOauthCommand(value) {
1046
+ if (typeof value !== "object" || value === null) {
1047
+ return void 0;
1048
+ }
1049
+ const args = getStringArray(value.args);
1050
+ return args ? { args } : void 0;
1051
+ }
1052
+ function getRefresh(value) {
1053
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
1054
+ return void 0;
1055
+ }
1056
+ const record = value;
1057
+ const tokenEndpoint = stringFromAliases(record, "tokenEndpoint", "token_endpoint");
1058
+ if (!tokenEndpoint) {
1059
+ return void 0;
1060
+ }
1061
+ const refreshSkewSeconds = record.refreshSkewSeconds ?? record.refresh_skew_seconds;
1062
+ return {
1063
+ tokenEndpoint,
1064
+ clientIdEnv: stringFromAliases(record, "clientIdEnv", "client_id_env"),
1065
+ clientSecretEnv: stringFromAliases(record, "clientSecretEnv", "client_secret_env"),
1066
+ clientAuthMethod: stringFromAliases(record, "clientAuthMethod", "client_auth_method"),
1067
+ ...typeof refreshSkewSeconds === "number" && Number.isInteger(refreshSkewSeconds) && refreshSkewSeconds >= 0 ? { refreshSkewSeconds } : {},
1068
+ accessTokenEnv: stringFromAliases(record, "accessTokenEnv", "access_token_env")
1069
+ };
1070
+ }
1071
+ function normalizeHttpFetch(value) {
1072
+ return value === "default" || value === "node-http1" ? value : void 0;
1073
+ }
1074
+ function stringFromAliases(record, ...keys) {
1075
+ for (const key of keys) {
1076
+ const value = record[key];
1077
+ if (typeof value === "string") {
1078
+ return value;
1079
+ }
1080
+ }
1081
+ return void 0;
1082
+ }
1083
+ function toStringRecord(value) {
1084
+ if (typeof value !== "object" || value === null) {
1085
+ return void 0;
1086
+ }
1087
+ const result = {};
1088
+ for (const [key, entry] of Object.entries(value)) {
1089
+ if (typeof entry === "string") {
1090
+ result[key] = entry;
1091
+ }
1092
+ }
1093
+ return Object.keys(result).length > 0 ? result : void 0;
1094
+ }
1095
+
1096
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/generate-cli.js
1097
+ var REPRODUCIBLE_GENERATED_AT = "1970-01-01T00:00:00.000Z";
1098
+ async function generateCli(options) {
1099
+ const runtimeKind = await resolveRuntimeKind(options.runtime, options.compile);
1100
+ const bundlerKind = options.bundler ?? (runtimeKind === "bun" ? "bun" : "rolldown");
1101
+ if (bundlerKind === "bun" && runtimeKind !== "bun") {
1102
+ throw new Error("--bundler bun currently requires --runtime bun.");
1103
+ }
1104
+ const timeoutMs = options.timeoutMs ?? 3e4;
1105
+ const { definition: baseDefinition, name } = await resolveServerDefinition(options.serverRef, options.configPath, options.rootDir);
1106
+ const { tools: allTools, derivedDescription } = await fetchTools(baseDefinition, name, options.configPath, options.rootDir);
1107
+ const tools = applyToolFilters(allTools, options.includeTools, options.excludeTools);
1108
+ const definition = baseDefinition.description || !derivedDescription ? baseDefinition : { ...baseDefinition, description: derivedDescription };
1109
+ const embeddedDefinition = stripBuildSources(definition);
1110
+ const serializedDefinition = serializeDefinition(embeddedDefinition);
1111
+ const toolMetadata = buildToolMetadataList(tools);
1112
+ const generator = await readPackageMetadata();
1113
+ const baseInvocation = ensureInvocationDefaults({
1114
+ serverRef: options.serverRef,
1115
+ configPath: options.configPath,
1116
+ rootDir: options.rootDir,
1117
+ runtime: runtimeKind,
1118
+ bundler: bundlerKind,
1119
+ outputPath: options.outputPath,
1120
+ bundle: options.bundle,
1121
+ compile: options.compile,
1122
+ timeoutMs,
1123
+ minify: options.minify ?? false,
1124
+ includeTools: options.includeTools,
1125
+ excludeTools: options.excludeTools
1126
+ }, embeddedDefinition);
1127
+ const embeddedMetadata = {
1128
+ schemaVersion: 1,
1129
+ generatedAt: REPRODUCIBLE_GENERATED_AT,
1130
+ generator,
1131
+ server: {
1132
+ name,
1133
+ definition: serializedDefinition
1134
+ },
1135
+ artifact: {
1136
+ path: "",
1137
+ kind: "template"
1138
+ },
1139
+ invocation: buildEmbeddedInvocation(baseInvocation, serializedDefinition)
1140
+ };
1141
+ const shouldBundle = Boolean(options.bundle ?? options.compile);
1142
+ let templateTmpDir;
1143
+ let templateOutputPath = options.outputPath;
1144
+ if (!templateOutputPath && shouldBundle) {
1145
+ templateTmpDir = resolveImplicitTemplateDir(name, serializedDefinition);
1146
+ await fs3.mkdir(templateTmpDir, { recursive: true });
1147
+ templateOutputPath = path3.join(templateTmpDir, `${sanitizePathSegment(name) || "server"}.ts`);
1148
+ }
1149
+ const templateSourcePath = path3.resolve(templateOutputPath ?? path3.resolve(process.cwd(), `${name}.ts`));
1150
+ let resolvedBundleTarget;
1151
+ let resolvedCompileTarget;
1152
+ if (shouldBundle) {
1153
+ resolvedBundleTarget = path3.resolve(resolveBundleTarget({
1154
+ bundle: options.bundle,
1155
+ compile: options.compile,
1156
+ outputPath: templateSourcePath
1157
+ }));
1158
+ if (options.compile) {
1159
+ resolvedCompileTarget = path3.resolve(computeCompileTarget(options.compile, resolvedBundleTarget, name));
1160
+ }
1161
+ }
1162
+ const runtimeScriptPath = resolvedCompileTarget ?? resolvedBundleTarget ?? templateSourcePath;
1163
+ const outputPath = await writeTemplate({
1164
+ outputPath: templateOutputPath,
1165
+ runtimeScriptPath,
1166
+ runtimeKind,
1167
+ timeoutMs,
1168
+ definition: embeddedDefinition,
1169
+ serverName: name,
1170
+ tools: toolMetadata,
1171
+ generator,
1172
+ metadata: embeddedMetadata
1173
+ });
1174
+ let bundlePath;
1175
+ let compilePath;
1176
+ try {
1177
+ if (shouldBundle && resolvedBundleTarget) {
1178
+ bundlePath = await bundleOutput({
1179
+ sourcePath: outputPath,
1180
+ runtimeKind,
1181
+ targetPath: resolvedBundleTarget,
1182
+ minify: options.minify ?? false,
1183
+ bundler: bundlerKind
1184
+ });
1185
+ if (options.compile) {
1186
+ if (runtimeKind !== "bun") {
1187
+ throw new Error("--compile is only supported when --runtime bun");
1188
+ }
1189
+ const compileTarget = resolvedCompileTarget ?? computeCompileTarget(options.compile, bundlePath, name);
1190
+ await compileBundleWithBun(bundlePath, compileTarget);
1191
+ compilePath = compileTarget;
1192
+ if (!options.bundle) {
1193
+ await fs3.rm(bundlePath).catch(() => {
1194
+ });
1195
+ bundlePath = void 0;
1196
+ }
1197
+ }
1198
+ }
1199
+ } finally {
1200
+ if (templateTmpDir) {
1201
+ await fs3.rm(outputPath, { force: true }).catch(() => {
1202
+ });
1203
+ await fs3.rmdir(templateTmpDir).catch(() => {
1204
+ });
1205
+ await fs3.rmdir(path3.dirname(templateTmpDir)).catch(() => {
1206
+ });
1207
+ }
1208
+ }
1209
+ return { outputPath: options.outputPath ?? outputPath, bundlePath, compilePath };
1210
+ }
1211
+ function stripBuildSources(definition) {
1212
+ const { source: _source, sources: _sources, ...runtimeDefinition } = definition;
1213
+ return runtimeDefinition;
1214
+ }
1215
+ function buildEmbeddedInvocation(invocation, definition) {
1216
+ return {
1217
+ serverRef: stableJsonStringify(definition),
1218
+ runtime: invocation.runtime,
1219
+ bundler: invocation.bundler,
1220
+ timeoutMs: invocation.timeoutMs,
1221
+ minify: invocation.minify,
1222
+ includeTools: invocation.includeTools,
1223
+ excludeTools: invocation.excludeTools,
1224
+ bundle: typeof invocation.bundle === "boolean" ? invocation.bundle : void 0,
1225
+ compile: invocation.compile
1226
+ };
1227
+ }
1228
+ function resolveImplicitTemplateDir(serverName, definition) {
1229
+ const hash = createHash("sha256").update(stableJsonStringify({ serverName, definition })).digest("hex").slice(0, 12);
1230
+ return path3.join(process.cwd(), "tmp", "mcporter-cli", `${sanitizePathSegment(serverName) || "server"}-${hash}`);
1231
+ }
1232
+ function sanitizePathSegment(value) {
1233
+ return value.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
1234
+ }
1235
+ function applyToolFilters(tools, includeTools, excludeTools) {
1236
+ if (includeTools && excludeTools) {
1237
+ throw new Error("Internal error: both includeTools and excludeTools provided to generateCli.");
1238
+ }
1239
+ if (includeTools && includeTools.length === 0) {
1240
+ throw new Error("--include-tools requires at least one tool name.");
1241
+ }
1242
+ if (excludeTools && excludeTools.length === 0) {
1243
+ throw new Error("--exclude-tools requires at least one tool name.");
1244
+ }
1245
+ if (!includeTools && !excludeTools) {
1246
+ return tools;
1247
+ }
1248
+ const toolMap = new Map(tools.map((tool) => [tool.name, tool]));
1249
+ if (includeTools && includeTools.length > 0) {
1250
+ const result = [];
1251
+ const missing = [];
1252
+ for (const name of includeTools) {
1253
+ const match = toolMap.get(name);
1254
+ if (match) {
1255
+ result.push(match);
1256
+ } else {
1257
+ missing.push(name);
1258
+ }
1259
+ }
1260
+ if (missing.length > 0) {
1261
+ throw new Error(`Requested tools not found on server: ${missing.join(", ")}. Available tools: ${tools.map((tool) => tool.name).join(", ")}`);
1262
+ }
1263
+ if (result.length === 0) {
1264
+ throw new Error("No tools remain after applying --include-tools filter.");
1265
+ }
1266
+ return result;
1267
+ }
1268
+ if (excludeTools && excludeTools.length > 0) {
1269
+ const excludeSet = new Set(excludeTools);
1270
+ const filtered = tools.filter((tool) => !excludeSet.has(tool.name));
1271
+ if (filtered.length === 0) {
1272
+ throw new Error(`All tools were excluded. Exclude list: ${[...excludeSet].join(", ")}. Available tools: ${tools.map((tool) => tool.name).join(", ")}`);
1273
+ }
1274
+ return filtered;
1275
+ }
1276
+ return tools;
1277
+ }
1278
+ var __test = { ...toolsTestHelpers, applyToolFilters };
1279
+
1280
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/output.js
1281
+ async function performGenerateFromArtifact(metadata, request) {
1282
+ const { outputPath, bundlePath, compilePath } = await generateCli(request);
1283
+ if (metadata.artifact.kind === "binary" && compilePath) {
1284
+ console.log(`Regenerated compiled CLI at ${compilePath}`);
1285
+ } else if (metadata.artifact.kind === "bundle" && bundlePath) {
1286
+ console.log(`Regenerated bundled CLI at ${bundlePath}`);
1287
+ } else {
1288
+ console.log(`Regenerated template at ${outputPath}`);
1289
+ }
1290
+ }
1291
+ async function performGenerateFromRequest(request) {
1292
+ const { outputPath, bundlePath, compilePath } = await generateCli(request);
1293
+ if (request.outputPath || !bundlePath && !compilePath) {
1294
+ console.log(`Generated CLI at ${outputPath}`);
1295
+ }
1296
+ if (bundlePath) {
1297
+ console.log(`Bundled executable created at ${bundlePath}`);
1298
+ }
1299
+ if (compilePath) {
1300
+ console.log(`Compiled executable created at ${compilePath}`);
1301
+ }
1302
+ }
1303
+
1304
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate/server-utils.js
1305
+ function buildInlineServerDefinition(name, command, description) {
1306
+ if (typeof command === "string") {
1307
+ const url = normalizeHttpUrlCandidate(command) ?? command;
1308
+ if (looksLikeHttpUrl(command)) {
1309
+ return {
1310
+ name,
1311
+ description,
1312
+ command: url
1313
+ };
1314
+ }
1315
+ return {
1316
+ name,
1317
+ description,
1318
+ command: {
1319
+ kind: "http",
1320
+ url: new URL(url)
1321
+ },
1322
+ source: { kind: "local", path: "<adhoc>" }
1323
+ };
1324
+ }
1325
+ return {
1326
+ name,
1327
+ description,
1328
+ command: {
1329
+ kind: "stdio",
1330
+ command: command.command,
1331
+ args: command.args ?? []
1332
+ },
1333
+ source: { kind: "local", path: "<adhoc>" }
1334
+ };
1335
+ }
1336
+
1337
+ // node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/cli/generate-cli-runner.js
1338
+ async function handleGenerateCli(args, globalFlags) {
1339
+ const parsed = parseGenerateFlags(args);
1340
+ if (parsed.includeTools && parsed.excludeTools) {
1341
+ throw new Error("--include-tools and --exclude-tools cannot be used together.");
1342
+ }
1343
+ if (parsed.includeTools && parsed.includeTools.length === 0) {
1344
+ throw new Error("--include-tools requires at least one tool name.");
1345
+ }
1346
+ if (parsed.excludeTools && parsed.excludeTools.length === 0) {
1347
+ throw new Error("--exclude-tools requires at least one tool name.");
1348
+ }
1349
+ if (parsed.from && (parsed.command || parsed.description || parsed.name)) {
1350
+ throw new Error("--from cannot be combined with --command/--description/--name.");
1351
+ }
1352
+ if (parsed.dryRun && !parsed.from) {
1353
+ throw new Error("--dry-run currently requires --from <artifact>.");
1354
+ }
1355
+ if (parsed.from) {
1356
+ const metadata = await readCliMetadata(parsed.from);
1357
+ const request = resolveGenerateRequestFromArtifact(parsed, metadata, globalFlags);
1358
+ if (parsed.dryRun) {
1359
+ const command = buildGenerateCliCommand({
1360
+ serverRef: request.serverRef,
1361
+ configPath: request.configPath,
1362
+ rootDir: request.rootDir,
1363
+ outputPath: request.outputPath,
1364
+ bundle: request.bundle,
1365
+ compile: request.compile,
1366
+ runtime: request.runtime ?? "node",
1367
+ timeoutMs: request.timeoutMs ?? 3e4,
1368
+ minify: request.minify ?? false,
1369
+ includeTools: request.includeTools,
1370
+ excludeTools: request.excludeTools
1371
+ }, metadata.server.definition, globalFlags);
1372
+ console.log("Dry run \u2014 would execute:");
1373
+ console.log(` ${command}`);
1374
+ return;
1375
+ }
1376
+ await performGenerateFromArtifact(metadata, request);
1377
+ return;
1378
+ }
1379
+ const inferredName = parsed.name ?? (parsed.command ? inferNameFromCommand(parsed.command) : void 0);
1380
+ const serverRef = parsed.server ?? (parsed.command && inferredName ? JSON.stringify(buildInlineServerDefinition(inferredName, parsed.command, parsed.description)) : void 0);
1381
+ if (!serverRef) {
1382
+ throw new Error("Provide --server with a definition or a command we can infer a name from (use --name to override).");
1383
+ }
1384
+ await performGenerateFromRequest({
1385
+ serverRef,
1386
+ configPath: globalFlags["--config"],
1387
+ rootDir: globalFlags["--root"],
1388
+ outputPath: parsed.output,
1389
+ runtime: parsed.runtime,
1390
+ bundler: parsed.bundler,
1391
+ bundle: parsed.bundle,
1392
+ timeoutMs: parsed.timeout,
1393
+ compile: parsed.compile,
1394
+ minify: parsed.minify ?? false,
1395
+ includeTools: parsed.includeTools,
1396
+ excludeTools: parsed.excludeTools
1397
+ });
1398
+ }
1399
+ function printGenerateCliHelp() {
1400
+ console.error([
1401
+ "Usage: mcporter generate-cli [server | command | url] [flags]",
1402
+ "",
1403
+ "Targets:",
1404
+ " <server> Use a configured server.",
1405
+ " <command|url> Infer an inline stdio or HTTP server.",
1406
+ " --server <name|json> Server name, HTTP URL, or JSON definition.",
1407
+ " --command <value> Inline stdio command or HTTP URL.",
1408
+ " --from <artifact> Regenerate from an existing generated CLI.",
1409
+ "",
1410
+ "Flags:",
1411
+ " --output <path> Write the TypeScript template to a path.",
1412
+ " --bundle [path] Emit a bundled JavaScript artifact.",
1413
+ " --compile [path] Emit a Bun-compiled binary.",
1414
+ " --runtime node|bun Runtime for generated code.",
1415
+ " --bundler rolldown|bun Bundler for JavaScript output.",
1416
+ " --timeout <ms> Discovery/call timeout in milliseconds.",
1417
+ " --minify / --no-minify Toggle bundle minification.",
1418
+ " --include-tools a,b Generate only these tools.",
1419
+ " --exclude-tools a,b Omit these tools.",
1420
+ " --dry-run Print regeneration command for --from."
1421
+ ].join("\n"));
1422
+ }
1423
+ export {
1424
+ handleGenerateCli,
1425
+ printGenerateCliHelp
1426
+ };