@scalar/cli 2.15.0 → 2.18.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 (112) hide show
  1. package/README.md +121 -25
  2. package/chunks/{action-3W4IC7QL.js → action-2WVJ2WEW.js} +26 -27
  3. package/chunks/{action-HOCCP353.js → action-4BDZ2CXP.js} +12 -13
  4. package/chunks/{action-3QQSKGM3.js → action-5AXDB5VN.js} +21 -23
  5. package/chunks/{action-LD5B5QQ4.js → action-6I3TJLRO.js} +34 -33
  6. package/chunks/{action-T7SD3ETN.js → action-6WZN63LT.js} +299 -75
  7. package/chunks/{action-IUAYC2SC.js → action-7GZGVTYI.js} +1071 -775
  8. package/chunks/{action-2BGAMGXU.js → action-7ZCJAWI2.js} +9 -9
  9. package/chunks/{action-6HFH7DAW.js → action-A6YOY24G.js} +14 -10
  10. package/chunks/{action-IU2AVNOW.js → action-AGGHY4N2.js} +26 -26
  11. package/chunks/{action-B2WWTOF6.js → action-BVZOA2G5.js} +15 -16
  12. package/chunks/{action-2UZWKMSJ.js → action-BYDJ4R4F.js} +18 -19
  13. package/chunks/{action-HDT7EO7W.js → action-CBAL5CYB.js} +19 -21
  14. package/chunks/action-COFGCCYS.js +89 -0
  15. package/chunks/action-CYU5Q5LT.js +254 -0
  16. package/chunks/{action-MJHLG7AE.js → action-DTQH6CKR.js} +33 -33
  17. package/chunks/{action-P2RPH5R2.js → action-ED5WLLIE.js} +11 -12
  18. package/chunks/action-F4CQ4DW3.js +654 -0
  19. package/chunks/{action-SRFBOLDL.js → action-GQDQU2WE.js} +1 -1
  20. package/chunks/{action-PDSSIW2A.js → action-GVW5PSPT.js} +26 -28
  21. package/chunks/{action-WOLNPEUQ.js → action-H5VRLFCY.js} +16 -12
  22. package/chunks/{action-G2WBTXOK.js → action-IWEAWDT3.js} +19 -19
  23. package/chunks/{action-NZJ4Z64U.js → action-JN6JVQUV.js} +16 -18
  24. package/chunks/{action-PNSWHIHC.js → action-KVM76ZKQ.js} +20 -20
  25. package/chunks/{action-JNH4DCZX.js → action-LLMFEBHH.js} +3 -4
  26. package/chunks/{action-QJMRAFOF.js → action-PEG7AUA6.js} +20 -19
  27. package/chunks/{action-2HPMP473.js → action-QC72LLYE.js} +13 -11
  28. package/chunks/{action-ZTLOQZTT.js → action-QP6MRSQW.js} +16 -15
  29. package/chunks/{action-4HXB3YQR.js → action-R53K22GE.js} +230 -52
  30. package/chunks/{action-U2RJ3ZAU.js → action-SJPWL723.js} +6 -5
  31. package/chunks/{action-57SV3ZBM.js → action-T3R4SDAI.js} +9 -9
  32. package/chunks/{action-777R7LOG.js → action-TT7ZJNST.js} +25 -25
  33. package/chunks/{action-TY4BZEMN.js → action-UPVVJE26.js} +18 -19
  34. package/chunks/{action-MBAAYXKK.js → action-V35W4MRK.js} +18 -19
  35. package/chunks/{action-TR2T2UYB.js → action-W4KGRBRV.js} +9 -9
  36. package/chunks/{action-ENDUKGWS.js → action-ZIVYJCC2.js} +16 -18
  37. package/chunks/{action-7LK4RUDP.js → action-ZU5X2KQX.js} +52 -49
  38. package/chunks/{actions-D5OHPBWC.js → actions-CERT7BL4.js} +25 -26
  39. package/chunks/{actions-RI42JY6H.js → actions-RCIS37Y6.js} +22 -24
  40. package/chunks/{agent-NA3QFKJX.js → agent-CT3RRYPJ.js} +7 -7
  41. package/chunks/{asyncapi-YBTWMTW6.js → asyncapi-DVBS23QW.js} +17 -18
  42. package/chunks/{build.action-4YDNDBXC.js → build.action-7MKMMV6V.js} +38 -32
  43. package/chunks/{chunk-MGGMCT77.js → chunk-36UI2W7I.js} +1 -1
  44. package/chunks/chunk-4BMOCIYO.js +536 -0
  45. package/chunks/{chunk-ADQ6B6QI.js → chunk-5DRLDTTU.js} +1 -1
  46. package/chunks/{chunk-G5WWW7VD.js → chunk-5EO2CVAR.js} +6 -6
  47. package/chunks/{chunk-Q26DFKTY.js → chunk-5GZAGHKL.js} +1 -1
  48. package/chunks/{chunk-DWJMPHLY.js → chunk-7LUXRNKV.js} +27 -2
  49. package/chunks/{chunk-BY4NGQ5D.js → chunk-A2MPF6GE.js} +7 -3
  50. package/chunks/{chunk-5D3T63G4.js → chunk-BIQFYZP6.js} +1 -1
  51. package/chunks/chunk-CNJ4TLU7.js +83 -0
  52. package/chunks/{chunk-UM3WZUGF.js → chunk-CWCRBWA6.js} +7 -3
  53. package/chunks/{chunk-Z6HOHGUJ.js → chunk-CYIGEQOJ.js} +2 -2
  54. package/chunks/{chunk-4S3DGMMZ.js → chunk-DUIMDHQQ.js} +1 -1
  55. package/chunks/{chunk-W7P6VTCG.js → chunk-DVA4NCCY.js} +6 -4
  56. package/chunks/chunk-DWWY3LPC.js +85 -0
  57. package/chunks/{chunk-USVU6AC2.js → chunk-F6E7FJEC.js} +18 -12
  58. package/chunks/{chunk-E24BNP6E.js → chunk-FDW4LC45.js} +1 -1
  59. package/chunks/{chunk-TW2UASEW.js → chunk-FMPJSW6A.js} +4 -4
  60. package/chunks/{chunk-IPWJEGPD.js → chunk-GCVB22TG.js} +2 -2
  61. package/chunks/{chunk-6BQHLHBE.js → chunk-GXKNYM54.js} +3 -3
  62. package/chunks/chunk-I25ZCHBJ.js +22 -0
  63. package/chunks/{chunk-I57ID5K7.js → chunk-JBMHCTZD.js} +8 -1
  64. package/chunks/{chunk-KOLEQNLG.js → chunk-JEOQ7LSA.js} +1 -1
  65. package/chunks/{chunk-QMERQSPM.js → chunk-KI2AVDKM.js} +8 -6
  66. package/chunks/{chunk-2KSOARE4.js → chunk-KSY2GH53.js} +3 -3
  67. package/chunks/{chunk-SHRUJFQI.js → chunk-KWQVA66H.js} +105 -18
  68. package/chunks/{chunk-DLYMDGFW.js → chunk-LPWRG2MS.js} +4 -4
  69. package/chunks/{chunk-Y6GKZ2FM.js → chunk-LVUMNGVA.js} +1 -1
  70. package/chunks/{chunk-PIDLENYN.js → chunk-M34HMQMV.js} +42 -83
  71. package/chunks/{chunk-7FS7BAUX.js → chunk-MRZ5A7LB.js} +133 -19
  72. package/chunks/chunk-O3I3LTTJ.js +24 -0
  73. package/chunks/{chunk-VBHPHAGS.js → chunk-O4DJIA6Y.js} +2 -18
  74. package/chunks/chunk-OKLL5422.js +263 -0
  75. package/chunks/{chunk-HIDIW2FN.js → chunk-OQE3WKI3.js} +1 -1
  76. package/chunks/{chunk-ERZ3HYB5.js → chunk-PMDHYIB4.js} +9 -21
  77. package/chunks/{chunk-IDGT5RAQ.js → chunk-RELSIFIL.js} +2 -2
  78. package/chunks/{chunk-BOCMOHQA.js → chunk-RGJPENX7.js} +1 -1
  79. package/chunks/{chunk-7FGJIUDN.js → chunk-RHAQ4XBA.js} +3 -3
  80. package/chunks/chunk-RQ7QBRJT.js +93 -0
  81. package/chunks/chunk-S3LY7RKP.js +54 -0
  82. package/chunks/{chunk-T76K7QNX.js → chunk-S5OGPH2P.js} +3 -3
  83. package/chunks/{chunk-ANP5XF26.js → chunk-U36HEOGO.js} +12625 -1369
  84. package/chunks/{chunk-IPUJEBMI.js → chunk-UWRJCJVG.js} +1 -1
  85. package/chunks/chunk-V7DBDXSJ.js +24 -0
  86. package/chunks/{chunk-RRYUCZYO.js → chunk-WGTZEX4Y.js} +7 -3
  87. package/chunks/{chunk-7PNOYE6B.js → chunk-Y3CXAIAG.js} +30 -3
  88. package/chunks/{chunk-GOKHFNB2.js → chunk-Z7EH7CJC.js} +3 -3
  89. package/chunks/{chunk-42MIV6WF.js → chunk-ZMJW5UWU.js} +6 -5
  90. package/chunks/chunk-ZQDAPKWX.js +111 -0
  91. package/chunks/{create.action-52K3XAYN.js → create.action-VA2ISPIM.js} +27 -29
  92. package/chunks/{delete.action-47LPLTOX.js → delete.action-AIWMDGXV.js} +26 -28
  93. package/chunks/{delete.action-3NMOQPIR.js → delete.action-GEN6OD7A.js} +26 -28
  94. package/chunks/{diff.action-5TLC2EHT.js → diff.action-LBK656RN.js} +32 -27
  95. package/chunks/{get.action-BCMLG7C7.js → get.action-5SWRNQ3D.js} +20 -19
  96. package/chunks/{get.action-TOZ474GO.js → get.action-UPPPGGI4.js} +29 -23
  97. package/chunks/{list.action-6ZWEENT6.js → list.action-YJZBC25S.js} +26 -28
  98. package/chunks/{list.action-CMAA5KTY.js → list.action-YOWWC4I4.js} +54 -25
  99. package/chunks/{publish.action-U3VIU5LZ.js → publish.action-QMVDHDJZ.js} +52 -49
  100. package/chunks/{update.action-UQHZYVTP.js → update.action-GFDZIGEP.js} +27 -29
  101. package/chunks/{update.action-QZOP25ME.js → update.action-SNGKPS7A.js} +26 -28
  102. package/index.js +688 -212
  103. package/package.json +11 -11
  104. package/skills/scalar-cli/SKILL.md +4 -3
  105. package/template.md +120 -24
  106. package/chunks/action-3KP3WVPZ.js +0 -112
  107. package/chunks/action-APBLB3IU.js +0 -235
  108. package/chunks/chunk-BLY2CF4S.js +0 -58
  109. package/chunks/chunk-BMQFEKHA.js +0 -3534
  110. package/chunks/chunk-EOTD7HAV.js +0 -318
  111. package/chunks/chunk-QXOUDBFK.js +0 -92
  112. package/chunks/chunk-TR5U7G7T.js +0 -32
package/index.js CHANGED
@@ -2,27 +2,45 @@
2
2
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
3
3
  import {
4
4
  DownloadIsolateCommand
5
- } from "./chunks/chunk-Y6GKZ2FM.js";
5
+ } from "./chunks/chunk-LVUMNGVA.js";
6
6
  import {
7
- openBrowser
8
- } from "./chunks/chunk-HIDIW2FN.js";
7
+ completeFiles
8
+ } from "./chunks/chunk-DFOZG7ZV.js";
9
9
  import {
10
10
  buildCliContext,
11
11
  runnableCommands
12
- } from "./chunks/chunk-ADQ6B6QI.js";
12
+ } from "./chunks/chunk-5DRLDTTU.js";
13
+ import {
14
+ measureTime
15
+ } from "./chunks/chunk-KHDYYVYF.js";
16
+ import {
17
+ openBrowser
18
+ } from "./chunks/chunk-OQE3WKI3.js";
19
+ import {
20
+ DEFAULT_FETCH_CONCURRENCY,
21
+ parseExitCode,
22
+ parseFetchLimit,
23
+ parsePort
24
+ } from "./chunks/chunk-V7DBDXSJ.js";
13
25
  import {
14
26
  normalizeVisibility
15
- } from "./chunks/chunk-IDGT5RAQ.js";
27
+ } from "./chunks/chunk-RELSIFIL.js";
16
28
  import {
17
29
  DOCUMENT_FORMATS,
18
30
  PRIVACY_VALUES
19
31
  } from "./chunks/chunk-NAC63XJF.js";
20
32
  import {
21
- measureTime
22
- } from "./chunks/chunk-KHDYYVYF.js";
33
+ requireInteractive,
34
+ text
35
+ } from "./chunks/chunk-XUX6JXU5.js";
36
+ import {
37
+ InputPolicyCommand,
38
+ configureInputPolicy,
39
+ isInputDisabled
40
+ } from "./chunks/chunk-IRQJDPZE.js";
23
41
  import {
24
42
  SdkLanguage
25
- } from "./chunks/chunk-EOTD7HAV.js";
43
+ } from "./chunks/chunk-4BMOCIYO.js";
26
44
  import {
27
45
  checkNodeVersion
28
46
  } from "./chunks/chunk-VUXPDHTQ.js";
@@ -30,45 +48,26 @@ import {
30
48
  getMetadata,
31
49
  logout,
32
50
  setMetadata
33
- } from "./chunks/chunk-42MIV6WF.js";
34
- import "./chunks/chunk-TR5U7G7T.js";
51
+ } from "./chunks/chunk-ZMJW5UWU.js";
35
52
  import {
36
53
  bin,
37
54
  name,
38
55
  version
39
- } from "./chunks/chunk-DWJMPHLY.js";
40
- import "./chunks/chunk-6BQHLHBE.js";
41
- import "./chunks/chunk-BOCMOHQA.js";
42
- import {
43
- BundleCommand,
44
- parseExitCode,
45
- parseFetchLimit,
46
- parsePort
47
- } from "./chunks/chunk-BLY2CF4S.js";
48
- import {
49
- completeFiles
50
- } from "./chunks/chunk-DFOZG7ZV.js";
51
- import {
52
- requireInteractive,
53
- text
54
- } from "./chunks/chunk-XUX6JXU5.js";
55
- import {
56
- InputPolicyCommand,
57
- configureInputPolicy,
58
- isInputDisabled
59
- } from "./chunks/chunk-IRQJDPZE.js";
56
+ } from "./chunks/chunk-7LUXRNKV.js";
60
57
  import {
61
58
  output
62
59
  } from "./chunks/chunk-T5HJUAWB.js";
63
60
  import {
64
61
  err,
65
62
  ok
66
- } from "./chunks/chunk-4S3DGMMZ.js";
67
- import "./chunks/chunk-7PNOYE6B.js";
68
- import "./chunks/chunk-Q26DFKTY.js";
63
+ } from "./chunks/chunk-DUIMDHQQ.js";
64
+ import "./chunks/chunk-Y3CXAIAG.js";
65
+ import "./chunks/chunk-GXKNYM54.js";
66
+ import "./chunks/chunk-RGJPENX7.js";
67
+ import "./chunks/chunk-5GZAGHKL.js";
69
68
  import {
70
69
  external_exports
71
- } from "./chunks/chunk-I57ID5K7.js";
70
+ } from "./chunks/chunk-JBMHCTZD.js";
72
71
  import "./chunks/chunk-3MZYUBJ6.js";
73
72
 
74
73
  // src/index.ts
@@ -86,7 +85,7 @@ var DeleteSchemaCommand = () => {
86
85
  cmd3.option("-s, --slug <slug>", "Schema slug");
87
86
  cmd3.option("-n, --namespace <namespace>", "Team namespace");
88
87
  cmd3.action(async (...args) => {
89
- const { deleteAction } = await import("./chunks/delete.action-47LPLTOX.js");
88
+ const { deleteAction } = await import("./chunks/delete.action-AIWMDGXV.js");
90
89
  return deleteAction(...args);
91
90
  });
92
91
  return cmd3;
@@ -143,7 +142,7 @@ var DiffSchemaCommand = () => {
143
142
  );
144
143
  completeFiles(cmd3, ["from", "to"], []);
145
144
  cmd3.action(async (...args) => {
146
- const { diffAction } = await import("./chunks/diff.action-5TLC2EHT.js");
145
+ const { diffAction } = await import("./chunks/diff.action-LBK656RN.js");
147
146
  return diffAction(...args);
148
147
  });
149
148
  return cmd3;
@@ -163,7 +162,7 @@ var GetSchemaCommand = () => {
163
162
  cmd3.option("-o, --output <file>", "Output file (defaults to stdout)");
164
163
  completeFiles(cmd3, [], ["--output"]);
165
164
  cmd3.action(async (...args) => {
166
- const { getAction } = await import("./chunks/get.action-BCMLG7C7.js");
165
+ const { getAction } = await import("./chunks/get.action-5SWRNQ3D.js");
167
166
  return getAction(...args);
168
167
  });
169
168
  return cmd3;
@@ -177,7 +176,7 @@ var ListSchemaCommand = () => {
177
176
  cmd3.option("--namespace <namespace>", "Team namespace");
178
177
  cmd3.option("--json", "Output schema metadata as JSON");
179
178
  cmd3.action(async (...args) => {
180
- const { listAction } = await import("./chunks/list.action-6ZWEENT6.js");
179
+ const { listAction } = await import("./chunks/list.action-YJZBC25S.js");
181
180
  return listAction(...args);
182
181
  });
183
182
  return cmd3;
@@ -212,11 +211,12 @@ var PublishSchemaCommand = () => {
212
211
  cmd3.option(
213
212
  "--fetchLimit <limit>",
214
213
  "Maximum number of concurrent URL fetches when bundling",
215
- parseFetchLimit
214
+ parseFetchLimit,
215
+ DEFAULT_FETCH_CONCURRENCY
216
216
  );
217
217
  completeFiles(cmd3, ["file"], []);
218
218
  cmd3.action(async (...args) => {
219
- const { publishAction } = await import("./chunks/publish.action-U3VIU5LZ.js");
219
+ const { publishAction } = await import("./chunks/publish.action-QMVDHDJZ.js");
220
220
  return publishAction(...args);
221
221
  });
222
222
  return cmd3;
@@ -251,7 +251,7 @@ var UpdateSchemaCommand = () => {
251
251
  "\nOmitting visibility options leaves access unchanged.\nExample: scalar schema update --namespace acme --slug my-schema --public"
252
252
  );
253
253
  cmd3.action(async (...args) => {
254
- const { updateAction } = await import("./chunks/update.action-UQHZYVTP.js");
254
+ const { updateAction } = await import("./chunks/update.action-GFDZIGEP.js");
255
255
  return updateAction(...args);
256
256
  });
257
257
  return cmd3;
@@ -275,22 +275,36 @@ var schema_default = schemaDomain;
275
275
  import { Command as Command14 } from "commander";
276
276
 
277
277
  // src/domains/sdk/build.ts
278
- import { Command as Command8 } from "commander";
278
+ import { Command as Command8, Option as Option4 } from "commander";
279
279
  var BuildSdkCommand = () => {
280
280
  const cmd3 = new Command8("build");
281
281
  cmd3.option("--json", "Output the mutation result as JSON without prompting");
282
282
  cmd3.description("Start an SDK build");
283
283
  cmd3.option("-s, --slug <slug>", "SDK slug");
284
284
  cmd3.option("-n, --namespace <namespace>", "Team namespace");
285
+ cmd3.option(
286
+ "--version <version>",
287
+ "API description version to build (defaults to its latest version)"
288
+ );
289
+ cmd3.option(
290
+ "--custom-code-ref <ref>",
291
+ "Branch, tag or commit to merge as custom code (defaults to each language's scalar-next)"
292
+ );
293
+ cmd3.addOption(
294
+ new Option4(
295
+ "-l, --language <language...>",
296
+ "Languages to build (defaults to every language the config declares)"
297
+ ).choices(Object.values(SdkLanguage))
298
+ );
285
299
  cmd3.action(async (...args) => {
286
- const { buildAction } = await import("./chunks/build.action-4YDNDBXC.js");
300
+ const { buildAction } = await import("./chunks/build.action-7MKMMV6V.js");
287
301
  return buildAction(...args);
288
302
  });
289
303
  return cmd3;
290
304
  };
291
305
 
292
306
  // src/domains/sdk/create.ts
293
- import { Command as Command9, Option as Option4 } from "commander";
307
+ import { Command as Command9, Option as Option5 } from "commander";
294
308
  var CreateSdkCommand = () => {
295
309
  const cmd3 = new Command9("create");
296
310
  cmd3.option("--json", "Output the mutation result as JSON without prompting");
@@ -298,12 +312,12 @@ var CreateSdkCommand = () => {
298
312
  cmd3.option("-a, --api <api>", "Scalar Registry API slug");
299
313
  cmd3.option("-n, --namespace <namespace>", "Team namespace of the source API");
300
314
  cmd3.addOption(
301
- new Option4("-l, --language <language>", "SDK language").choices(
315
+ new Option5("-l, --language <language>", "SDK language").choices(
302
316
  Object.values(SdkLanguage)
303
317
  )
304
318
  );
305
319
  cmd3.action(async (...args) => {
306
- const { createAction } = await import("./chunks/create.action-52K3XAYN.js");
320
+ const { createAction } = await import("./chunks/create.action-VA2ISPIM.js");
307
321
  return createAction(...args);
308
322
  });
309
323
  return cmd3;
@@ -318,14 +332,14 @@ var DeleteSdkCommand = () => {
318
332
  cmd3.option("-s, --slug <slug>", "SDK slug");
319
333
  cmd3.option("-n, --namespace <namespace>", "Team namespace");
320
334
  cmd3.action(async (...args) => {
321
- const { deleteAction } = await import("./chunks/delete.action-3NMOQPIR.js");
335
+ const { deleteAction } = await import("./chunks/delete.action-GEN6OD7A.js");
322
336
  return deleteAction(...args);
323
337
  });
324
338
  return cmd3;
325
339
  };
326
340
 
327
341
  // src/domains/sdk/update.ts
328
- import { Command as Command11, Option as Option5 } from "commander";
342
+ import { Command as Command11, Option as Option6 } from "commander";
329
343
  var UpdateSdkCommand = () => {
330
344
  const cmd3 = new Command11("update");
331
345
  cmd3.option("--json", "Output the mutation result as JSON without prompting");
@@ -334,13 +348,13 @@ var UpdateSdkCommand = () => {
334
348
  cmd3.option("-n, --namespace <namespace>", "Team namespace");
335
349
  cmd3.option("--title <title>", "SDK title");
336
350
  cmd3.addOption(
337
- new Option5(
351
+ new Option6(
338
352
  "--isPrivate <isPrivate>",
339
353
  "Access setting (true/private or false/public)"
340
354
  ).choices([...PRIVACY_VALUES])
341
355
  );
342
356
  cmd3.action(async (...args) => {
343
- const { updateAction } = await import("./chunks/update.action-QZOP25ME.js");
357
+ const { updateAction } = await import("./chunks/update.action-SNGKPS7A.js");
344
358
  return updateAction(...args);
345
359
  });
346
360
  return cmd3;
@@ -357,7 +371,7 @@ var GetSdkCommand = () => {
357
371
  cmd3.option("-n, --namespace <namespace>", "Team namespace");
358
372
  cmd3.option("--json", "Output structured SDK metadata as JSON");
359
373
  cmd3.action(async (...args) => {
360
- const { getAction } = await import("./chunks/get.action-TOZ474GO.js");
374
+ const { getAction } = await import("./chunks/get.action-UPPPGGI4.js");
361
375
  return getAction(...args);
362
376
  });
363
377
  return cmd3;
@@ -371,7 +385,7 @@ var ListSdkCommand = () => {
371
385
  cmd3.option("--json", "Output structured SDK metadata as JSON");
372
386
  cmd3.option("--namespace <namespace>", "Team namespace");
373
387
  cmd3.action(async (...args) => {
374
- const { listAction } = await import("./chunks/list.action-CMAA5KTY.js");
388
+ const { listAction } = await import("./chunks/list.action-YOWWC4I4.js");
375
389
  return listAction(...args);
376
390
  });
377
391
  return cmd3;
@@ -400,7 +414,7 @@ function createAllowlistCommand(field, descriptions) {
400
414
  for (const operation of ["add", "remove"]) {
401
415
  command.command(operation).description(descriptions[`${operation}Description`]).argument("<slug>", "Access group slug").argument(`<${field}>`, descriptions.valueDescription).option("--json", "Print the result as JSON").action(
402
416
  async (slug, value, options) => {
403
- const { runAction } = await import("./chunks/actions-RI42JY6H.js");
417
+ const { runAction } = await import("./chunks/actions-RCIS37Y6.js");
404
418
  await runAction({
405
419
  operation: `${operation}-${field}`,
406
420
  slug,
@@ -417,28 +431,28 @@ function createAccessGroupCommand() {
417
431
  "Manage access groups, allowed emails and domains for the current team"
418
432
  );
419
433
  command.command("list").description("List access groups for the current team").option("--json", "Print the result as JSON").action(async (options) => {
420
- const { runAction } = await import("./chunks/actions-RI42JY6H.js");
434
+ const { runAction } = await import("./chunks/actions-RCIS37Y6.js");
421
435
  await runAction({ operation: "list", ...options });
422
436
  });
423
437
  command.command("create").description("Create an access group (Pro or above)").argument("<slug>", "New access group slug").option("--name <name>", "Display name").option("--domain <domains...>", "Allowed email domains").option("--json", "Print the result as JSON").action(
424
438
  async (slug, options) => {
425
- const { runAction } = await import("./chunks/actions-RI42JY6H.js");
439
+ const { runAction } = await import("./chunks/actions-RCIS37Y6.js");
426
440
  await runAction({ operation: "create", slug, ...options });
427
441
  }
428
442
  );
429
443
  command.command("get").description("Get an access group and its allowlists").argument("<slug>", "Access group slug").option("--json", "Print the result as JSON").action(async (slug, options) => {
430
- const { runAction } = await import("./chunks/actions-RI42JY6H.js");
444
+ const { runAction } = await import("./chunks/actions-RCIS37Y6.js");
431
445
  await runAction({ operation: "get", slug, ...options });
432
446
  });
433
447
  command.command("update").description("Update access group metadata").argument("<slug>", "Current access group slug").option("--name <name>", "New display name").option("--new-slug <slug>", "New access group slug").option("--json", "Print the result as JSON").action(
434
448
  async (slug, options) => {
435
- const { runAction } = await import("./chunks/actions-RI42JY6H.js");
449
+ const { runAction } = await import("./chunks/actions-RCIS37Y6.js");
436
450
  await runAction({ operation: "update", slug, ...options });
437
451
  }
438
452
  );
439
453
  command.command("delete").description("Delete an access group and remove its project assignments").argument("<slug>", "Access group slug").option("-y, --yes", "Confirm deletion without prompting").option("--json", "Print the result as JSON (requires --yes)").action(
440
454
  async (slug, options) => {
441
- const { runAction } = await import("./chunks/actions-RI42JY6H.js");
455
+ const { runAction } = await import("./chunks/actions-RCIS37Y6.js");
442
456
  await runAction({ operation: "delete", slug, ...options });
443
457
  }
444
458
  );
@@ -466,7 +480,7 @@ var access_group_default = createAccessGroupCommand();
466
480
  import { Command as Command19 } from "commander";
467
481
 
468
482
  // src/domains/auth/login/index.ts
469
- import { Command as Command16, Option as Option6 } from "commander";
483
+ import { Command as Command16, Option as Option7 } from "commander";
470
484
  var LoginCommand = () => {
471
485
  const cmd3 = new Command16("login");
472
486
  cmd3.description("Log in to Scalar");
@@ -475,19 +489,19 @@ var LoginCommand = () => {
475
489
  "Personal token for authentication (overrides SCALAR_API_KEY; must not be empty)"
476
490
  );
477
491
  cmd3.addOption(
478
- new Option6(
492
+ new Option7(
479
493
  "--email <email>",
480
494
  "Email address (unsupported; use browser or token authentication)"
481
495
  ).hideHelp()
482
496
  );
483
497
  cmd3.addOption(
484
- new Option6(
498
+ new Option7(
485
499
  "--password <password>",
486
500
  "Password (unsupported; use browser or token authentication)"
487
501
  ).hideHelp()
488
502
  );
489
503
  cmd3.action(async (...args) => {
490
- const { loginAction } = await import("./chunks/action-P2RPH5R2.js");
504
+ const { loginAction } = await import("./chunks/action-ED5WLLIE.js");
491
505
  return loginAction(...args);
492
506
  });
493
507
  return cmd3;
@@ -512,7 +526,7 @@ var WhoAmICommand = () => {
512
526
  cmd3.description("Show the logged-in user and current team");
513
527
  cmd3.option("--json", "Output authentication details as JSON");
514
528
  cmd3.action(async (options) => {
515
- const { whoamiAction } = await import("./chunks/action-TY4BZEMN.js");
529
+ const { whoamiAction } = await import("./chunks/action-UPVVJE26.js");
516
530
  return whoamiAction(options);
517
531
  });
518
532
  return cmd3;
@@ -565,13 +579,13 @@ cmd.description(
565
579
  "Print every command, argument, and option as JSON for AI agents"
566
580
  );
567
581
  cmd.action(async () => {
568
- const { contextAction } = await import("./chunks/action-SRFBOLDL.js");
582
+ const { contextAction } = await import("./chunks/action-GQDQU2WE.js");
569
583
  return contextAction(cmd);
570
584
  });
571
585
  var context_default = cmd;
572
586
 
573
587
  // src/domains/document/index.ts
574
- import { Command as Command34 } from "commander";
588
+ import { Command as Command36 } from "commander";
575
589
 
576
590
  // src/domains/document/join/index.ts
577
591
  import { Command as Command22 } from "commander";
@@ -591,7 +605,7 @@ function JoinCommand() {
591
605
  );
592
606
  completeFiles(cmd3, ["files"], ["--output"]);
593
607
  cmd3.action(async (...args) => {
594
- const { joinAction } = await import("./chunks/action-4HXB3YQR.js");
608
+ const { joinAction } = await import("./chunks/action-R53K22GE.js");
595
609
  return joinAction(...args);
596
610
  });
597
611
  return cmd3;
@@ -615,16 +629,84 @@ function SplitCommand() {
615
629
  );
616
630
  completeFiles(cmd3, ["file|url"], ["--output"]);
617
631
  cmd3.action(async (...args) => {
618
- const { splitAction } = await import("./chunks/action-2BGAMGXU.js");
632
+ const { splitAction } = await import("./chunks/action-7ZCJAWI2.js");
619
633
  return splitAction(...args);
620
634
  });
621
635
  return cmd3;
622
636
  }
623
637
 
624
- // src/domains/document/format/index.ts
638
+ // src/domains/document/transform/index.ts
625
639
  import { Command as Command24 } from "commander";
640
+ var TransformCommand = () => {
641
+ const command = new Command24("transform").description("Create public or environment-specific API descriptions").argument("<file|url>", "OpenAPI or AsyncAPI description file path or URL").requiredOption(
642
+ "-c, --config <file>",
643
+ "JSON or YAML transformation configuration"
644
+ ).requiredOption(
645
+ "-o, --output <file>",
646
+ "JSON or YAML output file, or - for stdout; source files cannot be overwritten"
647
+ ).addHelpText(
648
+ "after",
649
+ "\nExample:\n scalar document transform api.yaml --config public.yaml --output public-api.yaml"
650
+ );
651
+ completeFiles(command, ["file|url"], ["--config", "--output"]);
652
+ command.action(
653
+ async (input, options) => {
654
+ const { transformAction } = await import("./chunks/action-F4CQ4DW3.js");
655
+ await transformAction(input, options).catch((error) => {
656
+ process.stderr.write(
657
+ `Could not transform API description: ${error instanceof Error ? error.message : String(error)}
658
+ `
659
+ );
660
+ process.exitCode = 1;
661
+ });
662
+ }
663
+ );
664
+ return command;
665
+ };
666
+
667
+ // src/domains/document/bundle/index.ts
668
+ import { Command as Command25, Option as Option8 } from "commander";
669
+ function BundleCommand() {
670
+ const cmd3 = new Command25("bundle");
671
+ cmd3.description("Bundle external references into a single API description");
672
+ cmd3.argument("[file|url]", "API description file path or URL to bundle");
673
+ cmd3.option(
674
+ "-o, --output <file>",
675
+ "Output file or directory, or - for stdout in the input format (required for URLs and non-interactive use; otherwise confirms overwriting the input file)"
676
+ );
677
+ cmd3.addOption(
678
+ new Option8(
679
+ "--ext <json|yaml|yml>",
680
+ "Output format; overrides and normalizes the output suffix"
681
+ ).choices(["json", "yaml", "yml"])
682
+ );
683
+ cmd3.option(
684
+ "-f, --force",
685
+ "Write an incomplete bundle despite unresolved references"
686
+ );
687
+ cmd3.option("--treeShake", "Remove unused components from the bundled output");
688
+ cmd3.option(
689
+ "--urlMap",
690
+ "Generate a map of resolved URLs in the bundled output"
691
+ );
692
+ cmd3.option(
693
+ "--fetchLimit <limit>",
694
+ "Maximum number of concurrent URL fetches",
695
+ parseFetchLimit,
696
+ DEFAULT_FETCH_CONCURRENCY
697
+ );
698
+ completeFiles(cmd3, ["file|url"], ["--output"]);
699
+ cmd3.action(async (...args) => {
700
+ const { bundleAction } = await import("./chunks/action-CYU5Q5LT.js");
701
+ return bundleAction(...args);
702
+ });
703
+ return cmd3;
704
+ }
705
+
706
+ // src/domains/document/format/index.ts
707
+ import { Command as Command26 } from "commander";
626
708
  function FormatCommand() {
627
- const cmd3 = new Command24("format");
709
+ const cmd3 = new Command26("format");
628
710
  cmd3.description("Format an OpenAPI or AsyncAPI description");
629
711
  cmd3.argument(
630
712
  "[file|url]",
@@ -636,14 +718,14 @@ function FormatCommand() {
636
718
  );
637
719
  completeFiles(cmd3, ["file|url"], ["--output"]);
638
720
  cmd3.action(async (...args) => {
639
- const { formatAction } = await import("./chunks/action-6HFH7DAW.js");
721
+ const { formatAction } = await import("./chunks/action-A6YOY24G.js");
640
722
  return formatAction(...args);
641
723
  });
642
724
  return cmd3;
643
725
  }
644
726
 
645
727
  // src/domains/document/lint/index.ts
646
- import { Command as Command25, InvalidArgumentError as InvalidArgumentError2, Option as Option7 } from "commander";
728
+ import { Command as Command27, InvalidArgumentError as InvalidArgumentError2, Option as Option9 } from "commander";
647
729
 
648
730
  // src/domains/document/lint/formats.ts
649
731
  var reportFormats = [
@@ -658,12 +740,19 @@ var reportFormats = [
658
740
 
659
741
  // src/domains/document/lint/index.ts
660
742
  function LintCommand() {
661
- const cmd3 = new Command25("lint");
662
- cmd3.description("Lint an OpenAPI or AsyncAPI description with Spectral rules");
663
- cmd3.argument("[file|url]", "API description file path or URL to lint");
743
+ const cmd3 = new Command27("lint");
744
+ cmd3.description("Lint OpenAPI or AsyncAPI descriptions with Spectral rules");
745
+ cmd3.argument(
746
+ "[file|url...]",
747
+ "API description files or URLs (defaults to APIs in scalar.config)"
748
+ );
749
+ cmd3.option(
750
+ "--config <file>",
751
+ "Scalar configuration file to read when no inputs are provided"
752
+ );
664
753
  cmd3.option("-r, --rule <file|url>", "Spectral ruleset file path or URL");
665
754
  cmd3.addOption(
666
- new Option7("--format <format>", "Report format").choices([...reportFormats]).default("codeframe")
755
+ new Option9("--format <format>", "Report format").choices([...reportFormats]).default("codeframe")
667
756
  );
668
757
  cmd3.option(
669
758
  "--max-problems <number>",
@@ -687,33 +776,37 @@ function LintCommand() {
687
776
  "--ignore-file <file>",
688
777
  "Ignore baseline path (Scalar file takes priority over Redocly fallback in the current directory)"
689
778
  );
690
- completeFiles(cmd3, ["file|url"], ["--rule", "--output", "--ignore-file"]);
779
+ completeFiles(
780
+ cmd3,
781
+ ["file|url"],
782
+ ["--rule", "--output", "--ignore-file", "--config"]
783
+ );
691
784
  cmd3.action(async (...args) => {
692
- const { lintAction } = await import("./chunks/action-IUAYC2SC.js");
785
+ const { lintAction } = await import("./chunks/action-7GZGVTYI.js");
693
786
  return lintAction(...args);
694
787
  });
695
788
  return cmd3;
696
789
  }
697
790
 
698
791
  // src/domains/document/markdown/index.ts
699
- import { Command as Command26 } from "commander";
792
+ import { Command as Command28 } from "commander";
700
793
  function MarkdownCommand() {
701
- const cmd3 = new Command26("markdown");
794
+ const cmd3 = new Command28("markdown");
702
795
  cmd3.description("Generate Markdown documentation from an OpenAPI description");
703
796
  cmd3.argument("[file|url]", "OpenAPI file path or URL to convert");
704
797
  cmd3.option("-o, --output <file>", "Output file (defaults to stdout)");
705
798
  completeFiles(cmd3, ["file|url"], ["--output"]);
706
799
  cmd3.action(async (...args) => {
707
- const { markdownAction } = await import("./chunks/action-57SV3ZBM.js");
800
+ const { markdownAction } = await import("./chunks/action-T3R4SDAI.js");
708
801
  return markdownAction(...args);
709
802
  });
710
803
  return cmd3;
711
804
  }
712
805
 
713
806
  // src/domains/document/mock/index.ts
714
- import { Command as Command27 } from "commander";
807
+ import { Command as Command29 } from "commander";
715
808
  function MockCommand() {
716
- const cmd3 = new Command27("mock");
809
+ const cmd3 = new Command29("mock");
717
810
  cmd3.description(
718
811
  "Run a Mock Server for OpenAPI operations or AsyncAPI WebSocket and SSE channels"
719
812
  );
@@ -722,16 +815,16 @@ function MockCommand() {
722
815
  cmd3.option("-p, --port <port>", "HTTP port for the Mock Server", parsePort);
723
816
  completeFiles(cmd3, ["file|url"], []);
724
817
  cmd3.action(async (...args) => {
725
- const { mockAction } = await import("./chunks/action-MBAAYXKK.js");
818
+ const { mockAction } = await import("./chunks/action-V35W4MRK.js");
726
819
  await mockAction(...args);
727
820
  });
728
821
  return cmd3;
729
822
  }
730
823
 
731
824
  // src/domains/document/postman/index.ts
732
- import { Command as Command28 } from "commander";
825
+ import { Command as Command30 } from "commander";
733
826
  function ConvertCommand() {
734
- const cmd3 = new Command28("convert");
827
+ const cmd3 = new Command30("convert");
735
828
  cmd3.description("Convert a Postman collection to an OpenAPI description");
736
829
  cmd3.argument("[file|url]", "Postman collection file path or URL to convert");
737
830
  cmd3.option("-o, --output <file>", "Output file (defaults to stdout)");
@@ -741,16 +834,16 @@ function ConvertCommand() {
741
834
  );
742
835
  completeFiles(cmd3, ["file|url"], ["--output"]);
743
836
  cmd3.action(async (...args) => {
744
- const { convertAction } = await import("./chunks/action-TR2T2UYB.js");
837
+ const { convertAction } = await import("./chunks/action-W4KGRBRV.js");
745
838
  return convertAction(...args);
746
839
  });
747
840
  return cmd3;
748
841
  }
749
842
 
750
843
  // src/domains/document/serve/index.ts
751
- import { Command as Command29 } from "commander";
844
+ import { Command as Command31 } from "commander";
752
845
  function ServeCommand() {
753
- const cmd3 = new Command29("serve");
846
+ const cmd3 = new Command31("serve");
754
847
  cmd3.description(
755
848
  "Serve API Reference documentation from an OpenAPI or AsyncAPI description"
756
849
  );
@@ -767,16 +860,16 @@ function ServeCommand() {
767
860
  );
768
861
  completeFiles(cmd3, ["file|url"], ["--config"]);
769
862
  cmd3.action(async (...args) => {
770
- const { serveAction } = await import("./chunks/action-G2WBTXOK.js");
863
+ const { serveAction } = await import("./chunks/action-IWEAWDT3.js");
771
864
  await serveAction(...args);
772
865
  });
773
866
  return cmd3;
774
867
  }
775
868
 
776
869
  // src/domains/document/share/index.ts
777
- import { Command as Command30 } from "commander";
870
+ import { Command as Command32 } from "commander";
778
871
  function ShareCommand() {
779
- const cmd3 = new Command30("share");
872
+ const cmd3 = new Command32("share");
780
873
  cmd3.description(
781
874
  "Publish an OpenAPI or AsyncAPI description to a public sandbox"
782
875
  );
@@ -787,16 +880,16 @@ function ShareCommand() {
787
880
  );
788
881
  completeFiles(cmd3, ["file"], []);
789
882
  cmd3.action(async (...args) => {
790
- const { shareAction } = await import("./chunks/action-HOCCP353.js");
883
+ const { shareAction } = await import("./chunks/action-4BDZ2CXP.js");
791
884
  return shareAction(...args);
792
885
  });
793
886
  return cmd3;
794
887
  }
795
888
 
796
889
  // src/domains/document/upgrade/index.ts
797
- import { Command as Command31 } from "commander";
890
+ import { Command as Command33 } from "commander";
798
891
  function UpgradeCommand() {
799
- const cmd3 = new Command31("upgrade");
892
+ const cmd3 = new Command33("upgrade");
800
893
  cmd3.description(
801
894
  "Upgrade an API description to OpenAPI 3.1 or the latest supported AsyncAPI version"
802
895
  );
@@ -807,30 +900,30 @@ function UpgradeCommand() {
807
900
  );
808
901
  completeFiles(cmd3, ["file|url"], ["--output"]);
809
902
  cmd3.action(async (...args) => {
810
- const { upgradeAction } = await import("./chunks/action-WOLNPEUQ.js");
903
+ const { upgradeAction } = await import("./chunks/action-H5VRLFCY.js");
811
904
  return upgradeAction(...args);
812
905
  });
813
906
  return cmd3;
814
907
  }
815
908
 
816
909
  // src/domains/document/validate/index.ts
817
- import { Command as Command32 } from "commander";
910
+ import { Command as Command34 } from "commander";
818
911
  function ValidateCommand() {
819
- const cmd3 = new Command32("validate");
912
+ const cmd3 = new Command34("validate");
820
913
  cmd3.description("Validate an OpenAPI or AsyncAPI description");
821
914
  cmd3.argument("[file|url]", "File or URL to validate");
822
915
  completeFiles(cmd3, ["file|url"], []);
823
916
  cmd3.action(async (...args) => {
824
- const { validateAction } = await import("./chunks/action-APBLB3IU.js");
917
+ const { validateAction } = await import("./chunks/action-COFGCCYS.js");
825
918
  return validateAction(...args);
826
919
  });
827
920
  return cmd3;
828
921
  }
829
922
 
830
923
  // src/domains/document/void/index.ts
831
- import { Command as Command33 } from "commander";
924
+ import { Command as Command35 } from "commander";
832
925
  function VoidCommand() {
833
- const cmd3 = new Command33("void");
926
+ const cmd3 = new Command35("void");
834
927
  cmd3.description("Mirror HTTP requests with a local server");
835
928
  cmd3.option(
836
929
  "-p, --port <port>",
@@ -847,6 +940,7 @@ function VoidCommand() {
847
940
  // src/domains/document/index.ts
848
941
  var documentCommands = [
849
942
  BundleCommand,
943
+ TransformCommand,
850
944
  SplitCommand,
851
945
  JoinCommand,
852
946
  FormatCommand,
@@ -860,30 +954,30 @@ var documentCommands = [
860
954
  LintCommand,
861
955
  UpgradeCommand
862
956
  ];
863
- var documentDomain = new Command34("document");
957
+ var documentDomain = new Command36("document");
864
958
  documentDomain.description("Work with OpenAPI and AsyncAPI descriptions");
865
959
  documentCommands.forEach((command) => documentDomain.addCommand(command()));
866
960
  var document_default = documentDomain;
867
961
 
868
962
  // src/domains/mcp/index.ts
869
- import { Command as Command35 } from "commander";
870
- var mcpDomain = new Command35("mcp").description(
963
+ import { Command as Command37 } from "commander";
964
+ var mcpDomain = new Command37("mcp").description(
871
965
  "Manage Scalar-hosted MCP servers"
872
966
  );
873
967
  mcpDomain.addCommand(
874
- new Command35("list").description("List MCP servers in the current team").option("--json", "Output server metadata as JSON").action(async (options) => {
875
- const { listAction } = await import("./chunks/actions-D5OHPBWC.js");
968
+ new Command37("list").description("List MCP servers in the current team").option("--json", "Output server metadata as JSON").action(async (options) => {
969
+ const { listAction } = await import("./chunks/actions-CERT7BL4.js");
876
970
  return listAction(options);
877
971
  })
878
972
  );
879
973
  mcpDomain.addCommand(
880
- new Command35("get").description("Get an MCP server and its environment versions").argument("<server-id>", "Server UUID from scalar mcp list").option("--json", "Output server and environment metadata as JSON").action(async (id, options) => {
881
- const { getAction } = await import("./chunks/actions-D5OHPBWC.js");
974
+ new Command37("get").description("Get an MCP server and its environment versions").argument("<server-id>", "Server UUID from scalar mcp list").option("--json", "Output server and environment metadata as JSON").action(async (id, options) => {
975
+ const { getAction } = await import("./chunks/actions-CERT7BL4.js");
882
976
  return getAction(id, options);
883
977
  })
884
978
  );
885
979
  mcpDomain.addCommand(
886
- new Command35("create").description(
980
+ new Command37("create").description(
887
981
  "Create an MCP server from an existing Registry API or Docs project"
888
982
  ).requiredOption("--name <name>", "Server name").option("--slug <slug>", "Server slug (generated from the name by default)").option(
889
983
  "--api <reference>",
@@ -892,31 +986,31 @@ mcpDomain.addCommand(
892
986
  "after",
893
987
  "\nProvide exactly one of --api or --project. API tool exposure follows the API description.\nCreation does not wait for the endpoint to become ready. MCP_URL overrides the endpoint host.\n\nExamples:\n scalar mcp create --name Petstore --api acme/petstore@1.0.0 --no-input\n scalar mcp create --name Docs --project <project-uid> --json --no-input"
894
988
  ).action(async (options) => {
895
- const { createAction } = await import("./chunks/actions-D5OHPBWC.js");
989
+ const { createAction } = await import("./chunks/actions-CERT7BL4.js");
896
990
  return createAction(options);
897
991
  })
898
992
  );
899
993
  mcpDomain.addCommand(
900
- new Command35("update").description("Change an MCP server name or slug").argument("<server-id>", "Server UUID from scalar mcp list").option("--name <name>", "New server name").option("--slug <slug>", "New server slug (changes the endpoint address)").option("--json", "Output updated server metadata as JSON").action(async (id, options) => {
901
- const { updateAction } = await import("./chunks/actions-D5OHPBWC.js");
994
+ new Command37("update").description("Change an MCP server name or slug").argument("<server-id>", "Server UUID from scalar mcp list").option("--name <name>", "New server name").option("--slug <slug>", "New server slug (changes the endpoint address)").option("--json", "Output updated server metadata as JSON").action(async (id, options) => {
995
+ const { updateAction } = await import("./chunks/actions-CERT7BL4.js");
902
996
  return updateAction(id, options);
903
997
  })
904
998
  );
905
999
  mcpDomain.addCommand(
906
- new Command35("delete").description("Delete an MCP server and stop its endpoints").argument("<server-id>", "Server UUID from scalar mcp list").option("--yes", "Confirm deletion of this server without prompting").option("--json", "Output the deletion result as JSON (requires --yes)").action(async (id, options) => {
907
- const { deleteAction } = await import("./chunks/actions-D5OHPBWC.js");
1000
+ new Command37("delete").description("Delete an MCP server and stop its endpoints").argument("<server-id>", "Server UUID from scalar mcp list").option("--yes", "Confirm deletion of this server without prompting").option("--json", "Output the deletion result as JSON (requires --yes)").action(async (id, options) => {
1001
+ const { deleteAction } = await import("./chunks/actions-CERT7BL4.js");
908
1002
  return deleteAction(id, options);
909
1003
  })
910
1004
  );
911
1005
  var mcp_default = mcpDomain;
912
1006
 
913
1007
  // src/domains/project/index.ts
914
- import { Command as Command48 } from "commander";
1008
+ import { Command as Command50 } from "commander";
915
1009
 
916
1010
  // src/domains/project/preview/index.ts
917
- import { Command as Command36, Option as Option8 } from "commander";
1011
+ import { Command as Command38, Option as Option10 } from "commander";
918
1012
  var PreviewCommand = () => {
919
- const cmd3 = new Command36("preview");
1013
+ const cmd3 = new Command38("preview");
920
1014
  cmd3.description("Preview a Scalar Docs project locally");
921
1015
  cmd3.argument(
922
1016
  "[config]",
@@ -929,21 +1023,21 @@ var PreviewCommand = () => {
929
1023
  );
930
1024
  cmd3.option("-H, --host [host]", "Host address for the preview server");
931
1025
  cmd3.addOption(
932
- new Option8("-L, --log-level <level>", "Set the log level").choices(["debug", "info"]).default("info")
1026
+ new Option10("-L, --log-level <level>", "Set the log level").choices(["debug", "info"]).default("info")
933
1027
  );
934
1028
  cmd3.option("-N, --no-open", "Do not open the browser automatically", true);
935
1029
  completeFiles(cmd3, ["config"], []);
936
1030
  cmd3.action(async (...args) => {
937
- const { previewAction } = await import("./chunks/action-PNSWHIHC.js");
1031
+ const { previewAction } = await import("./chunks/action-KVM76ZKQ.js");
938
1032
  return previewAction(...args);
939
1033
  });
940
1034
  return cmd3;
941
1035
  };
942
1036
 
943
1037
  // src/domains/project/check-config/index.ts
944
- import { Command as Command37 } from "commander";
1038
+ import { Command as Command39 } from "commander";
945
1039
  function CheckConfigCommand() {
946
- const cmd3 = new Command37("check-config");
1040
+ const cmd3 = new Command39("check-config");
947
1041
  cmd3.description("Validate a Scalar configuration file");
948
1042
  cmd3.argument(
949
1043
  "[file]",
@@ -951,53 +1045,53 @@ function CheckConfigCommand() {
951
1045
  );
952
1046
  completeFiles(cmd3, ["file"], []);
953
1047
  cmd3.action(async (...args) => {
954
- const { checkConfigAction } = await import("./chunks/action-U2RJ3ZAU.js");
1048
+ const { checkConfigAction } = await import("./chunks/action-SJPWL723.js");
955
1049
  return checkConfigAction(...args);
956
1050
  });
957
1051
  return cmd3;
958
1052
  }
959
1053
 
960
1054
  // src/domains/project/create/index.ts
961
- import { Command as Command38 } from "commander";
1055
+ import { Command as Command40 } from "commander";
962
1056
  var CreateCommand = () => {
963
- const cmd3 = new Command38("create");
1057
+ const cmd3 = new Command40("create");
964
1058
  cmd3.option("--json", "Output the result as JSON without prompting");
965
1059
  cmd3.description("Create a Scalar project without a linked GitHub repository");
966
1060
  cmd3.option("-n, --name <name>", "Project name");
967
1061
  cmd3.option("-s, --slug <slug>", "Project slug");
968
1062
  cmd3.action(async (...args) => {
969
- const { createAction } = await import("./chunks/action-3QQSKGM3.js");
1063
+ const { createAction } = await import("./chunks/action-5AXDB5VN.js");
970
1064
  return createAction(...args);
971
1065
  });
972
1066
  return cmd3;
973
1067
  };
974
1068
 
975
1069
  // src/domains/project/deployments/index.ts
976
- import { Command as Command41 } from "commander";
1070
+ import { Command as Command43 } from "commander";
977
1071
 
978
1072
  // src/domains/project/deployments/get/index.ts
979
- import { Command as Command39 } from "commander";
980
- var GetCommand = () => new Command39("get").description(
1073
+ import { Command as Command41 } from "commander";
1074
+ var GetCommand = () => new Command41("get").description(
981
1075
  "Inspect an existing build in the selected team without resubmitting"
982
1076
  ).argument("<build-id>", "Accepted build ID, including preview builds").option("--wait", "Wait for deployment instead of inspecting once").option(
983
1077
  "--timeout <seconds>",
984
1078
  "Maximum status wait in seconds (default: 30, or 600 with --wait)"
985
1079
  ).action(
986
1080
  async (buildId, options) => {
987
- const { getAction } = await import("./chunks/action-ZTLOQZTT.js");
1081
+ const { getAction } = await import("./chunks/action-QP6MRSQW.js");
988
1082
  await getAction(buildId, options);
989
1083
  }
990
1084
  );
991
1085
 
992
1086
  // src/domains/project/deployments/list/index.ts
993
- import { Command as Command40 } from "commander";
1087
+ import { Command as Command42 } from "commander";
994
1088
  var ListCommand = () => {
995
- const cmd3 = new Command40("list");
1089
+ const cmd3 = new Command42("list");
996
1090
  cmd3.option("--json", "Output the result as JSON without prompting");
997
1091
  cmd3.description("List production deployments for a project");
998
1092
  cmd3.option("-s, --slug [slug]", "Project slug from scalar project list");
999
1093
  cmd3.action(async (...args) => {
1000
- const { listAction } = await import("./chunks/action-IU2AVNOW.js");
1094
+ const { listAction } = await import("./chunks/action-AGGHY4N2.js");
1001
1095
  return listAction(...args);
1002
1096
  });
1003
1097
  return cmd3;
@@ -1005,7 +1099,7 @@ var ListCommand = () => {
1005
1099
 
1006
1100
  // src/domains/project/deployments/index.ts
1007
1101
  var DeploymentsCommand = () => {
1008
- const cmd3 = new Command41("deployments");
1102
+ const cmd3 = new Command43("deployments");
1009
1103
  cmd3.description("Show project deployment history");
1010
1104
  cmd3.addCommand(ListCommand());
1011
1105
  cmd3.addCommand(GetCommand());
@@ -1013,12 +1107,12 @@ var DeploymentsCommand = () => {
1013
1107
  };
1014
1108
 
1015
1109
  // src/domains/project/get/index.ts
1016
- import { Command as Command42 } from "commander";
1110
+ import { Command as Command44 } from "commander";
1017
1111
  function GetCommand2() {
1018
- const command = new Command42("get").description("Show project details for the current team").argument("<slug>", "Project slug from scalar project list").option("--json", "Print project details as JSON");
1112
+ const command = new Command44("get").description("Show project details for the current team").argument("<slug>", "Project slug from scalar project list").option("--json", "Print project details as JSON");
1019
1113
  command.action(
1020
1114
  async (slug, options) => {
1021
- const { getAction } = await import("./chunks/action-NZJ4Z64U.js");
1115
+ const { getAction } = await import("./chunks/action-JN6JVQUV.js");
1022
1116
  await getAction(slug, options);
1023
1117
  }
1024
1118
  );
@@ -1026,38 +1120,41 @@ function GetCommand2() {
1026
1120
  }
1027
1121
 
1028
1122
  // src/domains/project/init/index.ts
1029
- import { Command as Command43 } from "commander";
1123
+ import { Command as Command45 } from "commander";
1030
1124
  var InitCommand = () => {
1031
- const cmd3 = new Command43("init");
1125
+ const cmd3 = new Command45("init");
1032
1126
  cmd3.option("--json", "Output the result as JSON without prompting");
1033
1127
  cmd3.description("Initialize a local Scalar Docs project");
1034
1128
  cmd3.option(
1035
1129
  "-s, --subdomain [url]",
1036
1130
  "Subdomain for the published documentation"
1037
1131
  );
1038
- cmd3.option("--force", "Overwrite existing configuration");
1132
+ cmd3.option(
1133
+ "--force",
1134
+ "Replace the configuration, docs-quickstart.md, and docs-openapi.json"
1135
+ );
1039
1136
  cmd3.action(async (...args) => {
1040
- const { initAction } = await import("./chunks/action-T7SD3ETN.js");
1137
+ const { initAction } = await import("./chunks/action-6WZN63LT.js");
1041
1138
  return initAction(...args);
1042
1139
  });
1043
1140
  return cmd3;
1044
1141
  };
1045
1142
 
1046
1143
  // src/domains/project/list/index.ts
1047
- import { Command as Command44 } from "commander";
1144
+ import { Command as Command46 } from "commander";
1048
1145
  function ListCommand2() {
1049
- const command = new Command44("list").description("List projects and their slugs for the current team").option("--json", "Print project details as JSON");
1146
+ const command = new Command46("list").description("List projects and their slugs for the current team").option("--json", "Print project details as JSON");
1050
1147
  command.action(async (options) => {
1051
- const { listAction } = await import("./chunks/action-777R7LOG.js");
1148
+ const { listAction } = await import("./chunks/action-TT7ZJNST.js");
1052
1149
  await listAction(options);
1053
1150
  });
1054
1151
  return command;
1055
1152
  }
1056
1153
 
1057
1154
  // src/domains/project/publish/index.ts
1058
- import { Command as Command45 } from "commander";
1155
+ import { Command as Command47 } from "commander";
1059
1156
  var PublishCommand = () => {
1060
- const cmd3 = new Command45("publish");
1157
+ const cmd3 = new Command47("publish");
1061
1158
  cmd3.option("--json", "Output the result as JSON without prompting");
1062
1159
  cmd3.description("Publish a new build of a Scalar project");
1063
1160
  cmd3.option("-s, --slug [slug]", "Project slug from scalar project list");
@@ -1083,16 +1180,16 @@ var PublishCommand = () => {
1083
1180
  );
1084
1181
  completeFiles(cmd3, [], ["--config"]);
1085
1182
  cmd3.action(async (...args) => {
1086
- const { publishAction } = await import("./chunks/action-LD5B5QQ4.js");
1183
+ const { publishAction } = await import("./chunks/action-6I3TJLRO.js");
1087
1184
  return publishAction(...args);
1088
1185
  });
1089
1186
  return cmd3;
1090
1187
  };
1091
1188
 
1092
1189
  // src/domains/project/rollback/index.ts
1093
- import { Command as Command46 } from "commander";
1190
+ import { Command as Command48 } from "commander";
1094
1191
  var RollbackCommand = () => {
1095
- const cmd3 = new Command46("rollback");
1192
+ const cmd3 = new Command48("rollback");
1096
1193
  cmd3.option("--json", "Output the result as JSON without prompting");
1097
1194
  cmd3.description(
1098
1195
  "Roll the live deployment back to a previously deployed build."
@@ -1104,16 +1201,16 @@ var RollbackCommand = () => {
1104
1201
  );
1105
1202
  cmd3.option("-y, --yes", "Skip the confirmation prompt");
1106
1203
  cmd3.action(async (...args) => {
1107
- const { rollbackAction } = await import("./chunks/action-MJHLG7AE.js");
1204
+ const { rollbackAction } = await import("./chunks/action-DTQH6CKR.js");
1108
1205
  return rollbackAction(...args);
1109
1206
  });
1110
1207
  return cmd3;
1111
1208
  };
1112
1209
 
1113
1210
  // src/domains/project/upgrade/index.ts
1114
- import { Command as Command47 } from "commander";
1211
+ import { Command as Command49 } from "commander";
1115
1212
  var UpgradeCommand2 = () => {
1116
- const cmd3 = new Command47("upgrade");
1213
+ const cmd3 = new Command49("upgrade");
1117
1214
  cmd3.option("--json", "Output the result as JSON without prompting");
1118
1215
  cmd3.description("Upgrade a Scalar Docs configuration");
1119
1216
  cmd3.argument(
@@ -1122,7 +1219,7 @@ var UpgradeCommand2 = () => {
1122
1219
  );
1123
1220
  completeFiles(cmd3, ["config"], []);
1124
1221
  cmd3.action(async (...args) => {
1125
- const { upgradeAction } = await import("./chunks/action-2HPMP473.js");
1222
+ const { upgradeAction } = await import("./chunks/action-QC72LLYE.js");
1126
1223
  return upgradeAction(...args);
1127
1224
  });
1128
1225
  return cmd3;
@@ -1141,7 +1238,7 @@ var projectCommands = [
1141
1238
  DeploymentsCommand,
1142
1239
  UpgradeCommand2
1143
1240
  ];
1144
- var projectDomain = new Command48("project");
1241
+ var projectDomain = new Command50("project");
1145
1242
  projectDomain.description("Manage Scalar Docs projects");
1146
1243
  for (const command of projectCommands) {
1147
1244
  projectDomain.addCommand(command());
@@ -1150,11 +1247,11 @@ projectDomain.addCommand(DownloadIsolateCommand(), { hidden: true });
1150
1247
  var project_default = projectDomain;
1151
1248
 
1152
1249
  // src/domains/readme/index.ts
1153
- import { Command as Command50 } from "commander";
1250
+ import { Command as Command52 } from "commander";
1154
1251
 
1155
1252
  // src/domains/readme/generate.ts
1156
1253
  import as from "ansis";
1157
- import { Command as Command49 } from "commander";
1254
+ import { Command as Command51 } from "commander";
1158
1255
 
1159
1256
  // src/helpers/documentation/index.ts
1160
1257
  import fs from "node:fs/promises";
@@ -1188,7 +1285,7 @@ var generateDocumentationFile = async (outputPath) => {
1188
1285
 
1189
1286
  // src/domains/readme/generate.ts
1190
1287
  function GenerateReadmeCommand() {
1191
- const cmd3 = new Command49("generate");
1288
+ const cmd3 = new Command51("generate");
1192
1289
  cmd3.description("Generate the CLI README from the command tree");
1193
1290
  cmd3.option(
1194
1291
  "-o, --output [file]",
@@ -1240,18 +1337,18 @@ function ServeReadmeCommand(cmd3) {
1240
1337
  }
1241
1338
 
1242
1339
  // src/domains/readme/index.ts
1243
- var readmeDomain = new Command50("readme");
1340
+ var readmeDomain = new Command52("readme");
1244
1341
  readmeDomain.addCommand(GenerateReadmeCommand());
1245
1342
  ServeReadmeCommand(readmeDomain);
1246
1343
  var readme_default = readmeDomain;
1247
1344
 
1248
1345
  // src/domains/registry/index.ts
1249
- import { Command as Command56 } from "commander";
1346
+ import { Command as Command58 } from "commander";
1250
1347
 
1251
1348
  // src/domains/registry/publish/index.ts
1252
- import { Command as Command51 } from "commander";
1349
+ import { Command as Command53 } from "commander";
1253
1350
  var PublishCommand2 = () => {
1254
- const cmd3 = new Command51("publish");
1351
+ const cmd3 = new Command53("publish");
1255
1352
  cmd3.option("--json", "Output the mutation result as JSON without prompting");
1256
1353
  cmd3.description("Publish an OpenAPI description to the Scalar Registry");
1257
1354
  cmd3.argument("[file]", "API description file path or URL to upload");
@@ -1283,35 +1380,36 @@ var PublishCommand2 = () => {
1283
1380
  cmd3.option(
1284
1381
  "--fetchLimit <limit>",
1285
1382
  "Maximum number of concurrent URL fetches when bundling",
1286
- parseFetchLimit
1383
+ parseFetchLimit,
1384
+ DEFAULT_FETCH_CONCURRENCY
1287
1385
  );
1288
1386
  completeFiles(cmd3, ["file"], []);
1289
1387
  cmd3.action(async (...args) => {
1290
- const { publishAction } = await import("./chunks/action-7LK4RUDP.js");
1388
+ const { publishAction } = await import("./chunks/action-ZU5X2KQX.js");
1291
1389
  return publishAction(...args);
1292
1390
  });
1293
1391
  return cmd3;
1294
1392
  };
1295
1393
 
1296
1394
  // src/domains/registry/delete/index.ts
1297
- import { Command as Command52 } from "commander";
1395
+ import { Command as Command54 } from "commander";
1298
1396
  var DeleteCommand = () => {
1299
- const cmd3 = new Command52("delete");
1397
+ const cmd3 = new Command54("delete");
1300
1398
  cmd3.option("--json", "Output the mutation result as JSON without prompting");
1301
1399
  cmd3.description("Delete an API description from the Scalar Registry");
1302
1400
  cmd3.argument("[namespace]", "Team namespace");
1303
1401
  cmd3.argument("[slug]", "API description slug");
1304
1402
  cmd3.action(async (...args) => {
1305
- const { deleteAction } = await import("./chunks/action-ENDUKGWS.js");
1403
+ const { deleteAction } = await import("./chunks/action-ZIVYJCC2.js");
1306
1404
  return deleteAction(...args);
1307
1405
  });
1308
1406
  return cmd3;
1309
1407
  };
1310
1408
 
1311
1409
  // src/domains/registry/get/index.ts
1312
- import { Command as Command53, Option as Option9 } from "commander";
1410
+ import { Command as Command55, Option as Option11 } from "commander";
1313
1411
  var GetCommand3 = () => {
1314
- const cmd3 = new Command53("get");
1412
+ const cmd3 = new Command55("get");
1315
1413
  cmd3.description(
1316
1414
  "Download an API description version from the Scalar Registry"
1317
1415
  );
@@ -1322,41 +1420,44 @@ var GetCommand3 = () => {
1322
1420
  "API description version (defaults to latest)"
1323
1421
  );
1324
1422
  cmd3.addOption(
1325
- new Option9("--format <format>", "Output format").choices([...DOCUMENT_FORMATS]).default("json")
1423
+ new Option11("--format <format>", "Output format").choices([...DOCUMENT_FORMATS]).default("json")
1326
1424
  );
1327
1425
  cmd3.option("-o, --output <file>", "Output file (defaults to stdout)");
1328
1426
  completeFiles(cmd3, [], ["--output"]);
1329
1427
  cmd3.action(async (...args) => {
1330
- const { getAction } = await import("./chunks/action-QJMRAFOF.js");
1428
+ const { getAction } = await import("./chunks/action-PEG7AUA6.js");
1331
1429
  return getAction(...args);
1332
1430
  });
1333
1431
  return cmd3;
1334
1432
  };
1335
1433
 
1336
1434
  // src/domains/registry/list/index.ts
1337
- import { Command as Command54 } from "commander";
1435
+ import { Command as Command56 } from "commander";
1338
1436
  var ListCommand3 = () => {
1339
- const cmd3 = new Command54("list");
1437
+ const cmd3 = new Command56("list");
1340
1438
  cmd3.description("List Scalar Registry API descriptions in a team namespace");
1341
1439
  cmd3.option("--namespace <namespace>", "Team namespace");
1342
1440
  cmd3.option("--json", "Output Scalar Registry API metadata as JSON");
1343
1441
  cmd3.action(async (...args) => {
1344
- const { listAction } = await import("./chunks/action-PDSSIW2A.js");
1442
+ const { listAction } = await import("./chunks/action-GVW5PSPT.js");
1345
1443
  return listAction(...args);
1346
1444
  });
1347
1445
  return cmd3;
1348
1446
  };
1349
1447
 
1350
1448
  // src/domains/registry/update/index.ts
1351
- import { Command as Command55 } from "commander";
1449
+ import { Command as Command57 } from "commander";
1352
1450
  var UpdateCommand = () => {
1353
- const cmd3 = new Command55("update");
1451
+ const cmd3 = new Command57("update");
1354
1452
  cmd3.option("--json", "Output the mutation result as JSON without prompting");
1355
1453
  cmd3.description("Update API description metadata in the Scalar Registry");
1356
1454
  cmd3.argument("[namespace]", "Team namespace");
1357
1455
  cmd3.argument("[slug]", "API description slug");
1358
1456
  cmd3.option("--title <title>", "API description title");
1359
- cmd3.option("--description <description>", "API description summary");
1457
+ cmd3.option(
1458
+ "--description <description>",
1459
+ 'API description summary (pass "" to clear it)'
1460
+ );
1360
1461
  cmd3.option(
1361
1462
  "--public",
1362
1463
  "Make the whole entry public, including existing versions"
@@ -1370,7 +1471,7 @@ var UpdateCommand = () => {
1370
1471
  "\nOmitting visibility options leaves access unchanged.\nExample: scalar registry update acme my-api --private"
1371
1472
  );
1372
1473
  cmd3.action(async (...args) => {
1373
- const { updateAction } = await import("./chunks/action-3W4IC7QL.js");
1474
+ const { updateAction } = await import("./chunks/action-2WVJ2WEW.js");
1374
1475
  return updateAction(...args);
1375
1476
  });
1376
1477
  return cmd3;
@@ -1384,49 +1485,49 @@ var registryCommands = [
1384
1485
  ListCommand3,
1385
1486
  GetCommand3
1386
1487
  ];
1387
- var registryDomain = new Command56("registry");
1488
+ var registryDomain = new Command58("registry");
1388
1489
  registryDomain.description("Manage API descriptions in the Scalar Registry");
1389
1490
  registryCommands.forEach((command) => registryDomain.addCommand(command()));
1390
1491
  var registry_default = registryDomain;
1391
1492
 
1392
1493
  // src/domains/team/index.ts
1393
- import { Command as Command60 } from "commander";
1494
+ import { Command as Command62 } from "commander";
1394
1495
 
1395
1496
  // src/domains/team/get/index.ts
1396
- import { Command as Command57 } from "commander";
1497
+ import { Command as Command59 } from "commander";
1397
1498
  var GetCommand4 = () => {
1398
- const cmd3 = new Command57("get");
1499
+ const cmd3 = new Command59("get");
1399
1500
  cmd3.description("Show the current team and its namespaces");
1400
1501
  cmd3.option("--json", "Output the current team as JSON");
1401
1502
  cmd3.action(async (...args) => {
1402
- const { getAction } = await import("./chunks/action-2UZWKMSJ.js");
1503
+ const { getAction } = await import("./chunks/action-BYDJ4R4F.js");
1403
1504
  return getAction(...args);
1404
1505
  });
1405
1506
  return cmd3;
1406
1507
  };
1407
1508
 
1408
1509
  // src/domains/team/list/index.ts
1409
- import { Command as Command58 } from "commander";
1510
+ import { Command as Command60 } from "commander";
1410
1511
  var ListCommand4 = () => {
1411
- const cmd3 = new Command58("list");
1512
+ const cmd3 = new Command60("list");
1412
1513
  cmd3.description("List your Scalar teams");
1413
1514
  cmd3.option("--json", "Output teams as JSON");
1414
1515
  cmd3.action(async (...args) => {
1415
- const { listAction } = await import("./chunks/action-HDT7EO7W.js");
1516
+ const { listAction } = await import("./chunks/action-CBAL5CYB.js");
1416
1517
  return listAction(...args);
1417
1518
  });
1418
1519
  return cmd3;
1419
1520
  };
1420
1521
 
1421
1522
  // src/domains/team/set/index.ts
1422
- import { Command as Command59 } from "commander";
1523
+ import { Command as Command61 } from "commander";
1423
1524
  var SetCommand = () => {
1424
- const cmd3 = new Command59("set");
1525
+ const cmd3 = new Command61("set");
1425
1526
  cmd3.option("--json", "Output the result as JSON without prompting");
1426
1527
  cmd3.description("Select the current team");
1427
1528
  cmd3.option("--team <team>", "Team ID");
1428
1529
  cmd3.action(async (...args) => {
1429
- const { setAction } = await import("./chunks/action-B2WWTOF6.js");
1530
+ const { setAction } = await import("./chunks/action-BVZOA2G5.js");
1430
1531
  return setAction(...args);
1431
1532
  });
1432
1533
  return cmd3;
@@ -1434,7 +1535,7 @@ var SetCommand = () => {
1434
1535
 
1435
1536
  // src/domains/team/index.ts
1436
1537
  var teamCommands = [ListCommand4, GetCommand4, SetCommand];
1437
- var teamDomain = new Command60("team");
1538
+ var teamDomain = new Command62("team");
1438
1539
  teamDomain.description("List and switch between your Scalar teams");
1439
1540
  teamCommands.forEach((command) => {
1440
1541
  teamDomain.addCommand(command());
@@ -1442,8 +1543,7 @@ teamCommands.forEach((command) => {
1442
1543
  var team_default = teamDomain;
1443
1544
 
1444
1545
  // src/domains/upgrade/index.ts
1445
- import { execSync } from "node:child_process";
1446
- import { Command as Command61, Option as Option10 } from "commander";
1546
+ import { Command as Command63, Option as Option12 } from "commander";
1447
1547
 
1448
1548
  // src/helpers/upgrade.ts
1449
1549
  import semver from "semver";
@@ -1475,7 +1575,7 @@ async function getUpgradeInformation(timeoutMs = USER_INITIATED_TIMEOUT_MS) {
1475
1575
  async function checkUpgrade() {
1476
1576
  const emitOutput = () => {
1477
1577
  process.stderr.write(
1478
- "A new Scalar CLI version is available. Run `scalar upgrade` to install the latest version.\n"
1578
+ "A new Scalar CLI version is available. Run `scalar upgrade` for upgrade options.\n"
1479
1579
  );
1480
1580
  };
1481
1581
  const now = Date.now();
@@ -1512,12 +1612,380 @@ async function fetchReleaseVersion(url, timeoutMs) {
1512
1612
  return parsed.success ? ok(parsed.data) : err("Invalid release metadata");
1513
1613
  }
1514
1614
 
1615
+ // src/domains/upgrade/installation.ts
1616
+ import { execFileSync } from "node:child_process";
1617
+ import {
1618
+ existsSync,
1619
+ lstatSync,
1620
+ readdirSync,
1621
+ readFileSync,
1622
+ realpathSync
1623
+ } from "node:fs";
1624
+ import { homedir } from "node:os";
1625
+ import {
1626
+ basename,
1627
+ delimiter,
1628
+ dirname,
1629
+ isAbsolute,
1630
+ join,
1631
+ resolve,
1632
+ win32
1633
+ } from "node:path";
1634
+ var manifestSchema = external_exports.object({
1635
+ name: external_exports.string().optional(),
1636
+ version: external_exports.string().optional(),
1637
+ packageManager: external_exports.string().optional(),
1638
+ workspaces: external_exports.union([
1639
+ external_exports.array(external_exports.string()),
1640
+ external_exports.object({ packages: external_exports.array(external_exports.string()).optional() })
1641
+ ]).optional(),
1642
+ dependencies: external_exports.record(external_exports.string(), external_exports.string()).optional(),
1643
+ devDependencies: external_exports.record(external_exports.string(), external_exports.string()).optional()
1644
+ });
1645
+ function readManifest(directory) {
1646
+ try {
1647
+ const parsed = manifestSchema.safeParse(
1648
+ JSON.parse(readFileSync(join(directory, "package.json"), "utf8"))
1649
+ );
1650
+ return parsed.success ? ok(parsed.data) : err("Invalid package manifest");
1651
+ } catch {
1652
+ return err("Could not read package manifest");
1653
+ }
1654
+ }
1655
+ function hasPackageName(directory, name2, manifest = readManifest) {
1656
+ const result = manifest(directory);
1657
+ return result.ok && result.data.name === name2;
1658
+ }
1659
+ function canonical(path2) {
1660
+ try {
1661
+ return ok(realpathSync(path2));
1662
+ } catch {
1663
+ return err("Could not resolve installation path");
1664
+ }
1665
+ }
1666
+ function ancestors(directory) {
1667
+ const parent = dirname(directory);
1668
+ return parent === directory ? [directory] : [directory, ...ancestors(parent)];
1669
+ }
1670
+ function npmEntry(env, platform, manifest) {
1671
+ const path2 = env.PATH ?? env.Path ?? "";
1672
+ for (const directory of path2.split(platform === "win32" ? ";" : delimiter)) {
1673
+ if (!isAbsolute(directory)) continue;
1674
+ const entry = platform === "win32" ? ok(join(directory, "node_modules/npm/bin/npm-cli.js")) : canonical(join(directory, "npm"));
1675
+ if (entry.ok && hasPackageName(dirname(dirname(entry.data)), "npm", manifest) && existsSync(entry.data))
1676
+ return entry.data;
1677
+ }
1678
+ return void 0;
1679
+ }
1680
+ function probe(executable, args, cwd, env) {
1681
+ try {
1682
+ return ok(
1683
+ execFileSync(executable, args, {
1684
+ cwd,
1685
+ env,
1686
+ encoding: "utf8",
1687
+ timeout: 3e3,
1688
+ stdio: ["ignore", "pipe", "pipe"]
1689
+ }).trim()
1690
+ );
1691
+ } catch {
1692
+ return err("Could not query the package manager");
1693
+ }
1694
+ }
1695
+ function managerFor(directory, manifest) {
1696
+ const directories = ancestors(directory).filter(
1697
+ (path3) => !path3.split(/[\\/]/).includes("node_modules")
1698
+ );
1699
+ const metadata = directories.map((path3) => {
1700
+ const pkg2 = manifest(path3);
1701
+ const locks2 = [
1702
+ ...existsSync(join(path3, "package-lock.json")) || existsSync(join(path3, "npm-shrinkwrap.json")) ? ["npm"] : [],
1703
+ ...existsSync(join(path3, "pnpm-lock.yaml")) ? ["pnpm"] : [],
1704
+ ...existsSync(join(path3, "yarn.lock")) ? ["yarn"] : []
1705
+ ];
1706
+ return { path: path3, pkg: pkg2, locks: locks2 };
1707
+ }).find(
1708
+ ({ pkg: pkg2, locks: locks2 }) => pkg2.ok && pkg2.data.packageManager || locks2.length
1709
+ );
1710
+ if (!metadata) return void 0;
1711
+ const { path: path2, pkg, locks } = metadata;
1712
+ if (path2 !== directory && !(pkg.ok && pkg.data.workspaces) && !existsSync(join(path2, "pnpm-workspace.yaml")))
1713
+ return void 0;
1714
+ const declared = pkg.ok ? pkg.data.packageManager : void 0;
1715
+ const match = declared?.match(/^(npm|pnpm|yarn)@(\d+)\./);
1716
+ if (declared && !match) return void 0;
1717
+ const managers = /* @__PURE__ */ new Set([...locks, ...match ? [match[1]] : []]);
1718
+ if (managers.size !== 1) return void 0;
1719
+ const manager = match?.[1] ?? locks[0];
1720
+ if (manager !== "npm" && manager !== "pnpm" && manager !== "yarn")
1721
+ return void 0;
1722
+ return {
1723
+ manager,
1724
+ yarnModern: manager === "yarn" && (match ? Number(match[2]) >= 2 : !readFileSync(join(path2, "yarn.lock"), "utf8").includes(
1725
+ "# yarn lockfile v1"
1726
+ ))
1727
+ };
1728
+ }
1729
+ function resolvesPackage(directory, active) {
1730
+ const candidate = ancestors(directory).map((path3) => join(path3, "node_modules/@scalar/cli")).find(existsSync);
1731
+ if (!candidate) return false;
1732
+ const path2 = canonical(candidate);
1733
+ return path2.ok && path2.data === active;
1734
+ }
1735
+ function globalOwner(manager, active, cwd, env, platform, manifest) {
1736
+ const args = manager === "pnpm" ? ["root", "--global"] : ["--silent", "global", "dir"];
1737
+ const shell = env.ComSpec ?? "";
1738
+ if (platform === "win32" && (!shell || !win32.isAbsolute(shell)))
1739
+ return err("Could not locate the Windows command interpreter");
1740
+ const probeEnv = {
1741
+ ...env,
1742
+ YARN_IGNORE_PATH: "1",
1743
+ COREPACK_ENABLE_STRICT: "0",
1744
+ COREPACK_ENABLE_PROJECT_SPEC: "0",
1745
+ COREPACK_ENABLE_NETWORK: "0"
1746
+ };
1747
+ const global = platform === "win32" ? probe(shell, ["/d", "/s", "/c", [manager, ...args].join(" ")], cwd, {
1748
+ ...probeEnv,
1749
+ NoDefaultCurrentDirectoryInExePath: "1"
1750
+ }) : probe(manager, args, cwd, probeEnv);
1751
+ if (!global.ok || !isAbsolute(global.data))
1752
+ return err("Could not query the global directory");
1753
+ try {
1754
+ const candidates = manager === "yarn" ? [global.data] : basename(global.data) === "node_modules" ? [dirname(global.data)] : (
1755
+ // pnpm 11+ registers active install groups as links into isolated projects.
1756
+ readdirSync(global.data, { withFileTypes: true }).filter((entry) => entry.isSymbolicLink()).map((entry) => join(global.data, entry.name))
1757
+ );
1758
+ for (const directory of candidates) {
1759
+ const pkg = manifest(directory);
1760
+ if (!pkg.ok || !pkg.data.dependencies?.["@scalar/cli"]) continue;
1761
+ const target = canonical(join(directory, "node_modules/@scalar/cli"));
1762
+ if (target.ok && target.data === active) return canonical(directory);
1763
+ }
1764
+ } catch {
1765
+ return err("Could not read the global installation");
1766
+ }
1767
+ return err("The global installation does not own this package");
1768
+ }
1769
+ function isGlobalTarget(installation, manifest = readManifest) {
1770
+ const target = join(installation.root, "@scalar/cli");
1771
+ const rootPath = canonical(installation.root);
1772
+ const targetPath = canonical(target);
1773
+ if (!rootPath.ok || !targetPath.ok) return false;
1774
+ try {
1775
+ return !lstatSync(target).isSymbolicLink() && targetPath.data === join(rootPath.data, "@scalar/cli") && targetPath.data === installation.directory && hasPackageName(target, "@scalar/cli", manifest) && !existsSync(join(installation.root, ".pnpm")) && !existsSync(join(installation.root, ".yarn-integrity")) && !existsSync(join(installation.root, ".yarn-state.yml"));
1776
+ } catch {
1777
+ return false;
1778
+ }
1779
+ }
1780
+ function detectInstallation(options = {}) {
1781
+ const {
1782
+ moduleDirectory = import.meta.dirname,
1783
+ cwd = process.cwd(),
1784
+ env = process.env,
1785
+ platform = process.platform,
1786
+ homeDirectory = homedir()
1787
+ } = options;
1788
+ const manifests = /* @__PURE__ */ new Map();
1789
+ const manifest = (directory2) => {
1790
+ const cached = manifests.get(directory2);
1791
+ if (cached) return cached;
1792
+ const result = readManifest(directory2);
1793
+ manifests.set(directory2, result);
1794
+ return result;
1795
+ };
1796
+ if (env.SCALAR_CLI_DISTRIBUTION === "portable") return { kind: "portable" };
1797
+ const directory = ancestors(resolve(moduleDirectory)).find(
1798
+ (path2) => hasPackageName(path2, "@scalar/cli", manifest)
1799
+ );
1800
+ const resolved = directory ? canonical(directory) : err("Could not locate the running Scalar CLI package.");
1801
+ const unknown = (reason) => ({
1802
+ kind: "unknown",
1803
+ path: resolved.ok ? resolved.data : moduleDirectory,
1804
+ reason
1805
+ });
1806
+ if (!resolved.ok) return unknown(resolved.error);
1807
+ const active = resolved.data;
1808
+ const segments = active.replaceAll("\\", "/");
1809
+ if (/\/_npx\/[^/]+\/node_modules\//.test(segments))
1810
+ return { kind: "temporary", manager: "npm" };
1811
+ if (/\/pnpm(?:-cache)?\/dlx\/[^/]+\//.test(segments))
1812
+ return { kind: "temporary", manager: "pnpm" };
1813
+ if (/\/dlx-[^/]+\/node_modules\//.test(segments))
1814
+ return { kind: "temporary", manager: "yarn" };
1815
+ const candidates = [
1816
+ .../* @__PURE__ */ new Set([...ancestors(resolve(cwd)), ...ancestors(active)])
1817
+ ];
1818
+ for (const project of candidates) {
1819
+ if (project.split(/[\\/]/).includes("node_modules")) continue;
1820
+ const packageResult = manifest(project);
1821
+ if (!packageResult.ok) continue;
1822
+ const pkg = packageResult.data;
1823
+ if (!pkg?.dependencies?.["@scalar/cli"] && !pkg?.devDependencies?.["@scalar/cli"])
1824
+ continue;
1825
+ if (!resolvesPackage(project, active)) continue;
1826
+ try {
1827
+ const manager = managerFor(project, manifest);
1828
+ if (!manager)
1829
+ return unknown(
1830
+ "The owning project has missing or conflicting package-manager metadata."
1831
+ );
1832
+ if (manager.manager !== "npm" && !manager.yarnModern) {
1833
+ const global = globalOwner(
1834
+ manager.manager,
1835
+ active,
1836
+ homeDirectory,
1837
+ env,
1838
+ platform,
1839
+ manifest
1840
+ );
1841
+ const projectDirectory = canonical(project);
1842
+ if (global.ok && projectDirectory.ok && global.data === projectDirectory.data)
1843
+ return {
1844
+ kind: "global-guidance",
1845
+ manager: manager.manager,
1846
+ directory: global.data
1847
+ };
1848
+ }
1849
+ return {
1850
+ kind: "project",
1851
+ ...manager,
1852
+ directory: project,
1853
+ dev: !pkg.dependencies?.["@scalar/cli"],
1854
+ workspaceRoot: manager.manager === "pnpm" ? existsSync(join(project, "pnpm-workspace.yaml")) : Boolean(pkg.workspaces)
1855
+ };
1856
+ } catch {
1857
+ return unknown(
1858
+ "Could not read the owning project\u2019s package-manager metadata."
1859
+ );
1860
+ }
1861
+ }
1862
+ const npm = npmEntry(env, platform, manifest);
1863
+ if (npm) {
1864
+ const snapshot = { ...env };
1865
+ const prefix = probe(
1866
+ process.execPath,
1867
+ [npm, "prefix", "--global"],
1868
+ homeDirectory,
1869
+ snapshot
1870
+ );
1871
+ if (prefix.ok && isAbsolute(prefix.data)) {
1872
+ const root = probe(
1873
+ process.execPath,
1874
+ [npm, "root", "--global", "--prefix", prefix.data],
1875
+ homeDirectory,
1876
+ snapshot
1877
+ );
1878
+ if (root.ok && isAbsolute(root.data)) {
1879
+ const installation = {
1880
+ kind: "npm-global",
1881
+ directory: active,
1882
+ root: root.data,
1883
+ prefix: prefix.data,
1884
+ npm,
1885
+ cwd: homeDirectory,
1886
+ env: snapshot
1887
+ };
1888
+ const expectedRoot = canonical(
1889
+ platform === "win32" ? join(prefix.data, "node_modules") : join(prefix.data, "lib/node_modules")
1890
+ );
1891
+ const actualRoot = canonical(root.data);
1892
+ if (expectedRoot.ok && actualRoot.ok && actualRoot.data === expectedRoot.data && isGlobalTarget(installation, manifest))
1893
+ return installation;
1894
+ }
1895
+ }
1896
+ }
1897
+ for (const manager of ["pnpm", "yarn"]) {
1898
+ const global = globalOwner(
1899
+ manager,
1900
+ active,
1901
+ homeDirectory,
1902
+ env,
1903
+ platform,
1904
+ manifest
1905
+ );
1906
+ if (global.ok)
1907
+ return { kind: "global-guidance", manager, directory: global.data };
1908
+ }
1909
+ return unknown(
1910
+ "Could not verify which package manager owns this installation."
1911
+ );
1912
+ }
1913
+ function upgradeGlobal(installation, version2) {
1914
+ if (!isGlobalTarget(installation))
1915
+ return err(
1916
+ "The installation target changed. Nothing was installed; run scalar upgrade again."
1917
+ );
1918
+ try {
1919
+ execFileSync(
1920
+ process.execPath,
1921
+ [
1922
+ installation.npm,
1923
+ "install",
1924
+ "--global",
1925
+ "--prefix",
1926
+ installation.prefix,
1927
+ `@scalar/cli@${version2}`
1928
+ ],
1929
+ {
1930
+ cwd: installation.cwd,
1931
+ env: installation.env,
1932
+ stdio: "inherit"
1933
+ }
1934
+ );
1935
+ } catch {
1936
+ return err(
1937
+ "npm could not complete the upgrade. Check its diagnostics before retrying."
1938
+ );
1939
+ }
1940
+ const installed = readManifest(installation.directory);
1941
+ if (!installed.ok || !isGlobalTarget(installation) || installed.data.version !== version2) {
1942
+ return err(
1943
+ `npm completed, but Scalar CLI ${version2} could not be verified at ${installation.directory}. Inspect this installation before retrying.`
1944
+ );
1945
+ }
1946
+ return ok(installed.data.version);
1947
+ }
1948
+
1515
1949
  // src/domains/upgrade/instructions.ts
1516
- function getUpgradeInstructions(portable, platform, arch, env, latestVersion) {
1517
- if (!portable)
1518
- return ["To upgrade, run:", "npm install -g @scalar/cli@latest"];
1950
+ function getUpgradeInstructions(installation, platform, arch, env, latestVersion, execPath = process.execPath) {
1519
1951
  const quoteBash = (value) => `'${value.replaceAll("'", `'"'"'`)}'`;
1520
1952
  const quotePowerShell = (value) => `'${value.replaceAll("'", "''")}'`;
1953
+ if (installation.kind === "unknown")
1954
+ return [
1955
+ installation.reason,
1956
+ `Running package: ${installation.path}`,
1957
+ "Nothing was installed. Use the package manager or installer that originally installed this copy of Scalar CLI."
1958
+ ];
1959
+ if (installation.kind === "npm-global")
1960
+ return [
1961
+ `To upgrade the npm installation at ${installation.directory}, run:`,
1962
+ `${platform === "win32" ? "& " : ""}${[execPath, installation.npm, "install", "--global", "--prefix", installation.prefix, "@scalar/cli@latest"].map(platform === "win32" ? quotePowerShell : quoteBash).join(" ")}`
1963
+ ];
1964
+ if (installation.kind === "temporary")
1965
+ return [
1966
+ "This is a temporary installation. Nothing was installed. To use the latest Scalar CLI on your next invocation, run:",
1967
+ installation.manager === "npm" ? "npx @scalar/cli@latest --help" : `${installation.manager} dlx @scalar/cli@latest --help`
1968
+ ];
1969
+ if (installation.kind === "global-guidance")
1970
+ return [
1971
+ `Nothing was installed. Using the ${installation.manager} installation that owns ${installation.directory}, run:`,
1972
+ installation.manager === "pnpm" ? "pnpm add --global @scalar/cli@latest" : "yarn global add @scalar/cli@latest"
1973
+ ];
1974
+ if (installation.kind === "project") {
1975
+ const devFlag = installation.manager === "npm" ? installation.dev ? "--save-dev" : "--save-prod" : installation.dev ? "-D" : "";
1976
+ const rootFlag = !installation.workspaceRoot ? "" : installation.manager === "pnpm" ? "-w" : installation.manager === "yarn" && !installation.yarnModern ? "-W" : "";
1977
+ const command = [
1978
+ installation.manager,
1979
+ installation.manager === "npm" ? "install" : "add",
1980
+ devFlag,
1981
+ rootFlag,
1982
+ "@scalar/cli@latest"
1983
+ ].filter(Boolean).join(" ");
1984
+ return [
1985
+ `Nothing was installed. From the owning project at ${installation.directory}, run:`,
1986
+ command
1987
+ ];
1988
+ }
1521
1989
  const overrides = [
1522
1990
  "SCALAR_INSTALL_DIR",
1523
1991
  "SCALAR_BIN_DIR",
@@ -1553,28 +2021,30 @@ function getUpgradeInstructions(portable, platform, arch, env, latestVersion) {
1553
2021
  }
1554
2022
 
1555
2023
  // src/domains/upgrade/index.ts
1556
- var cmd2 = new Command61("upgrade");
2024
+ var cmd2 = new Command63("upgrade");
1557
2025
  cmd2.description("Upgrade the Scalar CLI to the latest version");
1558
2026
  cmd2.option(
1559
2027
  "--check",
1560
2028
  "Show installed and available versions without installing"
1561
2029
  );
1562
2030
  cmd2.addOption(
1563
- new Option10(
2031
+ new Option12(
1564
2032
  "--json",
1565
2033
  "Show the version check as JSON without installing"
1566
2034
  ).implies({ check: true })
1567
2035
  );
1568
2036
  cmd2.addHelpText(
1569
2037
  "after",
1570
- "\nExamples:\n scalar upgrade\n scalar upgrade --check\n scalar upgrade --json"
2038
+ "\nAutomatically upgrades verified global npm installations. Other installations receive upgrade instructions.\n\nExamples:\n scalar upgrade\n scalar upgrade --check\n scalar upgrade --json"
1571
2039
  );
1572
2040
  cmd2.action(async (options) => {
1573
- const portable = process.env.SCALAR_CLI_DISTRIBUTION === "portable";
1574
2041
  const result = await getUpgradeInformation();
1575
2042
  const upgradeStatus = result.ok ? result.data : null;
1576
- const instructions = getUpgradeInstructions(
1577
- portable,
2043
+ let detected;
2044
+ const installation = () => detected ??= detectInstallation();
2045
+ const portable = process.env.SCALAR_CLI_DISTRIBUTION === "portable";
2046
+ const instructions = upgradeStatus?.upgrade === false ? [] : getUpgradeInstructions(
2047
+ installation(),
1578
2048
  process.platform,
1579
2049
  process.arch,
1580
2050
  process.env,
@@ -1622,7 +2092,8 @@ ${instructions.join("\n\n")}
1622
2092
  process.stdout.write("Scalar CLI is already up to date.\n");
1623
2093
  return;
1624
2094
  }
1625
- if (portable || options.check) {
2095
+ const target = installation();
2096
+ if (target.kind !== "npm-global" || options.check) {
1626
2097
  process.stdout.write(
1627
2098
  `
1628
2099
  A Scalar CLI update is available.
@@ -1630,23 +2101,28 @@ A Scalar CLI update is available.
1630
2101
  ${instructions.join("\n\n")}
1631
2102
  `
1632
2103
  );
2104
+ if (target.kind === "unknown" && !options.check) process.exitCode = 1;
1633
2105
  return;
1634
2106
  }
1635
2107
  process.stderr.write(
1636
- `Upgrading from ${upgradeStatus.currentVersion} to ${upgradeStatus.latestVersion}\u2026
2108
+ `Upgrading ${target.directory} from ${upgradeStatus.currentVersion} to ${upgradeStatus.latestVersion}\u2026
1637
2109
  `
1638
2110
  );
1639
- try {
1640
- execSync(`npm install -g ${upgradeStatus.name}@latest`, {
1641
- stdio: "inherit"
1642
- });
1643
- process.stdout.write("Scalar CLI upgraded to the latest version.\n");
1644
- } catch {
1645
- process.stderr.write(`Upgrade failed.
1646
- ${instructions.join("\n")}
1647
- `);
2111
+ const upgraded = upgradeGlobal(target, upgradeStatus.latestVersion);
2112
+ if (!upgraded.ok) {
2113
+ process.stderr.write(
2114
+ `Upgrade failed. ${upgraded.error}
2115
+
2116
+ ${instructions.join("\n\n")}
2117
+ `
2118
+ );
1648
2119
  process.exitCode = 1;
2120
+ return;
1649
2121
  }
2122
+ process.stdout.write(
2123
+ `Scalar CLI ${upgraded.data} installed at ${target.directory}.
2124
+ `
2125
+ );
1650
2126
  });
1651
2127
  var upgrade_default = cmd2;
1652
2128
 
@@ -1703,7 +2179,7 @@ program.hook("preAction", (_program, command) => {
1703
2179
  const visibility = normalizeVisibility(command.opts());
1704
2180
  if (!visibility.ok) command.error(visibility.error);
1705
2181
  }
1706
- if (process.stdout.isTTY && process.stderr.isTTY && process.argv[2] !== "upgrade" && process.argv[2] !== "context" && process.argv[2] !== "completion" && process.argv[2] !== "__complete" && !process.argv.includes("--json") && process.env.SCALAR_CLI_DISTRIBUTION !== "portable") {
2182
+ if (process.stdout.isTTY && process.stderr.isTTY && process.argv[2] !== "upgrade" && process.argv[2] !== "context" && process.argv[2] !== "completion" && process.argv[2] !== "__complete" && command.name() !== "transform" && !process.argv.includes("--json") && process.env.SCALAR_CLI_DISTRIBUTION !== "portable") {
1707
2183
  checkUpgrade().catch(() => {
1708
2184
  });
1709
2185
  }