@scalar/cli 2.8.0 → 2.11.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 (111) hide show
  1. package/README.md +84 -1076
  2. package/chunks/action-25QMCP5G.js +122 -0
  3. package/chunks/{action-354TUG4H.js → action-2VF6LODL.js} +20 -16
  4. package/chunks/{action-XIUO64C7.js → action-5I4XDPPG.js} +20 -14
  5. package/chunks/action-6M5PTDF6.js +100 -0
  6. package/chunks/{action-NVI5DWFP.js → action-73ELLN3T.js} +8 -11
  7. package/chunks/{action-Y6NXJQ4H.js → action-7H3AWCHX.js} +21 -16
  8. package/chunks/{action-LLH4QPXM.js → action-BRSLSOE5.js} +19 -18
  9. package/chunks/{action-EOAVVL52.js → action-CQQCKSNS.js} +17 -22
  10. package/chunks/action-D5QWDNQ2.js +65 -0
  11. package/chunks/{action-Y7OUGD56.js → action-DQDHBOLJ.js} +34 -31
  12. package/chunks/{action-5SK5NE7E.js → action-EYPYQQVM.js} +18 -23
  13. package/chunks/{action-YRX6SN5F.js → action-FMA5ECUA.js} +12 -10
  14. package/chunks/{action-7PEQXDWT.js → action-GXDJLF2G.js} +134 -25
  15. package/chunks/action-HUICEXJZ.js +75 -0
  16. package/chunks/action-IH6G77C5.js +38 -0
  17. package/chunks/{action-H3RTILLM.js → action-IIQMZVRJ.js} +1 -1
  18. package/chunks/action-IQM54ITT.js +164 -0
  19. package/chunks/{action-UIKH4SZX.js → action-J5TO3UJW.js} +32 -26
  20. package/chunks/{action-H6OUJWWM.js → action-KC3ZCNDR.js} +17 -22
  21. package/chunks/{action-6BYGBXRC.js → action-L7TMS3Q3.js} +44 -37
  22. package/chunks/{action-GWXLHL2Z.js → action-LAAHRDSR.js} +5 -4
  23. package/chunks/{action-FCAYFPVR.js → action-LR75GHBA.js} +14 -11
  24. package/chunks/action-MJMLQFLT.js +1552 -0
  25. package/chunks/action-NHU4CUKT.js +130 -0
  26. package/chunks/action-NKTFNFU7.js +64 -0
  27. package/chunks/{action-F7A2K74G.js → action-NMW5WPD2.js} +12 -16
  28. package/chunks/{action-VOFDW3U2.js → action-OTPXODUE.js} +8 -7
  29. package/chunks/{action-43YBNBDR.js → action-RPCDNGCI.js} +54 -39
  30. package/chunks/{action-QQZLPI42.js → action-RQCXSJPZ.js} +55 -27
  31. package/chunks/action-SOYSVG67.js +147 -0
  32. package/chunks/action-Y7EBKCUU.js +16 -0
  33. package/chunks/{action-WFDNRA7D.js → action-YN4TE7TG.js} +24 -23
  34. package/chunks/{action-AQRPFQKI.js → action-ZGNVWTHZ.js} +14 -12
  35. package/chunks/action-ZKKRPLDK.js +64 -0
  36. package/chunks/{action-HT2DJ34Z.js → action-ZUZL7R3H.js} +20 -15
  37. package/chunks/{actions-OGIVBQC7.js → actions-S6K76HCW.js} +46 -19
  38. package/chunks/{agent-ASPV3R5U.js → agent-IRNEV4K5.js} +46 -9
  39. package/chunks/{asyncapi-QNFKXHEI.js → asyncapi-WQPIQMEZ.js} +15 -10
  40. package/chunks/{build.action-NM6CAE5F.js → build.action-CLBVKFWD.js} +28 -24
  41. package/chunks/chunk-25XERWCE.js +1058 -0
  42. package/chunks/chunk-3RIUDHLG.js +467 -0
  43. package/chunks/{chunk-MLSZVVTT.js → chunk-3TFOA64C.js} +19 -8
  44. package/chunks/{chunk-HGOD6THU.js → chunk-4JKXZ5CF.js} +12 -25
  45. package/chunks/{chunk-C2KAWRIX.js → chunk-5ENKYZA4.js} +1 -1
  46. package/chunks/{chunk-W24BETFG.js → chunk-5L7V7RCH.js} +10 -10
  47. package/chunks/chunk-6PSYZO3U.js +24 -0
  48. package/chunks/{chunk-IMG35UXX.js → chunk-ALYM4ZB2.js} +1 -1
  49. package/chunks/chunk-AVZFSWPD.js +37 -0
  50. package/chunks/{chunk-5UHLAJQD.js → chunk-BQYVSPAI.js} +36 -10
  51. package/chunks/{chunk-XXSQUBXS.js → chunk-CSSTCHHF.js} +6212 -4642
  52. package/chunks/chunk-DFOZG7ZV.js +15 -0
  53. package/chunks/{chunk-22HYZ7LE.js → chunk-DQD2753S.js} +3 -3
  54. package/chunks/{action-F2ZJNURT.js → chunk-EBNFCIKS.js} +7 -10
  55. package/chunks/{chunk-EXY3ZTV4.js → chunk-F3OPMYME.js} +143 -301
  56. package/chunks/{chunk-FDC2IESH.js → chunk-FG5AOTDN.js} +8519 -14702
  57. package/chunks/chunk-GKCVATQJ.js +92 -0
  58. package/chunks/{chunk-PH3WFNXJ.js → chunk-GMHIK5K2.js} +1 -1
  59. package/chunks/{chunk-GTV2BVXV.js → chunk-GYR5E6RB.js} +2 -2
  60. package/chunks/{chunk-OJ2EWIJH.js → chunk-HZN6IIPZ.js} +11 -6
  61. package/chunks/{chunk-IKT5F47M.js → chunk-I57ID5K7.js} +24 -11
  62. package/chunks/{chunk-BPGFSSUH.js → chunk-KOD2HX5I.js} +1 -1
  63. package/chunks/{chunk-L3UXDCBI.js → chunk-LOLVJNI5.js} +4 -4
  64. package/chunks/{chunk-KCCFN4F7.js → chunk-MN2AFJXM.js} +36 -29
  65. package/chunks/{chunk-UXJ753NV.js → chunk-N5CJ5MTY.js} +5 -13
  66. package/chunks/chunk-NAC63XJF.js +10 -0
  67. package/chunks/{chunk-2OCWX42S.js → chunk-NWJ37GI2.js} +166 -22
  68. package/chunks/{chunk-3ZJYGGAA.js → chunk-ORCUZITN.js} +1 -1
  69. package/chunks/chunk-QMLRYD76.js +24 -0
  70. package/chunks/{chunk-KKRGBXCE.js → chunk-SEURG74P.js} +303 -209
  71. package/chunks/{chunk-R5LK6VPY.js → chunk-SOV4POMS.js} +370 -264
  72. package/chunks/chunk-T34TL6KL.js +222 -0
  73. package/chunks/{chunk-5DEU2DVL.js → chunk-U6VE6JOS.js} +3 -15
  74. package/chunks/{chunk-YILQODZF.js → chunk-UFSFY7Z4.js} +23 -20
  75. package/chunks/{chunk-6YPQGVF4.js → chunk-ULRJZXMS.js} +1 -1
  76. package/chunks/chunk-US54KYOJ.js +131 -0
  77. package/chunks/chunk-V6LUKXBV.js +37 -0
  78. package/chunks/{chunk-5JLVQVKO.js → chunk-VRZSDUZK.js} +190 -152
  79. package/chunks/chunk-VUXPDHTQ.js +22 -0
  80. package/chunks/chunk-XP5UM7SF.js +21 -0
  81. package/chunks/chunk-Y6XGC4K5.js +311 -0
  82. package/chunks/{create.action-FUQ2BVJA.js → create.action-ITEOQ644.js} +34 -30
  83. package/chunks/{delete.action-47E66R3I.js → delete.action-77MFPLUN.js} +30 -26
  84. package/chunks/{delete.action-BTDFH7WY.js → delete.action-C6VX4S5Q.js} +30 -26
  85. package/chunks/{get.action-XC7KC2JO.js → get.action-3BP4FHZC.js} +20 -14
  86. package/chunks/get.action-LNBOWUVE.js +95 -0
  87. package/chunks/list.action-6CRFQPJT.js +156 -0
  88. package/chunks/list.action-KR5YIDR4.js +126 -0
  89. package/chunks/{publish.action-OS27XOX4.js → publish.action-YBORRPBM.js} +49 -42
  90. package/chunks/query-WKATAJJ6.js +129 -0
  91. package/chunks/scripts-6CI6U32J.js +102 -0
  92. package/chunks/{update.action-AEIBLCWD.js → update.action-O7TSXDGV.js} +34 -27
  93. package/chunks/{update.action-ZMS4CQ3T.js → update.action-QZI7M2MV.js} +34 -27
  94. package/index.js +579 -382
  95. package/package.json +15 -14
  96. package/skills/scalar-cli/SKILL.md +52 -46
  97. package/template.md +71 -136
  98. package/chunks/action-CA4QYPI6.js +0 -125
  99. package/chunks/action-JAHFRYWZ.js +0 -423
  100. package/chunks/action-KTYOCA2V.js +0 -229
  101. package/chunks/action-LEUD5P2U.js +0 -92
  102. package/chunks/action-LXGXKXZZ.js +0 -72
  103. package/chunks/action-W3C53GPH.js +0 -54
  104. package/chunks/action-YLF2G4G5.js +0 -37
  105. package/chunks/chunk-6XWCMJDB.js +0 -404
  106. package/chunks/chunk-K74E42RV.js +0 -7311
  107. package/chunks/chunk-QVQ4PNVL.js +0 -610
  108. package/chunks/chunk-XEDGMZJD.js +0 -366
  109. package/chunks/list.action-LXKEUYKO.js +0 -116
  110. package/chunks/list.action-OFGLMRE7.js +0 -95
  111. package/docs.html +0 -6245
package/index.js CHANGED
@@ -2,7 +2,11 @@
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-BPGFSSUH.js";
5
+ } from "./chunks/chunk-KOD2HX5I.js";
6
+ import {
7
+ buildCliContext,
8
+ runnableCommands
9
+ } from "./chunks/chunk-EBNFCIKS.js";
6
10
  import {
7
11
  openBrowser
8
12
  } from "./chunks/chunk-JFIXNSPP.js";
@@ -13,45 +17,51 @@ import {
13
17
  BundleCommand,
14
18
  parseFetchLimit,
15
19
  parsePort
16
- } from "./chunks/chunk-OJ2EWIJH.js";
20
+ } from "./chunks/chunk-HZN6IIPZ.js";
21
+ import {
22
+ completeFiles
23
+ } from "./chunks/chunk-DFOZG7ZV.js";
24
+ import {
25
+ DOCUMENT_FORMATS,
26
+ PRIVACY_VALUES
27
+ } from "./chunks/chunk-NAC63XJF.js";
17
28
  import {
18
29
  SdkLanguage
19
- } from "./chunks/chunk-FDC2IESH.js";
20
- import "./chunks/chunk-C2KAWRIX.js";
30
+ } from "./chunks/chunk-Y6XGC4K5.js";
31
+ import {
32
+ checkNodeVersion
33
+ } from "./chunks/chunk-VUXPDHTQ.js";
21
34
  import {
22
- checkNodeVersion,
23
- clearAuthData,
24
- getAuthData,
25
35
  getMetadata,
36
+ logout,
26
37
  setMetadata
27
- } from "./chunks/chunk-QVQ4PNVL.js";
38
+ } from "./chunks/chunk-3RIUDHLG.js";
39
+ import "./chunks/chunk-N5CJ5MTY.js";
28
40
  import {
29
41
  bin,
30
42
  name,
31
43
  version
32
- } from "./chunks/chunk-UXJ753NV.js";
33
- import "./chunks/chunk-5UHLAJQD.js";
34
- import "./chunks/chunk-5JLVQVKO.js";
44
+ } from "./chunks/chunk-US54KYOJ.js";
45
+ import "./chunks/chunk-BQYVSPAI.js";
46
+ import "./chunks/chunk-VRZSDUZK.js";
35
47
  import {
36
48
  requireInteractive
37
49
  } from "./chunks/chunk-EGOXR5FB.js";
38
- import "./chunks/chunk-K74E42RV.js";
39
- import "./chunks/chunk-6XWCMJDB.js";
40
- import "./chunks/chunk-4ORL4MST.js";
41
50
  import {
42
51
  output
43
52
  } from "./chunks/chunk-T5HJUAWB.js";
44
- import "./chunks/chunk-XEDGMZJD.js";
53
+ import "./chunks/chunk-25XERWCE.js";
54
+ import "./chunks/chunk-AVZFSWPD.js";
45
55
  import {
46
56
  external_exports
47
- } from "./chunks/chunk-IKT5F47M.js";
57
+ } from "./chunks/chunk-I57ID5K7.js";
48
58
  import "./chunks/chunk-3MZYUBJ6.js";
49
59
 
50
60
  // src/index.ts
51
61
  import { Agent, setGlobalDispatcher } from "undici";
52
62
 
53
63
  // src/program.ts
54
- import { Command as Command54 } from "commander";
64
+ import { Command as Command59 } from "commander";
55
65
 
56
66
  // src/domains/schema/index.ts
57
67
  import { Command as Command6 } from "commander";
@@ -60,28 +70,31 @@ import { Command as Command6 } from "commander";
60
70
  import { Command } from "commander";
61
71
  var DeleteSchemaCommand = () => {
62
72
  const cmd3 = new Command("delete");
63
- cmd3.description("Delete a schema.");
73
+ cmd3.description("Delete a shared schema");
64
74
  cmd3.option("-s, --slug <slug>", "Schema slug");
65
75
  cmd3.option("-n, --namespace <namespace>", "Team namespace");
66
76
  cmd3.action(async (...args) => {
67
- const { deleteAction } = await import("./chunks/delete.action-47E66R3I.js");
77
+ const { deleteAction } = await import("./chunks/delete.action-77MFPLUN.js");
68
78
  return deleteAction(...args);
69
79
  });
70
80
  return cmd3;
71
81
  };
72
82
 
73
83
  // src/domains/schema/get.ts
74
- import { Command as Command2 } from "commander";
84
+ import { Command as Command2, Option } from "commander";
75
85
  var GetSchemaCommand = () => {
76
86
  const cmd3 = new Command2("get");
77
- cmd3.description("Get a schema document version from the Scalar registry");
87
+ cmd3.description("Download a shared schema version from the Scalar Registry");
78
88
  cmd3.argument("[namespace]", "Team namespace");
79
89
  cmd3.argument("[slug]", "Schema slug");
80
90
  cmd3.option("--version <version>", "Schema version (defaults to latest)");
81
- cmd3.option("--format <format>", "Output format (json or yaml)", "json");
91
+ cmd3.addOption(
92
+ new Option("--format <format>", "Output format").choices([...DOCUMENT_FORMATS]).default("json")
93
+ );
82
94
  cmd3.option("-o, --output <file>", "Output file (defaults to stdout)");
95
+ completeFiles(cmd3, [], ["--output"]);
83
96
  cmd3.action(async (...args) => {
84
- const { getAction } = await import("./chunks/get.action-XC7KC2JO.js");
97
+ const { getAction } = await import("./chunks/get.action-3BP4FHZC.js");
85
98
  return getAction(...args);
86
99
  });
87
100
  return cmd3;
@@ -91,10 +104,11 @@ var GetSchemaCommand = () => {
91
104
  import { Command as Command3 } from "commander";
92
105
  var ListSchemaCommand = () => {
93
106
  const cmd3 = new Command3("list");
94
- cmd3.description("List all schemas for a team namespace");
107
+ cmd3.description("List shared schemas in a team namespace");
95
108
  cmd3.option("--namespace <namespace>", "Team namespace");
109
+ cmd3.option("--json", "Output schema metadata as JSON");
96
110
  cmd3.action(async (...args) => {
97
- const { listAction } = await import("./chunks/list.action-OFGLMRE7.js");
111
+ const { listAction } = await import("./chunks/list.action-KR5YIDR4.js");
98
112
  return listAction(...args);
99
113
  });
100
114
  return cmd3;
@@ -104,17 +118,14 @@ var ListSchemaCommand = () => {
104
118
  import { Command as Command4 } from "commander";
105
119
  var PublishSchemaCommand = () => {
106
120
  const cmd3 = new Command4("publish");
107
- cmd3.description("Publish a shared schema to the Scalar registry");
108
- cmd3.argument("[file]", "OpenAPI file to upload");
109
- cmd3.option(
110
- "--slug <slug>",
111
- "Slug identifier for the registry entry. Defaults to title."
112
- );
121
+ cmd3.description("Publish a shared schema to the Scalar Registry");
122
+ cmd3.argument("[file]", "Shared schema file path or URL to upload");
123
+ cmd3.option("--slug <slug>", "Shared schema slug");
113
124
  cmd3.option("--title <title>", "Schema title");
114
125
  cmd3.option("--namespace <namespace>", "Scalar team namespace");
115
- cmd3.option("--version <version>", "API version (e.g. 0.1.0)");
116
- cmd3.option("--private", "Make API private", false);
117
- cmd3.option("--force", "Force override an existing version", false);
126
+ cmd3.option("--version <version>", "Schema version (for example, 0.1.0)");
127
+ cmd3.option("--private", "Make the shared schema private", false);
128
+ cmd3.option("--force", "Overwrite an existing version", false);
118
129
  cmd3.option("--bundle", "Bundle all external references before uploading");
119
130
  cmd3.option(
120
131
  "--treeShake",
@@ -126,31 +137,34 @@ var PublishSchemaCommand = () => {
126
137
  );
127
138
  cmd3.option(
128
139
  "--fetchLimit <limit>",
129
- "Maximum number of concurrent URLs to fetch when bundling the document",
140
+ "Maximum number of concurrent URL fetches when bundling",
130
141
  parseFetchLimit
131
142
  );
143
+ completeFiles(cmd3, ["file"], []);
132
144
  cmd3.action(async (...args) => {
133
- const { publishAction } = await import("./chunks/publish.action-OS27XOX4.js");
145
+ const { publishAction } = await import("./chunks/publish.action-YBORRPBM.js");
134
146
  return publishAction(...args);
135
147
  });
136
148
  return cmd3;
137
149
  };
138
150
 
139
151
  // src/domains/schema/update.ts
140
- import { Command as Command5 } from "commander";
152
+ import { Command as Command5, Option as Option2 } from "commander";
141
153
  var UpdateSchemaCommand = () => {
142
154
  const cmd3 = new Command5("update");
143
- cmd3.description("Update schema metadata.");
155
+ cmd3.description("Update shared schema metadata");
144
156
  cmd3.option("-s, --slug <slug>", "Schema slug");
145
157
  cmd3.option("-n, --namespace <namespace>", "Team namespace");
146
- cmd3.option("--title <title>", "Title");
147
- cmd3.option("--description <description>", "Description");
148
- cmd3.option(
149
- "--isPrivate <isPrivate>",
150
- "Privacy (true/false or public/private)"
158
+ cmd3.option("--title <title>", "Schema title");
159
+ cmd3.option("--description <description>", "Schema description");
160
+ cmd3.addOption(
161
+ new Option2(
162
+ "--isPrivate <isPrivate>",
163
+ "Access setting (true/private or false/public)"
164
+ ).choices([...PRIVACY_VALUES])
151
165
  );
152
166
  cmd3.action(async (...args) => {
153
- const { updateAction } = await import("./chunks/update.action-AEIBLCWD.js");
167
+ const { updateAction } = await import("./chunks/update.action-O7TSXDGV.js");
154
168
  return updateAction(...args);
155
169
  });
156
170
  return cmd3;
@@ -165,46 +179,41 @@ var schemaCommands = [
165
179
  PublishSchemaCommand
166
180
  ];
167
181
  var schemaDomain = new Command6("schema");
168
- schemaDomain.description("Manage your Scalar schemas");
182
+ schemaDomain.description("Manage shared schemas in the Scalar Registry");
169
183
  schemaCommands.forEach((command) => void schemaDomain.addCommand(command()));
170
184
  var schema_default = schemaDomain;
171
185
 
172
186
  // src/domains/sdk/index.ts
173
- import { Command as Command12 } from "commander";
187
+ import { Command as Command13 } from "commander";
174
188
 
175
189
  // src/domains/sdk/build.ts
176
190
  import { Command as Command7 } from "commander";
177
191
  var BuildSdkCommand = () => {
178
192
  const cmd3 = new Command7("build");
179
- cmd3.description("Build an SDK.");
193
+ cmd3.description("Start an SDK build");
180
194
  cmd3.option("-s, --slug <slug>", "SDK slug");
181
195
  cmd3.option("-n, --namespace <namespace>", "Team namespace");
182
196
  cmd3.action(async (...args) => {
183
- const { buildAction } = await import("./chunks/build.action-NM6CAE5F.js");
197
+ const { buildAction } = await import("./chunks/build.action-CLBVKFWD.js");
184
198
  return buildAction(...args);
185
199
  });
186
200
  return cmd3;
187
201
  };
188
202
 
189
203
  // src/domains/sdk/create.ts
190
- import { Command as Command8, Option } from "commander";
204
+ import { Command as Command8, Option as Option3 } from "commander";
191
205
  var CreateSdkCommand = () => {
192
206
  const cmd3 = new Command8("create");
193
- cmd3.description(
194
- "Create a new SDK. The SDK is created in the namespace of the API it is built from."
195
- );
196
- cmd3.option("-a, --api <api>", "Registry API slug");
197
- cmd3.option(
198
- "-n, --namespace <namespace>",
199
- "Team namespace to look the API up in"
200
- );
207
+ cmd3.description("Create an SDK in the namespace of its source API");
208
+ cmd3.option("-a, --api <api>", "Scalar Registry API slug");
209
+ cmd3.option("-n, --namespace <namespace>", "Team namespace of the source API");
201
210
  cmd3.addOption(
202
- new Option("-l, --language <language>", "Language of your SDK").choices(
211
+ new Option3("-l, --language <language>", "SDK language").choices(
203
212
  Object.values(SdkLanguage)
204
213
  )
205
214
  );
206
215
  cmd3.action(async (...args) => {
207
- const { createAction } = await import("./chunks/create.action-FUQ2BVJA.js");
216
+ const { createAction } = await import("./chunks/create.action-ITEOQ644.js");
208
217
  return createAction(...args);
209
218
  });
210
219
  return cmd3;
@@ -214,43 +223,63 @@ var CreateSdkCommand = () => {
214
223
  import { Command as Command9 } from "commander";
215
224
  var DeleteSdkCommand = () => {
216
225
  const cmd3 = new Command9("delete");
217
- cmd3.description("Delete an SDK.");
226
+ cmd3.description("Delete an SDK");
218
227
  cmd3.option("-s, --slug <slug>", "SDK slug");
219
228
  cmd3.option("-n, --namespace <namespace>", "Team namespace");
220
229
  cmd3.action(async (...args) => {
221
- const { deleteAction } = await import("./chunks/delete.action-BTDFH7WY.js");
230
+ const { deleteAction } = await import("./chunks/delete.action-C6VX4S5Q.js");
222
231
  return deleteAction(...args);
223
232
  });
224
233
  return cmd3;
225
234
  };
226
235
 
227
236
  // src/domains/sdk/update.ts
228
- import { Command as Command10 } from "commander";
237
+ import { Command as Command10, Option as Option4 } from "commander";
229
238
  var UpdateSdkCommand = () => {
230
239
  const cmd3 = new Command10("update");
231
- cmd3.description("Update SDK metadata.");
240
+ cmd3.description("Update SDK metadata");
232
241
  cmd3.option("-s, --slug <slug>", "SDK slug");
233
242
  cmd3.option("-n, --namespace <namespace>", "Team namespace");
234
- cmd3.option("--title <title>", "Title");
235
- cmd3.option(
236
- "--isPrivate <isPrivate>",
237
- "Privacy (true/false or public/private)"
243
+ cmd3.option("--title <title>", "SDK title");
244
+ cmd3.addOption(
245
+ new Option4(
246
+ "--isPrivate <isPrivate>",
247
+ "Access setting (true/private or false/public)"
248
+ ).choices([...PRIVACY_VALUES])
238
249
  );
239
250
  cmd3.action(async (...args) => {
240
- const { updateAction } = await import("./chunks/update.action-ZMS4CQ3T.js");
251
+ const { updateAction } = await import("./chunks/update.action-QZI7M2MV.js");
241
252
  return updateAction(...args);
242
253
  });
243
254
  return cmd3;
244
255
  };
245
256
 
246
- // src/domains/sdk/list.ts
257
+ // src/domains/sdk/get.ts
247
258
  import { Command as Command11 } from "commander";
259
+ var GetSdkCommand = () => {
260
+ const cmd3 = new Command11("get");
261
+ cmd3.description(
262
+ "Inspect SDK metadata, API source, versions, and build status"
263
+ );
264
+ cmd3.requiredOption("-s, --slug <slug>", "SDK slug");
265
+ cmd3.option("-n, --namespace <namespace>", "Team namespace");
266
+ cmd3.option("--json", "Output structured SDK metadata as JSON");
267
+ cmd3.action(async (...args) => {
268
+ const { getAction } = await import("./chunks/get.action-LNBOWUVE.js");
269
+ return getAction(...args);
270
+ });
271
+ return cmd3;
272
+ };
273
+
274
+ // src/domains/sdk/list.ts
275
+ import { Command as Command12 } from "commander";
248
276
  var ListSdkCommand = () => {
249
- const cmd3 = new Command11("list");
250
- cmd3.description("List all SDKs for a team namespace");
277
+ const cmd3 = new Command12("list");
278
+ cmd3.description("List SDKs in a team namespace");
279
+ cmd3.option("--json", "Output structured SDK metadata as JSON");
251
280
  cmd3.option("--namespace <namespace>", "Team namespace");
252
281
  cmd3.action(async (...args) => {
253
- const { listAction } = await import("./chunks/list.action-LXKEUYKO.js");
282
+ const { listAction } = await import("./chunks/list.action-6CRFQPJT.js");
254
283
  return listAction(...args);
255
284
  });
256
285
  return cmd3;
@@ -259,54 +288,61 @@ var ListSdkCommand = () => {
259
288
  // src/domains/sdk/index.ts
260
289
  var sdkCommands = [
261
290
  ListSdkCommand,
291
+ GetSdkCommand,
262
292
  CreateSdkCommand,
263
293
  UpdateSdkCommand,
264
294
  DeleteSdkCommand,
265
295
  BuildSdkCommand
266
296
  ];
267
- var sdkDomain = new Command12("sdk");
268
- sdkDomain.description("Manage your Scalar SDKs (Enterprise Only)");
269
- sdkCommands.forEach((command) => sdkDomain.addCommand(command()));
297
+ var sdkDomain = new Command13("sdk");
298
+ sdkDomain.description("Manage Scalar SDKs (Enterprise only)");
299
+ sdkCommands.forEach((command) => {
300
+ sdkDomain.addCommand(command());
301
+ });
270
302
  var sdk_default = sdkDomain;
271
303
 
272
304
  // src/domains/access-group/index.ts
273
- import { Command as Command13 } from "commander";
305
+ import { Command as Command14 } from "commander";
274
306
  function createAccessGroupCommand() {
275
- const command = new Command13("access-group").description(
307
+ const command = new Command14("access-group").description(
276
308
  "Manage access groups and allowed email domains for the current team"
277
309
  );
310
+ command.command("list").description("List access groups for the current team").option("--json", "Print the result as JSON").action(async (options) => {
311
+ const { runAction } = await import("./chunks/actions-S6K76HCW.js");
312
+ await runAction({ operation: "list", ...options });
313
+ });
278
314
  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(
279
315
  async (slug, options) => {
280
- const { runAction } = await import("./chunks/actions-OGIVBQC7.js");
316
+ const { runAction } = await import("./chunks/actions-S6K76HCW.js");
281
317
  await runAction({ operation: "create", slug, ...options });
282
318
  }
283
319
  );
284
320
  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) => {
285
- const { runAction } = await import("./chunks/actions-OGIVBQC7.js");
321
+ const { runAction } = await import("./chunks/actions-S6K76HCW.js");
286
322
  await runAction({ operation: "get", slug, ...options });
287
323
  });
288
324
  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(
289
325
  async (slug, options) => {
290
- const { runAction } = await import("./chunks/actions-OGIVBQC7.js");
326
+ const { runAction } = await import("./chunks/actions-S6K76HCW.js");
291
327
  await runAction({ operation: "update", slug, ...options });
292
328
  }
293
329
  );
294
330
  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(
295
331
  async (slug, options) => {
296
- const { runAction } = await import("./chunks/actions-OGIVBQC7.js");
332
+ const { runAction } = await import("./chunks/actions-S6K76HCW.js");
297
333
  await runAction({ operation: "delete", slug, ...options });
298
334
  }
299
335
  );
300
336
  const domain = command.command("domain").description("Manage allowed email domains");
301
337
  domain.command("add").description("Add an exact email domain to an access group").argument("<slug>", "Access group slug").argument("<domain>", "Email domain, such as example.com").option("--json", "Print the result as JSON").action(
302
338
  async (slug, domain2, options) => {
303
- const { runAction } = await import("./chunks/actions-OGIVBQC7.js");
339
+ const { runAction } = await import("./chunks/actions-S6K76HCW.js");
304
340
  await runAction({ operation: "add-domain", slug, domain: domain2, ...options });
305
341
  }
306
342
  );
307
343
  domain.command("remove").description("Remove an exact email domain from an access group").argument("<slug>", "Access group slug").argument("<domain>", "Email domain, such as example.com").option("--json", "Print the result as JSON").action(
308
344
  async (slug, domain2, options) => {
309
- const { runAction } = await import("./chunks/actions-OGIVBQC7.js");
345
+ const { runAction } = await import("./chunks/actions-S6K76HCW.js");
310
346
  await runAction({
311
347
  operation: "remove-domain",
312
348
  slug,
@@ -320,274 +356,379 @@ function createAccessGroupCommand() {
320
356
  var access_group_default = createAccessGroupCommand();
321
357
 
322
358
  // src/domains/auth/index.ts
323
- import { Command as Command17 } from "commander";
359
+ import { Command as Command18 } from "commander";
324
360
 
325
361
  // src/domains/auth/login/index.ts
326
- import { Command as Command14 } from "commander";
362
+ import { Command as Command15, Option as Option5 } from "commander";
327
363
  var LoginCommand = () => {
328
- const cmd3 = new Command14("login");
329
- cmd3.description("Login to scalar");
330
- cmd3.option("--email <email>", "Email");
331
- cmd3.option("--password <password>", "Password");
332
- cmd3.option("--token <token>", "Personal token");
364
+ const cmd3 = new Command15("login");
365
+ cmd3.description("Log in to Scalar");
366
+ cmd3.option("--token <token>", "Personal token for authentication");
367
+ cmd3.addOption(
368
+ new Option5(
369
+ "--email <email>",
370
+ "Email address (unsupported; use browser or token authentication)"
371
+ ).hideHelp()
372
+ );
373
+ cmd3.addOption(
374
+ new Option5(
375
+ "--password <password>",
376
+ "Password (unsupported; use browser or token authentication)"
377
+ ).hideHelp()
378
+ );
333
379
  cmd3.action(async (...args) => {
334
- const { loginAction } = await import("./chunks/action-KTYOCA2V.js");
380
+ const { loginAction } = await import("./chunks/action-SOYSVG67.js");
335
381
  return loginAction(...args);
336
382
  });
337
383
  return cmd3;
338
384
  };
339
385
 
340
386
  // src/domains/auth/logout/index.ts
341
- import { Command as Command15 } from "commander";
387
+ import { Command as Command16 } from "commander";
342
388
  var LogoutCommand = () => {
343
- const cmd3 = new Command15("logout");
344
- cmd3.description("Logout from scalar");
389
+ const cmd3 = new Command16("logout");
390
+ cmd3.description("Log out of Scalar");
345
391
  cmd3.action(async () => {
346
- await clearAuthData();
347
- output.info().message("Successfully logged out.").print();
392
+ await logout();
393
+ output.info().message("Logged out of Scalar.").print();
348
394
  });
349
395
  return cmd3;
350
396
  };
351
397
 
352
398
  // src/domains/auth/whoami/index.ts
353
- import as from "ansis";
354
- import { Command as Command16 } from "commander";
399
+ import { Command as Command17 } from "commander";
355
400
  var WhoAmICommand = () => {
356
- const cmd3 = new Command16("whoami");
357
- cmd3.description("Display the current user");
358
- cmd3.action(async () => {
359
- const auth = await getAuthData();
360
- output.info().message(
361
- `You are logged in as ${as.cyan(auth.email ?? "")} (role: ${as.cyan(auth.role ?? "Owner")})`
362
- ).line().print();
401
+ const cmd3 = new Command17("whoami");
402
+ cmd3.description("Show the logged-in user and current team");
403
+ cmd3.option("--json", "Output authentication details as JSON");
404
+ cmd3.action(async (options) => {
405
+ const { whoamiAction } = await import("./chunks/action-D5QWDNQ2.js");
406
+ return whoamiAction(options);
363
407
  });
364
408
  return cmd3;
365
409
  };
366
410
 
367
411
  // src/domains/auth/index.ts
368
412
  var authCommands = [LoginCommand, WhoAmICommand, LogoutCommand];
369
- var authDomain = new Command17("auth");
370
- authDomain.description("Manage authorization on scalar platform");
413
+ var authDomain = new Command18("auth");
414
+ authDomain.description("Log in to Scalar and manage your session");
371
415
  authCommands.forEach((command) => authDomain.addCommand(command()));
372
416
  var auth_default = authDomain;
373
417
 
418
+ // src/domains/completion/index.ts
419
+ import { Argument, Command as Command19 } from "commander";
420
+
421
+ // src/helpers/completion/shells.ts
422
+ var COMPLETION_SHELLS = ["bash", "zsh", "fish"];
423
+
424
+ // src/domains/completion/index.ts
425
+ var createCompletionCommand = () => new Command19("completion").description("Generate shell completion definitions").addArgument(
426
+ new Argument("<shell>", "Shell to configure").choices([
427
+ ...COMPLETION_SHELLS
428
+ ])
429
+ ).action(async (shell) => {
430
+ const { renderCompletionScript } = await import("./chunks/scripts-6CI6U32J.js");
431
+ process.stdout.write(renderCompletionScript(shell));
432
+ });
433
+ var createCompletionQueryCommand = () => new Command19("__complete").description("Query shell completion candidates").argument("<cursor>", "Zero-based cursor word index").argument("[words...]", "Shell words including the executable").action(
434
+ async (cursor, words, _options, command) => {
435
+ const { queryCompletion } = await import("./chunks/query-WKATAJJ6.js");
436
+ const index = Number(cursor);
437
+ if (!command.parent || !Number.isSafeInteger(index) || index < 1 || index > words.length) {
438
+ process.stdout.write("none\n-\n");
439
+ return;
440
+ }
441
+ const result = queryCompletion(command.parent, words, index);
442
+ process.stdout.write(
443
+ `${result.mode}
444
+ ${result.prefix ?? "-"}
445
+ ${result.candidates.map((candidate) => `${candidate}
446
+ `).join("")}`
447
+ );
448
+ }
449
+ );
450
+
374
451
  // src/domains/context/index.ts
375
- import { Command as Command18 } from "commander";
376
- var cmd = new Command18("context");
452
+ import { Command as Command20 } from "commander";
453
+ var cmd = new Command20("context");
377
454
  cmd.description(
378
455
  "Print every command, argument, and option as JSON for AI agents"
379
456
  );
380
457
  cmd.action(async () => {
381
- const { contextAction } = await import("./chunks/action-F2ZJNURT.js");
458
+ const { contextAction } = await import("./chunks/action-Y7EBKCUU.js");
382
459
  return contextAction(cmd);
383
460
  });
384
461
  var context_default = cmd;
385
462
 
386
463
  // src/domains/document/index.ts
387
- import { Command as Command31 } from "commander";
464
+ import { Command as Command33 } from "commander";
388
465
 
389
466
  // src/domains/document/join/index.ts
390
- import { Command as Command19 } from "commander";
467
+ import { Command as Command21 } from "commander";
391
468
  function JoinCommand() {
392
- const cmd3 = new Command19("join");
469
+ const cmd3 = new Command21("join");
393
470
  cmd3.description(
394
- "Merge multiple OpenAPI or AsyncAPI documents into a single unified document"
471
+ "Join API descriptions of the same format into one description"
395
472
  );
396
- cmd3.argument("<files...>", "Paths to the OpenAPI or AsyncAPI files to merge");
397
- cmd3.option("--output -o <file>", "Path to save the merged output file");
473
+ cmd3.argument("<files...>", "OpenAPI or AsyncAPI file paths to join");
398
474
  cmd3.option(
399
- "--prefix-components-with-path-value -p <path>",
475
+ "-o, --output <file>",
476
+ "Output file for the joined description (required)"
477
+ );
478
+ cmd3.option(
479
+ "-p, --prefix-components-with-path-value <path>",
400
480
  "Dot-separated path to extract a prefix value from each input file for component names"
401
481
  );
482
+ completeFiles(cmd3, ["files"], ["--output"]);
402
483
  cmd3.action(async (...args) => {
403
- const { joinAction } = await import("./chunks/action-7PEQXDWT.js");
484
+ const { joinAction } = await import("./chunks/action-GXDJLF2G.js");
404
485
  return joinAction(...args);
405
486
  });
406
487
  return cmd3;
407
488
  }
408
489
 
409
490
  // src/domains/document/split/index.ts
410
- import { Command as Command20 } from "commander";
491
+ import { Command as Command22 } from "commander";
411
492
  function SplitCommand() {
412
- const cmd3 = new Command20("split");
413
- cmd3.description("Split OpenAPI or AsyncAPI documents into small chunks");
414
- cmd3.argument("[file|url]", "Path to OpenAPI or AsyncAPI file or URL to split");
415
- cmd3.option("-o, --output <path>", "Path to save the chunks");
493
+ const cmd3 = new Command22("split");
494
+ cmd3.description(
495
+ "Split an OpenAPI or AsyncAPI description into referenced JSON files"
496
+ );
497
+ cmd3.argument("[file|url]", "API description file path or URL to split");
498
+ cmd3.option(
499
+ "-o, --output <path>",
500
+ "Output directory for the split description and referenced files"
501
+ );
416
502
  cmd3.addHelpText(
417
503
  "after",
418
504
  "\nAsyncAPI versions are preserved (including 2.6, 3.0, and 3.1). External references are bundled before splitting.\n"
419
505
  );
506
+ completeFiles(cmd3, ["file|url"], ["--output"]);
420
507
  cmd3.action(async (...args) => {
421
- const { splitAction } = await import("./chunks/action-YRX6SN5F.js");
508
+ const { splitAction } = await import("./chunks/action-FMA5ECUA.js");
422
509
  return splitAction(...args);
423
510
  });
424
511
  return cmd3;
425
512
  }
426
513
 
427
514
  // src/domains/document/format/index.ts
428
- import { Command as Command21 } from "commander";
515
+ import { Command as Command23 } from "commander";
429
516
  function FormatCommand() {
430
- const cmd3 = new Command21("format");
431
- cmd3.description("Format an OpenAPI or AsyncAPI file");
517
+ const cmd3 = new Command23("format");
518
+ cmd3.description("Format an OpenAPI or AsyncAPI description");
432
519
  cmd3.argument("[file|url]", "File or URL to format");
433
- cmd3.option("-o, --output <file>", "Output file");
520
+ cmd3.option(
521
+ "-o, --output <file>",
522
+ "Output file (required for URLs; otherwise overwrites the input file)"
523
+ );
524
+ completeFiles(cmd3, ["file|url"], ["--output"]);
434
525
  cmd3.action(async (...args) => {
435
- const { formatAction } = await import("./chunks/action-H6OUJWWM.js");
526
+ const { formatAction } = await import("./chunks/action-KC3ZCNDR.js");
436
527
  return formatAction(...args);
437
528
  });
438
529
  return cmd3;
439
530
  }
440
531
 
441
532
  // src/domains/document/lint/index.ts
442
- import { Command as Command22 } from "commander";
533
+ import { Command as Command24, InvalidArgumentError, Option as Option6 } from "commander";
534
+
535
+ // src/domains/document/lint/formats.ts
536
+ var reportFormats = [
537
+ "text",
538
+ "codeframe",
539
+ "markdown",
540
+ "summary",
541
+ "json",
542
+ "github-actions",
543
+ "junit"
544
+ ];
545
+
546
+ // src/domains/document/lint/index.ts
443
547
  function LintCommand() {
444
- const cmd3 = new Command22("lint");
445
- cmd3.description("Lint your OpenAPI or AsyncAPI file using spectral rules");
446
- cmd3.argument("[file|url]", "OpenAPI or AsyncAPI file path or url");
447
- cmd3.option("-r, --rule <file|url>", "Rule path or url");
548
+ const cmd3 = new Command24("lint");
549
+ cmd3.description("Lint an OpenAPI or AsyncAPI description with Spectral rules");
550
+ cmd3.argument("[file|url]", "API description file path or URL to lint");
551
+ cmd3.option("-r, --rule <file|url>", "Spectral ruleset file path or URL");
552
+ cmd3.addOption(
553
+ new Option6("--format <format>", "Report format").choices([...reportFormats]).default("codeframe")
554
+ );
555
+ cmd3.option(
556
+ "--max-problems <number>",
557
+ "Maximum displayed findings (totals and exit status include all findings)",
558
+ (value) => {
559
+ if (!/^\d+$/.test(value) || !Number.isSafeInteger(Number(value)))
560
+ throw new InvalidArgumentError("Expected a nonnegative integer");
561
+ return Number(value);
562
+ },
563
+ 100
564
+ );
565
+ cmd3.option(
566
+ "-o, --output <file>",
567
+ "Write the report to a file instead of stdout"
568
+ );
569
+ cmd3.option(
570
+ "--generate-ignore-file",
571
+ "Record current findings in the ignore baseline"
572
+ );
573
+ cmd3.option(
574
+ "--ignore-file <file>",
575
+ "Ignore baseline path (Scalar file takes priority over Redocly fallback in the current directory)"
576
+ );
577
+ completeFiles(cmd3, ["file|url"], ["--rule", "--output", "--ignore-file"]);
448
578
  cmd3.action(async (...args) => {
449
- const { lintAction } = await import("./chunks/action-JAHFRYWZ.js");
579
+ const { lintAction } = await import("./chunks/action-MJMLQFLT.js");
450
580
  return lintAction(...args);
451
581
  });
452
582
  return cmd3;
453
583
  }
454
584
 
455
585
  // src/domains/document/markdown/index.ts
456
- import { Command as Command23 } from "commander";
586
+ import { Command as Command25 } from "commander";
457
587
  function MarkdownCommand() {
458
- const cmd3 = new Command23("markdown");
459
- cmd3.description("Generate Markdown from an OpenAPI file");
588
+ const cmd3 = new Command25("markdown");
589
+ cmd3.description("Generate Markdown documentation from an OpenAPI description");
460
590
  cmd3.argument("[file|url]", "OpenAPI file path or URL to convert");
461
591
  cmd3.option("-o, --output <file>", "Output file (defaults to stdout)");
592
+ completeFiles(cmd3, ["file|url"], ["--output"]);
462
593
  cmd3.action(async (...args) => {
463
- const { markdownAction } = await import("./chunks/action-VOFDW3U2.js");
594
+ const { markdownAction } = await import("./chunks/action-OTPXODUE.js");
464
595
  return markdownAction(...args);
465
596
  });
466
597
  return cmd3;
467
598
  }
468
599
 
469
600
  // src/domains/document/mock/index.ts
470
- import { Command as Command24 } from "commander";
601
+ import { Command as Command26 } from "commander";
471
602
  function MockCommand() {
472
- const cmd3 = new Command24("mock");
473
- cmd3.description("Mock an OpenAPI API or AsyncAPI WebSocket and SSE channels");
474
- cmd3.argument("[file|url]", "OpenAPI or AsyncAPI file or URL to mock");
475
- cmd3.option("-w, --watch", "watch the file for changes");
476
- cmd3.option("-o, --once", "run the server only once and exit after that");
477
- cmd3.option(
478
- "-p, --port <port>",
479
- "set the HTTP port for the mock server",
480
- parsePort
603
+ const cmd3 = new Command26("mock");
604
+ cmd3.description(
605
+ "Run a Mock Server for OpenAPI operations or AsyncAPI WebSocket and SSE channels"
481
606
  );
607
+ cmd3.argument("[file|url]", "OpenAPI or AsyncAPI file or URL to mock");
608
+ cmd3.option("-w, --watch", "Watch the file or URL for changes");
609
+ cmd3.option("-o, --once", "Start the server, then stop it after two seconds");
610
+ cmd3.option("-p, --port <port>", "HTTP port for the Mock Server", parsePort);
611
+ completeFiles(cmd3, ["file|url"], []);
482
612
  cmd3.action(async (...args) => {
483
- const { mockAction } = await import("./chunks/action-HT2DJ34Z.js");
613
+ const { mockAction } = await import("./chunks/action-ZUZL7R3H.js");
484
614
  return mockAction(...args);
485
615
  });
486
616
  return cmd3;
487
617
  }
488
618
 
489
619
  // src/domains/document/postman/index.ts
490
- import { Command as Command25 } from "commander";
620
+ import { Command as Command27 } from "commander";
491
621
  function ConvertCommand() {
492
- const cmd3 = new Command25("convert");
493
- cmd3.description("Convert a Postman collection to an OpenAPI document");
622
+ const cmd3 = new Command27("convert");
623
+ cmd3.description("Convert a Postman collection to an OpenAPI description");
494
624
  cmd3.argument("[file|url]", "Postman collection file path or URL to convert");
495
625
  cmd3.option("-o, --output <file>", "Output file (defaults to stdout)");
496
626
  cmd3.option(
497
627
  "--merge-operations",
498
628
  "Merge operations with shared path+method combinations"
499
629
  );
630
+ completeFiles(cmd3, ["file|url"], ["--output"]);
500
631
  cmd3.action(async (...args) => {
501
- const { convertAction } = await import("./chunks/action-F7A2K74G.js");
632
+ const { convertAction } = await import("./chunks/action-NMW5WPD2.js");
502
633
  return convertAction(...args);
503
634
  });
504
635
  return cmd3;
505
636
  }
506
637
 
507
638
  // src/domains/document/serve/index.ts
508
- import { Command as Command26 } from "commander";
639
+ import { Command as Command28 } from "commander";
509
640
  function ServeCommand() {
510
- const cmd3 = new Command26("serve");
511
- cmd3.description("Serve an API Reference from an OpenAPI or AsyncAPI file");
512
- cmd3.argument(
513
- "[file|url]",
514
- "OpenAPI or AsyncAPI file or URL to show the reference for"
641
+ const cmd3 = new Command28("serve");
642
+ cmd3.description(
643
+ "Serve API Reference documentation from an OpenAPI or AsyncAPI description"
515
644
  );
645
+ cmd3.argument("[file|url]", "API description file path or URL to preview");
516
646
  cmd3.option(
517
647
  "-c, --config <file>",
518
648
  "JSON file with API Reference configuration"
519
649
  );
520
- cmd3.option("-w, --watch", "watch the file for changes");
521
- cmd3.option("-o, --once", "run the server only once and exit after that");
650
+ cmd3.option("-w, --watch", "Watch the file or URL for changes");
651
+ cmd3.option("-o, --once", "Start the server, then stop it after two seconds");
522
652
  cmd3.option(
523
653
  "-p, --port <port>",
524
- "set the HTTP port for the API reference server",
654
+ "HTTP port for the API Reference server",
525
655
  parsePort
526
656
  );
657
+ completeFiles(cmd3, ["file|url"], ["--config"]);
527
658
  cmd3.action(async (...args) => {
528
- const { serveAction } = await import("./chunks/action-Y6NXJQ4H.js");
659
+ const { serveAction } = await import("./chunks/action-7H3AWCHX.js");
529
660
  return serveAction(...args);
530
661
  });
531
662
  return cmd3;
532
663
  }
533
664
 
534
665
  // src/domains/document/share/index.ts
535
- import { Command as Command27 } from "commander";
666
+ import { Command as Command29 } from "commander";
536
667
  function ShareCommand() {
537
- const cmd3 = new Command27("share");
538
- cmd3.description("Share an OpenAPI or AsyncAPI file");
539
- cmd3.argument("[file]", "file to share");
668
+ const cmd3 = new Command29("share");
669
+ cmd3.description(
670
+ "Publish an OpenAPI or AsyncAPI description to a public sandbox"
671
+ );
672
+ cmd3.argument("[file]", "API description file path or URL to share");
540
673
  cmd3.option(
541
674
  "-t, --token <token>",
542
- "pass a token to update an existing sandbox"
675
+ "Token to update an existing public sandbox"
543
676
  );
677
+ completeFiles(cmd3, ["file"], []);
544
678
  cmd3.action(async (...args) => {
545
- const { shareAction } = await import("./chunks/action-FCAYFPVR.js");
679
+ const { shareAction } = await import("./chunks/action-LR75GHBA.js");
546
680
  return shareAction(...args);
547
681
  });
548
682
  return cmd3;
549
683
  }
550
684
 
551
685
  // src/domains/document/upgrade/index.ts
552
- import { Command as Command28 } from "commander";
686
+ import { Command as Command30 } from "commander";
553
687
  function UpgradeCommand() {
554
- const cmd3 = new Command28("upgrade");
555
- cmd3.description("Upgrade an OpenAPI or AsyncAPI document to version 3.1");
688
+ const cmd3 = new Command30("upgrade");
689
+ cmd3.description(
690
+ "Upgrade an API description to OpenAPI 3.1 or the latest supported AsyncAPI version"
691
+ );
556
692
  cmd3.argument("[file|url]", "File or URL to upgrade");
557
- cmd3.option("-o, --output <file>", "Path to save the upgraded output file");
693
+ cmd3.option(
694
+ "-o, --output <file>",
695
+ "Output file (required for URLs; otherwise overwrites the input file)"
696
+ );
697
+ completeFiles(cmd3, ["file|url"], ["--output"]);
558
698
  cmd3.action(async (...args) => {
559
- const { upgradeAction } = await import("./chunks/action-5SK5NE7E.js");
699
+ const { upgradeAction } = await import("./chunks/action-EYPYQQVM.js");
560
700
  return upgradeAction(...args);
561
701
  });
562
702
  return cmd3;
563
703
  }
564
704
 
565
705
  // src/domains/document/validate/index.ts
566
- import { Command as Command29 } from "commander";
706
+ import { Command as Command31 } from "commander";
567
707
  function ValidateCommand() {
568
- const cmd3 = new Command29("validate");
569
- cmd3.description("Validate an OpenAPI or AsyncAPI file");
708
+ const cmd3 = new Command31("validate");
709
+ cmd3.description("Validate an OpenAPI or AsyncAPI description");
570
710
  cmd3.argument("[file|url]", "File or URL to validate");
711
+ completeFiles(cmd3, ["file|url"], []);
571
712
  cmd3.action(async (...args) => {
572
- const { validateAction } = await import("./chunks/action-AQRPFQKI.js");
713
+ const { validateAction } = await import("./chunks/action-ZGNVWTHZ.js");
573
714
  return validateAction(...args);
574
715
  });
575
716
  return cmd3;
576
717
  }
577
718
 
578
719
  // src/domains/document/void/index.ts
579
- import { Command as Command30 } from "commander";
720
+ import { Command as Command32 } from "commander";
580
721
  function VoidCommand() {
581
- const cmd3 = new Command30("void");
582
- cmd3.description("Boot a server to mirror HTTP requests");
583
- cmd3.option("-o, --once", "run the server only once and exit after that");
722
+ const cmd3 = new Command32("void");
723
+ cmd3.description("Mirror HTTP requests with a local server");
724
+ cmd3.option("-o, --once", "Start the server, then stop it after two seconds");
584
725
  cmd3.option(
585
726
  "-p, --port <port>",
586
- "set the HTTP port for the mock server",
727
+ "HTTP port for the request-mirroring server",
587
728
  parsePort
588
729
  );
589
730
  cmd3.action(async (...args) => {
590
- const { voidAction } = await import("./chunks/action-H3RTILLM.js");
731
+ const { voidAction } = await import("./chunks/action-IIQMZVRJ.js");
591
732
  return voidAction(...args);
592
733
  });
593
734
  return cmd3;
@@ -609,83 +750,83 @@ var documentCommands = [
609
750
  LintCommand,
610
751
  UpgradeCommand
611
752
  ];
612
- var documentDomain = new Command31("document");
613
- documentDomain.description("Manage local openapi file");
753
+ var documentDomain = new Command33("document");
754
+ documentDomain.description("Work with OpenAPI and AsyncAPI descriptions");
614
755
  documentCommands.forEach((command) => documentDomain.addCommand(command()));
615
756
  var document_default = documentDomain;
616
757
 
617
758
  // src/domains/project/index.ts
618
- import { Command as Command41 } from "commander";
759
+ import { Command as Command45 } from "commander";
619
760
 
620
761
  // src/domains/project/preview/index.ts
621
- import { Command as Command32, Option as Option2 } from "commander";
762
+ import { Command as Command34, Option as Option7 } from "commander";
622
763
  var PreviewCommand = () => {
623
- const cmd3 = new Command32("preview");
624
- cmd3.description("Preview scalar guides");
764
+ const cmd3 = new Command34("preview");
765
+ cmd3.description("Preview a Scalar Docs project locally");
625
766
  cmd3.argument(
626
767
  "[config]",
627
768
  "Path to the Scalar configuration file (usually `scalar.config.json5` or `scalar.config.json`)"
628
769
  );
629
770
  cmd3.option(
630
771
  "-p, --port [port]",
631
- "port to run the server on. If the port is not available, it will select another one.",
772
+ "Preferred server port (uses another port if unavailable)",
632
773
  "7970"
633
774
  );
634
- cmd3.option(
635
- "-H, --host [host]",
636
- "Specify which IP addresses the server should listen on."
637
- );
775
+ cmd3.option("-H, --host [host]", "Host address for the preview server");
638
776
  cmd3.addOption(
639
- new Option2("-L, --log-level <level>", "Set the log level").choices(["debug", "info"]).default("info")
777
+ new Option7("-L, --log-level <level>", "Set the log level").choices(["debug", "info"]).default("info")
640
778
  );
641
779
  cmd3.option("-N, --no-open", "Do not open the browser automatically", true);
780
+ completeFiles(cmd3, ["config"], []);
642
781
  cmd3.action(async (...args) => {
643
- const { previewAction } = await import("./chunks/action-LLH4QPXM.js");
782
+ const { previewAction } = await import("./chunks/action-BRSLSOE5.js");
644
783
  return previewAction(...args);
645
784
  });
646
785
  return cmd3;
647
786
  };
648
787
 
649
788
  // src/domains/project/check-config/index.ts
650
- import { Command as Command33 } from "commander";
789
+ import { Command as Command35 } from "commander";
651
790
  function CheckConfigCommand() {
652
- const cmd3 = new Command33("check-config");
653
- cmd3.description("Check a Scalar Configuration file");
654
- cmd3.argument("[file]", "File to check");
791
+ const cmd3 = new Command35("check-config");
792
+ cmd3.description("Validate a Scalar configuration file");
793
+ cmd3.argument(
794
+ "[file]",
795
+ "Scalar configuration file path (discovered in the current directory if omitted)"
796
+ );
797
+ completeFiles(cmd3, ["file"], []);
655
798
  cmd3.action(async (...args) => {
656
- const { checkConfigAction } = await import("./chunks/action-NVI5DWFP.js");
799
+ const { checkConfigAction } = await import("./chunks/action-73ELLN3T.js");
657
800
  return checkConfigAction(...args);
658
801
  });
659
802
  return cmd3;
660
803
  }
661
804
 
662
805
  // src/domains/project/create/index.ts
663
- import { Command as Command34 } from "commander";
806
+ import { Command as Command36 } from "commander";
664
807
  var CreateCommand = () => {
665
- const cmd3 = new Command34("create");
666
- cmd3.description(
667
- "Create a new project that is not linked to a github project."
668
- );
669
- cmd3.option("-n, --name <name>", "name of your project");
670
- cmd3.option("-s, --slug <slug>", "project slug");
808
+ const cmd3 = new Command36("create");
809
+ cmd3.description("Create a Scalar project without a linked GitHub repository");
810
+ cmd3.option("-n, --name <name>", "Project name");
811
+ cmd3.option("-s, --slug <slug>", "Project slug");
671
812
  cmd3.action(async (...args) => {
672
- const { createAction } = await import("./chunks/action-WFDNRA7D.js");
813
+ const { createAction } = await import("./chunks/action-YN4TE7TG.js");
673
814
  return createAction(...args);
674
815
  });
675
816
  return cmd3;
676
817
  };
677
818
 
678
819
  // src/domains/project/deployments/index.ts
679
- import { Command as Command36 } from "commander";
820
+ import { Command as Command38 } from "commander";
680
821
 
681
822
  // src/domains/project/deployments/list/index.ts
682
- import { Command as Command35 } from "commander";
823
+ import { Command as Command37 } from "commander";
683
824
  var ListCommand = () => {
684
- const cmd3 = new Command35("list");
685
- cmd3.description("List the production deployment history for a project.");
686
- cmd3.option("-s, --slug [slug]", "Project slug found in Scalar Dashboard");
825
+ const cmd3 = new Command37("list");
826
+ cmd3.description("List production deployments for a project");
827
+ cmd3.option("-s, --slug [slug]", "Project slug from scalar project list");
687
828
  cmd3.action(async (...args) => {
688
- const { listAction } = await import("./chunks/action-QQZLPI42.js");
829
+ const { listAction } = await import("./chunks/action-RQCXSJPZ.js");
689
830
  return listAction(...args);
690
831
  });
691
832
  return cmd3;
@@ -693,78 +834,111 @@ var ListCommand = () => {
693
834
 
694
835
  // src/domains/project/deployments/index.ts
695
836
  var DeploymentsCommand = () => {
696
- const cmd3 = new Command36("deployments");
697
- cmd3.description("Inspect a project deployment history.");
837
+ const cmd3 = new Command38("deployments");
838
+ cmd3.description("Show project deployment history");
698
839
  cmd3.addCommand(ListCommand());
699
840
  return cmd3;
700
841
  };
701
842
 
843
+ // src/domains/project/get/index.ts
844
+ import { Command as Command39 } from "commander";
845
+ function GetCommand() {
846
+ const command = new Command39("get").description("Show project details for the current team").argument("<slug>", "Project slug from scalar project list").option("--json", "Print project details as JSON");
847
+ command.action(
848
+ async (slug, options) => {
849
+ const { getAction } = await import("./chunks/action-ZKKRPLDK.js");
850
+ await getAction(slug, options);
851
+ }
852
+ );
853
+ return command;
854
+ }
855
+
702
856
  // src/domains/project/init/index.ts
703
- import { Command as Command37 } from "commander";
857
+ import { Command as Command40 } from "commander";
704
858
  var InitCommand = () => {
705
- const cmd3 = new Command37("init");
706
- cmd3.description("Create a new Scalar Docs project.");
707
- cmd3.option("-s, --subdomain [url]", "subdomain to publish on");
708
- cmd3.option("--force", "override existing configuration");
859
+ const cmd3 = new Command40("init");
860
+ cmd3.description("Initialize a local Scalar Docs project");
861
+ cmd3.option(
862
+ "-s, --subdomain [url]",
863
+ "Subdomain for the published documentation"
864
+ );
865
+ cmd3.option("--force", "Overwrite existing configuration");
709
866
  cmd3.action(async (...args) => {
710
- const { initAction } = await import("./chunks/action-Y7OUGD56.js");
867
+ const { initAction } = await import("./chunks/action-DQDHBOLJ.js");
711
868
  return initAction(...args);
712
869
  });
713
870
  return cmd3;
714
871
  };
715
872
 
873
+ // src/domains/project/list/index.ts
874
+ import { Command as Command41 } from "commander";
875
+ function ListCommand2() {
876
+ const command = new Command41("list").description("List projects and their slugs for the current team").option("--json", "Print project details as JSON");
877
+ command.action(async (options) => {
878
+ const { listAction } = await import("./chunks/action-IQM54ITT.js");
879
+ await listAction(options);
880
+ });
881
+ return command;
882
+ }
883
+
716
884
  // src/domains/project/publish/index.ts
717
- import { Command as Command38 } from "commander";
885
+ import { Command as Command42 } from "commander";
718
886
  var PublishCommand = () => {
719
- const cmd3 = new Command38("publish");
720
- cmd3.description(
721
- "Publish new build for a github sync project that is not linked."
887
+ const cmd3 = new Command42("publish");
888
+ cmd3.description("Publish a new build of a Scalar project");
889
+ cmd3.option("-s, --slug [slug]", "Project slug from scalar project list");
890
+ cmd3.option(
891
+ "-c, --config [config]",
892
+ "Scalar configuration file path for local publishing"
893
+ );
894
+ cmd3.option(
895
+ "-p, --preview",
896
+ "Publish a preview without replacing the live deployment"
722
897
  );
723
- cmd3.option("-s, --slug [slug]", "Project slug found in Scalar Dashboard");
724
- cmd3.option("-c, --config [config]", "Your config file of the project");
725
- cmd3.option("-p, --preview", "Publish in preview mode");
726
898
  cmd3.option(
727
899
  "-g, --github",
728
- "Publish from your linked remote GitHub repository"
900
+ "Publish from the linked GitHub repository instead of local files"
729
901
  );
902
+ completeFiles(cmd3, [], ["--config"]);
730
903
  cmd3.action(async (...args) => {
731
- const { publishAction } = await import("./chunks/action-43YBNBDR.js");
904
+ const { publishAction } = await import("./chunks/action-RPCDNGCI.js");
732
905
  return publishAction(...args);
733
906
  });
734
907
  return cmd3;
735
908
  };
736
909
 
737
910
  // src/domains/project/rollback/index.ts
738
- import { Command as Command39 } from "commander";
911
+ import { Command as Command43 } from "commander";
739
912
  var RollbackCommand = () => {
740
- const cmd3 = new Command39("rollback");
913
+ const cmd3 = new Command43("rollback");
741
914
  cmd3.description(
742
915
  "Roll the live deployment back to a previously deployed build."
743
916
  );
744
- cmd3.option("-s, --slug [slug]", "Project slug found in Scalar Dashboard");
917
+ cmd3.option("-s, --slug [slug]", "Project slug from scalar project list");
745
918
  cmd3.option(
746
919
  "-t, --to <publishUid>",
747
920
  "Roll back to a specific build id (defaults to the next older deployed build)"
748
921
  );
749
922
  cmd3.option("-y, --yes", "Skip the confirmation prompt");
750
923
  cmd3.action(async (...args) => {
751
- const { rollbackAction } = await import("./chunks/action-UIKH4SZX.js");
924
+ const { rollbackAction } = await import("./chunks/action-J5TO3UJW.js");
752
925
  return rollbackAction(...args);
753
926
  });
754
927
  return cmd3;
755
928
  };
756
929
 
757
930
  // src/domains/project/upgrade/index.ts
758
- import { Command as Command40 } from "commander";
931
+ import { Command as Command44 } from "commander";
759
932
  var UpgradeCommand2 = () => {
760
- const cmd3 = new Command40("upgrade");
761
- cmd3.description("Upgrade scalar project");
933
+ const cmd3 = new Command44("upgrade");
934
+ cmd3.description("Upgrade a Scalar Docs configuration");
762
935
  cmd3.argument(
763
936
  "[config]",
764
937
  "Path to the Scalar configuration file (usually `scalar.config.json5` or `scalar.config.json`)"
765
938
  );
939
+ completeFiles(cmd3, ["config"], []);
766
940
  cmd3.action(async (...args) => {
767
- const { upgradeAction } = await import("./chunks/action-CA4QYPI6.js");
941
+ const { upgradeAction } = await import("./chunks/action-NHU4CUKT.js");
768
942
  return upgradeAction(...args);
769
943
  });
770
944
  return cmd3;
@@ -772,6 +946,8 @@ var UpgradeCommand2 = () => {
772
946
 
773
947
  // src/domains/project/index.ts
774
948
  var projectCommands = [
949
+ ListCommand2,
950
+ GetCommand,
775
951
  InitCommand,
776
952
  CheckConfigCommand,
777
953
  CreateCommand,
@@ -781,71 +957,61 @@ var projectCommands = [
781
957
  DeploymentsCommand,
782
958
  UpgradeCommand2
783
959
  ];
784
- var projectDomain = new Command41("project");
785
- projectDomain.description("Manage scalar project");
786
- projectCommands.forEach((command) => projectDomain.addCommand(command()));
960
+ var projectDomain = new Command45("project");
961
+ projectDomain.description("Manage Scalar Docs projects");
962
+ for (const command of projectCommands) {
963
+ projectDomain.addCommand(command());
964
+ }
787
965
  projectDomain.addCommand(DownloadIsolateCommand(), { hidden: true });
788
966
  var project_default = projectDomain;
789
967
 
790
968
  // src/domains/readme/index.ts
791
- import { Command as Command43 } from "commander";
969
+ import { Command as Command47 } from "commander";
792
970
 
793
971
  // src/domains/readme/generate.ts
794
972
  import { text } from "@clack/prompts";
795
- import as2 from "ansis";
796
- import { Command as Command42 } from "commander";
973
+ import as from "ansis";
974
+ import { Command as Command46 } from "commander";
797
975
 
798
976
  // src/helpers/documentation/index.ts
799
977
  import fs from "node:fs/promises";
800
978
  import path from "node:path";
801
- var generateDocs = (command, depth = 0) => {
802
- if (command._hidden) return [];
803
- const documentation = [];
804
- documentation.push({
805
- title: command.name(),
806
- content: command.helpInformation(),
807
- depth
979
+ var COMMAND_REFERENCE_URL = "https://scalar.com/tools/cli/commands";
980
+ var hasOwnPage = (command) => runnableCommands(command.commands).length >= 2;
981
+ var referenceUrl = (command) => hasOwnPage(command) ? `${COMMAND_REFERENCE_URL}/${command.name}` : `${COMMAND_REFERENCE_URL}/general#${command.name}`;
982
+ var generateCommandTable = (commands) => {
983
+ const rows = commands.filter((command) => command.name !== "help").sort((a, b) => Number(hasOwnPage(b)) - Number(hasOwnPage(a))).map((command) => {
984
+ const prefix = `${command.command} `;
985
+ const subcommands = runnableCommands(command.commands).map((subcommand) => `\`${subcommand.command.slice(prefix.length)}\``).join(", ");
986
+ return `| [\`${command.command}\`](${referenceUrl(command)}) | ${command.description} | ${subcommands} |`;
808
987
  });
809
- const result = command.commands.flatMap((it) => generateDocs(it, depth + 1));
810
- documentation.push(...result);
811
- return documentation;
812
- };
813
- var generateCommandDocumentation = (command) => {
814
- const documentation = generateDocs(command);
815
- const codeBlock = "```";
816
- const documentationContent = [];
817
- for (const docs of documentation) {
818
- if (docs.depth !== 0) {
819
- documentationContent.push(`${"#".repeat(docs.depth + 2)} ${docs.title}`);
820
- }
821
- documentationContent.push(`${codeBlock}
822
- ${docs.content}${codeBlock}`);
823
- documentationContent.push("");
824
- }
825
- return documentationContent.join("\n");
988
+ return [
989
+ "| Command | Description | Subcommands |",
990
+ "| --- | --- | --- |",
991
+ ...rows
992
+ ].join("\n");
826
993
  };
827
994
  var generateDocumentationFile = async (outputPath) => {
828
- const commandDocumentation = generateCommandDocumentation(getProgram());
995
+ const { commands } = buildCliContext(getProgram());
829
996
  const template = await fs.readFile(
830
997
  path.join(import.meta.dirname, "template.md"),
831
- {
832
- encoding: "utf-8"
833
- }
998
+ { encoding: "utf-8" }
834
999
  );
835
1000
  await fs.writeFile(
836
1001
  outputPath,
837
- template.replace("<COMMANDS>", commandDocumentation)
1002
+ template.replace("<COMMANDS>", generateCommandTable(commands))
838
1003
  );
839
1004
  };
840
1005
 
841
1006
  // src/domains/readme/generate.ts
842
1007
  function GenerateReadmeCommand() {
843
- const cmd3 = new Command42("generate");
844
- cmd3.description("Self generate documentation for the cli");
1008
+ const cmd3 = new Command46("generate");
1009
+ cmd3.description("Generate the CLI README from the command tree");
845
1010
  cmd3.option(
846
1011
  "-o, --output [file]",
847
1012
  "Path where the documentation file will be written"
848
1013
  );
1014
+ completeFiles(cmd3, [], ["--output"]);
849
1015
  cmd3.action(async ({ output: __outputPath }) => {
850
1016
  const getOutputPath = async () => {
851
1017
  if (__outputPath !== void 0 && typeof __outputPath === "string") {
@@ -860,7 +1026,7 @@ function GenerateReadmeCommand() {
860
1026
  placeholder: "./README.md"
861
1027
  });
862
1028
  if (typeof outputPath2 !== "string") {
863
- return output.error().message("Operation cancelled by user").exit("error");
1029
+ return output.error().message("Operation cancelled.").exit("error");
864
1030
  }
865
1031
  return outputPath2;
866
1032
  };
@@ -868,67 +1034,52 @@ function GenerateReadmeCommand() {
868
1034
  const { executionTimeMs } = await measureTime(
869
1035
  () => generateDocumentationFile(outputPath)
870
1036
  );
871
- output.info().line().title(as2.green("Documentation Generated Successfully! \u{1F389}")).line().message(`\u2728 Documentation has been generated at: ${as2.blue(outputPath)}`).line(
872
- `\u23F1\uFE0F Generation completed in ${as2.yellow(executionTimeMs.toFixed(2))}ms`
873
- ).line("").exit("success");
1037
+ output.info().line().title(as.green("CLI documentation generated")).line().message(`Written to ${as.blue(outputPath)}`).line(`Completed (${as.yellow(executionTimeMs.toFixed(2))} ms)`).line("").exit("success");
874
1038
  });
875
1039
  return cmd3;
876
1040
  }
877
1041
 
878
1042
  // src/domains/readme/serve.ts
879
- import fs2 from "node:fs/promises";
880
- import path2 from "node:path";
881
- import as3 from "ansis";
882
- var fileExists = async (filePath) => {
883
- try {
884
- await fs2.access(filePath);
885
- return true;
886
- } catch {
887
- return false;
888
- }
889
- };
1043
+ import as2 from "ansis";
1044
+ var CLI_DOCS_URL = "https://scalar.com/tools/cli/getting-started";
890
1045
  function ServeReadmeCommand(cmd3) {
891
- cmd3.description("Open documentation for the CLI");
892
- cmd3.action(async () => {
893
- const docsPath = path2.join(import.meta.dirname, "docs.html");
894
- if (await fileExists(docsPath) === false) {
895
- return output.error().title("Documentation not found").message(
896
- "You can access documentation only by running the bundled version of the CLI."
897
- ).exit("error");
898
- }
899
- const docsUrl = `file://${path2.join(import.meta.dirname, "docs.html")}`;
900
- openBrowser(docsUrl);
1046
+ cmd3.description("Open CLI documentation in your browser");
1047
+ cmd3.action(() => {
1048
+ openBrowser(CLI_DOCS_URL);
901
1049
  output.info().message(
902
- "Documentation is being opened in your default browser. If it does not open automatically, please visit the following URL:"
903
- ).line(as3.blue(docsUrl)).line().exit("success");
1050
+ "Opening CLI documentation in your default browser. If it does not open, visit:"
1051
+ ).line(as2.blue(CLI_DOCS_URL)).line().exit("success");
904
1052
  });
905
1053
  return cmd3;
906
1054
  }
907
1055
 
908
1056
  // src/domains/readme/index.ts
909
- var readmeDomain = new Command43("readme");
1057
+ var readmeDomain = new Command47("readme");
910
1058
  readmeDomain.addCommand(GenerateReadmeCommand());
911
1059
  ServeReadmeCommand(readmeDomain);
912
1060
  var readme_default = readmeDomain;
913
1061
 
914
1062
  // src/domains/registry/index.ts
915
- import { Command as Command49 } from "commander";
1063
+ import { Command as Command53 } from "commander";
916
1064
 
917
1065
  // src/domains/registry/publish/index.ts
918
- import { Command as Command44 } from "commander";
1066
+ import { Command as Command48 } from "commander";
919
1067
  var PublishCommand2 = () => {
920
- const cmd3 = new Command44("publish");
921
- cmd3.description("Publish an OpenAPI document to the Scalar registry");
922
- cmd3.argument("[file]", "OpenAPI file to upload");
1068
+ const cmd3 = new Command48("publish");
1069
+ cmd3.description("Publish an OpenAPI description to the Scalar Registry");
1070
+ cmd3.argument("[file]", "API description file path or URL to upload");
923
1071
  cmd3.option(
924
1072
  "--slug <slug>",
925
- "Slug identifier for the registry entry. Defaults to title."
1073
+ "Scalar Registry entry slug (defaults to a slug generated from the title)"
926
1074
  );
927
1075
  cmd3.option("--namespace <namespace>", "Scalar team namespace");
928
- cmd3.option("--version <version>", "API version (e.g. 0.1.0)");
929
- cmd3.option("--private", "Make API private", false);
930
- cmd3.option("--no-current", "Do not set as the current version");
931
- cmd3.option("--force", "Force override an existing version", false);
1076
+ cmd3.option(
1077
+ "--version <version>",
1078
+ "API description version (for example, 0.1.0)"
1079
+ );
1080
+ cmd3.option("--private", "Make the API description private", false);
1081
+ cmd3.option("--no-current", "Keep the existing current version");
1082
+ cmd3.option("--force", "Overwrite an existing version", false);
932
1083
  cmd3.option("--bundle", "Bundle all external references before uploading");
933
1084
  cmd3.option(
934
1085
  "--treeShake",
@@ -940,71 +1091,81 @@ var PublishCommand2 = () => {
940
1091
  );
941
1092
  cmd3.option(
942
1093
  "--fetchLimit <limit>",
943
- "Maximum number of concurrent URLs to fetch when bundling the document",
1094
+ "Maximum number of concurrent URL fetches when bundling",
944
1095
  parseFetchLimit
945
1096
  );
1097
+ completeFiles(cmd3, ["file"], []);
946
1098
  cmd3.action(async (...args) => {
947
- const { publishAction } = await import("./chunks/action-6BYGBXRC.js");
1099
+ const { publishAction } = await import("./chunks/action-L7TMS3Q3.js");
948
1100
  return publishAction(...args);
949
1101
  });
950
1102
  return cmd3;
951
1103
  };
952
1104
 
953
1105
  // src/domains/registry/delete/index.ts
954
- import { Command as Command45 } from "commander";
1106
+ import { Command as Command49 } from "commander";
955
1107
  var DeleteCommand = () => {
956
- const cmd3 = new Command45("delete");
957
- cmd3.description("Delete a document from scalar registry");
1108
+ const cmd3 = new Command49("delete");
1109
+ cmd3.description("Delete an API description from the Scalar Registry");
958
1110
  cmd3.argument("[namespace]", "Team namespace");
959
- cmd3.argument("[slug]", "Managed doc slug");
1111
+ cmd3.argument("[slug]", "API description slug");
960
1112
  cmd3.action(async (...args) => {
961
- const { deleteAction } = await import("./chunks/action-YLF2G4G5.js");
1113
+ const { deleteAction } = await import("./chunks/action-IH6G77C5.js");
962
1114
  return deleteAction(...args);
963
1115
  });
964
1116
  return cmd3;
965
1117
  };
966
1118
 
967
1119
  // src/domains/registry/get/index.ts
968
- import { Command as Command46 } from "commander";
969
- var GetCommand = () => {
970
- const cmd3 = new Command46("get");
971
- cmd3.description("Get a document version from scalar registry");
1120
+ import { Command as Command50, Option as Option8 } from "commander";
1121
+ var GetCommand2 = () => {
1122
+ const cmd3 = new Command50("get");
1123
+ cmd3.description(
1124
+ "Download an API description version from the Scalar Registry"
1125
+ );
972
1126
  cmd3.argument("[namespace]", "Team namespace");
973
- cmd3.argument("[slug]", "Managed doc slug");
974
- cmd3.option("--version <version>", "Document version (defaults to latest)");
975
- cmd3.option("--format <format>", "Output format (json or yaml)", "json");
1127
+ cmd3.argument("[slug]", "API description slug");
1128
+ cmd3.option(
1129
+ "--version <version>",
1130
+ "API description version (defaults to latest)"
1131
+ );
1132
+ cmd3.addOption(
1133
+ new Option8("--format <format>", "Output format").choices([...DOCUMENT_FORMATS]).default("json")
1134
+ );
976
1135
  cmd3.option("-o, --output <file>", "Output file (defaults to stdout)");
1136
+ completeFiles(cmd3, [], ["--output"]);
977
1137
  cmd3.action(async (...args) => {
978
- const { getAction } = await import("./chunks/action-XIUO64C7.js");
1138
+ const { getAction } = await import("./chunks/action-5I4XDPPG.js");
979
1139
  return getAction(...args);
980
1140
  });
981
1141
  return cmd3;
982
1142
  };
983
1143
 
984
1144
  // src/domains/registry/list/index.ts
985
- import { Command as Command47 } from "commander";
986
- var ListCommand2 = () => {
987
- const cmd3 = new Command47("list");
988
- cmd3.description("List all registry APIs for a team namespace");
1145
+ import { Command as Command51 } from "commander";
1146
+ var ListCommand3 = () => {
1147
+ const cmd3 = new Command51("list");
1148
+ cmd3.description("List Scalar Registry API descriptions in a team namespace");
989
1149
  cmd3.option("--namespace <namespace>", "Team namespace");
1150
+ cmd3.option("--json", "Output Scalar Registry API metadata as JSON");
990
1151
  cmd3.action(async (...args) => {
991
- const { listAction } = await import("./chunks/action-LEUD5P2U.js");
1152
+ const { listAction } = await import("./chunks/action-25QMCP5G.js");
992
1153
  return listAction(...args);
993
1154
  });
994
1155
  return cmd3;
995
1156
  };
996
1157
 
997
1158
  // src/domains/registry/update/index.ts
998
- import { Command as Command48 } from "commander";
1159
+ import { Command as Command52 } from "commander";
999
1160
  var UpdateCommand = () => {
1000
- const cmd3 = new Command48("update");
1001
- cmd3.description("Update document metadata on scalar registry");
1002
- cmd3.argument("[namespace]", "namespace of document you want to update");
1003
- cmd3.argument("[slug]", "slug of document you want to update");
1004
- cmd3.option("--title <title>", "Document title");
1005
- cmd3.option("--description <description>", "Document description");
1161
+ const cmd3 = new Command52("update");
1162
+ cmd3.description("Update API description metadata in the Scalar Registry");
1163
+ cmd3.argument("[namespace]", "Team namespace");
1164
+ cmd3.argument("[slug]", "API description slug");
1165
+ cmd3.option("--title <title>", "API description title");
1166
+ cmd3.option("--description <description>", "API description summary");
1006
1167
  cmd3.action(async (...args) => {
1007
- const { updateAction } = await import("./chunks/action-LXGXKXZZ.js");
1168
+ const { updateAction } = await import("./chunks/action-HUICEXJZ.js");
1008
1169
  return updateAction(...args);
1009
1170
  });
1010
1171
  return cmd3;
@@ -1015,56 +1176,72 @@ var registryCommands = [
1015
1176
  PublishCommand2,
1016
1177
  UpdateCommand,
1017
1178
  DeleteCommand,
1018
- ListCommand2,
1019
- GetCommand
1179
+ ListCommand3,
1180
+ GetCommand2
1020
1181
  ];
1021
- var registryDomain = new Command49("registry");
1022
- registryDomain.description("Manage your scalar registry");
1182
+ var registryDomain = new Command53("registry");
1183
+ registryDomain.description("Manage API descriptions in the Scalar Registry");
1023
1184
  registryCommands.forEach((command) => registryDomain.addCommand(command()));
1024
1185
  var registry_default = registryDomain;
1025
1186
 
1026
1187
  // src/domains/team/index.ts
1027
- import { Command as Command52 } from "commander";
1188
+ import { Command as Command57 } from "commander";
1189
+
1190
+ // src/domains/team/get/index.ts
1191
+ import { Command as Command54 } from "commander";
1192
+ var GetCommand3 = () => {
1193
+ const cmd3 = new Command54("get");
1194
+ cmd3.description("Show the current team and its namespaces");
1195
+ cmd3.option("--json", "Output the current team as JSON");
1196
+ cmd3.action(async (...args) => {
1197
+ const { getAction } = await import("./chunks/action-NKTFNFU7.js");
1198
+ return getAction(...args);
1199
+ });
1200
+ return cmd3;
1201
+ };
1028
1202
 
1029
1203
  // src/domains/team/list/index.ts
1030
- import { Command as Command50 } from "commander";
1031
- var ListCommand3 = () => {
1032
- const cmd3 = new Command50("list");
1033
- cmd3.description("List all teams current user is part of");
1204
+ import { Command as Command55 } from "commander";
1205
+ var ListCommand4 = () => {
1206
+ const cmd3 = new Command55("list");
1207
+ cmd3.description("List your Scalar teams");
1208
+ cmd3.option("--json", "Output teams as JSON");
1034
1209
  cmd3.action(async (...args) => {
1035
- const { listAction } = await import("./chunks/action-W3C53GPH.js");
1210
+ const { listAction } = await import("./chunks/action-6M5PTDF6.js");
1036
1211
  return listAction(...args);
1037
1212
  });
1038
1213
  return cmd3;
1039
1214
  };
1040
1215
 
1041
1216
  // src/domains/team/set/index.ts
1042
- import { Command as Command51 } from "commander";
1217
+ import { Command as Command56 } from "commander";
1043
1218
  var SetCommand = () => {
1044
- const cmd3 = new Command51("set");
1045
- cmd3.description("Set current active team for the user");
1046
- cmd3.option("--team <team>", "Team uid");
1219
+ const cmd3 = new Command56("set");
1220
+ cmd3.description("Select the current team");
1221
+ cmd3.option("--team <team>", "Team ID");
1047
1222
  cmd3.action(async (...args) => {
1048
- const { setAction } = await import("./chunks/action-354TUG4H.js");
1223
+ const { setAction } = await import("./chunks/action-2VF6LODL.js");
1049
1224
  return setAction(...args);
1050
1225
  });
1051
1226
  return cmd3;
1052
1227
  };
1053
1228
 
1054
1229
  // src/domains/team/index.ts
1055
- var teamCommands = [ListCommand3, SetCommand];
1056
- var teamDomain = new Command52("team");
1057
- teamDomain.description("Manage user teams");
1058
- teamCommands.forEach((command) => teamDomain.addCommand(command()));
1230
+ var teamCommands = [ListCommand4, GetCommand3, SetCommand];
1231
+ var teamDomain = new Command57("team");
1232
+ teamDomain.description("List and switch between your Scalar teams");
1233
+ teamCommands.forEach((command) => {
1234
+ teamDomain.addCommand(command());
1235
+ });
1059
1236
  var team_default = teamDomain;
1060
1237
 
1061
1238
  // src/domains/upgrade/index.ts
1062
1239
  import { execSync } from "node:child_process";
1063
- import as5 from "ansis";
1064
- import { Command as Command53 } from "commander";
1240
+ import as4 from "ansis";
1241
+ import { Command as Command58 } from "commander";
1065
1242
 
1066
1243
  // src/helpers/upgrade.ts
1067
- import as4 from "ansis";
1244
+ import as3 from "ansis";
1068
1245
  import semver from "semver";
1069
1246
  var packageJsonSchema = external_exports.object({
1070
1247
  version: external_exports.string()
@@ -1100,10 +1277,18 @@ async function getUpgradeInformation(timeoutMs = USER_INITIATED_TIMEOUT_MS) {
1100
1277
  latestVersion
1101
1278
  };
1102
1279
  }
1103
- async function checkUpgrade() {
1104
- const emitOutput = () => output.info().message(
1105
- `New version available! Run ${as4.cyan("`scalar upgrade`")} to install the latest version`
1106
- ).print();
1280
+ async function checkUpgrade(stream = "stdout") {
1281
+ const emitOutput = () => {
1282
+ if (stream === "stderr") {
1283
+ process.stderr.write(
1284
+ "A new Scalar CLI version is available. Run `scalar upgrade` to install the latest version.\n"
1285
+ );
1286
+ return;
1287
+ }
1288
+ return output.info().message(
1289
+ `A new Scalar CLI version is available. Run ${as3.cyan("`scalar upgrade`")} to install the latest version.`
1290
+ ).print();
1291
+ };
1107
1292
  const now = Date.now();
1108
1293
  const delay = 1 * 60 * 60 * 1e3;
1109
1294
  const {
@@ -1128,30 +1313,30 @@ async function checkUpgrade() {
1128
1313
  }
1129
1314
 
1130
1315
  // src/domains/upgrade/index.ts
1131
- var cmd2 = new Command53("upgrade");
1132
- cmd2.description("Upgrade current version of your cli");
1316
+ var cmd2 = new Command58("upgrade");
1317
+ cmd2.description("Upgrade the Scalar CLI to the latest version");
1133
1318
  cmd2.action(async () => {
1134
1319
  if (process.env.SCALAR_CLI_DISTRIBUTION === "portable") {
1135
1320
  output.info().message(
1136
- "To upgrade this portable installation, download and extract the newer Scalar archive, then replace the installation directory."
1321
+ "To upgrade an installer-managed Scalar CLI, run the installer again. For a manually extracted installation, download and extract the newer archive and replace the installation directory."
1137
1322
  ).print();
1138
1323
  return;
1139
1324
  }
1140
1325
  const upgradeStatus = await getUpgradeInformation();
1141
1326
  if (!upgradeStatus.upgrade) {
1142
- output.info().message("You are already up to date").print();
1327
+ output.info().message("Scalar CLI is already up to date.").print();
1143
1328
  return;
1144
1329
  }
1145
1330
  output.info().message(
1146
- `Upgrading from ${upgradeStatus.currentVersion} to ${upgradeStatus.latestVersion}...`
1331
+ `Upgrading from ${upgradeStatus.currentVersion} to ${upgradeStatus.latestVersion}\u2026`
1147
1332
  ).print();
1148
1333
  try {
1149
1334
  execSync(`npm install -g ${upgradeStatus.name}@latest`, {
1150
1335
  stdio: "inherit"
1151
1336
  });
1152
- output.info().message("Successfully upgraded to the latest version").print();
1337
+ output.info().message("Scalar CLI upgraded to the latest version.").print();
1153
1338
  } catch {
1154
- output.error().title("Upgrade failed").message("Failed to upgrade the CLI. Please try running:").message(as5.cyan(`npm install -g ${upgradeStatus.name}@latest`)).exit("error");
1339
+ output.error().title("Upgrade failed").message("Could not upgrade Scalar CLI. Run:").message(as4.cyan(`npm install -g ${upgradeStatus.name}@latest`)).exit("error");
1155
1340
  }
1156
1341
  });
1157
1342
  var upgrade_default = cmd2;
@@ -1161,6 +1346,7 @@ var domains = [
1161
1346
  readme_default,
1162
1347
  upgrade_default,
1163
1348
  context_default,
1349
+ createCompletionCommand(),
1164
1350
  auth_default,
1165
1351
  access_group_default,
1166
1352
  document_default,
@@ -1174,10 +1360,19 @@ var domains_default = domains;
1174
1360
 
1175
1361
  // src/program.ts
1176
1362
  var getProgram = () => {
1177
- const program2 = new Command54();
1178
- program2.enablePositionalOptions().name(Object.keys(bin)[0]).description("CLI to work with your OpenAPI files").version(version, "-v, --version");
1363
+ const program2 = new Command59();
1364
+ program2.enablePositionalOptions().name(Object.keys(bin)[0]).description(
1365
+ "Validate, lint, bundle, mock, and preview OpenAPI and AsyncAPI descriptions, and publish them to Scalar"
1366
+ ).version(version, "-v, --version", "Show the version number");
1179
1367
  program2.showHelpAfterError();
1180
1368
  domains_default.forEach((domain) => program2.addCommand(domain));
1369
+ program2.addCommand(createCompletionQueryCommand(), { hidden: true });
1370
+ const configureHelpCopy = (command) => {
1371
+ command.helpOption("-h, --help", "Show help for this command");
1372
+ command.createHelp().visibleCommands(command).find((child) => child.name() === "help")?.description("Show help for a command");
1373
+ for (const child of command.commands) configureHelpCopy(child);
1374
+ };
1375
+ configureHelpCopy(program2);
1181
1376
  return program2;
1182
1377
  };
1183
1378
 
@@ -1192,8 +1387,10 @@ var program = getProgram();
1192
1387
  if (process.argv.length === 2) {
1193
1388
  program.help();
1194
1389
  }
1195
- if (process.argv[2] !== "upgrade" && process.argv[2] !== "context" && !(process.argv[2] === "access-group" && process.argv.includes("--json")) && process.env.SCALAR_CLI_DISTRIBUTION !== "portable") {
1196
- checkUpgrade().catch(() => {
1390
+ if (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") {
1391
+ checkUpgrade(
1392
+ process.argv[2] === "document" && process.argv[3] === "lint" ? "stderr" : "stdout"
1393
+ ).catch(() => {
1197
1394
  });
1198
1395
  }
1199
1396
  program.parse();