@scalar/cli 2.12.1 → 2.12.3
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.
- package/README.md +2 -0
- package/chunks/{action-JT6C472I.js → action-4ESHWOAM.js} +4 -4
- package/chunks/{action-7HXYZPOT.js → action-5BJL72JE.js} +4 -4
- package/chunks/{action-UTFRCKGE.js → action-6A4NM5WS.js} +4 -4
- package/chunks/{action-KWFAMQN5.js → action-6I2PWENU.js} +19 -19
- package/chunks/{action-D52JJ3NL.js → action-7CUPRYNA.js} +13 -13
- package/chunks/{action-6IHAGCNR.js → action-AYKKHH7A.js} +13 -13
- package/chunks/{action-AOKHLTZ6.js → action-B74PPGKB.js} +5 -5
- package/chunks/{action-NY2MGVBS.js → action-BDDXF4YV.js} +13 -13
- package/chunks/{action-T2I4TFLU.js → action-BYYKW4S6.js} +8 -8
- package/chunks/action-D7L757PX.js +422 -0
- package/chunks/{action-HJSRU322.js → action-ED4TSPRZ.js} +13 -13
- package/chunks/{action-IASJWF5P.js → action-EPGS3U3T.js} +14 -14
- package/chunks/{action-D3IVCY24.js → action-EWDQOX5B.js} +4 -4
- package/chunks/{action-TH3TYR2A.js → action-EWZLVN45.js} +21 -21
- package/chunks/{action-A2GXYB2K.js → action-FBOTIFVC.js} +10 -10
- package/chunks/{action-YL3CEKE7.js → action-FBQAU5LV.js} +13 -13
- package/chunks/{action-4G23NFVD.js → action-GJHOZ6Q5.js} +66 -46
- package/chunks/{action-GZKDPO3N.js → action-GMJJMZXY.js} +13 -13
- package/chunks/{action-XPJFCCAT.js → action-H4GW3KAI.js} +17 -17
- package/chunks/{action-6IZYBY5P.js → action-HAKFAXTQ.js} +4 -4
- package/chunks/{action-4B3MNNEG.js → action-I2IV4VLL.js} +18 -18
- package/chunks/{action-6UOTMYQ4.js → action-JXCU2JKC.js} +2 -2
- package/chunks/{action-KDT6H6ML.js → action-KIOYSVKX.js} +4 -4
- package/chunks/{action-IIQMZVRJ.js → action-LRR52RXL.js} +10 -8
- package/chunks/{action-INB2R2NQ.js → action-M5OUEDV2.js} +4 -4
- package/chunks/{action-AQ7BSPBE.js → action-O7ROX6NF.js} +89 -51
- package/chunks/{action-JHPUNA7Z.js → action-Q3DI54OW.js} +17 -17
- package/chunks/{action-6KP6KOYC.js → action-RPTLQBMK.js} +6 -6
- package/chunks/{action-RDXVIAS3.js → action-T4MM4OUS.js} +19 -19
- package/chunks/{action-S7SONQ5E.js → action-UHXBY3RD.js} +2 -2
- package/chunks/{action-ENZGEP4Y.js → action-VVKMUOKR.js} +8 -6
- package/chunks/{action-O757TFA2.js → action-YXRCGKCK.js} +4 -4
- package/chunks/{action-HA3CMV3P.js → action-ZBEOLJJR.js} +4 -4
- package/chunks/{action-5I763IT2.js → action-ZOYQBWGD.js} +16 -16
- package/chunks/{actions-LNIEIP7C.js → actions-EXQNVV4T.js} +13 -13
- package/chunks/{agent-F2A4UROF.js → agent-XAHNA4MB.js} +4 -4
- package/chunks/{asyncapi-HASQNFWS.js → asyncapi-FNOWXSKB.js} +51 -43
- package/chunks/{build.action-XKJ4ET3G.js → build.action-TIKRZPQ5.js} +17 -17
- package/chunks/{chunk-N645RGAB.js → chunk-2AK5O3NQ.js} +33 -33
- package/chunks/{chunk-LWIAFTKX.js → chunk-2GKXAGSH.js} +55 -10
- package/chunks/chunk-2I6V7AI3.js +68 -0
- package/chunks/{chunk-CFI5GBAK.js → chunk-4YQVGOHX.js} +1 -1
- package/chunks/{chunk-ZW62VYJW.js → chunk-62OOT7FY.js} +5 -5
- package/chunks/{chunk-KWLAZV7P.js → chunk-7S34K2P3.js} +1 -1
- package/chunks/{chunk-U764PQUA.js → chunk-AOZQPCWI.js} +2 -0
- package/chunks/{chunk-BHWUD65X.js → chunk-BDNCJLJP.js} +1 -1
- package/chunks/{chunk-WZJTV4ET.js → chunk-BOPEAS7H.js} +1 -1
- package/chunks/{chunk-D5YZ3FXG.js → chunk-CUHVXHIV.js} +1 -1
- package/chunks/{chunk-PU5UIHAF.js → chunk-EUFK4MVX.js} +2 -2
- package/chunks/{chunk-V3MYP5SQ.js → chunk-EXJUFF6G.js} +13 -2
- package/chunks/{chunk-7M44FQHX.js → chunk-F3TQHNSQ.js} +139 -95
- package/chunks/{chunk-NTRWXCXD.js → chunk-FI7UKPRF.js} +2 -2
- package/chunks/{chunk-LLZDQXYS.js → chunk-FYMDIB7J.js} +1 -1
- package/chunks/{chunk-SNOAL2C5.js → chunk-I7ZVWF57.js} +1 -1
- package/chunks/{chunk-DKZ3PS3X.js → chunk-IOW726L2.js} +1 -1
- package/chunks/{chunk-7TSQ7ZGU.js → chunk-IRA5BW2J.js} +7 -5
- package/chunks/{chunk-4BE7UCJO.js → chunk-JWNWOK2M.js} +2 -2
- package/chunks/{chunk-JLNHOA5Z.js → chunk-KPLWZIOV.js} +36 -4
- package/chunks/{chunk-EJSGWV2K.js → chunk-KWIY2QZY.js} +1 -1
- package/chunks/{chunk-GPQXLA43.js → chunk-LEECPQZN.js} +2 -2
- package/chunks/{chunk-YLZP3W37.js → chunk-MQ65WBVF.js} +22 -1
- package/chunks/{chunk-IZVRYC2N.js → chunk-OZQPMMTA.js} +3 -3
- package/chunks/{chunk-V6LUKXBV.js → chunk-RE5Z56QD.js} +2 -2
- package/chunks/{chunk-XLZEIIPW.js → chunk-TI4NDKQC.js} +40 -7
- package/chunks/{chunk-VUNOOPEG.js → chunk-TYNF7ROW.js} +1 -1
- package/chunks/{chunk-YMRRFDEQ.js → chunk-UN2AAVO5.js} +2 -2
- package/chunks/chunk-V7RTDFHK.js +56 -0
- package/chunks/{chunk-PERC34BV.js → chunk-WKW5W2ZP.js} +1 -1
- package/chunks/{chunk-RYWXF3LO.js → chunk-Y2OQOAY7.js} +1 -1
- package/chunks/{chunk-E57QCEAV.js → chunk-YTTDYTVB.js} +1 -1
- package/chunks/{create.action-XXOLILUS.js → create.action-K7GTWYST.js} +17 -17
- package/chunks/{delete.action-R5KGPLDG.js → delete.action-E4XRGKQW.js} +16 -16
- package/chunks/{delete.action-TQJOZRV7.js → delete.action-JKLXBYRD.js} +17 -17
- package/chunks/{get.action-IQMOL4WM.js → get.action-2AKMD4W3.js} +10 -10
- package/chunks/{get.action-46OBVOQQ.js → get.action-IY7WSJMX.js} +16 -16
- package/chunks/{list.action-RIS7Q4OU.js → list.action-44YVCWKN.js} +16 -16
- package/chunks/{list.action-GXTKKVHY.js → list.action-NRL2DDL5.js} +17 -17
- package/chunks/{publish.action-A4T4BT3F.js → publish.action-E76MHLCN.js} +21 -21
- package/chunks/{update.action-TK5L4PXB.js → update.action-FTTVWVAB.js} +16 -16
- package/chunks/{update.action-IZ5GULPY.js → update.action-LZCAHAWW.js} +17 -17
- package/index.js +223 -117
- package/package.json +1 -1
- package/skills/scalar-cli/SKILL.md +1 -1
- package/template.md +2 -0
- package/chunks/action-VK5HZHSC.js +0 -165
- package/chunks/chunk-JFIXNSPP.js +0 -26
package/index.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
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-
|
|
5
|
+
} from "./chunks/chunk-CUHVXHIV.js";
|
|
6
6
|
import {
|
|
7
7
|
buildCliContext,
|
|
8
8
|
runnableCommands
|
|
9
9
|
} from "./chunks/chunk-EBNFCIKS.js";
|
|
10
10
|
import {
|
|
11
11
|
openBrowser
|
|
12
|
-
} from "./chunks/chunk-
|
|
12
|
+
} from "./chunks/chunk-V7RTDFHK.js";
|
|
13
13
|
import {
|
|
14
14
|
measureTime
|
|
15
15
|
} from "./chunks/chunk-KHDYYVYF.js";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
BundleCommand,
|
|
18
18
|
parseFetchLimit,
|
|
19
19
|
parsePort
|
|
20
|
-
} from "./chunks/chunk-
|
|
20
|
+
} from "./chunks/chunk-KWIY2QZY.js";
|
|
21
21
|
import {
|
|
22
22
|
completeFiles
|
|
23
23
|
} from "./chunks/chunk-DFOZG7ZV.js";
|
|
@@ -27,7 +27,11 @@ import {
|
|
|
27
27
|
} from "./chunks/chunk-NAC63XJF.js";
|
|
28
28
|
import {
|
|
29
29
|
SdkLanguage
|
|
30
|
-
} from "./chunks/chunk-
|
|
30
|
+
} from "./chunks/chunk-Y2OQOAY7.js";
|
|
31
|
+
import {
|
|
32
|
+
err,
|
|
33
|
+
ok
|
|
34
|
+
} from "./chunks/chunk-5ENKYZA4.js";
|
|
31
35
|
import {
|
|
32
36
|
checkNodeVersion
|
|
33
37
|
} from "./chunks/chunk-VUXPDHTQ.js";
|
|
@@ -35,14 +39,14 @@ import {
|
|
|
35
39
|
getMetadata,
|
|
36
40
|
logout,
|
|
37
41
|
setMetadata
|
|
38
|
-
} from "./chunks/chunk-
|
|
39
|
-
import "./chunks/chunk-
|
|
42
|
+
} from "./chunks/chunk-FI7UKPRF.js";
|
|
43
|
+
import "./chunks/chunk-FYMDIB7J.js";
|
|
40
44
|
import {
|
|
41
45
|
bin,
|
|
42
46
|
name,
|
|
43
47
|
version
|
|
44
|
-
} from "./chunks/chunk-
|
|
45
|
-
import "./chunks/chunk-
|
|
48
|
+
} from "./chunks/chunk-IOW726L2.js";
|
|
49
|
+
import "./chunks/chunk-F3TQHNSQ.js";
|
|
46
50
|
import "./chunks/chunk-VRZSDUZK.js";
|
|
47
51
|
import {
|
|
48
52
|
requireInteractive
|
|
@@ -50,7 +54,7 @@ import {
|
|
|
50
54
|
import {
|
|
51
55
|
output
|
|
52
56
|
} from "./chunks/chunk-T5HJUAWB.js";
|
|
53
|
-
import "./chunks/chunk-
|
|
57
|
+
import "./chunks/chunk-AOZQPCWI.js";
|
|
54
58
|
import "./chunks/chunk-Q26DFKTY.js";
|
|
55
59
|
import {
|
|
56
60
|
external_exports
|
|
@@ -74,7 +78,7 @@ var DeleteSchemaCommand = () => {
|
|
|
74
78
|
cmd3.option("-s, --slug <slug>", "Schema slug");
|
|
75
79
|
cmd3.option("-n, --namespace <namespace>", "Team namespace");
|
|
76
80
|
cmd3.action(async (...args) => {
|
|
77
|
-
const { deleteAction } = await import("./chunks/delete.action-
|
|
81
|
+
const { deleteAction } = await import("./chunks/delete.action-E4XRGKQW.js");
|
|
78
82
|
return deleteAction(...args);
|
|
79
83
|
});
|
|
80
84
|
return cmd3;
|
|
@@ -94,7 +98,7 @@ var GetSchemaCommand = () => {
|
|
|
94
98
|
cmd3.option("-o, --output <file>", "Output file (defaults to stdout)");
|
|
95
99
|
completeFiles(cmd3, [], ["--output"]);
|
|
96
100
|
cmd3.action(async (...args) => {
|
|
97
|
-
const { getAction } = await import("./chunks/get.action-
|
|
101
|
+
const { getAction } = await import("./chunks/get.action-2AKMD4W3.js");
|
|
98
102
|
return getAction(...args);
|
|
99
103
|
});
|
|
100
104
|
return cmd3;
|
|
@@ -108,7 +112,7 @@ var ListSchemaCommand = () => {
|
|
|
108
112
|
cmd3.option("--namespace <namespace>", "Team namespace");
|
|
109
113
|
cmd3.option("--json", "Output schema metadata as JSON");
|
|
110
114
|
cmd3.action(async (...args) => {
|
|
111
|
-
const { listAction } = await import("./chunks/list.action-
|
|
115
|
+
const { listAction } = await import("./chunks/list.action-NRL2DDL5.js");
|
|
112
116
|
return listAction(...args);
|
|
113
117
|
});
|
|
114
118
|
return cmd3;
|
|
@@ -142,7 +146,7 @@ var PublishSchemaCommand = () => {
|
|
|
142
146
|
);
|
|
143
147
|
completeFiles(cmd3, ["file"], []);
|
|
144
148
|
cmd3.action(async (...args) => {
|
|
145
|
-
const { publishAction } = await import("./chunks/publish.action-
|
|
149
|
+
const { publishAction } = await import("./chunks/publish.action-E76MHLCN.js");
|
|
146
150
|
return publishAction(...args);
|
|
147
151
|
});
|
|
148
152
|
return cmd3;
|
|
@@ -164,7 +168,7 @@ var UpdateSchemaCommand = () => {
|
|
|
164
168
|
).choices([...PRIVACY_VALUES])
|
|
165
169
|
);
|
|
166
170
|
cmd3.action(async (...args) => {
|
|
167
|
-
const { updateAction } = await import("./chunks/update.action-
|
|
171
|
+
const { updateAction } = await import("./chunks/update.action-FTTVWVAB.js");
|
|
168
172
|
return updateAction(...args);
|
|
169
173
|
});
|
|
170
174
|
return cmd3;
|
|
@@ -194,7 +198,7 @@ var BuildSdkCommand = () => {
|
|
|
194
198
|
cmd3.option("-s, --slug <slug>", "SDK slug");
|
|
195
199
|
cmd3.option("-n, --namespace <namespace>", "Team namespace");
|
|
196
200
|
cmd3.action(async (...args) => {
|
|
197
|
-
const { buildAction } = await import("./chunks/build.action-
|
|
201
|
+
const { buildAction } = await import("./chunks/build.action-TIKRZPQ5.js");
|
|
198
202
|
return buildAction(...args);
|
|
199
203
|
});
|
|
200
204
|
return cmd3;
|
|
@@ -213,7 +217,7 @@ var CreateSdkCommand = () => {
|
|
|
213
217
|
)
|
|
214
218
|
);
|
|
215
219
|
cmd3.action(async (...args) => {
|
|
216
|
-
const { createAction } = await import("./chunks/create.action-
|
|
220
|
+
const { createAction } = await import("./chunks/create.action-K7GTWYST.js");
|
|
217
221
|
return createAction(...args);
|
|
218
222
|
});
|
|
219
223
|
return cmd3;
|
|
@@ -227,7 +231,7 @@ var DeleteSdkCommand = () => {
|
|
|
227
231
|
cmd3.option("-s, --slug <slug>", "SDK slug");
|
|
228
232
|
cmd3.option("-n, --namespace <namespace>", "Team namespace");
|
|
229
233
|
cmd3.action(async (...args) => {
|
|
230
|
-
const { deleteAction } = await import("./chunks/delete.action-
|
|
234
|
+
const { deleteAction } = await import("./chunks/delete.action-JKLXBYRD.js");
|
|
231
235
|
return deleteAction(...args);
|
|
232
236
|
});
|
|
233
237
|
return cmd3;
|
|
@@ -248,7 +252,7 @@ var UpdateSdkCommand = () => {
|
|
|
248
252
|
).choices([...PRIVACY_VALUES])
|
|
249
253
|
);
|
|
250
254
|
cmd3.action(async (...args) => {
|
|
251
|
-
const { updateAction } = await import("./chunks/update.action-
|
|
255
|
+
const { updateAction } = await import("./chunks/update.action-LZCAHAWW.js");
|
|
252
256
|
return updateAction(...args);
|
|
253
257
|
});
|
|
254
258
|
return cmd3;
|
|
@@ -265,7 +269,7 @@ var GetSdkCommand = () => {
|
|
|
265
269
|
cmd3.option("-n, --namespace <namespace>", "Team namespace");
|
|
266
270
|
cmd3.option("--json", "Output structured SDK metadata as JSON");
|
|
267
271
|
cmd3.action(async (...args) => {
|
|
268
|
-
const { getAction } = await import("./chunks/get.action-
|
|
272
|
+
const { getAction } = await import("./chunks/get.action-IY7WSJMX.js");
|
|
269
273
|
return getAction(...args);
|
|
270
274
|
});
|
|
271
275
|
return cmd3;
|
|
@@ -279,7 +283,7 @@ var ListSdkCommand = () => {
|
|
|
279
283
|
cmd3.option("--json", "Output structured SDK metadata as JSON");
|
|
280
284
|
cmd3.option("--namespace <namespace>", "Team namespace");
|
|
281
285
|
cmd3.action(async (...args) => {
|
|
282
|
-
const { listAction } = await import("./chunks/list.action-
|
|
286
|
+
const { listAction } = await import("./chunks/list.action-44YVCWKN.js");
|
|
283
287
|
return listAction(...args);
|
|
284
288
|
});
|
|
285
289
|
return cmd3;
|
|
@@ -308,41 +312,41 @@ function createAccessGroupCommand() {
|
|
|
308
312
|
"Manage access groups and allowed email domains for the current team"
|
|
309
313
|
);
|
|
310
314
|
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-
|
|
315
|
+
const { runAction } = await import("./chunks/actions-EXQNVV4T.js");
|
|
312
316
|
await runAction({ operation: "list", ...options });
|
|
313
317
|
});
|
|
314
318
|
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(
|
|
315
319
|
async (slug, options) => {
|
|
316
|
-
const { runAction } = await import("./chunks/actions-
|
|
320
|
+
const { runAction } = await import("./chunks/actions-EXQNVV4T.js");
|
|
317
321
|
await runAction({ operation: "create", slug, ...options });
|
|
318
322
|
}
|
|
319
323
|
);
|
|
320
324
|
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) => {
|
|
321
|
-
const { runAction } = await import("./chunks/actions-
|
|
325
|
+
const { runAction } = await import("./chunks/actions-EXQNVV4T.js");
|
|
322
326
|
await runAction({ operation: "get", slug, ...options });
|
|
323
327
|
});
|
|
324
328
|
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(
|
|
325
329
|
async (slug, options) => {
|
|
326
|
-
const { runAction } = await import("./chunks/actions-
|
|
330
|
+
const { runAction } = await import("./chunks/actions-EXQNVV4T.js");
|
|
327
331
|
await runAction({ operation: "update", slug, ...options });
|
|
328
332
|
}
|
|
329
333
|
);
|
|
330
334
|
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(
|
|
331
335
|
async (slug, options) => {
|
|
332
|
-
const { runAction } = await import("./chunks/actions-
|
|
336
|
+
const { runAction } = await import("./chunks/actions-EXQNVV4T.js");
|
|
333
337
|
await runAction({ operation: "delete", slug, ...options });
|
|
334
338
|
}
|
|
335
339
|
);
|
|
336
340
|
const domain = command.command("domain").description("Manage allowed email domains");
|
|
337
341
|
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(
|
|
338
342
|
async (slug, domain2, options) => {
|
|
339
|
-
const { runAction } = await import("./chunks/actions-
|
|
343
|
+
const { runAction } = await import("./chunks/actions-EXQNVV4T.js");
|
|
340
344
|
await runAction({ operation: "add-domain", slug, domain: domain2, ...options });
|
|
341
345
|
}
|
|
342
346
|
);
|
|
343
347
|
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(
|
|
344
348
|
async (slug, domain2, options) => {
|
|
345
|
-
const { runAction } = await import("./chunks/actions-
|
|
349
|
+
const { runAction } = await import("./chunks/actions-EXQNVV4T.js");
|
|
346
350
|
await runAction({
|
|
347
351
|
operation: "remove-domain",
|
|
348
352
|
slug,
|
|
@@ -377,7 +381,7 @@ var LoginCommand = () => {
|
|
|
377
381
|
).hideHelp()
|
|
378
382
|
);
|
|
379
383
|
cmd3.action(async (...args) => {
|
|
380
|
-
const { loginAction } = await import("./chunks/action-
|
|
384
|
+
const { loginAction } = await import("./chunks/action-VVKMUOKR.js");
|
|
381
385
|
return loginAction(...args);
|
|
382
386
|
});
|
|
383
387
|
return cmd3;
|
|
@@ -402,7 +406,7 @@ var WhoAmICommand = () => {
|
|
|
402
406
|
cmd3.description("Show the logged-in user and current team");
|
|
403
407
|
cmd3.option("--json", "Output authentication details as JSON");
|
|
404
408
|
cmd3.action(async (options) => {
|
|
405
|
-
const { whoamiAction } = await import("./chunks/action-
|
|
409
|
+
const { whoamiAction } = await import("./chunks/action-GMJJMZXY.js");
|
|
406
410
|
return whoamiAction(options);
|
|
407
411
|
});
|
|
408
412
|
return cmd3;
|
|
@@ -481,7 +485,7 @@ function JoinCommand() {
|
|
|
481
485
|
);
|
|
482
486
|
completeFiles(cmd3, ["files"], ["--output"]);
|
|
483
487
|
cmd3.action(async (...args) => {
|
|
484
|
-
const { joinAction } = await import("./chunks/action-
|
|
488
|
+
const { joinAction } = await import("./chunks/action-4ESHWOAM.js");
|
|
485
489
|
return joinAction(...args);
|
|
486
490
|
});
|
|
487
491
|
return cmd3;
|
|
@@ -505,7 +509,7 @@ function SplitCommand() {
|
|
|
505
509
|
);
|
|
506
510
|
completeFiles(cmd3, ["file|url"], ["--output"]);
|
|
507
511
|
cmd3.action(async (...args) => {
|
|
508
|
-
const { splitAction } = await import("./chunks/action-
|
|
512
|
+
const { splitAction } = await import("./chunks/action-5BJL72JE.js");
|
|
509
513
|
return splitAction(...args);
|
|
510
514
|
});
|
|
511
515
|
return cmd3;
|
|
@@ -523,7 +527,7 @@ function FormatCommand() {
|
|
|
523
527
|
);
|
|
524
528
|
completeFiles(cmd3, ["file|url"], ["--output"]);
|
|
525
529
|
cmd3.action(async (...args) => {
|
|
526
|
-
const { formatAction } = await import("./chunks/action-
|
|
530
|
+
const { formatAction } = await import("./chunks/action-KIOYSVKX.js");
|
|
527
531
|
return formatAction(...args);
|
|
528
532
|
});
|
|
529
533
|
return cmd3;
|
|
@@ -576,7 +580,7 @@ function LintCommand() {
|
|
|
576
580
|
);
|
|
577
581
|
completeFiles(cmd3, ["file|url"], ["--rule", "--output", "--ignore-file"]);
|
|
578
582
|
cmd3.action(async (...args) => {
|
|
579
|
-
const { lintAction } = await import("./chunks/action-
|
|
583
|
+
const { lintAction } = await import("./chunks/action-HAKFAXTQ.js");
|
|
580
584
|
return lintAction(...args);
|
|
581
585
|
});
|
|
582
586
|
return cmd3;
|
|
@@ -591,7 +595,7 @@ function MarkdownCommand() {
|
|
|
591
595
|
cmd3.option("-o, --output <file>", "Output file (defaults to stdout)");
|
|
592
596
|
completeFiles(cmd3, ["file|url"], ["--output"]);
|
|
593
597
|
cmd3.action(async (...args) => {
|
|
594
|
-
const { markdownAction } = await import("./chunks/action-
|
|
598
|
+
const { markdownAction } = await import("./chunks/action-EWDQOX5B.js");
|
|
595
599
|
return markdownAction(...args);
|
|
596
600
|
});
|
|
597
601
|
return cmd3;
|
|
@@ -606,12 +610,11 @@ function MockCommand() {
|
|
|
606
610
|
);
|
|
607
611
|
cmd3.argument("[file|url]", "OpenAPI or AsyncAPI file or URL to mock");
|
|
608
612
|
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
613
|
cmd3.option("-p, --port <port>", "HTTP port for the Mock Server", parsePort);
|
|
611
614
|
completeFiles(cmd3, ["file|url"], []);
|
|
612
615
|
cmd3.action(async (...args) => {
|
|
613
|
-
const { mockAction } = await import("./chunks/action-
|
|
614
|
-
|
|
616
|
+
const { mockAction } = await import("./chunks/action-GJHOZ6Q5.js");
|
|
617
|
+
await mockAction(...args);
|
|
615
618
|
});
|
|
616
619
|
return cmd3;
|
|
617
620
|
}
|
|
@@ -629,7 +632,7 @@ function ConvertCommand() {
|
|
|
629
632
|
);
|
|
630
633
|
completeFiles(cmd3, ["file|url"], ["--output"]);
|
|
631
634
|
cmd3.action(async (...args) => {
|
|
632
|
-
const { convertAction } = await import("./chunks/action-
|
|
635
|
+
const { convertAction } = await import("./chunks/action-YXRCGKCK.js");
|
|
633
636
|
return convertAction(...args);
|
|
634
637
|
});
|
|
635
638
|
return cmd3;
|
|
@@ -648,7 +651,6 @@ function ServeCommand() {
|
|
|
648
651
|
"JSON file with API Reference configuration"
|
|
649
652
|
);
|
|
650
653
|
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");
|
|
652
654
|
cmd3.option(
|
|
653
655
|
"-p, --port <port>",
|
|
654
656
|
"HTTP port for the API Reference server",
|
|
@@ -656,8 +658,8 @@ function ServeCommand() {
|
|
|
656
658
|
);
|
|
657
659
|
completeFiles(cmd3, ["file|url"], ["--config"]);
|
|
658
660
|
cmd3.action(async (...args) => {
|
|
659
|
-
const { serveAction } = await import("./chunks/action-
|
|
660
|
-
|
|
661
|
+
const { serveAction } = await import("./chunks/action-O7ROX6NF.js");
|
|
662
|
+
await serveAction(...args);
|
|
661
663
|
});
|
|
662
664
|
return cmd3;
|
|
663
665
|
}
|
|
@@ -676,7 +678,7 @@ function ShareCommand() {
|
|
|
676
678
|
);
|
|
677
679
|
completeFiles(cmd3, ["file"], []);
|
|
678
680
|
cmd3.action(async (...args) => {
|
|
679
|
-
const { shareAction } = await import("./chunks/action-
|
|
681
|
+
const { shareAction } = await import("./chunks/action-RPTLQBMK.js");
|
|
680
682
|
return shareAction(...args);
|
|
681
683
|
});
|
|
682
684
|
return cmd3;
|
|
@@ -696,7 +698,7 @@ function UpgradeCommand() {
|
|
|
696
698
|
);
|
|
697
699
|
completeFiles(cmd3, ["file|url"], ["--output"]);
|
|
698
700
|
cmd3.action(async (...args) => {
|
|
699
|
-
const { upgradeAction } = await import("./chunks/action-
|
|
701
|
+
const { upgradeAction } = await import("./chunks/action-ZBEOLJJR.js");
|
|
700
702
|
return upgradeAction(...args);
|
|
701
703
|
});
|
|
702
704
|
return cmd3;
|
|
@@ -710,7 +712,7 @@ function ValidateCommand() {
|
|
|
710
712
|
cmd3.argument("[file|url]", "File or URL to validate");
|
|
711
713
|
completeFiles(cmd3, ["file|url"], []);
|
|
712
714
|
cmd3.action(async (...args) => {
|
|
713
|
-
const { validateAction } = await import("./chunks/action-
|
|
715
|
+
const { validateAction } = await import("./chunks/action-6A4NM5WS.js");
|
|
714
716
|
return validateAction(...args);
|
|
715
717
|
});
|
|
716
718
|
return cmd3;
|
|
@@ -721,15 +723,14 @@ import { Command as Command32 } from "commander";
|
|
|
721
723
|
function VoidCommand() {
|
|
722
724
|
const cmd3 = new Command32("void");
|
|
723
725
|
cmd3.description("Mirror HTTP requests with a local server");
|
|
724
|
-
cmd3.option("-o, --once", "Start the server, then stop it after two seconds");
|
|
725
726
|
cmd3.option(
|
|
726
727
|
"-p, --port <port>",
|
|
727
728
|
"HTTP port for the request-mirroring server",
|
|
728
729
|
parsePort
|
|
729
730
|
);
|
|
730
731
|
cmd3.action(async (...args) => {
|
|
731
|
-
const { voidAction } = await import("./chunks/action-
|
|
732
|
-
|
|
732
|
+
const { voidAction } = await import("./chunks/action-LRR52RXL.js");
|
|
733
|
+
await voidAction(...args);
|
|
733
734
|
});
|
|
734
735
|
return cmd3;
|
|
735
736
|
}
|
|
@@ -779,7 +780,7 @@ var PreviewCommand = () => {
|
|
|
779
780
|
cmd3.option("-N, --no-open", "Do not open the browser automatically", true);
|
|
780
781
|
completeFiles(cmd3, ["config"], []);
|
|
781
782
|
cmd3.action(async (...args) => {
|
|
782
|
-
const { previewAction } = await import("./chunks/action-
|
|
783
|
+
const { previewAction } = await import("./chunks/action-D7L757PX.js");
|
|
783
784
|
return previewAction(...args);
|
|
784
785
|
});
|
|
785
786
|
return cmd3;
|
|
@@ -796,7 +797,7 @@ function CheckConfigCommand() {
|
|
|
796
797
|
);
|
|
797
798
|
completeFiles(cmd3, ["file"], []);
|
|
798
799
|
cmd3.action(async (...args) => {
|
|
799
|
-
const { checkConfigAction } = await import("./chunks/action-
|
|
800
|
+
const { checkConfigAction } = await import("./chunks/action-UHXBY3RD.js");
|
|
800
801
|
return checkConfigAction(...args);
|
|
801
802
|
});
|
|
802
803
|
return cmd3;
|
|
@@ -810,7 +811,7 @@ var CreateCommand = () => {
|
|
|
810
811
|
cmd3.option("-n, --name <name>", "Project name");
|
|
811
812
|
cmd3.option("-s, --slug <slug>", "Project slug");
|
|
812
813
|
cmd3.action(async (...args) => {
|
|
813
|
-
const { createAction } = await import("./chunks/action-
|
|
814
|
+
const { createAction } = await import("./chunks/action-7CUPRYNA.js");
|
|
814
815
|
return createAction(...args);
|
|
815
816
|
});
|
|
816
817
|
return cmd3;
|
|
@@ -826,7 +827,7 @@ var ListCommand = () => {
|
|
|
826
827
|
cmd3.description("List production deployments for a project");
|
|
827
828
|
cmd3.option("-s, --slug [slug]", "Project slug from scalar project list");
|
|
828
829
|
cmd3.action(async (...args) => {
|
|
829
|
-
const { listAction } = await import("./chunks/action-
|
|
830
|
+
const { listAction } = await import("./chunks/action-I2IV4VLL.js");
|
|
830
831
|
return listAction(...args);
|
|
831
832
|
});
|
|
832
833
|
return cmd3;
|
|
@@ -846,7 +847,7 @@ function GetCommand() {
|
|
|
846
847
|
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
848
|
command.action(
|
|
848
849
|
async (slug, options) => {
|
|
849
|
-
const { getAction } = await import("./chunks/action-
|
|
850
|
+
const { getAction } = await import("./chunks/action-FBQAU5LV.js");
|
|
850
851
|
await getAction(slug, options);
|
|
851
852
|
}
|
|
852
853
|
);
|
|
@@ -864,7 +865,7 @@ var InitCommand = () => {
|
|
|
864
865
|
);
|
|
865
866
|
cmd3.option("--force", "Overwrite existing configuration");
|
|
866
867
|
cmd3.action(async (...args) => {
|
|
867
|
-
const { initAction } = await import("./chunks/action-
|
|
868
|
+
const { initAction } = await import("./chunks/action-EPGS3U3T.js");
|
|
868
869
|
return initAction(...args);
|
|
869
870
|
});
|
|
870
871
|
return cmd3;
|
|
@@ -875,7 +876,7 @@ import { Command as Command41 } from "commander";
|
|
|
875
876
|
function ListCommand2() {
|
|
876
877
|
const command = new Command41("list").description("List projects and their slugs for the current team").option("--json", "Print project details as JSON");
|
|
877
878
|
command.action(async (options) => {
|
|
878
|
-
const { listAction } = await import("./chunks/action-
|
|
879
|
+
const { listAction } = await import("./chunks/action-Q3DI54OW.js");
|
|
879
880
|
await listAction(options);
|
|
880
881
|
});
|
|
881
882
|
return command;
|
|
@@ -901,7 +902,7 @@ var PublishCommand = () => {
|
|
|
901
902
|
);
|
|
902
903
|
completeFiles(cmd3, [], ["--config"]);
|
|
903
904
|
cmd3.action(async (...args) => {
|
|
904
|
-
const { publishAction } = await import("./chunks/action-
|
|
905
|
+
const { publishAction } = await import("./chunks/action-6I2PWENU.js");
|
|
905
906
|
return publishAction(...args);
|
|
906
907
|
});
|
|
907
908
|
return cmd3;
|
|
@@ -921,7 +922,7 @@ var RollbackCommand = () => {
|
|
|
921
922
|
);
|
|
922
923
|
cmd3.option("-y, --yes", "Skip the confirmation prompt");
|
|
923
924
|
cmd3.action(async (...args) => {
|
|
924
|
-
const { rollbackAction } = await import("./chunks/action-
|
|
925
|
+
const { rollbackAction } = await import("./chunks/action-T4MM4OUS.js");
|
|
925
926
|
return rollbackAction(...args);
|
|
926
927
|
});
|
|
927
928
|
return cmd3;
|
|
@@ -938,7 +939,7 @@ var UpgradeCommand2 = () => {
|
|
|
938
939
|
);
|
|
939
940
|
completeFiles(cmd3, ["config"], []);
|
|
940
941
|
cmd3.action(async (...args) => {
|
|
941
|
-
const { upgradeAction } = await import("./chunks/action-
|
|
942
|
+
const { upgradeAction } = await import("./chunks/action-JXCU2JKC.js");
|
|
942
943
|
return upgradeAction(...args);
|
|
943
944
|
});
|
|
944
945
|
return cmd3;
|
|
@@ -1044,8 +1045,11 @@ import as2 from "ansis";
|
|
|
1044
1045
|
var CLI_DOCS_URL = "https://scalar.com/tools/cli/getting-started";
|
|
1045
1046
|
function ServeReadmeCommand(cmd3) {
|
|
1046
1047
|
cmd3.description("Open CLI documentation in your browser");
|
|
1047
|
-
cmd3.action(() => {
|
|
1048
|
-
openBrowser(CLI_DOCS_URL);
|
|
1048
|
+
cmd3.action(async () => {
|
|
1049
|
+
const browser = await openBrowser(CLI_DOCS_URL);
|
|
1050
|
+
if (!browser.ok) {
|
|
1051
|
+
return output.error().message(browser.error).exit("error");
|
|
1052
|
+
}
|
|
1049
1053
|
output.info().message(
|
|
1050
1054
|
"Opening CLI documentation in your default browser. If it does not open, visit:"
|
|
1051
1055
|
).line(as2.blue(CLI_DOCS_URL)).line().exit("success");
|
|
@@ -1096,7 +1100,7 @@ var PublishCommand2 = () => {
|
|
|
1096
1100
|
);
|
|
1097
1101
|
completeFiles(cmd3, ["file"], []);
|
|
1098
1102
|
cmd3.action(async (...args) => {
|
|
1099
|
-
const { publishAction } = await import("./chunks/action-
|
|
1103
|
+
const { publishAction } = await import("./chunks/action-EWZLVN45.js");
|
|
1100
1104
|
return publishAction(...args);
|
|
1101
1105
|
});
|
|
1102
1106
|
return cmd3;
|
|
@@ -1110,7 +1114,7 @@ var DeleteCommand = () => {
|
|
|
1110
1114
|
cmd3.argument("[namespace]", "Team namespace");
|
|
1111
1115
|
cmd3.argument("[slug]", "API description slug");
|
|
1112
1116
|
cmd3.action(async (...args) => {
|
|
1113
|
-
const { deleteAction } = await import("./chunks/action-
|
|
1117
|
+
const { deleteAction } = await import("./chunks/action-BDDXF4YV.js");
|
|
1114
1118
|
return deleteAction(...args);
|
|
1115
1119
|
});
|
|
1116
1120
|
return cmd3;
|
|
@@ -1135,7 +1139,7 @@ var GetCommand2 = () => {
|
|
|
1135
1139
|
cmd3.option("-o, --output <file>", "Output file (defaults to stdout)");
|
|
1136
1140
|
completeFiles(cmd3, [], ["--output"]);
|
|
1137
1141
|
cmd3.action(async (...args) => {
|
|
1138
|
-
const { getAction } = await import("./chunks/action-
|
|
1142
|
+
const { getAction } = await import("./chunks/action-FBOTIFVC.js");
|
|
1139
1143
|
return getAction(...args);
|
|
1140
1144
|
});
|
|
1141
1145
|
return cmd3;
|
|
@@ -1149,7 +1153,7 @@ var ListCommand3 = () => {
|
|
|
1149
1153
|
cmd3.option("--namespace <namespace>", "Team namespace");
|
|
1150
1154
|
cmd3.option("--json", "Output Scalar Registry API metadata as JSON");
|
|
1151
1155
|
cmd3.action(async (...args) => {
|
|
1152
|
-
const { listAction } = await import("./chunks/action-
|
|
1156
|
+
const { listAction } = await import("./chunks/action-H4GW3KAI.js");
|
|
1153
1157
|
return listAction(...args);
|
|
1154
1158
|
});
|
|
1155
1159
|
return cmd3;
|
|
@@ -1165,7 +1169,7 @@ var UpdateCommand = () => {
|
|
|
1165
1169
|
cmd3.option("--title <title>", "API description title");
|
|
1166
1170
|
cmd3.option("--description <description>", "API description summary");
|
|
1167
1171
|
cmd3.action(async (...args) => {
|
|
1168
|
-
const { updateAction } = await import("./chunks/action-
|
|
1172
|
+
const { updateAction } = await import("./chunks/action-AYKKHH7A.js");
|
|
1169
1173
|
return updateAction(...args);
|
|
1170
1174
|
});
|
|
1171
1175
|
return cmd3;
|
|
@@ -1194,7 +1198,7 @@ var GetCommand3 = () => {
|
|
|
1194
1198
|
cmd3.description("Show the current team and its namespaces");
|
|
1195
1199
|
cmd3.option("--json", "Output the current team as JSON");
|
|
1196
1200
|
cmd3.action(async (...args) => {
|
|
1197
|
-
const { getAction } = await import("./chunks/action-
|
|
1201
|
+
const { getAction } = await import("./chunks/action-ED4TSPRZ.js");
|
|
1198
1202
|
return getAction(...args);
|
|
1199
1203
|
});
|
|
1200
1204
|
return cmd3;
|
|
@@ -1207,7 +1211,7 @@ var ListCommand4 = () => {
|
|
|
1207
1211
|
cmd3.description("List your Scalar teams");
|
|
1208
1212
|
cmd3.option("--json", "Output teams as JSON");
|
|
1209
1213
|
cmd3.action(async (...args) => {
|
|
1210
|
-
const { listAction } = await import("./chunks/action-
|
|
1214
|
+
const { listAction } = await import("./chunks/action-ZOYQBWGD.js");
|
|
1211
1215
|
return listAction(...args);
|
|
1212
1216
|
});
|
|
1213
1217
|
return cmd3;
|
|
@@ -1220,7 +1224,7 @@ var SetCommand = () => {
|
|
|
1220
1224
|
cmd3.description("Select the current team");
|
|
1221
1225
|
cmd3.option("--team <team>", "Team ID");
|
|
1222
1226
|
cmd3.action(async (...args) => {
|
|
1223
|
-
const { setAction } = await import("./chunks/action-
|
|
1227
|
+
const { setAction } = await import("./chunks/action-BYYKW4S6.js");
|
|
1224
1228
|
return setAction(...args);
|
|
1225
1229
|
});
|
|
1226
1230
|
return cmd3;
|
|
@@ -1237,57 +1241,40 @@ var team_default = teamDomain;
|
|
|
1237
1241
|
|
|
1238
1242
|
// src/domains/upgrade/index.ts
|
|
1239
1243
|
import { execSync } from "node:child_process";
|
|
1240
|
-
import
|
|
1241
|
-
import { Command as Command58 } from "commander";
|
|
1244
|
+
import { Command as Command58, Option as Option9 } from "commander";
|
|
1242
1245
|
|
|
1243
1246
|
// src/helpers/upgrade.ts
|
|
1244
|
-
import as3 from "ansis";
|
|
1245
1247
|
import semver from "semver";
|
|
1246
1248
|
var packageJsonSchema = external_exports.object({
|
|
1247
|
-
version: external_exports.string()
|
|
1249
|
+
version: external_exports.string().refine((value) => semver.valid(value) !== null)
|
|
1248
1250
|
});
|
|
1249
1251
|
var BACKGROUND_CHECK_TIMEOUT_MS = 2e3;
|
|
1250
1252
|
var USER_INITIATED_TIMEOUT_MS = 1e4;
|
|
1251
1253
|
async function getRemotePackageJson(packageName, version2 = "latest", timeoutMs = BACKGROUND_CHECK_TIMEOUT_MS) {
|
|
1252
|
-
|
|
1254
|
+
return fetchReleaseVersion(
|
|
1253
1255
|
`https://registry.npmjs.org/${packageName}/${version2}`,
|
|
1254
|
-
|
|
1255
|
-
signal: AbortSignal.timeout(timeoutMs)
|
|
1256
|
-
}
|
|
1256
|
+
timeoutMs
|
|
1257
1257
|
);
|
|
1258
|
-
const body = await response.json();
|
|
1259
|
-
return packageJsonSchema.parse(body);
|
|
1260
1258
|
}
|
|
1261
1259
|
async function getUpgradeInformation(timeoutMs = USER_INITIATED_TIMEOUT_MS) {
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1264
|
-
"latest",
|
|
1260
|
+
const release = process.env.SCALAR_CLI_DISTRIBUTION === "portable" ? await fetchReleaseVersion(
|
|
1261
|
+
"https://cdn.scalar.com/cli/latest/manifest.json",
|
|
1265
1262
|
timeoutMs
|
|
1266
|
-
);
|
|
1267
|
-
if (
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
};
|
|
1272
|
-
}
|
|
1273
|
-
return {
|
|
1274
|
-
upgrade: true,
|
|
1263
|
+
) : await getRemotePackageJson(name, "latest", timeoutMs);
|
|
1264
|
+
if (!release.ok) return release;
|
|
1265
|
+
const latestVersion = release.data.version;
|
|
1266
|
+
return ok({
|
|
1267
|
+
upgrade: semver.lt(version, latestVersion),
|
|
1275
1268
|
name,
|
|
1276
1269
|
currentVersion: version,
|
|
1277
1270
|
latestVersion
|
|
1278
|
-
};
|
|
1271
|
+
});
|
|
1279
1272
|
}
|
|
1280
|
-
async function checkUpgrade(
|
|
1273
|
+
async function checkUpgrade() {
|
|
1281
1274
|
const emitOutput = () => {
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
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();
|
|
1275
|
+
process.stderr.write(
|
|
1276
|
+
"A new Scalar CLI version is available. Run `scalar upgrade` to install the latest version.\n"
|
|
1277
|
+
);
|
|
1291
1278
|
};
|
|
1292
1279
|
const now = Date.now();
|
|
1293
1280
|
const delay = 1 * 60 * 60 * 1e3;
|
|
@@ -1296,7 +1283,9 @@ async function checkUpgrade(stream = "stdout") {
|
|
|
1296
1283
|
lastKnownVersion = version
|
|
1297
1284
|
} = await getMetadata();
|
|
1298
1285
|
if (lastUpdateCheck + delay < now) {
|
|
1299
|
-
return getUpgradeInformation(BACKGROUND_CHECK_TIMEOUT_MS).then(async (
|
|
1286
|
+
return getUpgradeInformation(BACKGROUND_CHECK_TIMEOUT_MS).then(async (result) => {
|
|
1287
|
+
if (!result.ok) return;
|
|
1288
|
+
const { upgrade, latestVersion } = result.data;
|
|
1300
1289
|
await setMetadata({
|
|
1301
1290
|
lastUpdateCheck: now,
|
|
1302
1291
|
lastKnownVersion: latestVersion
|
|
@@ -1311,32 +1300,150 @@ async function checkUpgrade(stream = "stdout") {
|
|
|
1311
1300
|
emitOutput();
|
|
1312
1301
|
}
|
|
1313
1302
|
}
|
|
1303
|
+
async function fetchReleaseVersion(url, timeoutMs) {
|
|
1304
|
+
const response = await fetch(url, {
|
|
1305
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
1306
|
+
}).catch(() => null);
|
|
1307
|
+
if (!response?.ok) return err("Could not fetch the latest release");
|
|
1308
|
+
const body = await response.json().catch(() => null);
|
|
1309
|
+
const parsed = packageJsonSchema.safeParse(body);
|
|
1310
|
+
return parsed.success ? ok(parsed.data) : err("Invalid release metadata");
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
// src/domains/upgrade/instructions.ts
|
|
1314
|
+
function getUpgradeInstructions(portable, platform, arch, env, latestVersion) {
|
|
1315
|
+
if (!portable)
|
|
1316
|
+
return ["To upgrade, run:", "npm install -g @scalar/cli@latest"];
|
|
1317
|
+
const quoteBash = (value) => `'${value.replaceAll("'", `'"'"'`)}'`;
|
|
1318
|
+
const quotePowerShell = (value) => `'${value.replaceAll("'", "''")}'`;
|
|
1319
|
+
const overrides = [
|
|
1320
|
+
"SCALAR_INSTALL_DIR",
|
|
1321
|
+
"SCALAR_BIN_DIR",
|
|
1322
|
+
"SCALAR_NO_MODIFY_PATH"
|
|
1323
|
+
].filter((key) => env[key]);
|
|
1324
|
+
const installer = platform === "win32" ? [
|
|
1325
|
+
"$env:SCALAR_VERSION = 'latest'",
|
|
1326
|
+
...overrides.map(
|
|
1327
|
+
(key) => `$env:${key} = ${quotePowerShell(env[key] ?? "")}`
|
|
1328
|
+
),
|
|
1329
|
+
"irm https://cdn.scalar.com/cli/install.ps1 | iex"
|
|
1330
|
+
].join("\n") : `curl -fsSL https://cdn.scalar.com/cli/install.sh | SCALAR_VERSION=latest ${overrides.map((key) => `${key}=${quoteBash(env[key] ?? "")} `).join("")}bash`;
|
|
1331
|
+
const target = `${platform}-${arch}`;
|
|
1332
|
+
const supported = [
|
|
1333
|
+
"darwin-arm64",
|
|
1334
|
+
"darwin-x64",
|
|
1335
|
+
"linux-arm64",
|
|
1336
|
+
"linux-x64",
|
|
1337
|
+
"win32-x64"
|
|
1338
|
+
].includes(target);
|
|
1339
|
+
const hasArchive = latestVersion && /^\d+\.\d+\.\d+$/.test(latestVersion) && supported;
|
|
1340
|
+
const archive = hasArchive ? `https://cdn.scalar.com/cli/${latestVersion}/scalar-${latestVersion}-${target}.tar.gz` : "https://cdn.scalar.com/cli/latest/manifest.json";
|
|
1341
|
+
return [
|
|
1342
|
+
"For an installer-managed installation, run:",
|
|
1343
|
+
installer,
|
|
1344
|
+
"If you used custom installation paths, reuse the same SCALAR_INSTALL_DIR and SCALAR_BIN_DIR values when running the installer.",
|
|
1345
|
+
...platform === "win32" ? [
|
|
1346
|
+
"Close running Scalar processes before running the installer in PowerShell."
|
|
1347
|
+
] : [],
|
|
1348
|
+
hasArchive ? "For a manually extracted installation, download the archive below, verify its .sha256 checksum, extract it, and replace the complete installation directory (including app and runtime):" : "For a manually extracted installation, find your platform archive in the release manifest below, verify its SHA-256 checksum, extract it, and replace the complete installation directory (including app and runtime):",
|
|
1349
|
+
archive
|
|
1350
|
+
];
|
|
1351
|
+
}
|
|
1314
1352
|
|
|
1315
1353
|
// src/domains/upgrade/index.ts
|
|
1316
1354
|
var cmd2 = new Command58("upgrade");
|
|
1317
1355
|
cmd2.description("Upgrade the Scalar CLI to the latest version");
|
|
1318
|
-
cmd2.
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1356
|
+
cmd2.option(
|
|
1357
|
+
"--check",
|
|
1358
|
+
"Show installed and available versions without installing"
|
|
1359
|
+
);
|
|
1360
|
+
cmd2.addOption(
|
|
1361
|
+
new Option9(
|
|
1362
|
+
"--json",
|
|
1363
|
+
"Show the version check as JSON without installing"
|
|
1364
|
+
).implies({ check: true })
|
|
1365
|
+
);
|
|
1366
|
+
cmd2.addHelpText(
|
|
1367
|
+
"after",
|
|
1368
|
+
"\nExamples:\n scalar upgrade\n scalar upgrade --check\n scalar upgrade --json"
|
|
1369
|
+
);
|
|
1370
|
+
cmd2.action(async (options) => {
|
|
1371
|
+
const portable = process.env.SCALAR_CLI_DISTRIBUTION === "portable";
|
|
1372
|
+
const result = await getUpgradeInformation();
|
|
1373
|
+
const upgradeStatus = result.ok ? result.data : null;
|
|
1374
|
+
const instructions = getUpgradeInstructions(
|
|
1375
|
+
portable,
|
|
1376
|
+
process.platform,
|
|
1377
|
+
process.arch,
|
|
1378
|
+
process.env,
|
|
1379
|
+
upgradeStatus?.latestVersion
|
|
1380
|
+
);
|
|
1381
|
+
if (options.json) {
|
|
1382
|
+
process.stdout.write(
|
|
1383
|
+
`${JSON.stringify({
|
|
1384
|
+
status: upgradeStatus ? "ok" : "error",
|
|
1385
|
+
data: {
|
|
1386
|
+
currentVersion: version,
|
|
1387
|
+
latestVersion: upgradeStatus?.latestVersion ?? null,
|
|
1388
|
+
upgradeAvailable: upgradeStatus?.upgrade ?? null,
|
|
1389
|
+
distribution: portable ? "portable" : "npm",
|
|
1390
|
+
instructions
|
|
1391
|
+
},
|
|
1392
|
+
...upgradeStatus ? {} : {
|
|
1393
|
+
error: {
|
|
1394
|
+
code: "VERSION_CHECK_FAILED",
|
|
1395
|
+
message: "Could not check the latest version. Run scalar upgrade --check to retry."
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
})}
|
|
1399
|
+
`
|
|
1400
|
+
);
|
|
1401
|
+
if (!upgradeStatus) process.exitCode = 1;
|
|
1402
|
+
return;
|
|
1403
|
+
}
|
|
1404
|
+
process.stdout.write(
|
|
1405
|
+
`Installed: ${version}
|
|
1406
|
+
Latest available: ${upgradeStatus?.latestVersion ?? "could not check"}
|
|
1407
|
+
`
|
|
1408
|
+
);
|
|
1409
|
+
if (!upgradeStatus) {
|
|
1410
|
+
process.stderr.write(
|
|
1411
|
+
"Could not check the latest version. Check your connection and run `scalar upgrade --check` to retry.\n"
|
|
1412
|
+
);
|
|
1413
|
+
process.stdout.write(`
|
|
1414
|
+
${instructions.join("\n\n")}
|
|
1415
|
+
`);
|
|
1416
|
+
process.exitCode = 1;
|
|
1323
1417
|
return;
|
|
1324
1418
|
}
|
|
1325
|
-
const upgradeStatus = await getUpgradeInformation();
|
|
1326
1419
|
if (!upgradeStatus.upgrade) {
|
|
1327
|
-
|
|
1420
|
+
process.stdout.write("Scalar CLI is already up to date.\n");
|
|
1328
1421
|
return;
|
|
1329
1422
|
}
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1423
|
+
if (portable || options.check) {
|
|
1424
|
+
process.stdout.write(
|
|
1425
|
+
`
|
|
1426
|
+
A Scalar CLI update is available.
|
|
1427
|
+
|
|
1428
|
+
${instructions.join("\n\n")}
|
|
1429
|
+
`
|
|
1430
|
+
);
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1433
|
+
process.stderr.write(
|
|
1434
|
+
`Upgrading from ${upgradeStatus.currentVersion} to ${upgradeStatus.latestVersion}\u2026
|
|
1435
|
+
`
|
|
1436
|
+
);
|
|
1333
1437
|
try {
|
|
1334
1438
|
execSync(`npm install -g ${upgradeStatus.name}@latest`, {
|
|
1335
1439
|
stdio: "inherit"
|
|
1336
1440
|
});
|
|
1337
|
-
|
|
1441
|
+
process.stdout.write("Scalar CLI upgraded to the latest version.\n");
|
|
1338
1442
|
} catch {
|
|
1339
|
-
|
|
1443
|
+
process.stderr.write(`Upgrade failed.
|
|
1444
|
+
${instructions.join("\n")}
|
|
1445
|
+
`);
|
|
1446
|
+
process.exitCode = 1;
|
|
1340
1447
|
}
|
|
1341
1448
|
});
|
|
1342
1449
|
var upgrade_default = cmd2;
|
|
@@ -1387,10 +1494,9 @@ var program = getProgram();
|
|
|
1387
1494
|
if (process.argv.length === 2) {
|
|
1388
1495
|
program.help();
|
|
1389
1496
|
}
|
|
1390
|
-
program.hook("preAction", (
|
|
1391
|
-
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") {
|
|
1392
|
-
|
|
1393
|
-
checkUpgrade(usesDocumentStdout ? "stderr" : "stdout").catch(() => {
|
|
1497
|
+
program.hook("preAction", () => {
|
|
1498
|
+
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") {
|
|
1499
|
+
checkUpgrade().catch(() => {
|
|
1394
1500
|
});
|
|
1395
1501
|
}
|
|
1396
1502
|
});
|