@scalar/cli 2.12.2 → 2.13.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.
- package/README.md +221 -2
- package/chunks/{action-JXCU2JKC.js → action-27BJMHFD.js} +38 -6
- package/chunks/{action-WLPCBFRE.js → action-4EJA6UEB.js} +16 -16
- package/chunks/{action-JDXGQSQN.js → action-5MJTAO5X.js} +36 -23
- package/chunks/{action-H5XQIZKX.js → action-6FPGU5SY.js} +51 -24
- package/chunks/{action-HMPATNVE.js → action-6RQDLMOM.js} +53 -30
- package/chunks/{action-Y7EBKCUU.js → action-ASBFLTOA.js} +1 -1
- package/chunks/{action-HRRNN33O.js → action-AWHBOHGW.js} +68 -89
- package/chunks/{action-UOH5L2JF.js → action-ENN7KFBZ.js} +93 -54
- package/chunks/{action-ZNBXKA7T.js → action-ESVI46KE.js} +4 -4
- package/chunks/{action-LCTTNNFD.js → action-EVNUUWR5.js} +33 -17
- package/chunks/{action-OWWGJ34K.js → action-F6JSCBEU.js} +34 -16
- package/chunks/{action-2RIPHL6V.js → action-FZNFBX6U.js} +23 -6
- package/chunks/{action-DJ6FLPXH.js → action-GNYNOFDK.js} +15 -5
- package/chunks/{action-HOLFCPUY.js → action-JSYHIEYP.js} +12 -12
- package/chunks/action-KTY5ICV5.js +55 -0
- package/chunks/{action-IIQMZVRJ.js → action-LRR52RXL.js} +10 -8
- package/chunks/{action-Z3UXS5KI.js → action-LVYFHK4D.js} +6 -4
- package/chunks/{action-XBTIONQD.js → action-NN7QF6MI.js} +9 -6
- package/chunks/{action-2GIOY3HU.js → action-OD4GNHM3.js} +48 -28
- package/chunks/{action-OY5LI7TW.js → action-OZWRV54F.js} +9 -8
- package/chunks/{action-AZNY2B7G.js → action-QZV6IPK4.js} +26 -11
- package/chunks/action-S7PMEFCE.js +423 -0
- package/chunks/{action-6IL6KE3L.js → action-SZ6SG3RB.js} +16 -16
- package/chunks/{action-PRLW546C.js → action-U3MQZ5ZQ.js} +12 -12
- package/chunks/action-UAGYB4ZS.js +48 -0
- package/chunks/{action-U3R6AXJY.js → action-UVAYACFA.js} +6 -6
- package/chunks/{action-7OJTNQRM.js → action-VXEJNBNR.js} +9 -8
- package/chunks/{action-KE53K5EJ.js → action-W24B4YT5.js} +14 -14
- package/chunks/{action-QA5ATGWB.js → action-WQICTF7K.js} +67 -45
- package/chunks/{action-SFRYHYTZ.js → action-WUWWJGRJ.js} +6 -4
- package/chunks/{action-II3OJSGP.js → action-Y4YLWZHL.js} +12 -12
- package/chunks/{action-2NJJO35T.js → action-YEAOKB6V.js} +13 -11
- package/chunks/{action-LGNWFVEG.js → action-YFTRHKOK.js} +63 -48
- package/chunks/{action-QEYNGQXG.js → action-YQSSXJAX.js} +10 -7
- package/chunks/{action-IYUOT7XX.js → action-ZL2CXRJR.js} +8 -6
- package/chunks/{actions-DKQERAKZ.js → actions-GHHWF4Q2.js} +20 -18
- package/chunks/{agent-KQKNJZKK.js → agent-XAHNA4MB.js} +3 -3
- package/chunks/{asyncapi-MKBEQYBV.js → asyncapi-TICSLZRM.js} +52 -42
- package/chunks/{build.action-EGAOPKSX.js → build.action-AURC6QZ6.js} +37 -20
- package/chunks/{chunk-ZZTCEMCG.js → chunk-2AK5O3NQ.js} +2 -2
- package/chunks/chunk-2I6V7AI3.js +68 -0
- package/chunks/chunk-2XWUFFEZ.js +133 -0
- package/chunks/{chunk-7GOHWSPA.js → chunk-62OOT7FY.js} +5 -2
- package/chunks/{chunk-W2JGSGIQ.js → chunk-7K6I2GUG.js} +15 -9
- package/chunks/{chunk-5VZSFLRO.js → chunk-7O5H2SQP.js} +2 -2
- package/chunks/{chunk-FJREFWEE.js → chunk-7S34K2P3.js} +1 -1
- package/chunks/{chunk-PIWBFJX3.js → chunk-AOZQPCWI.js} +2 -0
- package/chunks/{chunk-EBNFCIKS.js → chunk-APX65SRT.js} +2 -1
- package/chunks/{chunk-GZA7GEZW.js → chunk-B3XOSR6W.js} +2 -2
- package/chunks/{chunk-VJAVNG6U.js → chunk-CSJIKXUD.js} +1 -1
- package/chunks/{chunk-MLBEF6MB.js → chunk-DDDYR2HF.js} +1 -1
- package/chunks/{chunk-TQL55CUG.js → chunk-EXJUFF6G.js} +1 -1
- package/chunks/{chunk-W6FLDNRM.js → chunk-IRA5BW2J.js} +2 -2
- package/chunks/chunk-IRQJDPZE.js +34 -0
- package/chunks/{chunk-ZK76AK3B.js → chunk-KPLWZIOV.js} +22 -3
- package/chunks/chunk-LK2ZIDHH.js +32 -0
- package/chunks/{chunk-3DKOVKCV.js → chunk-M2MMGSLK.js} +5 -5
- package/chunks/{chunk-FD364GM7.js → chunk-NRHHB3YY.js} +1 -1
- package/chunks/{chunk-W3Y5X3X3.js → chunk-OVKTA5CX.js} +12 -5
- package/chunks/chunk-PVDORWEM.js +167 -0
- package/chunks/chunk-RAJM56L7.js +60 -0
- package/chunks/{chunk-UJU2ORWU.js → chunk-RAU5KE6F.js} +1 -1
- package/chunks/{chunk-V6LUKXBV.js → chunk-RE5Z56QD.js} +2 -2
- package/chunks/chunk-SNQFFEYH.js +11 -0
- package/chunks/{chunk-GUF4PKDL.js → chunk-TI4NDKQC.js} +6 -5
- package/chunks/{chunk-VRZRTOZF.js → chunk-TKT5UW3G.js} +2 -2
- package/chunks/{chunk-A27OERJM.js → chunk-TVPVXL73.js} +7 -7
- package/chunks/{chunk-4RF2NKQN.js → chunk-TYNF7ROW.js} +1 -1
- package/chunks/{chunk-HDNCXPCZ.js → chunk-VNF2GRZA.js} +2 -2
- package/chunks/chunk-WDFZ7WYJ.js +16 -0
- package/chunks/{chunk-672Y6REB.js → chunk-WKW5W2ZP.js} +1 -1
- package/chunks/chunk-XUX6JXU5.js +58 -0
- package/chunks/{chunk-6YOXEMMX.js → chunk-Y2OQOAY7.js} +1 -1
- package/chunks/{create.action-UUDVWZ3F.js → create.action-O3HN6GV2.js} +32 -23
- package/chunks/{delete.action-XRP3VU5C.js → delete.action-2L2RWLPI.js} +36 -22
- package/chunks/{delete.action-EUQ4ESLJ.js → delete.action-KEBI2QCS.js} +38 -22
- package/chunks/{get.action-IYA5Q3RI.js → get.action-BUNTDW54.js} +13 -11
- package/chunks/{get.action-UHCFOKUQ.js → get.action-WDMTCZZR.js} +14 -14
- package/chunks/{list.action-3CCWEEAM.js → list.action-JNSEJVHX.js} +14 -14
- package/chunks/{list.action-D3GHA6S5.js → list.action-NSK7OBRH.js} +16 -16
- package/chunks/{publish.action-HIVWJ7QE.js → publish.action-ZRZQUL7S.js} +49 -29
- package/chunks/{update.action-NSKVEZES.js → update.action-7TA46AE6.js} +36 -22
- package/chunks/{update.action-VOZNA7BV.js → update.action-O2R5ODGG.js} +47 -27
- package/index.js +226 -149
- package/package.json +1 -1
- package/skills/scalar-cli/SKILL.md +4 -2
- package/template.md +220 -1
- package/chunks/action-RNVV27ET.js +0 -165
- package/chunks/action-ZHDGAUGG.js +0 -38
- package/chunks/chunk-AC62V47N.js +0 -38
- package/chunks/chunk-EGOXR5FB.js +0 -15
- package/chunks/chunk-JFIXNSPP.js +0 -26
- package/chunks/{action-UHXBY3RD.js → action-3P66ZSL3.js} +1 -1
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
apiService
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-TVPVXL73.js";
|
|
5
|
+
import "./chunk-2AK5O3NQ.js";
|
|
6
6
|
import {
|
|
7
7
|
accessGroupDomains,
|
|
8
8
|
accessGroupNameSchema,
|
|
9
9
|
emailDomainSchema
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KPLWZIOV.js";
|
|
11
11
|
import "./chunk-YTTDYTVB.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-MLBEF6MB.js";
|
|
12
|
+
import "./chunk-Y2OQOAY7.js";
|
|
13
|
+
import "./chunk-IRA5BW2J.js";
|
|
14
|
+
import "./chunk-EXJUFF6G.js";
|
|
15
|
+
import "./chunk-DDDYR2HF.js";
|
|
17
16
|
import {
|
|
18
17
|
config
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-CSJIKXUD.js";
|
|
19
|
+
import "./chunk-NRHHB3YY.js";
|
|
21
20
|
import "./chunk-F3TQHNSQ.js";
|
|
22
21
|
import "./chunk-VRZSDUZK.js";
|
|
23
|
-
import
|
|
22
|
+
import {
|
|
23
|
+
canPrompt,
|
|
24
|
+
cancelOperation,
|
|
25
|
+
confirm
|
|
26
|
+
} from "./chunk-XUX6JXU5.js";
|
|
27
|
+
import "./chunk-IRQJDPZE.js";
|
|
28
|
+
import "./chunk-TYNF7ROW.js";
|
|
24
29
|
import {
|
|
25
30
|
output,
|
|
26
31
|
printTable
|
|
27
32
|
} from "./chunk-T5HJUAWB.js";
|
|
28
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-5ENKYZA4.js";
|
|
34
|
+
import "./chunk-AOZQPCWI.js";
|
|
29
35
|
import "./chunk-Q26DFKTY.js";
|
|
30
36
|
import {
|
|
31
37
|
external_exports,
|
|
@@ -34,7 +40,6 @@ import {
|
|
|
34
40
|
import "./chunk-3MZYUBJ6.js";
|
|
35
41
|
|
|
36
42
|
// src/domains/access-group/actions.ts
|
|
37
|
-
import { confirm, isCancel } from "@clack/prompts";
|
|
38
43
|
var common = { slug: slugSchema, json: external_exports.boolean().default(false) };
|
|
39
44
|
var argsSchema = external_exports.discriminatedUnion("operation", [
|
|
40
45
|
external_exports.object({ operation: external_exports.literal("list"), json: external_exports.boolean().default(false) }),
|
|
@@ -77,16 +82,13 @@ async function runAction(input) {
|
|
|
77
82
|
}
|
|
78
83
|
const args = parsed.data;
|
|
79
84
|
if (args.operation === "delete" && !args.yes) {
|
|
80
|
-
if (args.json || !
|
|
85
|
+
if (args.json || !canPrompt() || !process.stdout.isTTY) {
|
|
81
86
|
return output.error().title("Confirmation required").message("Pass --yes to delete an access group without prompting.").exit("error");
|
|
82
87
|
}
|
|
83
88
|
const accepted = await confirm({
|
|
84
89
|
message: `Delete access group "${args.slug}" and remove its project assignments?`
|
|
85
90
|
});
|
|
86
|
-
if (
|
|
87
|
-
output.info().message("Operation cancelled.").print();
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
91
|
+
if (!accepted) return cancelOperation();
|
|
90
92
|
}
|
|
91
93
|
const client = await apiService();
|
|
92
94
|
if (args.operation === "list") {
|
|
@@ -77,13 +77,13 @@ import {
|
|
|
77
77
|
usageRecordSchema,
|
|
78
78
|
usageRoutes,
|
|
79
79
|
versionLabelParamSchema
|
|
80
|
-
} from "./chunk-
|
|
81
|
-
import "./chunk-
|
|
80
|
+
} from "./chunk-IRA5BW2J.js";
|
|
81
|
+
import "./chunk-EXJUFF6G.js";
|
|
82
82
|
import "./chunk-F3TQHNSQ.js";
|
|
83
83
|
import "./chunk-VRZSDUZK.js";
|
|
84
84
|
import {
|
|
85
85
|
createdMcpServerSchema
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-AOZQPCWI.js";
|
|
87
87
|
import "./chunk-Q26DFKTY.js";
|
|
88
88
|
import "./chunk-I57ID5K7.js";
|
|
89
89
|
import "./chunk-3MZYUBJ6.js";
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
createServerSession
|
|
4
|
+
} from "./chunk-2I6V7AI3.js";
|
|
2
5
|
import {
|
|
3
6
|
isDocument
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7K6I2GUG.js";
|
|
5
8
|
import {
|
|
6
9
|
isAsyncApiDocument
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WKW5W2ZP.js";
|
|
11
|
+
import "./chunk-2XWUFFEZ.js";
|
|
8
12
|
import {
|
|
9
13
|
watchFile
|
|
10
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-RE5Z56QD.js";
|
|
11
15
|
import "./chunk-VUXPDHTQ.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-DDDYR2HF.js";
|
|
17
|
+
import "./chunk-CSJIKXUD.js";
|
|
18
|
+
import "./chunk-NRHHB3YY.js";
|
|
15
19
|
import "./chunk-F3TQHNSQ.js";
|
|
16
20
|
import "./chunk-VRZSDUZK.js";
|
|
17
21
|
import "./chunk-4ORL4MST.js";
|
|
18
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-TYNF7ROW.js";
|
|
19
23
|
import {
|
|
20
24
|
output
|
|
21
25
|
} from "./chunk-T5HJUAWB.js";
|
|
22
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-5ENKYZA4.js";
|
|
27
|
+
import "./chunk-AOZQPCWI.js";
|
|
23
28
|
import "./chunk-Q26DFKTY.js";
|
|
24
29
|
import "./chunk-I57ID5K7.js";
|
|
25
30
|
import "./chunk-3MZYUBJ6.js";
|
|
@@ -52,7 +57,7 @@ var mockAsyncApi = async (input, options) => {
|
|
|
52
57
|
}
|
|
53
58
|
);
|
|
54
59
|
if (!document) return;
|
|
55
|
-
const
|
|
60
|
+
const session = createServerSession();
|
|
56
61
|
const start = async (nextDocument) => {
|
|
57
62
|
const { app, websocket } = await createAsyncApiMockServer({
|
|
58
63
|
document: nextDocument,
|
|
@@ -61,46 +66,51 @@ var mockAsyncApi = async (input, options) => {
|
|
|
61
66
|
output.info().line(`${direction} ${channel}`).print();
|
|
62
67
|
}
|
|
63
68
|
});
|
|
64
|
-
const
|
|
69
|
+
const server = serve(
|
|
65
70
|
{ fetch: app.fetch, port: options.port ?? 3e3, websocket },
|
|
66
71
|
({ port }) => {
|
|
67
72
|
output.info().line(`AsyncAPI Mock Server listening on http://localhost:${port}`).print();
|
|
68
73
|
}
|
|
69
74
|
);
|
|
70
|
-
|
|
71
|
-
connections.add(socket);
|
|
72
|
-
socket.once("close", () => connections.delete(socket));
|
|
73
|
-
});
|
|
74
|
-
return server2;
|
|
75
|
+
return server;
|
|
75
76
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
77
|
+
try {
|
|
78
|
+
await session.setServer(await start(document));
|
|
79
|
+
let current = JSON.stringify(document);
|
|
80
|
+
let reloading = false;
|
|
81
|
+
let pending = false;
|
|
82
|
+
if (options.watch && !session.signal.aborted) {
|
|
83
|
+
await session.setWatcher(
|
|
84
|
+
await watchFile(input, async function reload() {
|
|
85
|
+
if (session.signal.aborted) return;
|
|
86
|
+
if (reloading) {
|
|
87
|
+
pending = true;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
pending = false;
|
|
91
|
+
reloading = true;
|
|
92
|
+
try {
|
|
93
|
+
const nextDocument = await loadAsyncApiMockDocument(input);
|
|
94
|
+
if (session.signal.aborted) return;
|
|
95
|
+
const serialized = JSON.stringify(nextDocument);
|
|
96
|
+
if (serialized === current) return;
|
|
97
|
+
await session.closeServer();
|
|
98
|
+
if (session.signal.aborted) return;
|
|
99
|
+
await session.setServer(await start(nextDocument));
|
|
100
|
+
current = serialized;
|
|
101
|
+
} catch (error) {
|
|
102
|
+
output.warn().title(String(error)).print();
|
|
103
|
+
} finally {
|
|
104
|
+
reloading = false;
|
|
105
|
+
if (pending) await reload();
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
);
|
|
96
109
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
server.close();
|
|
102
|
-
for (const socket of connections) socket.destroy();
|
|
103
|
-
}, 2e3);
|
|
110
|
+
return session;
|
|
111
|
+
} catch (error) {
|
|
112
|
+
await session.close();
|
|
113
|
+
throw error;
|
|
104
114
|
}
|
|
105
115
|
};
|
|
106
116
|
export {
|
|
@@ -1,39 +1,47 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
writeJson
|
|
4
|
+
} from "./chunk-SNQFFEYH.js";
|
|
2
5
|
import {
|
|
3
6
|
BaseCollections
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TI4NDKQC.js";
|
|
5
8
|
import {
|
|
6
9
|
getDatabaseClient
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-OVKTA5CX.js";
|
|
8
11
|
import {
|
|
9
12
|
apiService
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-TVPVXL73.js";
|
|
14
|
+
import "./chunk-2AK5O3NQ.js";
|
|
15
|
+
import "./chunk-KPLWZIOV.js";
|
|
13
16
|
import "./chunk-YTTDYTVB.js";
|
|
14
17
|
import {
|
|
15
18
|
sdkSchema
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-V6LUKXBV.js";
|
|
19
|
+
} from "./chunk-Y2OQOAY7.js";
|
|
20
|
+
import "./chunk-IRA5BW2J.js";
|
|
21
|
+
import "./chunk-EXJUFF6G.js";
|
|
22
|
+
import "./chunk-RE5Z56QD.js";
|
|
21
23
|
import "./chunk-VUXPDHTQ.js";
|
|
22
24
|
import {
|
|
23
25
|
getAuthData
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
26
|
+
} from "./chunk-DDDYR2HF.js";
|
|
27
|
+
import "./chunk-CSJIKXUD.js";
|
|
28
|
+
import "./chunk-NRHHB3YY.js";
|
|
27
29
|
import {
|
|
28
30
|
teamSchema
|
|
29
31
|
} from "./chunk-F3TQHNSQ.js";
|
|
30
32
|
import "./chunk-VRZSDUZK.js";
|
|
33
|
+
import {
|
|
34
|
+
canPrompt,
|
|
35
|
+
select
|
|
36
|
+
} from "./chunk-XUX6JXU5.js";
|
|
37
|
+
import "./chunk-IRQJDPZE.js";
|
|
31
38
|
import "./chunk-4ORL4MST.js";
|
|
32
|
-
import "./chunk-
|
|
39
|
+
import "./chunk-TYNF7ROW.js";
|
|
33
40
|
import {
|
|
34
41
|
output
|
|
35
42
|
} from "./chunk-T5HJUAWB.js";
|
|
36
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-5ENKYZA4.js";
|
|
44
|
+
import "./chunk-AOZQPCWI.js";
|
|
37
45
|
import "./chunk-Q26DFKTY.js";
|
|
38
46
|
import {
|
|
39
47
|
external_exports,
|
|
@@ -43,7 +51,6 @@ import {
|
|
|
43
51
|
import "./chunk-3MZYUBJ6.js";
|
|
44
52
|
|
|
45
53
|
// src/domains/sdk/build.action.ts
|
|
46
|
-
import { select } from "@clack/prompts";
|
|
47
54
|
async function buildAction(opts) {
|
|
48
55
|
const { error, data } = external_exports.object({
|
|
49
56
|
slug: slugSchema.optional(),
|
|
@@ -86,9 +93,9 @@ async function buildAction(opts) {
|
|
|
86
93
|
return output.error().title("SDK not found").message(
|
|
87
94
|
`No SDK "${data.slug}" in namespace "${namespace}". Available: ${availableSlugs}`
|
|
88
95
|
).exit("error");
|
|
89
|
-
} else if (
|
|
96
|
+
} else if (opts.json || !canPrompt() || !process.stdout.isTTY) {
|
|
90
97
|
return output.error().title("Missing SDK slug").message(
|
|
91
|
-
`Pass --slug when running without
|
|
98
|
+
`Pass --slug when running without interactive input. Available in "${namespace}": ${availableSlugs}`
|
|
92
99
|
).exit("error");
|
|
93
100
|
}
|
|
94
101
|
const slug = data.slug || await select({
|
|
@@ -102,12 +109,22 @@ async function buildAction(opts) {
|
|
|
102
109
|
if (!matchingSdk) {
|
|
103
110
|
return output.error().title("SDK not found").message("Provide a valid SDK slug.").exit("error");
|
|
104
111
|
}
|
|
105
|
-
const logger = output.info().loader("Starting SDK build\u2026");
|
|
112
|
+
const logger = opts.json ? void 0 : output.info().loader("Starting SDK build\u2026");
|
|
106
113
|
const response = await client.sdks.build(matchingSdk.uid);
|
|
107
114
|
if (response.error) {
|
|
108
115
|
return output.error().title("Could not start the SDK build").message(response.message).exit("error");
|
|
109
116
|
}
|
|
110
|
-
|
|
117
|
+
if (opts.json) {
|
|
118
|
+
writeJson({
|
|
119
|
+
uid: matchingSdk.uid,
|
|
120
|
+
namespace,
|
|
121
|
+
slug,
|
|
122
|
+
version: response.data?.version ?? null,
|
|
123
|
+
status: "started"
|
|
124
|
+
});
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
logger?.update("loader", 0, {
|
|
111
128
|
content: `SDK build started for ${matchingSdk.slug}`
|
|
112
129
|
}).exit("success");
|
|
113
130
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
SdkLanguage
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Y2OQOAY7.js";
|
|
5
5
|
import {
|
|
6
6
|
contentShaSchema
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-AOZQPCWI.js";
|
|
8
8
|
import {
|
|
9
9
|
compareVersionsDesc,
|
|
10
10
|
docVersionSchema,
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/domains/document/helpers/server-session.ts
|
|
4
|
+
var createServerSession = () => {
|
|
5
|
+
const controller = new AbortController();
|
|
6
|
+
const sockets = /* @__PURE__ */ new Set();
|
|
7
|
+
let server;
|
|
8
|
+
let watcher;
|
|
9
|
+
let closing;
|
|
10
|
+
const onConnection = (socket) => {
|
|
11
|
+
sockets.add(socket);
|
|
12
|
+
socket.once("close", () => sockets.delete(socket));
|
|
13
|
+
};
|
|
14
|
+
const closeServer = async () => {
|
|
15
|
+
const current = server;
|
|
16
|
+
server = void 0;
|
|
17
|
+
if (!current) return;
|
|
18
|
+
current.off("close", onClose);
|
|
19
|
+
current.off("connection", onConnection);
|
|
20
|
+
await new Promise((resolve) => {
|
|
21
|
+
current.close(() => resolve());
|
|
22
|
+
for (const socket of sockets) socket.destroy();
|
|
23
|
+
sockets.clear();
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const close = () => {
|
|
27
|
+
if (closing) return closing;
|
|
28
|
+
controller.abort();
|
|
29
|
+
process.off("SIGINT", onInterrupt);
|
|
30
|
+
process.off("SIGTERM", onTerminate);
|
|
31
|
+
closing = Promise.all([watcher?.unsubscribe(), closeServer()]).then(
|
|
32
|
+
() => void 0
|
|
33
|
+
);
|
|
34
|
+
return closing;
|
|
35
|
+
};
|
|
36
|
+
const onClose = () => {
|
|
37
|
+
void close();
|
|
38
|
+
};
|
|
39
|
+
const onInterrupt = () => {
|
|
40
|
+
process.exitCode = 130;
|
|
41
|
+
void close();
|
|
42
|
+
};
|
|
43
|
+
const onTerminate = () => {
|
|
44
|
+
process.exitCode = 143;
|
|
45
|
+
void close();
|
|
46
|
+
};
|
|
47
|
+
process.once("SIGINT", onInterrupt);
|
|
48
|
+
process.once("SIGTERM", onTerminate);
|
|
49
|
+
return {
|
|
50
|
+
signal: controller.signal,
|
|
51
|
+
close,
|
|
52
|
+
closeServer,
|
|
53
|
+
setServer: async (next) => {
|
|
54
|
+
server = next;
|
|
55
|
+
next.on("connection", onConnection);
|
|
56
|
+
next.once("close", onClose);
|
|
57
|
+
if (controller.signal.aborted) await closeServer();
|
|
58
|
+
},
|
|
59
|
+
setWatcher: async (next) => {
|
|
60
|
+
watcher = next;
|
|
61
|
+
if (controller.signal.aborted) await next?.unsubscribe();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
createServerSession
|
|
68
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
err,
|
|
4
|
+
ok
|
|
5
|
+
} from "./chunk-5ENKYZA4.js";
|
|
6
|
+
|
|
7
|
+
// src/helpers/input-error.ts
|
|
8
|
+
var causes = {
|
|
9
|
+
ERR_INVALID_URL: {
|
|
10
|
+
reason: "Invalid URL (ERR_INVALID_URL).",
|
|
11
|
+
recovery: "Provide a valid HTTP or HTTPS URL."
|
|
12
|
+
},
|
|
13
|
+
ENOENT: {
|
|
14
|
+
reason: "File not found (ENOENT).",
|
|
15
|
+
recovery: "Check that the file path exists."
|
|
16
|
+
},
|
|
17
|
+
EACCES: {
|
|
18
|
+
reason: "Permission denied (EACCES).",
|
|
19
|
+
recovery: "Check that you have permission to read the file."
|
|
20
|
+
},
|
|
21
|
+
EPERM: {
|
|
22
|
+
reason: "Operation not permitted (EPERM).",
|
|
23
|
+
recovery: "Check that you have permission to read the file."
|
|
24
|
+
},
|
|
25
|
+
EISDIR: {
|
|
26
|
+
reason: "The path is a directory (EISDIR).",
|
|
27
|
+
recovery: "Provide a file path instead of a directory."
|
|
28
|
+
},
|
|
29
|
+
ENOTDIR: {
|
|
30
|
+
reason: "A path component is not a directory (ENOTDIR).",
|
|
31
|
+
recovery: "Check the file path and its parent directories."
|
|
32
|
+
},
|
|
33
|
+
ENOTFOUND: {
|
|
34
|
+
reason: "Host not found (ENOTFOUND).",
|
|
35
|
+
recovery: "Check the URL hostname and your network connection."
|
|
36
|
+
},
|
|
37
|
+
EAI_AGAIN: {
|
|
38
|
+
reason: "DNS lookup failed (EAI_AGAIN).",
|
|
39
|
+
recovery: "Check your network and DNS settings before trying again."
|
|
40
|
+
},
|
|
41
|
+
ECONNREFUSED: {
|
|
42
|
+
reason: "Connection refused (ECONNREFUSED).",
|
|
43
|
+
recovery: "Check the host, port, and whether the server is running."
|
|
44
|
+
},
|
|
45
|
+
ECONNRESET: {
|
|
46
|
+
reason: "Connection reset (ECONNRESET).",
|
|
47
|
+
recovery: "Check your network connection and server availability before trying again."
|
|
48
|
+
},
|
|
49
|
+
ETIMEDOUT: {
|
|
50
|
+
reason: "Connection timed out (ETIMEDOUT).",
|
|
51
|
+
recovery: "Check your network connection and server availability before trying again."
|
|
52
|
+
},
|
|
53
|
+
UND_ERR_CONNECT_TIMEOUT: {
|
|
54
|
+
reason: "Connection timed out (UND_ERR_CONNECT_TIMEOUT).",
|
|
55
|
+
recovery: "Check your network connection and server availability before trying again."
|
|
56
|
+
},
|
|
57
|
+
UND_ERR_SOCKET: {
|
|
58
|
+
reason: "Connection interrupted (UND_ERR_SOCKET).",
|
|
59
|
+
recovery: "Check your network connection and server availability before trying again."
|
|
60
|
+
},
|
|
61
|
+
CERT_HAS_EXPIRED: {
|
|
62
|
+
reason: "The server certificate has expired (CERT_HAS_EXPIRED).",
|
|
63
|
+
recovery: "Ask the server owner to renew its TLS certificate."
|
|
64
|
+
},
|
|
65
|
+
DEPTH_ZERO_SELF_SIGNED_CERT: {
|
|
66
|
+
reason: "The server certificate is not trusted (DEPTH_ZERO_SELF_SIGNED_CERT).",
|
|
67
|
+
recovery: "Check the server certificate and your trusted certificate configuration."
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
function quoteInput(input) {
|
|
71
|
+
return JSON.stringify(input).replace(
|
|
72
|
+
/[\p{Cc}\p{Cf}]/gu,
|
|
73
|
+
(character) => character.split("").map((unit) => `\\u${unit.charCodeAt(0).toString(16).padStart(4, "0")}`).join("")
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
function safeInput(input, kind) {
|
|
77
|
+
if (kind === "file" && !/^\s*[a-z][a-z\d+.-]*:\/\//i.test(input))
|
|
78
|
+
return quoteInput(input);
|
|
79
|
+
try {
|
|
80
|
+
const url = new URL(input);
|
|
81
|
+
url.username = "";
|
|
82
|
+
url.password = "";
|
|
83
|
+
url.search = "";
|
|
84
|
+
url.hash = "";
|
|
85
|
+
return quoteInput(url.toString());
|
|
86
|
+
} catch {
|
|
87
|
+
return "[invalid URL]";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function inputFailure(error, kind) {
|
|
91
|
+
for (let depth = 0, current = error; depth < 5; depth++) {
|
|
92
|
+
if (typeof current !== "object" || current === null) break;
|
|
93
|
+
if ("code" in current && typeof current.code === "string" && Object.hasOwn(causes, current.code)) {
|
|
94
|
+
const cause = causes[current.code];
|
|
95
|
+
return `${cause.reason} ${cause.recovery}`;
|
|
96
|
+
}
|
|
97
|
+
current = "cause" in current ? current.cause : void 0;
|
|
98
|
+
}
|
|
99
|
+
return kind === "file" ? "The file could not be read. Check the path and read permissions." : "The download failed. Check the URL, network connection, and server availability before trying again.";
|
|
100
|
+
}
|
|
101
|
+
function httpFailure(status, registry) {
|
|
102
|
+
const recovery = status === 401 ? registry ? "Run scalar auth login and check your access to this resource." : "Check the credentials required by this URL." : status === 403 ? "Check that you have access to this resource." : status === 404 ? registry ? "Check the namespace, slug, and version." : "Check that the URL points to an existing API description." : "Check the URL and server availability before trying again.";
|
|
103
|
+
return `HTTP ${status}. ${recovery}`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// src/helpers/read-url.ts
|
|
107
|
+
var DOWNLOAD_TIMEOUT_MS = 1e4;
|
|
108
|
+
async function readUrl(input, registryAuth) {
|
|
109
|
+
const signal = AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS);
|
|
110
|
+
const context = safeInput(input, "url");
|
|
111
|
+
const failure = (error) => signal.aborted ? "The download timed out after 10 seconds. Check your network connection and server availability before trying again." : inputFailure(error, "url");
|
|
112
|
+
const response = await fetch(input, {
|
|
113
|
+
signal,
|
|
114
|
+
...registryAuth ? {
|
|
115
|
+
headers: { "x-scalar-auth": registryAuth.accessToken },
|
|
116
|
+
redirect: "error"
|
|
117
|
+
} : {}
|
|
118
|
+
}).then(ok).catch((error) => err(`${context}: ${failure(error)}`));
|
|
119
|
+
if (!response.ok) return response;
|
|
120
|
+
const body = await response.data.text().then(ok).catch((error) => err(failure(error)));
|
|
121
|
+
if (!response.data.ok) {
|
|
122
|
+
return err(
|
|
123
|
+
`${context}: ${httpFailure(response.data.status, registryAuth !== void 0)}${body.ok ? "" : ` ${body.error}`}`
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
return body.ok ? body : err(`${context}: ${body.error}`);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export {
|
|
130
|
+
safeInput,
|
|
131
|
+
inputFailure,
|
|
132
|
+
readUrl
|
|
133
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
RegistryAsset
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TYNF7ROW.js";
|
|
5
5
|
import {
|
|
6
|
+
MCP_DOWNLOAD_PATH_PREFIX,
|
|
6
7
|
contentShaSchema
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AOZQPCWI.js";
|
|
8
9
|
import {
|
|
9
10
|
docVersionSchema,
|
|
10
11
|
external_exports,
|
|
@@ -221,6 +222,8 @@ var VERSION_WORDS = [
|
|
|
221
222
|
];
|
|
222
223
|
var VERSION_LABEL = `(?:(?:(?:[a-z][a-z0-9]*-)*(?:[vV]?[0-9]+(?:[.][0-9]+){0,4}(?:-[0-9A-Za-z.-]+)?|[0-9a-f]{7,40})|${VERSION_WORDS.join("|")})(?:[+]${MCP_BUILD_PATTERN})?|latest)`;
|
|
223
224
|
var ORIGIN_VERSION_LABEL = `[^/@+]+(?:[+]${MCP_BUILD_PATTERN})?`;
|
|
225
|
+
var TOKEN_SEGMENT = "[A-Za-z0-9_-]+";
|
|
226
|
+
var DOWNLOAD_PATTERN = `^${MCP_DOWNLOAD_PATH_PREFIX}/${TOKEN_SEGMENT}[.]${TOKEN_SEGMENT}(?:[.]${TOKEN_SEGMENT})?$`;
|
|
224
227
|
var READ = ["GET", "HEAD"];
|
|
225
228
|
var DASHBOARD_POST = [
|
|
226
229
|
"POST",
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
safeNormalize
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WKW5W2ZP.js";
|
|
5
|
+
import {
|
|
6
|
+
inputFailure,
|
|
7
|
+
readUrl,
|
|
8
|
+
safeInput
|
|
9
|
+
} from "./chunk-2XWUFFEZ.js";
|
|
5
10
|
import {
|
|
6
11
|
isUrl
|
|
7
12
|
} from "./chunk-4ORL4MST.js";
|
|
@@ -38,17 +43,18 @@ import fs from "node:fs";
|
|
|
38
43
|
import as2 from "ansis";
|
|
39
44
|
import { validate } from "@scalar/openapi-validator";
|
|
40
45
|
var getFileOrUrl = async (input) => {
|
|
41
|
-
if (isUrl(input)) {
|
|
42
|
-
const
|
|
43
|
-
if (!
|
|
44
|
-
return output.error().title("Could not fetch the API description from the URL").exit("error");
|
|
46
|
+
if (isUrl(input) || /^\s*https?:/i.test(input)) {
|
|
47
|
+
const result = await readUrl(input);
|
|
48
|
+
if (!result.ok) {
|
|
49
|
+
return output.error().title("Could not fetch the API description from the URL").message(result.error).exit("error");
|
|
45
50
|
}
|
|
46
|
-
return
|
|
51
|
+
return result.data;
|
|
47
52
|
}
|
|
48
|
-
|
|
49
|
-
return
|
|
53
|
+
try {
|
|
54
|
+
return fs.readFileSync(input, "utf-8");
|
|
55
|
+
} catch (error) {
|
|
56
|
+
return output.error().title("Could not read the API description file").message(`${safeInput(input, "file")}: ${inputFailure(error, "file")}`).exit("error");
|
|
50
57
|
}
|
|
51
|
-
return fs.readFileSync(input, "utf-8");
|
|
52
58
|
};
|
|
53
59
|
var loadOpenApiDocument = async (content) => {
|
|
54
60
|
try {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
config
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CSJIKXUD.js";
|
|
5
5
|
import {
|
|
6
6
|
RegistryAsset
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TYNF7ROW.js";
|
|
8
8
|
|
|
9
9
|
// src/domains/registry/helpers/links.ts
|
|
10
10
|
function registryUrl(path) {
|
|
@@ -2,7 +2,7 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
|
|
|
2
2
|
import {
|
|
3
3
|
getPublishPreviewUrl,
|
|
4
4
|
getPublishUrl
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-62OOT7FY.js";
|
|
6
6
|
|
|
7
7
|
// src/domains/project/publish/url.ts
|
|
8
8
|
function getPublishDeploymentUrl(publish) {
|
|
@@ -173,6 +173,7 @@ var mcpServerChannelSchema = external_exports.discriminatedUnion("kind", [
|
|
|
173
173
|
external_exports.object({ kind: external_exports.literal("api"), documentUid: external_exports.string() }),
|
|
174
174
|
external_exports.object({ kind: external_exports.literal("docs"), projectUid: external_exports.string() })
|
|
175
175
|
]);
|
|
176
|
+
var MCP_DOWNLOAD_PATH_PREFIX = "/_scalar/download";
|
|
176
177
|
var mcpServerSchema = external_exports.object({
|
|
177
178
|
id: external_exports.string().meta({ examples: ["42"] }),
|
|
178
179
|
teamUid: external_exports.string(),
|
|
@@ -1022,6 +1023,7 @@ export {
|
|
|
1022
1023
|
mcpDocsProjectTrackModes,
|
|
1023
1024
|
mcpChannelModes,
|
|
1024
1025
|
mcpServerChannelSchema,
|
|
1026
|
+
MCP_DOWNLOAD_PATH_PREFIX,
|
|
1025
1027
|
mcpServerSchema,
|
|
1026
1028
|
mcpServerVersionSchema,
|
|
1027
1029
|
mcpServerDocsPageToolSchema,
|
|
@@ -5,7 +5,8 @@ var AGENT_NOTES = [
|
|
|
5
5
|
"Run `scalar <command>` when the CLI is installed, or `npx @scalar/cli <command>` when it is not.",
|
|
6
6
|
"Run `scalar context` for this command tree as JSON, or `scalar <command> --help` for a single command.",
|
|
7
7
|
"Log in with a personal token: `scalar auth login --token <token>`, or set `SCALAR_API_KEY` and run `scalar auth login`. Both store the session on disk for later commands. Without a token, `scalar auth login` opens a browser and waits for a person to log in, so do not run it that way. Check the session with `scalar auth whoami`.",
|
|
8
|
-
"
|
|
8
|
+
"Use --no-input before or after subcommands to disable prompts and browser launches, including under a PTY. Supply required values explicitly; missing inputs fail with exit code 1 and guidance. Piped input is never a confirmation. Cancelled prompts and EOF exit with code 1. The flag does not imply --yes or --force and neither option chooses an unspecified target.",
|
|
9
|
+
"Many commands prompt when a value is left out, such as a slug, a team, or a confirmation before overwriting a file, and missing values fail when interaction is disabled. Pass every value as an argument or flag: for example `--output` on `document bundle` and `document upgrade`, `--yes` on `project rollback`, and `--force` on `project init`.",
|
|
9
10
|
"Results go to stdout. Errors go to stderr, prefixed with `[ERROR]`."
|
|
10
11
|
];
|
|
11
12
|
var EXIT_CODES = {
|