@scalar/cli 2.13.2 → 2.15.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 (95) hide show
  1. package/README.md +75 -9
  2. package/chunks/{action-MHBMWRU4.js → action-2BGAMGXU.js} +7 -6
  3. package/chunks/{action-KCJTUKNF.js → action-2HPMP473.js} +4 -4
  4. package/chunks/{action-6WWWTCCB.js → action-2UZWKMSJ.js} +14 -14
  5. package/chunks/{action-O4WDOJVV.js → action-3KP3WVPZ.js} +8 -7
  6. package/chunks/{action-D7D3YH2N.js → action-3QQSKGM3.js} +16 -15
  7. package/chunks/{action-RDG3SJ2G.js → action-3W4IC7QL.js} +17 -16
  8. package/chunks/{action-E7EK6TJJ.js → action-4HXB3YQR.js} +12 -11
  9. package/chunks/{action-4U36CMZG.js → action-57SV3ZBM.js} +7 -6
  10. package/chunks/{action-BIEKRF2X.js → action-6HFH7DAW.js} +7 -6
  11. package/chunks/{action-3OYAJ5F6.js → action-777R7LOG.js} +20 -18
  12. package/chunks/{action-YH3KB4NR.js → action-7LK4RUDP.js} +39 -36
  13. package/chunks/{action-ZSUVSURQ.js → action-APBLB3IU.js} +7 -6
  14. package/chunks/{action-JOKVK5PP.js → action-B2WWTOF6.js} +8 -8
  15. package/chunks/{action-VK6HFIZ5.js → action-ENDUKGWS.js} +16 -15
  16. package/chunks/{action-3QTDQRAO.js → action-G2WBTXOK.js} +18 -16
  17. package/chunks/{action-HGPGL624.js → action-HDT7EO7W.js} +18 -17
  18. package/chunks/{action-2LFAO27S.js → action-HOCCP353.js} +11 -10
  19. package/chunks/{action-BVORONSB.js → action-IU2AVNOW.js} +23 -21
  20. package/chunks/{action-Q7OD2QHZ.js → action-IUAYC2SC.js} +8 -7
  21. package/chunks/{action-ZYQEUYF7.js → action-JNH4DCZX.js} +4 -4
  22. package/chunks/{action-6LNC6MMJ.js → action-LD5B5QQ4.js} +26 -24
  23. package/chunks/{action-YXAOA3TJ.js → action-MBAAYXKK.js} +17 -16
  24. package/chunks/{action-WMOLIVXC.js → action-MJHLG7AE.js} +24 -22
  25. package/chunks/{action-AQCSAFDU.js → action-NZJ4Z64U.js} +16 -15
  26. package/chunks/{action-WJMC3TDN.js → action-P2RPH5R2.js} +7 -7
  27. package/chunks/{action-XZDNARAW.js → action-PDSSIW2A.js} +21 -20
  28. package/chunks/{action-MHJOOGII.js → action-PNSWHIHC.js} +10 -10
  29. package/chunks/{action-4DEIYLOW.js → action-QJMRAFOF.js} +16 -15
  30. package/chunks/{action-S7NCRXKS.js → action-T7SD3ETN.js} +19 -18
  31. package/chunks/{action-IN7SNSSI.js → action-TR2T2UYB.js} +7 -6
  32. package/chunks/{action-V2B42324.js → action-TY4BZEMN.js} +14 -14
  33. package/chunks/{action-NY2R6VH2.js → action-U2RJ3ZAU.js} +4 -4
  34. package/chunks/{action-FIKVZPFG.js → action-WOLNPEUQ.js} +10 -8
  35. package/chunks/{action-LKMBK3MO.js → action-ZTLOQZTT.js} +12 -11
  36. package/chunks/actions-D5OHPBWC.js +327 -0
  37. package/chunks/{actions-K2RSZCU4.js → actions-RI42JY6H.js} +37 -15
  38. package/chunks/{agent-YNVT6RJ6.js → agent-NA3QFKJX.js} +5 -5
  39. package/chunks/{asyncapi-XLHXPF2X.js → asyncapi-YBTWMTW6.js} +23 -18
  40. package/chunks/{build.action-TAMUO3F2.js → build.action-4YDNDBXC.js} +18 -17
  41. package/chunks/{chunk-ORHGCCJR.js → chunk-2KSOARE4.js} +2 -2
  42. package/chunks/{chunk-KAKAN5X3.js → chunk-42MIV6WF.js} +2 -2
  43. package/chunks/{chunk-5ENKYZA4.js → chunk-4S3DGMMZ.js} +1 -1
  44. package/chunks/chunk-5D3T63G4.js +14 -0
  45. package/chunks/{chunk-DRXJRWZA.js → chunk-6BQHLHBE.js} +4 -2
  46. package/chunks/chunk-7FGJIUDN.js +27 -0
  47. package/chunks/{chunk-NEB25B57.js → chunk-7FS7BAUX.js} +3 -3
  48. package/chunks/{chunk-JA7EIRUB.js → chunk-7PNOYE6B.js} +1 -1
  49. package/chunks/{chunk-KVK4LNTB.js → chunk-ANP5XF26.js} +8108 -3716
  50. package/chunks/{chunk-MQNTUZ2B.js → chunk-BLY2CF4S.js} +3 -1
  51. package/chunks/{chunk-I2JLVALT.js → chunk-BMQFEKHA.js} +120 -15
  52. package/chunks/{chunk-4T5XUXTP.js → chunk-BOCMOHQA.js} +3 -1
  53. package/chunks/chunk-BY4NGQ5D.js +15 -0
  54. package/chunks/{chunk-RQOKASNF.js → chunk-DLYMDGFW.js} +2 -2
  55. package/chunks/{chunk-VMRXSVEE.js → chunk-DWJMPHLY.js} +3 -1
  56. package/chunks/{chunk-2XWUFFEZ.js → chunk-E24BNP6E.js} +1 -1
  57. package/chunks/{chunk-NDCXYF5Q.js → chunk-EOTD7HAV.js} +1 -1
  58. package/chunks/{chunk-TWTUSPPI.js → chunk-ERZ3HYB5.js} +2 -96
  59. package/chunks/{chunk-66POUWQA.js → chunk-G5WWW7VD.js} +3 -3
  60. package/chunks/{chunk-AP2O742I.js → chunk-GOKHFNB2.js} +2 -2
  61. package/chunks/{chunk-RAJM56L7.js → chunk-HIDIW2FN.js} +1 -1
  62. package/chunks/{chunk-LK2ZIDHH.js → chunk-IDGT5RAQ.js} +1 -1
  63. package/chunks/chunk-IPUJEBMI.js +9 -0
  64. package/chunks/{chunk-XG6WXQFN.js → chunk-IPWJEGPD.js} +2 -2
  65. package/chunks/{chunk-UPYLTC2Z.js → chunk-KOLEQNLG.js} +1 -1
  66. package/chunks/{chunk-QHR5X4FO.js → chunk-MGGMCT77.js} +1 -1
  67. package/chunks/{chunk-ZO7KDO3C.js → chunk-PIDLENYN.js} +7192 -6436
  68. package/chunks/{chunk-3CZG44E4.js → chunk-QMERQSPM.js} +2 -2
  69. package/chunks/{chunk-JQJSNCGD.js → chunk-QXOUDBFK.js} +4 -4
  70. package/chunks/{chunk-KYJLZCM3.js → chunk-RRYUCZYO.js} +2 -2
  71. package/chunks/{chunk-7UKLAB2Q.js → chunk-SHRUJFQI.js} +30 -8
  72. package/chunks/{chunk-Z2NUKRKG.js → chunk-T76K7QNX.js} +3 -3
  73. package/chunks/{chunk-OBJCYCIV.js → chunk-TR5U7G7T.js} +2 -1
  74. package/chunks/{chunk-UXCQFVXG.js → chunk-TW2UASEW.js} +2 -2
  75. package/chunks/{chunk-PFUJVZFI.js → chunk-UM3WZUGF.js} +4 -12
  76. package/chunks/{chunk-G7DFH6WK.js → chunk-USVU6AC2.js} +21 -5
  77. package/chunks/chunk-VBHPHAGS.js +114 -0
  78. package/chunks/{chunk-3MKTCEUX.js → chunk-W7P6VTCG.js} +25 -2
  79. package/chunks/{chunk-DDTGQKVB.js → chunk-Y6GKZ2FM.js} +1 -1
  80. package/chunks/{chunk-PFP35UAF.js → chunk-Z6HOHGUJ.js} +18 -1
  81. package/chunks/{create.action-UX5TVHST.js → create.action-52K3XAYN.js} +18 -17
  82. package/chunks/{delete.action-UMVF2N4A.js → delete.action-3NMOQPIR.js} +18 -17
  83. package/chunks/{delete.action-C3ZGIXJX.js → delete.action-47LPLTOX.js} +18 -17
  84. package/chunks/diff.action-5TLC2EHT.js +325 -0
  85. package/chunks/{get.action-KFLT4UUT.js → get.action-BCMLG7C7.js} +22 -27
  86. package/chunks/{get.action-KIEUFN4D.js → get.action-TOZ474GO.js} +17 -16
  87. package/chunks/{list.action-QK5DK5X3.js → list.action-6ZWEENT6.js} +21 -20
  88. package/chunks/{list.action-F3M4XJFC.js → list.action-CMAA5KTY.js} +17 -16
  89. package/chunks/{publish.action-GZ2TSAPE.js → publish.action-U3VIU5LZ.js} +39 -36
  90. package/chunks/{update.action-OTRO76PF.js → update.action-QZOP25ME.js} +18 -17
  91. package/chunks/{update.action-DNINDNBT.js → update.action-UQHZYVTP.js} +19 -18
  92. package/index.js +339 -219
  93. package/package.json +13 -12
  94. package/skills/scalar-cli/SKILL.md +9 -1
  95. package/template.md +72 -7
@@ -0,0 +1,327 @@
1
+ import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ writeJson
4
+ } from "./chunk-SNQFFEYH.js";
5
+ import {
6
+ buildMcpAddressUrl
7
+ } from "./chunk-VBHPHAGS.js";
8
+ import {
9
+ mcpClients
10
+ } from "./chunk-BMQFEKHA.js";
11
+ import "./chunk-ANP5XF26.js";
12
+ import "./chunk-7FS7BAUX.js";
13
+ import "./chunk-Z6HOHGUJ.js";
14
+ import "./chunk-EOTD7HAV.js";
15
+ import "./chunk-USVU6AC2.js";
16
+ import "./chunk-W7P6VTCG.js";
17
+ import "./chunk-5D3T63G4.js";
18
+ import "./chunk-42MIV6WF.js";
19
+ import {
20
+ config
21
+ } from "./chunk-TR5U7G7T.js";
22
+ import "./chunk-DWJMPHLY.js";
23
+ import "./chunk-6BQHLHBE.js";
24
+ import "./chunk-BOCMOHQA.js";
25
+ import {
26
+ cancelOperation,
27
+ confirm,
28
+ requireInteractive
29
+ } from "./chunk-XUX6JXU5.js";
30
+ import "./chunk-IRQJDPZE.js";
31
+ import "./chunk-2KSOARE4.js";
32
+ import {
33
+ output,
34
+ printTable
35
+ } from "./chunk-T5HJUAWB.js";
36
+ import "./chunk-4S3DGMMZ.js";
37
+ import "./chunk-7PNOYE6B.js";
38
+ import "./chunk-Q26DFKTY.js";
39
+ import {
40
+ docVersionSchema,
41
+ external_exports,
42
+ namespaceSchema,
43
+ nanoidSchema,
44
+ slugSchema
45
+ } from "./chunk-I57ID5K7.js";
46
+ import "./chunk-3MZYUBJ6.js";
47
+
48
+ // src/domains/mcp/metadata.ts
49
+ function serverMetadata(server) {
50
+ return {
51
+ id: server.id,
52
+ uid: server.uid,
53
+ name: server.name,
54
+ namespace: server.namespace,
55
+ slug: server.slug,
56
+ url: buildMcpAddressUrl({
57
+ baseUrl: config.mcpUrl,
58
+ namespace: server.namespace,
59
+ slug: server.slug
60
+ })
61
+ };
62
+ }
63
+
64
+ // src/domains/mcp/sources.ts
65
+ var apiReferenceSchema = external_exports.string().transform((value, context) => {
66
+ const match = /^@?([^/]+)\/([^/@]+)(?:@([^/]+))?$/.exec(value);
67
+ const parsed = external_exports.object({
68
+ namespace: namespaceSchema,
69
+ slug: slugSchema,
70
+ version: docVersionSchema.optional()
71
+ }).safeParse({
72
+ namespace: match?.[1],
73
+ slug: match?.[2],
74
+ version: match?.[3]
75
+ });
76
+ if (!parsed.success) {
77
+ context.addIssue({
78
+ code: "custom",
79
+ message: "Use --api namespace/slug or namespace/slug@version."
80
+ });
81
+ return external_exports.NEVER;
82
+ }
83
+ return parsed.data;
84
+ });
85
+ async function resolveApi(reference, { core, agent }) {
86
+ const api = await core.managedDocs.getApiDoc(
87
+ reference.namespace,
88
+ reference.slug
89
+ );
90
+ if (api.error)
91
+ return output.error().title("Could not load API description").message(api.message).exit("error");
92
+ const version = api.data.versions.find(
93
+ (entry) => entry.version === (reference.version ?? api.data.version)
94
+ );
95
+ if (!version)
96
+ return output.error().title("API version not found").message("Check the version or publish it with scalar registry publish.").exit("error");
97
+ const available = await agent.registry.getVersionOperations({
98
+ params: { versionUid: version.uid }
99
+ });
100
+ if (available.error)
101
+ return output.error().title("API version is unavailable for MCP").message(available.message).exit("error");
102
+ if (available.data.embedStatus !== "success")
103
+ return output.error().title("API version is not ready for MCP").message(
104
+ `Embedding status: ${available.data.embedStatus}. Check the API description in Scalar Dashboard before creating the server.`
105
+ ).exit("error");
106
+ return { apiUid: api.data.uid, versionUid: version.uid };
107
+ }
108
+ async function resolveDocsProject(uid, { core, agent }) {
109
+ let cursor;
110
+ const seen = /* @__PURE__ */ new Set();
111
+ while (true) {
112
+ const result = await core.docsProject.listProjects({ limit: 200, cursor });
113
+ if (result.error)
114
+ return output.error().title("Could not load Docs projects").message(result.message).exit("error");
115
+ const project2 = result.data.data.find((entry) => entry.uid === uid);
116
+ if (project2) {
117
+ return checkDocsProject(project2, agent);
118
+ }
119
+ if (!result.data.hasMore) break;
120
+ const next = result.data.nextCursor;
121
+ if (!next || seen.has(next))
122
+ return output.error().title("Could not load all Docs projects").message("The server returned an invalid continuation cursor.").exit("error");
123
+ seen.add(next);
124
+ cursor = next;
125
+ }
126
+ const legacy = await core.github.getProjects();
127
+ if (legacy.error)
128
+ return output.error().title("Could not load Docs projects").message(legacy.message).exit("error");
129
+ const project = legacy.data.find((entry) => entry.uid === uid);
130
+ if (!project)
131
+ return output.error().title("Docs project not found").message(
132
+ "Run scalar project list --json to find a project UID in the current team."
133
+ ).exit("error");
134
+ return checkDocsProject(project, agent);
135
+ }
136
+ async function checkDocsProject(project, agent) {
137
+ if (!project.activeDeployment)
138
+ return output.error().title("Docs project has no active publish").message(
139
+ "Publish the project with scalar project publish before creating its MCP server."
140
+ ).exit("error");
141
+ const available = await agent.docs.getProject({
142
+ params: { projectUid: project.uid }
143
+ });
144
+ if (available.error)
145
+ return output.error().title("Docs project is unavailable for MCP").message(available.message).exit("error");
146
+ return project.uid;
147
+ }
148
+
149
+ // src/domains/mcp/actions.ts
150
+ var nameSchema = external_exports.string().trim().min(1).max(100);
151
+ var identitySchema = external_exports.object({
152
+ name: nameSchema.optional(),
153
+ slug: slugSchema.optional()
154
+ });
155
+ function validate(schema, input) {
156
+ const parsed = schema.safeParse(input);
157
+ if (!parsed.success)
158
+ return output.error().title("Invalid input").message(parsed.error.issues[0]?.message).exit("error");
159
+ return parsed.data;
160
+ }
161
+ function printServer(server, options) {
162
+ if (options.json) {
163
+ writeJson(server);
164
+ return;
165
+ }
166
+ output.info().title(server.name).line(`ID: ${server.id}`).line(`Record UID: ${server.uid}`).line(`Address: ${server.url}`).print();
167
+ }
168
+ async function listAction(options) {
169
+ const { agent } = await mcpClients();
170
+ const result = await agent.mcp.listServers({});
171
+ if (result.error)
172
+ return output.error().title("Could not list MCP servers").message(result.message).exit("error");
173
+ const servers = result.data.map(serverMetadata);
174
+ if (options.json) {
175
+ writeJson(servers);
176
+ return;
177
+ }
178
+ if (!servers.length) {
179
+ output.info().message("No MCP servers found in the current team.").print();
180
+ return;
181
+ }
182
+ printTable(
183
+ [
184
+ { name: "name", title: "Name" },
185
+ { name: "id", title: "Server ID" },
186
+ { name: "url", title: "Address" }
187
+ ],
188
+ servers
189
+ );
190
+ }
191
+ async function getAction(id, options) {
192
+ validate(external_exports.uuid(), id);
193
+ const { agent } = await mcpClients();
194
+ const result = await agent.mcp.getServer({ params: { id } });
195
+ if (result.error)
196
+ return output.error().title("Could not load MCP server").message(result.message).exit("error");
197
+ const installations = await agent.mcp.listInstallations({ params: { id } });
198
+ if (installations.error)
199
+ return output.error().title("Could not load MCP environments").message(installations.message).exit("error");
200
+ const server = serverMetadata(result.data);
201
+ const environments = installations.data.map((entry) => ({
202
+ name: entry.slug,
203
+ version: entry.mcpVersion,
204
+ isPrivate: entry.isPrivate,
205
+ url: buildMcpAddressUrl({
206
+ baseUrl: config.mcpUrl,
207
+ namespace: server.namespace,
208
+ slug: server.slug,
209
+ environment: entry.slug
210
+ })
211
+ }));
212
+ if (options.json) {
213
+ writeJson({ ...server, environments });
214
+ return;
215
+ }
216
+ printServer(server, options);
217
+ for (const environment of environments)
218
+ output.info().line(
219
+ `${environment.name}: ${environment.version ?? "No served version"} (${environment.url})`
220
+ ).print();
221
+ }
222
+ async function createAction(options) {
223
+ const input = validate(
224
+ identitySchema.extend({
225
+ name: nameSchema,
226
+ api: apiReferenceSchema.optional(),
227
+ project: nanoidSchema.optional()
228
+ }).refine(
229
+ (value) => Boolean(value.api) !== Boolean(value.project),
230
+ "Provide exactly one of --api or --project."
231
+ ),
232
+ options
233
+ );
234
+ const clients = await mcpClients();
235
+ const source = input.api ? await resolveApi(input.api, clients) : void 0;
236
+ const projectUid = input.project ? await resolveDocsProject(input.project, clients) : void 0;
237
+ const result = await clients.core.mcpServers.create({
238
+ name: input.name,
239
+ slug: input.slug,
240
+ ...source && {
241
+ apiUids: [source.apiUid],
242
+ versionUids: [source.versionUid],
243
+ documentTracking: [
244
+ { versionUid: source.versionUid, trackMode: "pinned" }
245
+ ]
246
+ },
247
+ ...projectUid && {
248
+ projectUids: [projectUid],
249
+ docsProjectTracking: [
250
+ { projectUid, trackMode: "track-active-publish" }
251
+ ]
252
+ },
253
+ defaultHeaders: true
254
+ }).catch(() => null);
255
+ if (!result || result.error)
256
+ return output.error().title("Could not confirm MCP server creation").message(
257
+ `${result?.message ?? "The request did not return a usable response."} Run scalar mcp list before repeating the create command; the server may already exist.`
258
+ ).exit("error");
259
+ const server = serverMetadata(result.data.server);
260
+ const linked = source ? await clients.agent.mcp.listDocumentVersions({ params: { id: server.id } }).then(
261
+ (response) => !response.error && response.data.some((version) => version.uid === source.versionUid)
262
+ ).catch(() => false) : await clients.agent.mcp.listServerPublishes({ params: { id: server.id } }).then(
263
+ (response) => !response.error && response.data.some((publish) => publish.projectUid === projectUid)
264
+ ).catch(() => false);
265
+ if (!linked)
266
+ return output.error().title("MCP server created, but its source link could not be confirmed").message(
267
+ `Server ID: ${server.id}. Check the source in Scalar Dashboard. Run scalar mcp get ${server.id} to inspect the server or scalar mcp delete ${server.id} --yes to remove it before creating another.`
268
+ ).exit("error");
269
+ if (options.json) {
270
+ writeJson({ ...server, status: "created" });
271
+ return;
272
+ }
273
+ printServer(server, options);
274
+ output.info().message(
275
+ `MCP server created. Run scalar mcp get ${server.id} to inspect its served versions; endpoint readiness has not been checked.`
276
+ ).print();
277
+ }
278
+ async function updateAction(id, options) {
279
+ validate(external_exports.uuid(), id);
280
+ const input = validate(
281
+ identitySchema.refine(
282
+ (value) => value.name !== void 0 || value.slug !== void 0,
283
+ "Provide --name or --slug."
284
+ ),
285
+ options
286
+ );
287
+ const { core, agent } = await mcpClients();
288
+ const server = await agent.mcp.getServer({ params: { id } });
289
+ if (server.error)
290
+ return output.error().title("Could not load MCP server").message(server.message).exit("error");
291
+ const result = await core.mcpServers.update(server.data.uid, input);
292
+ if (result.error)
293
+ return output.error().title("Could not update MCP server").message(result.message).exit("error");
294
+ printServer(serverMetadata(result.data), options);
295
+ }
296
+ async function deleteAction(id, options) {
297
+ validate(external_exports.uuid(), id);
298
+ if (!options.yes)
299
+ requireInteractive(
300
+ "Pass --yes to confirm deletion of this MCP server.",
301
+ options.json
302
+ );
303
+ const { core, agent } = await mcpClients();
304
+ const server = await agent.mcp.getServer({ params: { id } });
305
+ if (server.error)
306
+ return output.error().title("Could not load MCP server").message(server.message).exit("error");
307
+ if (!options.yes && !await confirm({
308
+ message: `Delete MCP server "${server.data.name}" (${id}) and stop its endpoints?`,
309
+ initialValue: false
310
+ }))
311
+ return cancelOperation();
312
+ const result = await core.mcpServers.delete(server.data.uid);
313
+ if (result.error)
314
+ return output.error().title("Could not delete MCP server").message(result.message).exit("error");
315
+ if (options.json) {
316
+ writeJson({ id, uid: server.data.uid, deleted: true });
317
+ return;
318
+ }
319
+ output.info().message(`MCP server "${server.data.name}" deleted.`).print();
320
+ }
321
+ export {
322
+ createAction,
323
+ deleteAction,
324
+ getAction,
325
+ listAction,
326
+ updateAction
327
+ };
@@ -1,39 +1,41 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  apiService
4
- } from "./chunk-I2JLVALT.js";
5
- import "./chunk-KVK4LNTB.js";
4
+ } from "./chunk-BMQFEKHA.js";
5
+ import "./chunk-ANP5XF26.js";
6
6
  import {
7
7
  accessGroupDomains,
8
8
  accessGroupNameSchema,
9
9
  emailDomainSchema
10
- } from "./chunk-NEB25B57.js";
11
- import "./chunk-PFP35UAF.js";
12
- import "./chunk-NDCXYF5Q.js";
13
- import "./chunk-G7DFH6WK.js";
14
- import "./chunk-3MKTCEUX.js";
15
- import "./chunk-KAKAN5X3.js";
10
+ } from "./chunk-7FS7BAUX.js";
11
+ import "./chunk-Z6HOHGUJ.js";
12
+ import "./chunk-EOTD7HAV.js";
13
+ import "./chunk-USVU6AC2.js";
14
+ import "./chunk-W7P6VTCG.js";
15
+ import "./chunk-5D3T63G4.js";
16
+ import "./chunk-42MIV6WF.js";
16
17
  import {
17
18
  config
18
- } from "./chunk-OBJCYCIV.js";
19
- import "./chunk-VMRXSVEE.js";
20
- import "./chunk-DRXJRWZA.js";
21
- import "./chunk-4T5XUXTP.js";
19
+ } from "./chunk-TR5U7G7T.js";
20
+ import "./chunk-DWJMPHLY.js";
21
+ import "./chunk-6BQHLHBE.js";
22
+ import "./chunk-BOCMOHQA.js";
22
23
  import {
23
24
  canPrompt,
24
25
  cancelOperation,
25
26
  confirm
26
27
  } from "./chunk-XUX6JXU5.js";
27
28
  import "./chunk-IRQJDPZE.js";
28
- import "./chunk-ORHGCCJR.js";
29
+ import "./chunk-2KSOARE4.js";
29
30
  import {
30
31
  output,
31
32
  printTable
32
33
  } from "./chunk-T5HJUAWB.js";
33
- import "./chunk-5ENKYZA4.js";
34
- import "./chunk-JA7EIRUB.js";
34
+ import "./chunk-4S3DGMMZ.js";
35
+ import "./chunk-7PNOYE6B.js";
35
36
  import "./chunk-Q26DFKTY.js";
36
37
  import {
38
+ emailSchema,
37
39
  external_exports,
38
40
  slugSchema
39
41
  } from "./chunk-I57ID5K7.js";
@@ -73,6 +75,16 @@ var argsSchema = external_exports.discriminatedUnion("operation", [
73
75
  ...common,
74
76
  operation: external_exports.literal("remove-domain"),
75
77
  domain: emailDomainSchema
78
+ }),
79
+ external_exports.object({
80
+ ...common,
81
+ operation: external_exports.literal("add-email"),
82
+ email: emailSchema
83
+ }),
84
+ external_exports.object({
85
+ ...common,
86
+ operation: external_exports.literal("remove-email"),
87
+ email: emailSchema
76
88
  })
77
89
  ]);
78
90
  async function runAction(input) {
@@ -150,6 +162,10 @@ async function runAction(input) {
150
162
  });
151
163
  case "delete":
152
164
  return client.accessGroups.delete(group.data.uid);
165
+ case "add-email":
166
+ return client.accessGroups.addEmail(group.data.uid, args.email);
167
+ case "remove-email":
168
+ return client.accessGroups.removeEmail(group.data.uid, args.email);
153
169
  case "add-domain":
154
170
  return client.accessGroups.addDomain(group.data.uid, args.domain);
155
171
  case "remove-domain":
@@ -161,6 +177,8 @@ async function runAction(input) {
161
177
  {
162
178
  update: "Could not update access group",
163
179
  delete: "Could not delete access group",
180
+ "add-email": "Could not add email",
181
+ "remove-email": "Could not remove email",
164
182
  "add-domain": "Could not add domain",
165
183
  "remove-domain": "Could not remove domain"
166
184
  }[args.operation]
@@ -174,6 +192,10 @@ async function runAction(input) {
174
192
  return `Updated access group "${args.newSlug ?? args.slug}".`;
175
193
  case "delete":
176
194
  return `Deleted access group "${args.slug}".`;
195
+ case "add-email":
196
+ return `Added email "${args.email}" to access group "${args.slug}".`;
197
+ case "remove-email":
198
+ return `Removed email "${args.email}" from access group "${args.slug}".`;
177
199
  case "add-domain":
178
200
  return `Added domain "${args.domain}" to access group "${args.slug}".`;
179
201
  case "remove-domain":
@@ -78,13 +78,13 @@ import {
78
78
  usageRecordSchema,
79
79
  usageRoutes,
80
80
  versionLabelParamSchema
81
- } from "./chunk-G7DFH6WK.js";
82
- import "./chunk-3MKTCEUX.js";
83
- import "./chunk-DRXJRWZA.js";
84
- import "./chunk-4T5XUXTP.js";
81
+ } from "./chunk-USVU6AC2.js";
82
+ import "./chunk-W7P6VTCG.js";
83
+ import "./chunk-6BQHLHBE.js";
84
+ import "./chunk-BOCMOHQA.js";
85
85
  import {
86
86
  createdMcpServerSchema
87
- } from "./chunk-JA7EIRUB.js";
87
+ } from "./chunk-7PNOYE6B.js";
88
88
  import "./chunk-Q26DFKTY.js";
89
89
  import "./chunk-I57ID5K7.js";
90
90
  import "./chunk-3MZYUBJ6.js";
@@ -2,40 +2,42 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
2
2
  import {
3
3
  createServerSession
4
4
  } from "./chunk-2I6V7AI3.js";
5
- import {
6
- isDocument
7
- } from "./chunk-KYJLZCM3.js";
8
- import {
9
- isAsyncApiDocument
10
- } from "./chunk-PFUJVZFI.js";
11
- import "./chunk-2XWUFFEZ.js";
12
5
  import {
13
6
  watchFile
14
7
  } from "./chunk-RE5Z56QD.js";
15
8
  import "./chunk-VUXPDHTQ.js";
16
- import "./chunk-KAKAN5X3.js";
17
- import "./chunk-OBJCYCIV.js";
18
- import "./chunk-VMRXSVEE.js";
19
- import "./chunk-DRXJRWZA.js";
20
- import "./chunk-4T5XUXTP.js";
9
+ import "./chunk-42MIV6WF.js";
10
+ import "./chunk-TR5U7G7T.js";
11
+ import "./chunk-DWJMPHLY.js";
12
+ import "./chunk-6BQHLHBE.js";
13
+ import "./chunk-BOCMOHQA.js";
14
+ import {
15
+ isDocument
16
+ } from "./chunk-RRYUCZYO.js";
17
+ import {
18
+ isAsyncApiDocument
19
+ } from "./chunk-UM3WZUGF.js";
20
+ import "./chunk-BY4NGQ5D.js";
21
+ import "./chunk-E24BNP6E.js";
21
22
  import "./chunk-4ORL4MST.js";
22
- import "./chunk-ORHGCCJR.js";
23
+ import "./chunk-2KSOARE4.js";
23
24
  import {
24
25
  output
25
26
  } from "./chunk-T5HJUAWB.js";
26
- import "./chunk-5ENKYZA4.js";
27
- import "./chunk-JA7EIRUB.js";
27
+ import "./chunk-4S3DGMMZ.js";
28
+ import "./chunk-7PNOYE6B.js";
28
29
  import "./chunk-Q26DFKTY.js";
29
30
  import "./chunk-I57ID5K7.js";
30
31
  import "./chunk-3MZYUBJ6.js";
31
32
 
32
33
  // src/domains/document/mock/asyncapi.ts
33
- import { serve } from "@hono/node-server";
34
+ import { serve, upgradeWebSocket } from "@hono/node-server";
35
+ import { WebSocketServer } from "ws";
34
36
  import { upgrade } from "@scalar/asyncapi-upgrader";
35
37
  import { validate } from "@scalar/asyncapi-validator";
36
38
  import { bundle } from "@scalar/json-magic/bundle";
37
39
  import { fetchUrls, readFiles } from "@scalar/json-magic/bundle/plugins/node";
38
- import { createAsyncApiMockServer } from "@scalar/mock-server";
40
+ import { createMockServer } from "@scalar/mock-server";
39
41
  var loadAsyncApiMockDocument = async (input) => {
40
42
  const document = await bundle(input, {
41
43
  plugins: [readFiles(), fetchUrls()],
@@ -59,19 +61,22 @@ var mockAsyncApi = async (input, options) => {
59
61
  if (!document) return;
60
62
  const session = createServerSession();
61
63
  const start = async (nextDocument) => {
62
- const { app, websocket } = await createAsyncApiMockServer({
64
+ const app = await createMockServer({
65
+ upgradeWebSocket,
63
66
  document: nextDocument,
64
67
  logger: (line) => output.info().line(line).print(),
65
68
  onMessage: ({ channel, direction }) => {
66
69
  output.info().line(`${direction} ${channel}`).print();
67
70
  }
68
71
  });
72
+ const websocket = { server: new WebSocketServer({ noServer: true }) };
69
73
  const server = serve(
70
74
  { fetch: app.fetch, port: options.port ?? 3e3, websocket },
71
75
  ({ port }) => {
72
76
  output.info().line(`AsyncAPI Mock Server listening on http://localhost:${port}`).print();
73
77
  }
74
78
  );
79
+ server.once("close", () => websocket.server.close());
75
80
  return server;
76
81
  };
77
82
  try {
@@ -4,44 +4,45 @@ import {
4
4
  } from "./chunk-SNQFFEYH.js";
5
5
  import {
6
6
  BaseCollections
7
- } from "./chunk-7UKLAB2Q.js";
7
+ } from "./chunk-SHRUJFQI.js";
8
8
  import {
9
9
  getDatabaseClient
10
- } from "./chunk-AP2O742I.js";
10
+ } from "./chunk-GOKHFNB2.js";
11
11
  import {
12
12
  apiService
13
- } from "./chunk-I2JLVALT.js";
14
- import "./chunk-KVK4LNTB.js";
15
- import "./chunk-NEB25B57.js";
16
- import "./chunk-PFP35UAF.js";
13
+ } from "./chunk-BMQFEKHA.js";
14
+ import "./chunk-ANP5XF26.js";
15
+ import "./chunk-7FS7BAUX.js";
16
+ import "./chunk-Z6HOHGUJ.js";
17
17
  import {
18
18
  sdkSchema
19
- } from "./chunk-NDCXYF5Q.js";
20
- import "./chunk-G7DFH6WK.js";
21
- import "./chunk-3MKTCEUX.js";
19
+ } from "./chunk-EOTD7HAV.js";
20
+ import "./chunk-USVU6AC2.js";
21
+ import "./chunk-W7P6VTCG.js";
22
+ import "./chunk-5D3T63G4.js";
22
23
  import "./chunk-RE5Z56QD.js";
23
24
  import "./chunk-VUXPDHTQ.js";
24
25
  import {
25
26
  getAuthData
26
- } from "./chunk-KAKAN5X3.js";
27
- import "./chunk-OBJCYCIV.js";
28
- import "./chunk-VMRXSVEE.js";
27
+ } from "./chunk-42MIV6WF.js";
28
+ import "./chunk-TR5U7G7T.js";
29
+ import "./chunk-DWJMPHLY.js";
29
30
  import {
30
31
  teamSchema
31
- } from "./chunk-DRXJRWZA.js";
32
- import "./chunk-4T5XUXTP.js";
32
+ } from "./chunk-6BQHLHBE.js";
33
+ import "./chunk-BOCMOHQA.js";
33
34
  import {
34
35
  canPrompt,
35
36
  select
36
37
  } from "./chunk-XUX6JXU5.js";
37
38
  import "./chunk-IRQJDPZE.js";
38
39
  import "./chunk-4ORL4MST.js";
39
- import "./chunk-ORHGCCJR.js";
40
+ import "./chunk-2KSOARE4.js";
40
41
  import {
41
42
  output
42
43
  } from "./chunk-T5HJUAWB.js";
43
- import "./chunk-5ENKYZA4.js";
44
- import "./chunk-JA7EIRUB.js";
44
+ import "./chunk-4S3DGMMZ.js";
45
+ import "./chunk-7PNOYE6B.js";
45
46
  import "./chunk-Q26DFKTY.js";
46
47
  import {
47
48
  external_exports,
@@ -2,7 +2,7 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
2
2
  import {
3
3
  baseRegistrySchema,
4
4
  docVersionToolSchema
5
- } from "./chunk-JA7EIRUB.js";
5
+ } from "./chunk-7PNOYE6B.js";
6
6
  import {
7
7
  brandedUid,
8
8
  docVersionSchema,
@@ -136,7 +136,7 @@ var managedDocSchema = baseRegistrySchema.extend({
136
136
  verified: external_exports.boolean().default(false)
137
137
  }).meta({ id: "managed-doc" });
138
138
 
139
- // ../../node_modules/.pnpm/@scalar+helpers@0.16.1/node_modules/@scalar/helpers/dist/http/http-methods.js
139
+ // ../../node_modules/.pnpm/@scalar+helpers@0.16.4/node_modules/@scalar/helpers/dist/http/http-methods.js
140
140
  var HTTP_METHODS = ["delete", "get", "head", "options", "patch", "post", "put", "query", "trace"];
141
141
  var httpMethods = Object.freeze(new Set(HTTP_METHODS));
142
142
 
@@ -1,10 +1,10 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  config
4
- } from "./chunk-OBJCYCIV.js";
4
+ } from "./chunk-TR5U7G7T.js";
5
5
  import {
6
6
  roleSchema
7
- } from "./chunk-DRXJRWZA.js";
7
+ } from "./chunk-6BQHLHBE.js";
8
8
  import {
9
9
  output
10
10
  } from "./chunk-T5HJUAWB.js";
@@ -1,6 +1,6 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
 
3
- // ../../node_modules/.pnpm/@scalar+helpers@0.16.1/node_modules/@scalar/helpers/dist/types/result.js
3
+ // ../../node_modules/.pnpm/@scalar+helpers@0.16.4/node_modules/@scalar/helpers/dist/types/result.js
4
4
  var ok = (data) => ({ ok: true, data });
5
5
  var err = (error, message) => ({
6
6
  ok: false,
@@ -0,0 +1,14 @@
1
+ import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+
3
+ // ../../node_modules/.pnpm/@scalar+helpers@0.16.4/node_modules/@scalar/helpers/dist/object/is-object.js
4
+ var isObject = (value) => {
5
+ if (value === null || typeof value !== "object") {
6
+ return false;
7
+ }
8
+ const proto = Object.getPrototypeOf(value);
9
+ return proto === Object.prototype || proto === null;
10
+ };
11
+
12
+ export {
13
+ isObject
14
+ };
@@ -1,7 +1,7 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  customProjectIconSchema
4
- } from "./chunk-4T5XUXTP.js";
4
+ } from "./chunk-BOCMOHQA.js";
5
5
  import {
6
6
  MAX_TEAM_ENVIRONMENTS,
7
7
  defaultTeamEnvironments,
@@ -677,7 +677,9 @@ var usageBillingReportSchema = zod_default.object({
677
677
  billingMode: zod_default.string().nullable(),
678
678
  hadUsageItem: zod_default.boolean(),
679
679
  /** Intervals of the subscription's items, e.g. ['year', 'month'], to spot unusual contracts. */
680
- intervals: zod_default.array(zod_default.string())
680
+ intervals: zod_default.array(zod_default.string()),
681
+ /** 1 when the billing subscription, created before `baselinesBefore`, had no agent credit baseline: written on apply, only counted on a dry run. */
682
+ baselines: zod_default.number().int().min(0)
681
683
  }).meta({ id: "usage-billing-report" });
682
684
 
683
685
  export {