@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
@@ -0,0 +1,147 @@
1
+ import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ openBrowser
4
+ } from "./chunk-JFIXNSPP.js";
5
+ import {
6
+ CLI_CLIENT_ID,
7
+ accessTokenPayloadSchema,
8
+ decode,
9
+ generateAccessByPersonalToken,
10
+ requestTokens,
11
+ setAuthData
12
+ } from "./chunk-3RIUDHLG.js";
13
+ import {
14
+ config
15
+ } from "./chunk-N5CJ5MTY.js";
16
+ import "./chunk-US54KYOJ.js";
17
+ import "./chunk-BQYVSPAI.js";
18
+ import "./chunk-VRZSDUZK.js";
19
+ import {
20
+ output
21
+ } from "./chunk-T5HJUAWB.js";
22
+ import "./chunk-AVZFSWPD.js";
23
+ import "./chunk-I57ID5K7.js";
24
+ import "./chunk-3MZYUBJ6.js";
25
+
26
+ // src/domains/auth/login/action.ts
27
+ import { createHash, randomBytes } from "node:crypto";
28
+ import { createServer } from "node:http";
29
+ import as2 from "ansis";
30
+ import getPort from "get-port";
31
+
32
+ // src/domains/auth/login/helpers/messages.ts
33
+ import as from "ansis";
34
+ function loggedInMessage(userIdentifier) {
35
+ if (process.env.CI || !userIdentifier) return "Logged in to Scalar.";
36
+ return `Logged in to Scalar as ${as.cyan(userIdentifier)}.`;
37
+ }
38
+
39
+ // src/domains/auth/login/action.ts
40
+ var CALLBACK_TIMEOUT_MS = 3 * 60 * 1e3;
41
+ async function listenForCode(state) {
42
+ const preferred = await getPort({
43
+ port: config.auth.callback.preferredPortRange
44
+ });
45
+ const server = createServer();
46
+ await new Promise((resolve, reject) => {
47
+ server.once("error", reject);
48
+ server.listen({ port: preferred, host: "127.0.0.1" }, resolve);
49
+ });
50
+ const { port } = server.address();
51
+ const answer = new Promise((resolve, reject) => {
52
+ const timeout = setTimeout(() => {
53
+ server.close();
54
+ reject(new Error("Timed out waiting for the browser"));
55
+ }, CALLBACK_TIMEOUT_MS);
56
+ server.on("request", (req, res) => {
57
+ const url = new URL(req.url ?? "/", `http://127.0.0.1:${port}`);
58
+ if (url.pathname !== "/callback" || url.searchParams.get("state") !== state) {
59
+ res.writeHead(400).end();
60
+ return;
61
+ }
62
+ clearTimeout(timeout);
63
+ resolve({
64
+ code: url.searchParams.get("code"),
65
+ finish: (ok) => {
66
+ const page = ok ? "success" : "failure";
67
+ res.writeHead(302, {
68
+ location: `${config.projects.dashboard}/login/exchange/${page}`
69
+ });
70
+ res.end(() => server.close());
71
+ }
72
+ });
73
+ });
74
+ });
75
+ return { redirectUri: `http://127.0.0.1:${port}/callback`, answer };
76
+ }
77
+ async function loginAction({
78
+ email,
79
+ password,
80
+ token: _token
81
+ }) {
82
+ if (email || password) {
83
+ return output.error().title(
84
+ "Email and password authentication is no longer supported. Use `scalar auth login --token <token>` or `scalar auth login` to log in through your browser."
85
+ ).exit("error");
86
+ }
87
+ const token = process.env.SCALAR_API_KEY || _token;
88
+ if (token) {
89
+ try {
90
+ const { accessToken } = await generateAccessByPersonalToken({
91
+ personalToken: token
92
+ });
93
+ const { email: userEmail } = decode(accessToken, accessTokenPayloadSchema);
94
+ output.info().message(loggedInMessage(userEmail)).print();
95
+ } catch (err) {
96
+ return output.error().title("Invalid token").message(err.message ?? "Provide a valid personal token.").exit("error");
97
+ }
98
+ return;
99
+ }
100
+ const state = randomBytes(16).toString("base64url");
101
+ const verifier = randomBytes(32).toString("base64url");
102
+ let callback;
103
+ try {
104
+ callback = await listenForCode(state);
105
+ } catch (err) {
106
+ return output.error().title("Could not start the login callback server").message(err.message).exit("error");
107
+ }
108
+ const loginUrl = new URL("/_scalar/oauth/authorize", config.auth.origin);
109
+ loginUrl.search = new URLSearchParams({
110
+ response_type: "code",
111
+ client_id: CLI_CLIENT_ID,
112
+ redirect_uri: callback.redirectUri,
113
+ code_challenge: createHash("sha256").update(verifier).digest("base64url"),
114
+ code_challenge_method: "S256",
115
+ state
116
+ }).toString();
117
+ output.info().message("Open this URL to log in:").print();
118
+ process.stdout.write(`${as2.cyan(loginUrl.href)}
119
+ `);
120
+ openBrowser(loginUrl.href);
121
+ try {
122
+ const { code, finish } = await callback.answer;
123
+ const tokens = code ? await requestTokens({
124
+ grant_type: "authorization_code",
125
+ code,
126
+ code_verifier: verifier,
127
+ client_id: CLI_CLIENT_ID,
128
+ redirect_uri: callback.redirectUri
129
+ }).catch(() => void 0) : void 0;
130
+ finish(Boolean(tokens?.refresh_token));
131
+ if (!tokens?.refresh_token) throw new Error("Unable to log in");
132
+ await setAuthData({
133
+ accessToken: tokens.access_token,
134
+ refreshToken: tokens.refresh_token
135
+ });
136
+ const { email: userEmail } = decode(
137
+ tokens.access_token,
138
+ accessTokenPayloadSchema
139
+ );
140
+ return output.info().message(loggedInMessage(userEmail)).exit("success");
141
+ } catch {
142
+ return output.error().title("Could not log in to Scalar").exit("error");
143
+ }
144
+ }
145
+ export {
146
+ loginAction
147
+ };
@@ -0,0 +1,16 @@
1
+ import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ buildCliContext
4
+ } from "./chunk-EBNFCIKS.js";
5
+ import "./chunk-3MZYUBJ6.js";
6
+
7
+ // src/domains/context/action.ts
8
+ var rootCommand = (command) => command.parent ? rootCommand(command.parent) : command;
9
+ function contextAction(command) {
10
+ const context = buildCliContext(rootCommand(command));
11
+ process.stdout.write(`${JSON.stringify(context, null, 2)}
12
+ `);
13
+ }
14
+ export {
15
+ contextAction
16
+ };
@@ -1,28 +1,29 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  apiService
4
- } from "./chunk-EXY3ZTV4.js";
5
- import "./chunk-KKRGBXCE.js";
6
- import "./chunk-MLSZVVTT.js";
7
- import "./chunk-FDC2IESH.js";
8
- import "./chunk-C2KAWRIX.js";
9
- import "./chunk-R5LK6VPY.js";
10
- import "./chunk-QVQ4PNVL.js";
11
- import "./chunk-UXJ753NV.js";
12
- import "./chunk-5UHLAJQD.js";
13
- import "./chunk-5JLVQVKO.js";
4
+ } from "./chunk-F3OPMYME.js";
5
+ import "./chunk-FG5AOTDN.js";
6
+ import "./chunk-SEURG74P.js";
7
+ import "./chunk-3TFOA64C.js";
8
+ import "./chunk-5ENKYZA4.js";
9
+ import "./chunk-Y6XGC4K5.js";
10
+ import "./chunk-SOV4POMS.js";
11
+ import "./chunk-T34TL6KL.js";
12
+ import "./chunk-3RIUDHLG.js";
13
+ import "./chunk-N5CJ5MTY.js";
14
+ import "./chunk-US54KYOJ.js";
15
+ import "./chunk-BQYVSPAI.js";
16
+ import "./chunk-VRZSDUZK.js";
14
17
  import {
15
18
  requireInteractive
16
19
  } from "./chunk-EGOXR5FB.js";
17
- import "./chunk-K74E42RV.js";
18
- import "./chunk-KCCFN4F7.js";
19
- import "./chunk-6XWCMJDB.js";
20
- import "./chunk-4ORL4MST.js";
20
+ import "./chunk-MN2AFJXM.js";
21
21
  import {
22
22
  output
23
23
  } from "./chunk-T5HJUAWB.js";
24
- import "./chunk-XEDGMZJD.js";
25
- import "./chunk-IKT5F47M.js";
24
+ import "./chunk-25XERWCE.js";
25
+ import "./chunk-AVZFSWPD.js";
26
+ import "./chunk-I57ID5K7.js";
26
27
  import "./chunk-3MZYUBJ6.js";
27
28
 
28
29
  // src/domains/project/create/action.ts
@@ -40,9 +41,9 @@ async function createAction({
40
41
  "Pass --name <name> to create a project non-interactively."
41
42
  );
42
43
  const response2 = await text({
43
- message: "What is the name of your project?",
44
+ message: "Enter the project name",
44
45
  validate(value) {
45
- if (!value.trim()) return "Please provide a project name.";
46
+ if (!value.trim()) return "Provide a project name.";
46
47
  }
47
48
  });
48
49
  if (isCancel(response2)) return;
@@ -50,13 +51,13 @@ async function createAction({
50
51
  }
51
52
  if (!slugValue && process.stdin.isTTY) {
52
53
  const response2 = await text({
53
- message: "What is the slug of your project? (Optional)",
54
+ message: "Enter the project slug (optional)",
54
55
  defaultValue: ""
55
56
  });
56
57
  if (isCancel(response2)) return;
57
58
  slugValue = response2 || void 0;
58
59
  }
59
- const logger = output.info().loader("Creating the project");
60
+ const logger = output.info().loader("Creating project\u2026");
60
61
  const response = await apiClient.docsProject.createProject({
61
62
  provider: "forgejo",
62
63
  blank: true,
@@ -64,11 +65,11 @@ async function createAction({
64
65
  slug: slugValue
65
66
  });
66
67
  if (response.error) {
67
- return output.error().title("Something went wrong").message(response.message).exit("error");
68
+ return output.error().title("Could not create the project").message(response.message).exit("error");
68
69
  }
69
- logger.update("loader", 0, { content: "Project created successfully!" });
70
+ logger.update("loader", 0, { content: "Project created." });
70
71
  logger.message(
71
- `Project uid: ${as.cyan(response.data.uid)}
72
+ `Project ID: ${as.cyan(response.data.uid)}
72
73
  Project slug: ${as.cyan(response.data.slug)}`
73
74
  ).exit("success");
74
75
  }
@@ -1,22 +1,24 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
- isAsyncApiDocument,
4
3
  isDocument
5
- } from "./chunk-HGOD6THU.js";
4
+ } from "./chunk-4JKXZ5CF.js";
5
+ import {
6
+ isAsyncApiDocument
7
+ } from "./chunk-QMLRYD76.js";
6
8
  import {
7
9
  err,
8
10
  ok
9
- } from "./chunk-C2KAWRIX.js";
10
- import "./chunk-KCCFN4F7.js";
11
- import "./chunk-6XWCMJDB.js";
11
+ } from "./chunk-5ENKYZA4.js";
12
12
  import {
13
13
  isUrl
14
14
  } from "./chunk-4ORL4MST.js";
15
+ import "./chunk-MN2AFJXM.js";
15
16
  import {
16
17
  output
17
18
  } from "./chunk-T5HJUAWB.js";
18
- import "./chunk-XEDGMZJD.js";
19
- import "./chunk-IKT5F47M.js";
19
+ import "./chunk-25XERWCE.js";
20
+ import "./chunk-AVZFSWPD.js";
21
+ import "./chunk-I57ID5K7.js";
20
22
  import "./chunk-3MZYUBJ6.js";
21
23
 
22
24
  // src/domains/document/validate/action.ts
@@ -177,7 +179,7 @@ var resolveForValidation = (document) => {
177
179
  async function validateAction(inputArgument) {
178
180
  const startTime = performance.now();
179
181
  if (!inputArgument) {
180
- return output.error().title("Invalid argument").message("Please provide a file path").exit("error");
182
+ return output.error().title("Invalid argument").message("Provide a file path or URL.").exit("error");
181
183
  }
182
184
  const document = await bundle(
183
185
  isUrl(inputArgument) ? inputArgument : path.resolve(inputArgument),
@@ -189,7 +191,7 @@ async function validateAction(inputArgument) {
189
191
  return output.error().title("Invalid input").message(error instanceof Error ? error.message : String(error)).exit("error");
190
192
  });
191
193
  if (!isDocument(document)) {
192
- return output.error().title("Invalid input").message("Please provide a valid JSON or YAML document.").exit("error");
194
+ return output.error().title("Invalid input").message("Provide a valid JSON or YAML document.").exit("error");
193
195
  }
194
196
  const resolved = resolveForValidation(document);
195
197
  if (!resolved.ok) {
@@ -207,8 +209,8 @@ async function validateAction(inputArgument) {
207
209
  `
208
210
  )
209
211
  ).line(
210
- `${as.green("File validated")} ${as.grey(
211
- `in ${as.white(`${as.bold(`${Math.round(endTime - startTime)}`)} ms`)}
212
+ `${as.green("API description validated")} ${as.grey(
213
+ `(${as.white(`${as.bold(`${Math.round(endTime - startTime)}`)} ms`)})
212
214
  `
213
215
  )}`
214
216
  ).print();
@@ -220,7 +222,7 @@ async function validateAction(inputArgument) {
220
222
  ).message(
221
223
  as.red(
222
224
  `${as.bold(
223
- `${result.errors?.length} error${result.errors && result.errors.length > 1 ? "s" : ""}`
225
+ `${result.errors?.length ?? 0} error${result.errors?.length === 1 ? "" : "s"}`
224
226
  )} found.`
225
227
  )
226
228
  ).exit("error");
@@ -0,0 +1,64 @@
1
+ import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ projectDetails
4
+ } from "./chunk-6PSYZO3U.js";
5
+ import {
6
+ resolveProject
7
+ } from "./chunk-TSURUX4A.js";
8
+ import {
9
+ formatAbsoluteTime
10
+ } from "./chunk-AEFPCC4U.js";
11
+ import {
12
+ apiService
13
+ } from "./chunk-F3OPMYME.js";
14
+ import "./chunk-FG5AOTDN.js";
15
+ import "./chunk-SEURG74P.js";
16
+ import "./chunk-3TFOA64C.js";
17
+ import "./chunk-5ENKYZA4.js";
18
+ import "./chunk-Y6XGC4K5.js";
19
+ import "./chunk-SOV4POMS.js";
20
+ import "./chunk-T34TL6KL.js";
21
+ import "./chunk-3RIUDHLG.js";
22
+ import "./chunk-N5CJ5MTY.js";
23
+ import "./chunk-US54KYOJ.js";
24
+ import "./chunk-BQYVSPAI.js";
25
+ import "./chunk-VRZSDUZK.js";
26
+ import "./chunk-MN2AFJXM.js";
27
+ import {
28
+ output
29
+ } from "./chunk-T5HJUAWB.js";
30
+ import "./chunk-25XERWCE.js";
31
+ import "./chunk-AVZFSWPD.js";
32
+ import {
33
+ slugSchema
34
+ } from "./chunk-I57ID5K7.js";
35
+ import "./chunk-3MZYUBJ6.js";
36
+
37
+ // src/domains/project/get/action.ts
38
+ async function getAction(slug, options) {
39
+ const parsed = slugSchema.safeParse(slug);
40
+ if (!parsed.success) {
41
+ return output.error().title("Invalid slug").message(parsed.error.issues[0].message).exit("error");
42
+ }
43
+ const client = await apiService();
44
+ const resolved = await resolveProject(parsed.data, client);
45
+ if (resolved.kind === "not-found") {
46
+ return output.error().title("Project not found").message(
47
+ `No project with slug "${slug}" was found for your team. Run scalar project list to find your project slug.`
48
+ ).exit("error");
49
+ }
50
+ const project = projectDetails(resolved.project);
51
+ if (options.json) {
52
+ console.log(JSON.stringify(project));
53
+ return;
54
+ }
55
+ const deployment = project.activeDeployment;
56
+ output.info().title(project.name).line(`Slug: ${project.slug}`).line(`ID: ${project.uid}`).line(
57
+ `Source: ${project.provider === "forgejo" ? "Scalar" : project.provider}`
58
+ ).line(`Access: ${project.isPrivate ? "Private" : "Public"}`).line(`Repository: ${project.repository?.name ?? "(unlinked)"}`).line(`Branch: ${project.repository?.branch || "\u2014"}`).line(`Config path: ${project.repository?.configPath || "\u2014"}`).line(`Live deployment: ${deployment?.uid ?? "(none)"}`).line(`Domain: ${deployment?.domain ?? "\u2014"}`).line(
59
+ `Deployed: ${deployment ? formatAbsoluteTime(deployment.publishedAt * 1e3) : "\u2014"}`
60
+ ).print();
61
+ }
62
+ export {
63
+ getAction
64
+ };
@@ -1,26 +1,31 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  getFileOrUrl,
4
- isAsyncApiContent,
5
4
  loadOpenApiDocument,
6
5
  printSpecificationBanner
7
- } from "./chunk-HGOD6THU.js";
6
+ } from "./chunk-4JKXZ5CF.js";
7
+ import {
8
+ isAsyncApiContent
9
+ } from "./chunk-QMLRYD76.js";
8
10
  import {
9
11
  watchFile
10
- } from "./chunk-QVQ4PNVL.js";
11
- import "./chunk-UXJ753NV.js";
12
- import "./chunk-5UHLAJQD.js";
13
- import "./chunk-5JLVQVKO.js";
14
- import "./chunk-KCCFN4F7.js";
15
- import "./chunk-6XWCMJDB.js";
12
+ } from "./chunk-V6LUKXBV.js";
13
+ import "./chunk-VUXPDHTQ.js";
14
+ import "./chunk-3RIUDHLG.js";
15
+ import "./chunk-N5CJ5MTY.js";
16
+ import "./chunk-US54KYOJ.js";
17
+ import "./chunk-BQYVSPAI.js";
18
+ import "./chunk-VRZSDUZK.js";
16
19
  import {
17
20
  isUrl
18
21
  } from "./chunk-4ORL4MST.js";
22
+ import "./chunk-MN2AFJXM.js";
19
23
  import {
20
24
  output
21
25
  } from "./chunk-T5HJUAWB.js";
22
- import "./chunk-XEDGMZJD.js";
23
- import "./chunk-IKT5F47M.js";
26
+ import "./chunk-25XERWCE.js";
27
+ import "./chunk-AVZFSWPD.js";
28
+ import "./chunk-I57ID5K7.js";
24
29
  import "./chunk-3MZYUBJ6.js";
25
30
 
26
31
  // src/domains/document/mock/action.ts
@@ -50,7 +55,7 @@ var bootServer = async ({
50
55
  treeShake: false
51
56
  }).then((bundled) => createMockServer({ document: bundled, onRequest })).catch(
52
57
  (error) => output.error().title(
53
- `Could not start mock server: ${error instanceof Error ? error.message : String(error)}`
58
+ `Could not start Mock Server: ${error instanceof Error ? error.message : String(error)}`
54
59
  ).exit("error")
55
60
  );
56
61
  return serve(
@@ -68,9 +73,9 @@ var bootServer = async ({
68
73
  );
69
74
  };
70
75
  var printAvailablePaths = (specification) => {
71
- output.info().message(as.white.bold("Available Paths")).print();
76
+ output.info().message(as.white.bold("Available paths")).print();
72
77
  if (specification?.paths === void 0 || Object.keys(specification?.paths).length === 0) {
73
- output.warn().title(as.grey("Could not find any paths in the OpenAPI file.")).print();
78
+ output.warn().title(as.grey("No paths found in the OpenAPI description")).print();
74
79
  }
75
80
  for (const path3 in specification?.paths ?? []) {
76
81
  if (specification?.paths?.[path3] === void 0) {
@@ -111,7 +116,7 @@ function getMethodColor(method) {
111
116
  async function mockAction(fileArgument, { watch, once, port }) {
112
117
  const content = await getFileOrUrl(fileArgument);
113
118
  if (isAsyncApiContent(content)) {
114
- const { mockAsyncApi } = await import("./asyncapi-QNFKXHEI.js");
119
+ const { mockAsyncApi } = await import("./asyncapi-WQPIQMEZ.js");
115
120
  return mockAsyncApi(fileArgument, { watch, once, port });
116
121
  }
117
122
  const origin = isUrl(fileArgument) ? fileArgument : path2.resolve(fileArgument);
@@ -150,7 +155,7 @@ async function mockAction(fileArgument, { watch, once, port }) {
150
155
  });
151
156
  }
152
157
  if (!specification) {
153
- output.warn().title("Could not find any paths in the OpenAPI file.").print();
158
+ output.warn().title("No paths found in the OpenAPI description").print();
154
159
  return;
155
160
  }
156
161
  printAvailablePaths(specification);
@@ -1,38 +1,43 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  apiService
4
- } from "./chunk-EXY3ZTV4.js";
4
+ } from "./chunk-F3OPMYME.js";
5
+ import "./chunk-FG5AOTDN.js";
5
6
  import {
6
7
  accessGroupDomains,
7
8
  accessGroupNameSchema,
8
9
  emailDomainSchema
9
- } from "./chunk-KKRGBXCE.js";
10
- import "./chunk-MLSZVVTT.js";
11
- import "./chunk-FDC2IESH.js";
12
- import "./chunk-C2KAWRIX.js";
13
- import "./chunk-R5LK6VPY.js";
14
- import "./chunk-QVQ4PNVL.js";
15
- import "./chunk-UXJ753NV.js";
16
- import "./chunk-5UHLAJQD.js";
17
- import "./chunk-5JLVQVKO.js";
18
- import "./chunk-K74E42RV.js";
19
- import "./chunk-KCCFN4F7.js";
20
- import "./chunk-6XWCMJDB.js";
21
- import "./chunk-4ORL4MST.js";
10
+ } from "./chunk-SEURG74P.js";
11
+ import "./chunk-3TFOA64C.js";
12
+ import "./chunk-5ENKYZA4.js";
13
+ import "./chunk-Y6XGC4K5.js";
14
+ import "./chunk-SOV4POMS.js";
15
+ import "./chunk-T34TL6KL.js";
16
+ import "./chunk-3RIUDHLG.js";
22
17
  import {
23
- output
18
+ config
19
+ } from "./chunk-N5CJ5MTY.js";
20
+ import "./chunk-US54KYOJ.js";
21
+ import "./chunk-BQYVSPAI.js";
22
+ import "./chunk-VRZSDUZK.js";
23
+ import "./chunk-MN2AFJXM.js";
24
+ import {
25
+ output,
26
+ printTable
24
27
  } from "./chunk-T5HJUAWB.js";
25
- import "./chunk-XEDGMZJD.js";
28
+ import "./chunk-25XERWCE.js";
29
+ import "./chunk-AVZFSWPD.js";
26
30
  import {
27
31
  external_exports,
28
32
  slugSchema
29
- } from "./chunk-IKT5F47M.js";
33
+ } from "./chunk-I57ID5K7.js";
30
34
  import "./chunk-3MZYUBJ6.js";
31
35
 
32
36
  // src/domains/access-group/actions.ts
33
37
  import { confirm, isCancel } from "@clack/prompts";
34
38
  var common = { slug: slugSchema, json: external_exports.boolean().default(false) };
35
39
  var argsSchema = external_exports.discriminatedUnion("operation", [
40
+ external_exports.object({ operation: external_exports.literal("list"), json: external_exports.boolean().default(false) }),
36
41
  external_exports.object({
37
42
  ...common,
38
43
  operation: external_exports.literal("create"),
@@ -79,11 +84,33 @@ async function runAction(input) {
79
84
  message: `Delete access group "${args.slug}" and remove its project assignments?`
80
85
  });
81
86
  if (isCancel(accepted) || !accepted) {
82
- output.info().message("Deletion cancelled.").print();
87
+ output.info().message("Operation cancelled.").print();
83
88
  return;
84
89
  }
85
90
  }
86
91
  const client = await apiService();
92
+ if (args.operation === "list") {
93
+ const response2 = await client.accessGroups.list();
94
+ if (response2.error)
95
+ return output.error().title("Could not list access groups").message(response2.message).exit("error");
96
+ if (args.json) console.log(JSON.stringify(response2.data));
97
+ else if (response2.data.length === 0)
98
+ output.info().message("No access groups found for the current team.").print();
99
+ else
100
+ printTable(
101
+ [
102
+ { name: "name", title: "Name", alignment: "left", maxLen: 40 },
103
+ { name: "slug", title: "Slug", alignment: "left" },
104
+ { name: "dashboard", title: "Dashboard", alignment: "left" }
105
+ ],
106
+ response2.data.map(({ name, slug, uid }) => ({
107
+ name: name || slug,
108
+ slug,
109
+ dashboard: `${config.projects.dashboard}/configuration/groups/${uid}`
110
+ }))
111
+ );
112
+ return;
113
+ }
87
114
  if (args.operation === "create") {
88
115
  const response2 = await client.accessGroups.create({
89
116
  slug: args.slug,
@@ -105,7 +132,7 @@ async function runAction(input) {
105
132
  if (args.operation === "get") {
106
133
  if (args.json) console.log(JSON.stringify(group.data));
107
134
  else
108
- output.info().title(group.data.name || group.data.slug).line(`Slug: ${group.data.slug}`).line(`UID: ${group.data.uid}`).line(
135
+ output.info().title(group.data.name || group.data.slug).line(`Slug: ${group.data.slug}`).line(`ID: ${group.data.uid}`).line(
109
136
  `Allowed domains: ${group.data.allowedDomains.join(", ") || "(none)"}`
110
137
  ).line(
111
138
  `Allowed emails: ${group.data.allowedEmails.join(", ") || "(none)"}`