@scalar/cli 2.5.2 → 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.
- package/README.md +113 -28
- package/chunks/{action-Y6CEKYEK.js → action-4NGK5XMD.js} +38 -21
- package/chunks/{action-DGD6Q6Y5.js → action-5SK5NE7E.js} +10 -4
- package/chunks/{action-LUVBQEIQ.js → action-7PEQXDWT.js} +4 -4
- package/chunks/action-AQRPFQKI.js +231 -0
- package/chunks/{action-TWHLZW4V.js → action-ATGZOWSH.js} +49 -26
- package/chunks/{action-ZLTUMRO2.js → action-BAQYJ6UE.js} +25 -21
- package/chunks/{action-X7TZA3RE.js → action-BOZNBCNZ.js} +89 -14
- package/chunks/{action-OK55BFGM.js → action-BRSSC2SR.js} +7 -7
- package/chunks/{action-RBVPKCRI.js → action-CA4QYPI6.js} +6 -6
- package/chunks/{action-EPNE5XCM.js → action-CPLH2CQ5.js} +17 -17
- package/chunks/{action-FF2OMGAS.js → action-E4YSRFGT.js} +34 -20
- package/chunks/{action-7H3XARJP.js → action-EOAVVL52.js} +11 -5
- package/chunks/action-F2ZJNURT.js +72 -0
- package/chunks/{action-AMNYOA4B.js → action-F7A2K74G.js} +4 -4
- package/chunks/{action-ZWQLQENM.js → action-H6OUJWWM.js} +4 -4
- package/chunks/{action-HIL5ZFNB.js → action-HJYZCPUN.js} +5 -5
- package/chunks/{action-PAA4NWUJ.js → action-JAHFRYWZ.js} +58 -9
- package/chunks/{action-42D2C47G.js → action-LPVITMWA.js} +3 -3
- package/chunks/{action-P7RFXIC7.js → action-LVDU6YOI.js} +32 -23
- package/chunks/{action-HXHBU7XC.js → action-N7BA5I3E.js} +37 -12
- package/chunks/{action-W62AIEBN.js → action-NVI5DWFP.js} +6 -6
- package/chunks/{action-PHLOE27S.js → action-OX2566BE.js} +32 -25
- package/chunks/{action-DCINFQ57.js → action-QYGOPSTY.js} +13 -13
- package/chunks/{action-6MZZHPVQ.js → action-RBOLLIGX.js} +27 -14
- package/chunks/{action-LFL3ZZKN.js → action-SCOXTCPR.js} +15 -15
- package/chunks/{action-OILGZAMK.js → action-SNPOOW6S.js} +20 -15
- package/chunks/{action-V5KYG7XD.js → action-SRBN7N3R.js} +10 -10
- package/chunks/{action-XUQ7TKKJ.js → action-T5XMJXPO.js} +11 -7
- package/chunks/{action-6FAJNP6C.js → action-VOFDW3U2.js} +4 -4
- package/chunks/{action-SJYAMXYI.js → action-YRX6SN5F.js} +10 -4
- package/chunks/{agent-JAXLLDPE.js → agent-ASPV3R5U.js} +4 -4
- package/chunks/{asyncapi-P6Y3L7RG.js → asyncapi-H4FU6GPC.js} +10 -11
- package/chunks/{build.action-AZ5ECU4B.js → build.action-6V6GXI3X.js} +35 -31
- package/chunks/{chunk-FOKFF4EP.js → chunk-2DSVF5AD.js} +3 -3
- package/chunks/{chunk-HXIDUCSZ.js → chunk-2PPRO2QB.js} +1 -1
- package/chunks/{chunk-RPVHJMQT.js → chunk-4X47MN6Q.js} +2 -2
- package/chunks/{chunk-OQKDBLOZ.js → chunk-5JLVQVKO.js} +8 -0
- package/chunks/{chunk-VNYE4R7N.js → chunk-5UHLAJQD.js} +2 -1
- package/chunks/{chunk-CX7ZRMTC.js → chunk-6XWCMJDB.js} +1 -1
- package/chunks/{chunk-6ZMT63IV.js → chunk-6YPQGVF4.js} +1 -1
- package/chunks/{chunk-RAO7VUGM.js → chunk-BDEPNGTO.js} +1 -1
- package/chunks/{chunk-FQVVKQPU.js → chunk-BIKOD3SG.js} +134 -1
- package/chunks/{chunk-M622VXRQ.js → chunk-C2KAWRIX.js} +1 -1
- package/chunks/{chunk-NIXG4KDE.js → chunk-CWCETP6H.js} +170 -5
- package/chunks/chunk-EGOXR5FB.js +15 -0
- package/chunks/{chunk-3BWGTPPT.js → chunk-FDC2IESH.js} +1776 -1113
- package/chunks/{chunk-JV7TUEXQ.js → chunk-GPNB7ISG.js} +14 -1
- package/chunks/{chunk-SWWWYWHC.js → chunk-HGOD6THU.js} +27 -18
- package/chunks/{chunk-3DJ2GKEG.js → chunk-IMG35UXX.js} +1 -1
- package/chunks/{chunk-UB3XGOUW.js → chunk-ISXH6Q7I.js} +253 -9
- package/chunks/{chunk-MNLXYOVF.js → chunk-KCCFN4F7.js} +2 -2
- package/chunks/{chunk-KEOCJ3NJ.js → chunk-LG7IFACX.js} +38 -87
- package/chunks/{chunk-B2MHTD3R.js → chunk-MLSZVVTT.js} +1 -1
- package/chunks/{chunk-LCPFHE4Z.js → chunk-OJ2EWIJH.js} +21 -2
- package/chunks/{chunk-UMPODUJO.js → chunk-QXQZVEDC.js} +105 -15
- package/chunks/{chunk-CIFOFSZ3.js → chunk-R5LK6VPY.js} +72 -7
- package/chunks/{chunk-T7B6WNZC.js → chunk-TSURUX4A.js} +12 -3
- package/chunks/{chunk-HUCR333E.js → chunk-W24BETFG.js} +2 -2
- package/chunks/{chunk-LQN4S62O.js → chunk-XEDGMZJD.js} +18 -4
- package/chunks/{chunk-NNMSZVAB.js → chunk-XXSQUBXS.js} +82 -6
- package/chunks/{chunk-M6Q3ARBV.js → chunk-YILQODZF.js} +2 -2
- package/chunks/{chunk-TYLWJ2UL.js → chunk-ZJVYOZFB.js} +2 -2
- package/chunks/{create.action-34OTO2SB.js → create.action-P6DLCK4W.js} +27 -15
- package/chunks/{delete.action-6LRT4M3S.js → delete.action-HJKRRHE2.js} +24 -15
- package/chunks/{delete.action-ZYXFMIOW.js → delete.action-Z3GAA4ZN.js} +24 -15
- package/chunks/{get.action-XP36SA2J.js → get.action-IT4EHAV4.js} +10 -10
- package/chunks/{list.action-WVRVLX5E.js → list.action-2FU5UZNH.js} +15 -15
- package/chunks/{list.action-6LF6KSD5.js → list.action-WLIAO5UW.js} +13 -13
- package/chunks/{publish.action-AHFUBT5C.js → publish.action-T4J4DRXR.js} +48 -22
- package/chunks/{update.action-ZREAFJVG.js → update.action-3OVS3HWC.js} +25 -16
- package/chunks/{update.action-YQTVUDYE.js → update.action-MY7QPSSU.js} +25 -16
- package/docs.html +289 -96
- package/index.js +436 -401
- package/package.json +14 -22
- package/skills/scalar-cli/SKILL.md +71 -0
- package/template.md +81 -3
- package/chunks/action-YRWHX2AE.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-
|
|
4
|
+
} from "./chunk-HGOD6THU.js";
|
|
5
5
|
import {
|
|
6
6
|
require_dist
|
|
7
7
|
} from "./chunk-K74E42RV.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
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-
|
|
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-
|
|
6
|
+
} from "./chunk-HGOD6THU.js";
|
|
7
7
|
import {
|
|
8
8
|
require_dist
|
|
9
9
|
} from "./chunk-K74E42RV.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
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-
|
|
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-
|
|
5
|
+
} from "./chunk-HGOD6THU.js";
|
|
6
6
|
import {
|
|
7
7
|
config
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
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-
|
|
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-
|
|
5
|
+
} from "./chunk-HGOD6THU.js";
|
|
6
6
|
import {
|
|
7
7
|
err,
|
|
8
8
|
ok
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-C2KAWRIX.js";
|
|
10
10
|
import {
|
|
11
11
|
require_dist
|
|
12
12
|
} from "./chunk-K74E42RV.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
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-
|
|
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
|
|
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,
|
|
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-
|
|
7
|
+
} from "./chunk-QXQZVEDC.js";
|
|
8
8
|
import "./chunk-3ZJYGGAA.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
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-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
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-
|
|
16
|
-
import "./chunk-
|
|
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-
|
|
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
|
-
|
|
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()
|
|
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
|
-
|
|
51
|
+
if (!slugValue && process.stdin.isTTY) {
|
|
52
|
+
const response2 = await text({
|
|
48
53
|
message: "What is the slug of your project? (Optional)",
|
|
49
|
-
defaultValue:
|
|
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.
|
|
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-
|
|
11
|
+
} from "./chunk-CWCETP6H.js";
|
|
12
12
|
import {
|
|
13
13
|
config
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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).
|
|
197
|
+
output.error().title(err.message).exit("error");
|
|
180
198
|
}
|
|
181
199
|
return;
|
|
182
200
|
}
|
|
183
|
-
|
|
184
|
-
|
|
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-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-W24BETFG.js";
|
|
6
|
+
import "./chunk-XXSQUBXS.js";
|
|
7
|
+
import "./chunk-5JLVQVKO.js";
|
|
8
8
|
import "./chunk-K74E42RV.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
11
|
+
} from "./chunk-W24BETFG.js";
|
|
9
12
|
import {
|
|
10
13
|
DEFAULT_ASSETS_DIR
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import
|
|
13
|
-
resolveProject
|
|
14
|
-
} from "./chunk-T7B6WNZC.js";
|
|
15
|
-
import "./chunk-M6Q3ARBV.js";
|
|
14
|
+
} from "./chunk-XXSQUBXS.js";
|
|
15
|
+
import "./chunk-YILQODZF.js";
|
|
16
16
|
import {
|
|
17
17
|
apiService
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ISXH6Q7I.js";
|
|
19
19
|
import {
|
|
20
20
|
getDatabaseClient
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
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-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
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-
|
|
36
|
+
} from "./chunk-5JLVQVKO.js";
|
|
37
37
|
import "./chunk-K74E42RV.js";
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
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-
|
|
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-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
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-
|
|
16
|
-
import "./chunk-
|
|
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-
|
|
21
|
+
import "./chunk-XEDGMZJD.js";
|
|
22
22
|
import "./chunk-IKT5F47M.js";
|
|
23
23
|
import "./chunk-3MZYUBJ6.js";
|
|
24
24
|
|