@scalar/cli 2.5.1 → 2.7.1

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 (78) hide show
  1. package/README.md +113 -28
  2. package/chunks/{action-VTVFY2MP.js → action-4NGK5XMD.js} +38 -21
  3. package/chunks/{action-FDB7NEOK.js → action-5SK5NE7E.js} +10 -4
  4. package/chunks/{action-QE2ZQQX7.js → action-7PEQXDWT.js} +4 -4
  5. package/chunks/action-AQRPFQKI.js +231 -0
  6. package/chunks/{action-R7IMFHQ5.js → action-ATGZOWSH.js} +49 -26
  7. package/chunks/{action-XMNX5ZYT.js → action-BAQYJ6UE.js} +25 -21
  8. package/chunks/{action-M7RQKBSB.js → action-BOZNBCNZ.js} +89 -14
  9. package/chunks/{action-QPUSPD5M.js → action-BRSSC2SR.js} +7 -7
  10. package/chunks/{action-37EV4UHW.js → action-CA4QYPI6.js} +6 -6
  11. package/chunks/{action-JZLZ7ZAD.js → action-CPLH2CQ5.js} +17 -17
  12. package/chunks/{action-SQG3JAII.js → action-E4YSRFGT.js} +34 -20
  13. package/chunks/{action-CH24QGTE.js → action-EOAVVL52.js} +11 -5
  14. package/chunks/action-F2ZJNURT.js +72 -0
  15. package/chunks/{action-5IU77OII.js → action-F7A2K74G.js} +4 -4
  16. package/chunks/{action-SH4UUXPL.js → action-H6OUJWWM.js} +4 -4
  17. package/chunks/{action-SNLCIBQC.js → action-HJYZCPUN.js} +5 -5
  18. package/chunks/{action-LA6KVAXQ.js → action-JAHFRYWZ.js} +58 -9
  19. package/chunks/{action-UZQJNYK4.js → action-LPVITMWA.js} +3 -3
  20. package/chunks/{action-VC4DCVST.js → action-LVDU6YOI.js} +32 -23
  21. package/chunks/{action-4XI7XJR4.js → action-N7BA5I3E.js} +37 -12
  22. package/chunks/{action-NVSZT2ZD.js → action-NVI5DWFP.js} +6 -6
  23. package/chunks/{action-F3UX5E3M.js → action-OX2566BE.js} +32 -25
  24. package/chunks/{action-OGQSTRMX.js → action-QYGOPSTY.js} +13 -13
  25. package/chunks/{action-IUE4IOWO.js → action-RBOLLIGX.js} +82 -16
  26. package/chunks/{action-MSLBC2SO.js → action-SCOXTCPR.js} +15 -15
  27. package/chunks/{action-WFWYGY7O.js → action-SNPOOW6S.js} +20 -15
  28. package/chunks/{action-HGBBV353.js → action-SRBN7N3R.js} +10 -10
  29. package/chunks/{action-PAGJ5PWC.js → action-T5XMJXPO.js} +11 -7
  30. package/chunks/{action-G26LSVZ7.js → action-VOFDW3U2.js} +4 -4
  31. package/chunks/{action-FIXBOJEW.js → action-YRX6SN5F.js} +10 -4
  32. package/chunks/{agent-HCQRMHQ5.js → agent-ASPV3R5U.js} +4 -4
  33. package/chunks/{asyncapi-QM76O55R.js → asyncapi-H4FU6GPC.js} +10 -11
  34. package/chunks/{build.action-P7FCIMYU.js → build.action-6V6GXI3X.js} +35 -31
  35. package/chunks/{chunk-PT5TI77I.js → chunk-2DSVF5AD.js} +3 -3
  36. package/chunks/{chunk-X5T526CE.js → chunk-2PPRO2QB.js} +1 -1
  37. package/chunks/{chunk-Z2KMGFE6.js → chunk-4X47MN6Q.js} +2 -2
  38. package/chunks/{chunk-OQKDBLOZ.js → chunk-5JLVQVKO.js} +8 -0
  39. package/chunks/{chunk-VNYE4R7N.js → chunk-5UHLAJQD.js} +2 -1
  40. package/chunks/{chunk-Q7DOQHZN.js → chunk-6XWCMJDB.js} +1 -1
  41. package/chunks/{chunk-6ZMT63IV.js → chunk-6YPQGVF4.js} +1 -1
  42. package/chunks/{chunk-UGGNHILG.js → chunk-BDEPNGTO.js} +1 -1
  43. package/chunks/{chunk-HCPN3KNF.js → chunk-BIKOD3SG.js} +134 -1
  44. package/chunks/{chunk-P7H7GY5A.js → chunk-C2KAWRIX.js} +1 -1
  45. package/chunks/{chunk-M37TP6U2.js → chunk-CWCETP6H.js} +170 -5
  46. package/chunks/chunk-EGOXR5FB.js +15 -0
  47. package/chunks/{chunk-3L6DLIXJ.js → chunk-FDC2IESH.js} +3474 -1319
  48. package/chunks/{chunk-4ZDQXWBT.js → chunk-GPNB7ISG.js} +14 -1
  49. package/chunks/{chunk-24WAOKGG.js → chunk-HGOD6THU.js} +27 -18
  50. package/chunks/{chunk-4NHMAG6F.js → chunk-IMG35UXX.js} +1 -1
  51. package/chunks/{chunk-AO3F5XWR.js → chunk-ISXH6Q7I.js} +253 -9
  52. package/chunks/{chunk-CISTON3A.js → chunk-KCCFN4F7.js} +2 -2
  53. package/chunks/{chunk-F467BYYR.js → chunk-LG7IFACX.js} +38 -87
  54. package/chunks/{chunk-B2MHTD3R.js → chunk-MLSZVVTT.js} +1 -1
  55. package/chunks/{chunk-K4DTP5TV.js → chunk-OJ2EWIJH.js} +21 -2
  56. package/chunks/{chunk-LFU5ZUAP.js → chunk-QXQZVEDC.js} +105 -15
  57. package/chunks/{chunk-HPL3ZZ2P.js → chunk-R5LK6VPY.js} +72 -7
  58. package/chunks/{chunk-T7B6WNZC.js → chunk-TSURUX4A.js} +12 -3
  59. package/chunks/{chunk-7AGLC7WV.js → chunk-W24BETFG.js} +2 -2
  60. package/chunks/{chunk-GSGZHE26.js → chunk-XEDGMZJD.js} +19 -5
  61. package/chunks/{chunk-PBXZN65A.js → chunk-XXSQUBXS.js} +82 -6
  62. package/chunks/{chunk-XCSR4RIT.js → chunk-YILQODZF.js} +2 -2
  63. package/chunks/{chunk-COBPBRQF.js → chunk-ZJVYOZFB.js} +2 -2
  64. package/chunks/{create.action-HDD2WUON.js → create.action-P6DLCK4W.js} +27 -15
  65. package/chunks/{delete.action-VE66JFDS.js → delete.action-HJKRRHE2.js} +24 -15
  66. package/chunks/{delete.action-7GOZY7ID.js → delete.action-Z3GAA4ZN.js} +24 -15
  67. package/chunks/{get.action-2745EB4N.js → get.action-IT4EHAV4.js} +10 -10
  68. package/chunks/{list.action-4QDCZLSZ.js → list.action-2FU5UZNH.js} +15 -15
  69. package/chunks/{list.action-3VTXQJRA.js → list.action-WLIAO5UW.js} +13 -13
  70. package/chunks/{publish.action-ULQLZKWU.js → publish.action-T4J4DRXR.js} +48 -22
  71. package/chunks/{update.action-OROQSP2S.js → update.action-3OVS3HWC.js} +25 -16
  72. package/chunks/{update.action-6QEFP7NA.js → update.action-MY7QPSSU.js} +25 -16
  73. package/docs.html +294 -99
  74. package/index.js +436 -401
  75. package/package.json +15 -23
  76. package/skills/scalar-cli/SKILL.md +71 -0
  77. package/template.md +81 -3
  78. package/chunks/action-B3KKREWQ.js +0 -64
@@ -0,0 +1,72 @@
1
+ import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import "./chunk-3MZYUBJ6.js";
3
+
4
+ // src/helpers/documentation/context.ts
5
+ var AGENT_NOTES = [
6
+ "Run `scalar <command>` when the CLI is installed, or `npx @scalar/cli <command>` when it is not.",
7
+ "Run `scalar context` for this command tree as JSON, or `scalar <command> --help` for a single command.",
8
+ "Authenticate 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 sign in, so do not run it that way. Check the session with `scalar auth whoami`.",
9
+ "Many commands prompt when a value is left out, such as a slug, a team, or a confirmation before overwriting a file, and a prompt blocks a non-interactive run. 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`.",
10
+ "Results go to stdout. Errors go to stderr, prefixed with `[ERROR]`."
11
+ ];
12
+ var EXIT_CODES = {
13
+ "0": "Success",
14
+ "1": "Failure, including invalid arguments or options. The reason is printed to stderr."
15
+ };
16
+ var isHidden = (command) => command._hidden === true;
17
+ var isRunnable = (command) => typeof command._actionHandler === "function";
18
+ var toArgument = (argument) => ({
19
+ name: argument.name(),
20
+ description: argument.description,
21
+ required: argument.required,
22
+ variadic: argument.variadic,
23
+ ...argument.defaultValue !== void 0 && {
24
+ default: argument.defaultValue
25
+ },
26
+ ...argument.argChoices && { choices: argument.argChoices }
27
+ });
28
+ var toOption = (option) => ({
29
+ flags: option.flags,
30
+ description: option.description,
31
+ value: option.required ? "required" : option.optional ? "optional" : "none",
32
+ variadic: option.variadic,
33
+ mandatory: option.mandatory,
34
+ ...option.defaultValue !== void 0 && { default: option.defaultValue },
35
+ ...option.argChoices && { choices: option.argChoices },
36
+ ...option.envVar && { env: option.envVar }
37
+ });
38
+ var visibleOptions = (command) => command.createHelp().visibleOptions(command).map(toOption);
39
+ var toCommand = (command, parentPath) => {
40
+ const path = `${parentPath} ${command.name()}`;
41
+ return {
42
+ name: command.name(),
43
+ command: path,
44
+ usage: `${path} ${command.usage()}`,
45
+ description: command.description(),
46
+ aliases: command.aliases(),
47
+ runnable: isRunnable(command),
48
+ arguments: command.registeredArguments.map(toArgument),
49
+ options: visibleOptions(command),
50
+ commands: command.commands.filter((child) => !isHidden(child)).map((child) => toCommand(child, path))
51
+ };
52
+ };
53
+ var buildCliContext = (program) => ({
54
+ name: program.name(),
55
+ version: program.version() ?? "",
56
+ description: program.description(),
57
+ notes: AGENT_NOTES,
58
+ exitCodes: EXIT_CODES,
59
+ options: visibleOptions(program),
60
+ commands: program.commands.filter((command) => !isHidden(command)).map((command) => toCommand(command, program.name()))
61
+ });
62
+
63
+ // src/domains/context/action.ts
64
+ var rootCommand = (command) => command.parent ? rootCommand(command.parent) : command;
65
+ function contextAction(command) {
66
+ const context = buildCliContext(rootCommand(command));
67
+ process.stdout.write(`${JSON.stringify(context, null, 2)}
68
+ `);
69
+ }
70
+ export {
71
+ contextAction
72
+ };
@@ -1,19 +1,19 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  getFileOrUrl
4
- } from "./chunk-24WAOKGG.js";
4
+ } from "./chunk-HGOD6THU.js";
5
5
  import {
6
6
  require_dist
7
7
  } from "./chunk-K74E42RV.js";
8
- import "./chunk-CISTON3A.js";
9
- import "./chunk-Q7DOQHZN.js";
8
+ import "./chunk-KCCFN4F7.js";
9
+ import "./chunk-6XWCMJDB.js";
10
10
  import {
11
11
  isYamlFileName
12
12
  } from "./chunk-4ORL4MST.js";
13
13
  import {
14
14
  output
15
15
  } from "./chunk-T5HJUAWB.js";
16
- import "./chunk-GSGZHE26.js";
16
+ import "./chunk-XEDGMZJD.js";
17
17
  import "./chunk-IKT5F47M.js";
18
18
  import {
19
19
  __toESM
@@ -3,12 +3,12 @@ import {
3
3
  getFileOrUrl,
4
4
  isDocument,
5
5
  safeNormalize
6
- } from "./chunk-24WAOKGG.js";
6
+ } from "./chunk-HGOD6THU.js";
7
7
  import {
8
8
  require_dist
9
9
  } from "./chunk-K74E42RV.js";
10
- import "./chunk-CISTON3A.js";
11
- import "./chunk-Q7DOQHZN.js";
10
+ import "./chunk-KCCFN4F7.js";
11
+ import "./chunk-6XWCMJDB.js";
12
12
  import {
13
13
  isUrl,
14
14
  isYamlFileName
@@ -16,7 +16,7 @@ import {
16
16
  import {
17
17
  output
18
18
  } from "./chunk-T5HJUAWB.js";
19
- import "./chunk-GSGZHE26.js";
19
+ import "./chunk-XEDGMZJD.js";
20
20
  import "./chunk-IKT5F47M.js";
21
21
  import {
22
22
  __toESM
@@ -2,17 +2,17 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
2
2
  import {
3
3
  getFileOrUrl,
4
4
  isAsyncApiContent
5
- } from "./chunk-24WAOKGG.js";
5
+ } from "./chunk-HGOD6THU.js";
6
6
  import {
7
7
  config
8
- } from "./chunk-4ZDQXWBT.js";
9
- import "./chunk-CISTON3A.js";
10
- import "./chunk-Q7DOQHZN.js";
8
+ } from "./chunk-GPNB7ISG.js";
9
+ import "./chunk-KCCFN4F7.js";
10
+ import "./chunk-6XWCMJDB.js";
11
11
  import "./chunk-4ORL4MST.js";
12
12
  import {
13
13
  output
14
14
  } from "./chunk-T5HJUAWB.js";
15
- import "./chunk-GSGZHE26.js";
15
+ import "./chunk-XEDGMZJD.js";
16
16
  import "./chunk-IKT5F47M.js";
17
17
  import "./chunk-3MZYUBJ6.js";
18
18
 
@@ -2,21 +2,21 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
2
2
  import {
3
3
  getFileOrUrl,
4
4
  isAsyncApiContent
5
- } from "./chunk-24WAOKGG.js";
5
+ } from "./chunk-HGOD6THU.js";
6
6
  import {
7
7
  err,
8
8
  ok
9
- } from "./chunk-P7H7GY5A.js";
9
+ } from "./chunk-C2KAWRIX.js";
10
10
  import {
11
11
  require_dist
12
12
  } from "./chunk-K74E42RV.js";
13
- import "./chunk-CISTON3A.js";
14
- import "./chunk-Q7DOQHZN.js";
13
+ import "./chunk-KCCFN4F7.js";
14
+ import "./chunk-6XWCMJDB.js";
15
15
  import "./chunk-4ORL4MST.js";
16
16
  import {
17
17
  output
18
18
  } from "./chunk-T5HJUAWB.js";
19
- import "./chunk-GSGZHE26.js";
19
+ import "./chunk-XEDGMZJD.js";
20
20
  import "./chunk-IKT5F47M.js";
21
21
  import {
22
22
  __toESM
@@ -176,6 +176,42 @@ function isFile(path) {
176
176
  }
177
177
  }
178
178
 
179
+ // ../../packages/api-document-lint/dist/validate-inline-document.js
180
+ var import_yaml = __toESM(require_dist(), 1);
181
+ function validateInlineDocument(document) {
182
+ const parsed = (() => {
183
+ try {
184
+ return ok((0, import_yaml.parse)(document));
185
+ } catch {
186
+ return err("Document must be valid YAML or JSON before linting.");
187
+ }
188
+ })();
189
+ if (!parsed.ok)
190
+ return parsed;
191
+ const references = /* @__PURE__ */ new Set([
192
+ "$ref",
193
+ "$dynamicRef",
194
+ "$recursiveRef",
195
+ "operationRef"
196
+ ]);
197
+ const seen = /* @__PURE__ */ new Set();
198
+ const pending = [parsed.data];
199
+ while (pending.length) {
200
+ const value = pending.pop();
201
+ if (!value || typeof value !== "object" || seen.has(value))
202
+ continue;
203
+ seen.add(value);
204
+ for (const [key, child] of Object.entries(value)) {
205
+ if (references.has(key) && typeof child === "string" && child !== "" && !child.startsWith("#")) {
206
+ return err("External references are not supported by hosted linting. Bundle the document first.");
207
+ }
208
+ if (child && typeof child === "object")
209
+ pending.push(child);
210
+ }
211
+ }
212
+ return ok(void 0);
213
+ }
214
+
179
215
  // ../../packages/api-document-lint/dist/run-vacuum.js
180
216
  var execFileAsync = promisify(execFile);
181
217
  var MAX_BUFFER = 64 * 1024 * 1024;
@@ -184,6 +220,11 @@ async function runVacuum(input, options = {}) {
184
220
  if (input.document.trim().length === 0) {
185
221
  return ok([]);
186
222
  }
223
+ if (options.allowExternalReferences === false) {
224
+ const validation = validateInlineDocument(input.document);
225
+ if (!validation.ok)
226
+ return validation;
227
+ }
187
228
  const binary = resolveVacuumBinary(options.binaryPath);
188
229
  if (!binary.ok) {
189
230
  return binary;
@@ -206,8 +247,15 @@ async function runVacuum(input, options = {}) {
206
247
  "--skip-check",
207
248
  // Match Spectral's working-directory base for document strings.
208
249
  "--base",
209
- process.cwd()
250
+ options.allowExternalReferences === false ? directory : process.cwd()
210
251
  ];
252
+ if (options.allowExternalReferences === false) {
253
+ const configPath = join2(directory, "vacuum.conf.yaml");
254
+ const configured = await writeFile(configPath, "{}").then(() => true).catch(() => false);
255
+ if (!configured)
256
+ return err("Could not create hosted lint configuration");
257
+ args.push("--remote=false", "--config", configPath);
258
+ }
211
259
  if (input.ruleset && input.ruleset.trim().length > 0) {
212
260
  const rulesetPath = join2(directory, "ruleset.yaml");
213
261
  const wroteRuleset = await writeFile(rulesetPath, input.ruleset, "utf8").then(() => true).catch(() => false);
@@ -219,7 +267,8 @@ async function runVacuum(input, options = {}) {
219
267
  args.push(documentPath, reportPath);
220
268
  const failure = await execFileAsync(binary.data, args, {
221
269
  maxBuffer: MAX_BUFFER,
222
- timeout: TIMEOUT_MS
270
+ timeout: options.timeoutMs ?? TIMEOUT_MS,
271
+ ...options.allowExternalReferences === false ? { cwd: directory } : {}
223
272
  }).then(() => null).catch((error) => error);
224
273
  const report = await readFile(reportPath, "utf8").catch(() => null);
225
274
  if (report === null) {
@@ -262,7 +311,7 @@ function parseReport(report) {
262
311
  }
263
312
 
264
313
  // ../../packages/api-document-lint/dist/select-engine.js
265
- var import_yaml = __toESM(require_dist(), 1);
314
+ var import_yaml2 = __toESM(require_dist(), 1);
266
315
  function selectEngine(ruleset) {
267
316
  if (!ruleset || ruleset.trim().length === 0) {
268
317
  return "vacuum";
@@ -291,7 +340,7 @@ function isRecord(value) {
291
340
  }
292
341
  function parseRuleset(ruleset) {
293
342
  try {
294
- const value = (0, import_yaml.parse)(ruleset);
343
+ const value = (0, import_yaml2.parse)(ruleset);
295
344
  if (value && typeof value === "object" && !Array.isArray(value)) {
296
345
  return value;
297
346
  }
@@ -4,10 +4,10 @@ import {
4
4
  downloadIsolate,
5
5
  isDiskWriteError,
6
6
  updateIsolate
7
- } from "./chunk-LFU5ZUAP.js";
7
+ } from "./chunk-QXQZVEDC.js";
8
8
  import "./chunk-3ZJYGGAA.js";
9
- import "./chunk-X5T526CE.js";
10
- import "./chunk-4ZDQXWBT.js";
9
+ import "./chunk-2PPRO2QB.js";
10
+ import "./chunk-GPNB7ISG.js";
11
11
  import "./chunk-T5HJUAWB.js";
12
12
  import "./chunk-3MZYUBJ6.js";
13
13
  export {
@@ -1,29 +1,32 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  apiService
4
- } from "./chunk-AO3F5XWR.js";
5
- import "./chunk-HCPN3KNF.js";
6
- import "./chunk-B2MHTD3R.js";
7
- import "./chunk-3L6DLIXJ.js";
8
- import "./chunk-P7H7GY5A.js";
9
- import "./chunk-HPL3ZZ2P.js";
10
- import "./chunk-M37TP6U2.js";
11
- import "./chunk-4ZDQXWBT.js";
12
- import "./chunk-VNYE4R7N.js";
13
- import "./chunk-OQKDBLOZ.js";
4
+ } from "./chunk-ISXH6Q7I.js";
5
+ import "./chunk-BIKOD3SG.js";
6
+ import "./chunk-MLSZVVTT.js";
7
+ import "./chunk-FDC2IESH.js";
8
+ import "./chunk-C2KAWRIX.js";
9
+ import "./chunk-R5LK6VPY.js";
10
+ import "./chunk-CWCETP6H.js";
11
+ import "./chunk-GPNB7ISG.js";
12
+ import "./chunk-5UHLAJQD.js";
13
+ import "./chunk-5JLVQVKO.js";
14
+ import {
15
+ requireInteractive
16
+ } from "./chunk-EGOXR5FB.js";
14
17
  import "./chunk-K74E42RV.js";
15
- import "./chunk-CISTON3A.js";
16
- import "./chunk-Q7DOQHZN.js";
18
+ import "./chunk-KCCFN4F7.js";
19
+ import "./chunk-6XWCMJDB.js";
17
20
  import "./chunk-4ORL4MST.js";
18
21
  import {
19
22
  output
20
23
  } from "./chunk-T5HJUAWB.js";
21
- import "./chunk-GSGZHE26.js";
24
+ import "./chunk-XEDGMZJD.js";
22
25
  import "./chunk-IKT5F47M.js";
23
26
  import "./chunk-3MZYUBJ6.js";
24
27
 
25
28
  // src/domains/project/create/action.ts
26
- import { text } from "@clack/prompts";
29
+ import { isCancel, text } from "@clack/prompts";
27
30
  import as from "ansis";
28
31
  async function createAction({
29
32
  name,
@@ -33,24 +36,30 @@ async function createAction({
33
36
  let nameValue = name;
34
37
  let slugValue = slug;
35
38
  if (!nameValue) {
36
- nameValue = await text({
39
+ requireInteractive(
40
+ "Pass --name <name> to create a project non-interactively."
41
+ );
42
+ const response2 = await text({
37
43
  message: "What is the name of your project?",
38
44
  validate(value) {
39
- if (value.trim().length === 0) {
40
- return "You did not provide a project name. Please provide a name!";
41
- }
42
- return;
45
+ if (!value.trim()) return "Please provide a project name.";
43
46
  }
44
47
  });
48
+ if (isCancel(response2)) return;
49
+ nameValue = response2;
45
50
  }
46
- if (!slugValue) {
47
- slugValue = await text({
51
+ if (!slugValue && process.stdin.isTTY) {
52
+ const response2 = await text({
48
53
  message: "What is the slug of your project? (Optional)",
49
- defaultValue: void 0
54
+ defaultValue: ""
50
55
  });
56
+ if (isCancel(response2)) return;
57
+ slugValue = response2 || void 0;
51
58
  }
52
59
  const logger = output.info().loader("Creating the project");
53
- const response = await apiClient.github.createProject({
60
+ const response = await apiClient.docsProject.createProject({
61
+ provider: "forgejo",
62
+ blank: true,
54
63
  name: nameValue,
55
64
  slug: slugValue
56
65
  });
@@ -8,12 +8,12 @@ import {
8
8
  generateAccessByPersonalToken,
9
9
  setAuthData,
10
10
  tokenResponseSchema
11
- } from "./chunk-M37TP6U2.js";
11
+ } from "./chunk-CWCETP6H.js";
12
12
  import {
13
13
  config
14
- } from "./chunk-4ZDQXWBT.js";
15
- import "./chunk-VNYE4R7N.js";
16
- import "./chunk-OQKDBLOZ.js";
14
+ } from "./chunk-GPNB7ISG.js";
15
+ import "./chunk-5UHLAJQD.js";
16
+ import "./chunk-5JLVQVKO.js";
17
17
  import "./chunk-4ORL4MST.js";
18
18
  import {
19
19
  output
@@ -28,7 +28,12 @@ import as2 from "ansis";
28
28
 
29
29
  // ../../packages/mongobase-client/dist/auth/node/exchange-callback-server.js
30
30
  import getPort from "get-port";
31
- var generateTokenCallbackEndpoint = async (exchangeUrl) => {
31
+ var generateTokenCallbackEndpoint = async (exchangeUrl, allowedOrigin) => {
32
+ const parsedAllowedOrigin = URL.parse(allowedOrigin);
33
+ if (!parsedAllowedOrigin) {
34
+ throw new Error(`Invalid dashboard URL "${allowedOrigin}". Provide an absolute URL such as https://dashboard.scalar.com.`);
35
+ }
36
+ const allowedCorsOrigin = parsedAllowedOrigin.origin;
32
37
  const http = await import("node:http");
33
38
  const port = await getPort();
34
39
  const server = http.createServer();
@@ -36,11 +41,24 @@ var generateTokenCallbackEndpoint = async (exchangeUrl) => {
36
41
  const getTokens = async () => {
37
42
  const resultPromise = new Promise((resolve) => {
38
43
  server.on("request", async (req, res) => {
39
- const corsOrigin = `http://127.0.0.1:${port}`;
44
+ const corsHeaders = req.headers.origin === allowedCorsOrigin ? {
45
+ "Access-Control-Allow-Origin": allowedCorsOrigin,
46
+ Vary: "Origin"
47
+ } : { Vary: "Origin" };
48
+ if (req.method === "OPTIONS") {
49
+ res.writeHead(204, {
50
+ ...corsHeaders,
51
+ "Access-Control-Allow-Methods": "POST",
52
+ "Access-Control-Allow-Headers": "*",
53
+ "Access-Control-Allow-Private-Network": "true"
54
+ });
55
+ res.end();
56
+ return;
57
+ }
40
58
  const errorResponse = (message, code) => {
41
59
  res.writeHead(code, {
42
60
  "Content-Type": "application/json",
43
- "Access-Control-Allow-Origin": corsOrigin
61
+ ...corsHeaders
44
62
  });
45
63
  res.end(JSON.stringify({
46
64
  success: false,
@@ -63,7 +81,7 @@ var generateTokenCallbackEndpoint = async (exchangeUrl) => {
63
81
  if (tokens) {
64
82
  res.writeHead(200, {
65
83
  "Content-Type": "application/json",
66
- "Access-Control-Allow-Origin": corsOrigin
84
+ ...corsHeaders
67
85
  });
68
86
  res.end(JSON.stringify({
69
87
  success: true,
@@ -176,13 +194,20 @@ async function loginAction({
176
194
  await setAuthData({ accessToken, refreshToken });
177
195
  output.info().message(loggedInMessage(email)).print();
178
196
  } catch (err) {
179
- output.error().title(err.message).print();
197
+ output.error().title(err.message).exit("error");
180
198
  }
181
199
  return;
182
200
  }
183
- const { port, getTokens } = await generateTokenCallbackEndpoint(
184
- `${config.services.api}/core/login/exchange`
185
- );
201
+ let callbackEndpoint;
202
+ try {
203
+ callbackEndpoint = await generateTokenCallbackEndpoint(
204
+ `${config.services.api}/core/login/exchange`,
205
+ config.projects.dashboard
206
+ );
207
+ } catch (err) {
208
+ return output.error().title("Unable to start the login callback server").message(err.message).exit("error");
209
+ }
210
+ const { port, getTokens } = callbackEndpoint;
186
211
  const loginUrl = `${config.projects.dashboard}/login?externalRedirect=local&port=${port}`;
187
212
  output.info().message(`Please follow the link to login: ${as2.cyan(loginUrl)}`).print();
188
213
  openBrowser(loginUrl);
@@ -2,16 +2,16 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
2
2
  import {
3
3
  readAndParseConfig,
4
4
  renderConfigError
5
- } from "./chunk-7AGLC7WV.js";
6
- import "./chunk-PBXZN65A.js";
7
- import "./chunk-OQKDBLOZ.js";
5
+ } from "./chunk-W24BETFG.js";
6
+ import "./chunk-XXSQUBXS.js";
7
+ import "./chunk-5JLVQVKO.js";
8
8
  import "./chunk-K74E42RV.js";
9
- import "./chunk-CISTON3A.js";
10
- import "./chunk-Q7DOQHZN.js";
9
+ import "./chunk-KCCFN4F7.js";
10
+ import "./chunk-6XWCMJDB.js";
11
11
  import {
12
12
  output
13
13
  } from "./chunk-T5HJUAWB.js";
14
- import "./chunk-GSGZHE26.js";
14
+ import "./chunk-XEDGMZJD.js";
15
15
  import "./chunk-IKT5F47M.js";
16
16
  import "./chunk-3MZYUBJ6.js";
17
17
 
@@ -1,47 +1,47 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  getPublishDeploymentUrl
4
- } from "./chunk-4NHMAG6F.js";
4
+ } from "./chunk-IMG35UXX.js";
5
+ import {
6
+ resolveProject
7
+ } from "./chunk-TSURUX4A.js";
5
8
  import {
6
9
  readAndParseConfig,
7
10
  renderConfigError
8
- } from "./chunk-7AGLC7WV.js";
11
+ } from "./chunk-W24BETFG.js";
9
12
  import {
10
13
  DEFAULT_ASSETS_DIR
11
- } from "./chunk-PBXZN65A.js";
12
- import {
13
- resolveProject
14
- } from "./chunk-T7B6WNZC.js";
15
- import "./chunk-XCSR4RIT.js";
14
+ } from "./chunk-XXSQUBXS.js";
15
+ import "./chunk-YILQODZF.js";
16
16
  import {
17
17
  apiService
18
- } from "./chunk-AO3F5XWR.js";
18
+ } from "./chunk-ISXH6Q7I.js";
19
19
  import {
20
20
  getDatabaseClient
21
- } from "./chunk-Z2KMGFE6.js";
22
- import "./chunk-HCPN3KNF.js";
23
- import "./chunk-B2MHTD3R.js";
24
- import "./chunk-3L6DLIXJ.js";
25
- import "./chunk-P7H7GY5A.js";
26
- import "./chunk-HPL3ZZ2P.js";
21
+ } from "./chunk-4X47MN6Q.js";
22
+ import "./chunk-BIKOD3SG.js";
23
+ import "./chunk-MLSZVVTT.js";
24
+ import "./chunk-FDC2IESH.js";
25
+ import "./chunk-C2KAWRIX.js";
26
+ import "./chunk-R5LK6VPY.js";
27
27
  import {
28
28
  getAuthData
29
- } from "./chunk-M37TP6U2.js";
30
- import "./chunk-4ZDQXWBT.js";
31
- import "./chunk-VNYE4R7N.js";
29
+ } from "./chunk-CWCETP6H.js";
30
+ import "./chunk-GPNB7ISG.js";
31
+ import "./chunk-5UHLAJQD.js";
32
32
  import {
33
33
  ConfigVersion,
34
34
  isGithubBackedDocsProject,
35
35
  publishRecordSchema
36
- } from "./chunk-OQKDBLOZ.js";
36
+ } from "./chunk-5JLVQVKO.js";
37
37
  import "./chunk-K74E42RV.js";
38
- import "./chunk-CISTON3A.js";
39
- import "./chunk-Q7DOQHZN.js";
38
+ import "./chunk-KCCFN4F7.js";
39
+ import "./chunk-6XWCMJDB.js";
40
40
  import "./chunk-4ORL4MST.js";
41
41
  import {
42
42
  output
43
43
  } from "./chunk-T5HJUAWB.js";
44
- import "./chunk-GSGZHE26.js";
44
+ import "./chunk-XEDGMZJD.js";
45
45
  import {
46
46
  slugSchema,
47
47
  zod_default
@@ -131,7 +131,8 @@ var FILE_BEARING_CONFIG_KEYS = /* @__PURE__ */ new Set([
131
131
  "logo",
132
132
  "icon",
133
133
  "backgroundImage",
134
- "assetsDir"
134
+ "assetsDir",
135
+ "imageTemplate"
135
136
  ]);
136
137
  function collectConfigReferences(config) {
137
138
  const references = [];
@@ -222,6 +223,11 @@ function collectConfigReferences(config) {
222
223
  case "assetsDir":
223
224
  add(value, key);
224
225
  break;
226
+ // A site's own social card template, which the build compiles and runs
227
+ // for every page. Always a repository path, never a URL.
228
+ case "imageTemplate":
229
+ add(value, key);
230
+ break;
225
231
  }
226
232
  }
227
233
  };
@@ -500,8 +506,8 @@ async function waitForPublish({
500
506
  logger.exit("success");
501
507
  return;
502
508
  }
503
- if (deployStatus.data.status === "error") {
504
- logger.exit("error");
509
+ if (deployStatus.data.status === "error" || deployStatus.data.status === "cancelled") {
510
+ return logger.exit("error");
505
511
  }
506
512
  await sleep(3e3);
507
513
  }
@@ -518,5 +524,6 @@ async function getDeployStatus({
518
524
  });
519
525
  }
520
526
  export {
521
- publishAction
527
+ publishAction,
528
+ waitForPublish
522
529
  };
@@ -1,24 +1,24 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  apiService
4
- } from "./chunk-AO3F5XWR.js";
5
- import "./chunk-HCPN3KNF.js";
6
- import "./chunk-B2MHTD3R.js";
7
- import "./chunk-3L6DLIXJ.js";
8
- import "./chunk-P7H7GY5A.js";
9
- import "./chunk-HPL3ZZ2P.js";
10
- import "./chunk-M37TP6U2.js";
11
- import "./chunk-4ZDQXWBT.js";
12
- import "./chunk-VNYE4R7N.js";
13
- import "./chunk-OQKDBLOZ.js";
4
+ } from "./chunk-ISXH6Q7I.js";
5
+ import "./chunk-BIKOD3SG.js";
6
+ import "./chunk-MLSZVVTT.js";
7
+ import "./chunk-FDC2IESH.js";
8
+ import "./chunk-C2KAWRIX.js";
9
+ import "./chunk-R5LK6VPY.js";
10
+ import "./chunk-CWCETP6H.js";
11
+ import "./chunk-GPNB7ISG.js";
12
+ import "./chunk-5UHLAJQD.js";
13
+ import "./chunk-5JLVQVKO.js";
14
14
  import "./chunk-K74E42RV.js";
15
- import "./chunk-CISTON3A.js";
16
- import "./chunk-Q7DOQHZN.js";
15
+ import "./chunk-KCCFN4F7.js";
16
+ import "./chunk-6XWCMJDB.js";
17
17
  import "./chunk-4ORL4MST.js";
18
18
  import {
19
19
  output
20
20
  } from "./chunk-T5HJUAWB.js";
21
- import "./chunk-GSGZHE26.js";
21
+ import "./chunk-XEDGMZJD.js";
22
22
  import "./chunk-IKT5F47M.js";
23
23
  import "./chunk-3MZYUBJ6.js";
24
24