@docsxai/engine 0.2.1-rc.1 → 0.3.0-rc.2
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 +18 -5
- package/dist/address-class.d.ts +14 -0
- package/dist/address-class.js +151 -0
- package/dist/auth/api-login.d.ts +3 -3
- package/dist/auth/email-otp.d.ts +60 -60
- package/dist/auth/jwt-injection.d.ts +45 -45
- package/dist/auth/pat-header.d.ts +2 -2
- package/dist/auth/types.d.ts +2 -2
- package/dist/auth/ui-form.d.ts +54 -54
- package/dist/auth/webauthn.d.ts +22 -22
- package/dist/backend-client-contracts.d.ts +4 -2
- package/dist/backend-client-token.js +2 -1
- package/dist/calibrate.d.ts +2 -2
- package/dist/calibrate.js +5 -0
- package/dist/cli-backend-errors.d.ts +7 -0
- package/dist/cli-backend-errors.js +65 -0
- package/dist/cli-commands-authoring.js +57 -51
- package/dist/cli-commands-backend.js +49 -42
- package/dist/cli-commands-docpack.d.ts +5 -0
- package/dist/cli-commands-docpack.js +106 -66
- package/dist/cli-commands-pack.d.ts +2 -0
- package/dist/cli-commands-pack.js +65 -0
- package/dist/cli-commands-session.js +120 -125
- package/dist/cli-messages.d.ts +17 -0
- package/dist/cli-messages.js +80 -0
- package/dist/cli-retired.d.ts +6 -0
- package/dist/cli-retired.js +12 -0
- package/dist/cli-run-summary.d.ts +15 -0
- package/dist/cli-run-summary.js +33 -0
- package/dist/cli-usage.d.ts +1 -1
- package/dist/cli-usage.js +78 -5
- package/dist/cli-verify.d.ts +14 -0
- package/dist/cli-verify.js +54 -0
- package/dist/cli.js +15 -2
- package/dist/deprecation.d.ts +19 -0
- package/dist/deprecation.js +32 -0
- package/dist/diagnose.d.ts +25 -0
- package/dist/diagnose.js +69 -3
- package/dist/diff-compute.js +1 -0
- package/dist/doc-pack-io.d.ts +14 -0
- package/dist/doc-pack-io.js +121 -14
- package/dist/doc-pack.d.ts +2282 -387
- package/dist/doc-pack.js +135 -43
- package/dist/doctor-checks-plugins.js +4 -3
- package/dist/doctor-checks.d.ts +1 -1
- package/dist/doctor-checks.js +31 -6
- package/dist/doctor.d.ts +2 -0
- package/dist/doctor.js +27 -3
- package/dist/driver-budget.d.ts +6 -0
- package/dist/driver-budget.js +15 -0
- package/dist/egress-guard.d.ts +58 -0
- package/dist/egress-guard.js +136 -0
- package/dist/environment-spec.d.ts +67 -0
- package/dist/environment-spec.js +38 -0
- package/dist/export/playwright-test.js +42 -10
- package/dist/flow-file.d.ts +9 -3
- package/dist/flow-file.js +21 -1
- package/dist/flow-halt.d.ts +16 -0
- package/dist/flow-halt.js +76 -0
- package/dist/flow-hidden.d.ts +9 -0
- package/dist/flow-hidden.js +20 -0
- package/dist/flow-lint.js +91 -1
- package/dist/flow-matrix-lint.d.ts +10 -0
- package/dist/flow-matrix-lint.js +40 -0
- package/dist/flow-matrix.d.ts +44 -0
- package/dist/flow-matrix.js +238 -0
- package/dist/flow-name-rules.d.ts +15 -0
- package/dist/flow-name-rules.js +39 -0
- package/dist/flow-runtime.d.ts +52 -22
- package/dist/flow-runtime.js +63 -117
- package/dist/flow-success.d.ts +3 -0
- package/dist/flow-success.js +37 -0
- package/dist/flow-tree.d.ts +2 -0
- package/dist/flow-tree.js +17 -5
- package/dist/flow-wait.d.ts +3 -0
- package/dist/flow-wait.js +22 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/matrix-spec.d.ts +145 -0
- package/dist/matrix-spec.js +120 -0
- package/dist/page-hide.d.ts +10 -0
- package/dist/page-hide.js +45 -0
- package/dist/page-settle.d.ts +39 -0
- package/dist/page-settle.js +142 -0
- package/dist/playwright-driver.d.ts +28 -8
- package/dist/playwright-driver.js +73 -28
- package/dist/plugins/manifest.d.ts +9 -9
- package/dist/run-flows.d.ts +40 -0
- package/dist/run-flows.js +129 -0
- package/dist/style.d.ts +2 -2
- package/dist/upload-path.d.ts +15 -0
- package/dist/upload-path.js +63 -0
- package/dist/verify-compare.d.ts +43 -0
- package/dist/verify-compare.js +237 -0
- package/dist/verify-determinism.d.ts +16 -0
- package/dist/verify-determinism.js +88 -0
- package/dist/verify-report.d.ts +53 -0
- package/dist/verify-report.js +141 -0
- package/dist/verify-tree.d.ts +27 -0
- package/dist/verify-tree.js +95 -0
- package/dist/viewer-bin.d.ts +6 -0
- package/dist/viewer-bin.js +24 -0
- package/dist/zip.d.ts +2 -2
- package/package.json +3 -2
|
@@ -2,60 +2,104 @@
|
|
|
2
2
|
// They read the rendered artifacts (flows/docs/screenshots) and emit something derived; none of
|
|
3
3
|
// them drive a live browser:
|
|
4
4
|
// render — build the static viewer by spawning the docsxai-viewer bin
|
|
5
|
+
// burn — bake the annotations into PNG copies by spawning the same bin
|
|
5
6
|
// zip — deterministic single-archive hand-off bundle
|
|
6
7
|
// export — project the doc pack to ADF (Confluence) or self-contained Playwright specs
|
|
7
8
|
// baseline — snapshot the doc pack into .baseline/ as the "before" for diff
|
|
8
9
|
// diff — drift report against a baseline (the after-vs-before)
|
|
9
|
-
import { spawn } from "node:child_process";
|
|
10
10
|
import { promises as fs } from "node:fs";
|
|
11
11
|
import * as path from "node:path";
|
|
12
|
-
import { FlowFileError } from "./flow-file.js";
|
|
13
12
|
import { diffDocPacks, formatDriftReportMarkdown, formatDriftReportText, severityAtLeast, } from "./diff.js";
|
|
14
13
|
import { projectDocPackToAdf } from "./export/adf.js";
|
|
15
14
|
import { exportWorkspaceFlowsAsPlaywrightTests } from "./export/playwright-test.js";
|
|
16
|
-
import {
|
|
15
|
+
import { runViewerBin } from "./viewer-bin.js";
|
|
17
16
|
import { ZipError, zipDocPack } from "./zip.js";
|
|
18
17
|
import { resolveWorkspacePath } from "./workspace.js";
|
|
19
18
|
import { parseFlags } from "./cli-shared.js";
|
|
20
|
-
import {
|
|
19
|
+
import { shellQuote, usageError, withNext } from "./cli-messages.js";
|
|
21
20
|
export async function cmdRender(args) {
|
|
22
21
|
const { positionals } = parseFlags(args);
|
|
23
22
|
const projectDir = positionals[0];
|
|
24
|
-
if (!projectDir)
|
|
25
|
-
|
|
26
|
-
return 2;
|
|
27
|
-
}
|
|
23
|
+
if (!projectDir)
|
|
24
|
+
return usageError("render", "missing <workspace-dir>");
|
|
28
25
|
const docsDir = resolveWorkspacePath(projectDir, "docs");
|
|
29
26
|
const outDir = resolveWorkspacePath(projectDir, ".viewer");
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
27
|
+
if (!(await fs.stat(docsDir).then((s) => s.isDirectory(), () => false))) {
|
|
28
|
+
const note = withNext(`warning — ${docsDir} does not exist, so the viewer will be empty`, `docsxai run ${shellQuote(projectDir)}`);
|
|
29
|
+
process.stderr.write(`render: ${note}\n`);
|
|
30
|
+
}
|
|
31
|
+
const code = await runViewerBin("render", ["build", docsDir, outDir]);
|
|
32
|
+
if (code === 0) {
|
|
33
|
+
process.stdout.write(`render: open ${path.join(outDir, "index.html")} (the index links the flows; each flow page shows the screenshots — hover a pulsing halo to read its callout)\n`);
|
|
34
|
+
}
|
|
35
|
+
return code;
|
|
36
|
+
}
|
|
37
|
+
/** A flow name as `burn` passes it on: no separators, and no leading dot, so it can't name a parent or hidden path. */
|
|
38
|
+
const FLOW_NAME = /^[A-Za-z0-9_-][A-Za-z0-9._-]*$/;
|
|
39
|
+
/** Parse `burn`'s argv. Returns the usage-error message when the argv is malformed. */
|
|
40
|
+
function parseBurnArgs(args) {
|
|
41
|
+
const parsed = { workspace: "", flows: [], plainConnectors: false };
|
|
42
|
+
const positionals = [];
|
|
43
|
+
for (let i = 0; i < args.length; i++) {
|
|
44
|
+
const a = args[i];
|
|
45
|
+
if (a === "--no-connector-outline") {
|
|
46
|
+
parsed.plainConnectors = true;
|
|
47
|
+
}
|
|
48
|
+
else if (a === "--flow" || a === "--out" || a === "--report") {
|
|
49
|
+
const value = args[++i];
|
|
50
|
+
if (value === undefined || value.startsWith("--"))
|
|
51
|
+
return `${a} needs a value`;
|
|
52
|
+
if (a === "--flow")
|
|
53
|
+
parsed.flows.push(value);
|
|
54
|
+
else if (a === "--out")
|
|
55
|
+
parsed.out = value;
|
|
56
|
+
else
|
|
57
|
+
parsed.report = value;
|
|
58
|
+
}
|
|
59
|
+
else if (a.startsWith("--")) {
|
|
60
|
+
return `unknown flag ${a}`;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
positionals.push(a);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (positionals.length === 0)
|
|
67
|
+
return "missing <workspace-dir>";
|
|
68
|
+
if (positionals.length > 1)
|
|
69
|
+
return `unexpected argument "${positionals[1]}"`;
|
|
70
|
+
parsed.workspace = positionals[0];
|
|
71
|
+
const bad = parsed.flows.find((f) => !FLOW_NAME.test(f));
|
|
72
|
+
if (bad !== undefined)
|
|
73
|
+
return `--flow "${bad}" is not a flow name`;
|
|
74
|
+
return parsed;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* `burn` — bake each annotation into a copy of its screenshot, for surfaces that can't run the
|
|
78
|
+
* interactive viewer. The renderer lives in `@docsxai/viewer`; this runs its `burn` command.
|
|
79
|
+
*/
|
|
80
|
+
export async function cmdBurn(args) {
|
|
81
|
+
const parsed = parseBurnArgs(args);
|
|
82
|
+
if (typeof parsed === "string")
|
|
83
|
+
return usageError("burn", parsed);
|
|
84
|
+
const docsDir = resolveWorkspacePath(parsed.workspace, "docs");
|
|
85
|
+
if (!(await fs.stat(docsDir).then((s) => s.isDirectory(), () => false))) {
|
|
86
|
+
const note = withNext(`${parsed.workspace} has no docs/ directory (expected ${docsDir})`, `docsxai run ${shellQuote(parsed.workspace)}`);
|
|
87
|
+
process.stderr.write(`burn: ${note}\n`);
|
|
88
|
+
return 1;
|
|
89
|
+
}
|
|
90
|
+
return runViewerBin("burn", [
|
|
91
|
+
"burn",
|
|
92
|
+
parsed.workspace,
|
|
93
|
+
...parsed.flows.flatMap((f) => ["--flow", f]),
|
|
94
|
+
...(parsed.out !== undefined ? ["--out", parsed.out] : []),
|
|
95
|
+
...(parsed.report !== undefined ? ["--report", parsed.report] : []),
|
|
96
|
+
...(parsed.plainConnectors ? ["--no-connector-outline"] : []),
|
|
97
|
+
]);
|
|
52
98
|
}
|
|
53
99
|
export async function cmdZip(args) {
|
|
54
100
|
const { positionals, flags } = parseFlags(args);
|
|
55
|
-
if (!positionals[0])
|
|
56
|
-
|
|
57
|
-
return 2;
|
|
58
|
-
}
|
|
101
|
+
if (!positionals[0])
|
|
102
|
+
return usageError("zip", "missing <workspace-dir>");
|
|
59
103
|
const projectDir = positionals[0];
|
|
60
104
|
const output = typeof flags.get("out") === "string"
|
|
61
105
|
? flags.get("out")
|
|
@@ -69,7 +113,12 @@ export async function cmdZip(args) {
|
|
|
69
113
|
}
|
|
70
114
|
catch (e) {
|
|
71
115
|
if (e instanceof ZipError) {
|
|
72
|
-
|
|
116
|
+
const next = /nothing to zip/.test(e.message)
|
|
117
|
+
? `docsxai run ${shellQuote(projectDir)}`
|
|
118
|
+
: /doesn't exist/.test(e.message)
|
|
119
|
+
? `docsxai init ${shellQuote(projectDir)} (or fix the path)`
|
|
120
|
+
: undefined;
|
|
121
|
+
process.stderr.write(`zip: ${next ? withNext(e.message, next) : e.message}\n`);
|
|
73
122
|
return 1;
|
|
74
123
|
}
|
|
75
124
|
throw e;
|
|
@@ -83,23 +132,21 @@ export async function cmdExport(args) {
|
|
|
83
132
|
case "playwright":
|
|
84
133
|
return cmdExportPlaywright(rest);
|
|
85
134
|
default:
|
|
86
|
-
|
|
87
|
-
|
|
135
|
+
return usageError("export", format === undefined
|
|
136
|
+
? "missing format — supported: adf, playwright"
|
|
137
|
+
: `unknown format "${format}" — supported: adf, playwright`);
|
|
88
138
|
}
|
|
89
139
|
}
|
|
90
140
|
async function cmdExportAdf(rest) {
|
|
91
141
|
const { positionals, flags } = parseFlags(rest);
|
|
92
|
-
if (!positionals[0])
|
|
93
|
-
|
|
94
|
-
return 2;
|
|
95
|
-
}
|
|
142
|
+
if (!positionals[0])
|
|
143
|
+
return usageError("export adf", "missing <workspace-dir>");
|
|
96
144
|
const projectDir = positionals[0];
|
|
97
145
|
const modeFlag = flags.get("mode");
|
|
98
146
|
let mode = "single";
|
|
99
147
|
if (typeof modeFlag === "string") {
|
|
100
148
|
if (modeFlag !== "single" && modeFlag !== "page-tree") {
|
|
101
|
-
|
|
102
|
-
return 2;
|
|
149
|
+
return usageError("export adf", `--mode must be "single" or "page-tree" (got "${modeFlag}")`);
|
|
103
150
|
}
|
|
104
151
|
mode = modeFlag;
|
|
105
152
|
}
|
|
@@ -129,16 +176,14 @@ async function cmdExportAdf(rest) {
|
|
|
129
176
|
return 0;
|
|
130
177
|
}
|
|
131
178
|
catch (e) {
|
|
132
|
-
process.stderr.write(`export adf: ${e.message}\n`);
|
|
179
|
+
process.stderr.write(`export adf: ${withNext(e.message, `docsxai lint ${shellQuote(projectDir)}`)}\n`);
|
|
133
180
|
return 1;
|
|
134
181
|
}
|
|
135
182
|
}
|
|
136
183
|
async function cmdExportPlaywright(rest) {
|
|
137
184
|
const { positionals, flags } = parseFlags(rest);
|
|
138
|
-
if (!positionals[0])
|
|
139
|
-
|
|
140
|
-
return 2;
|
|
141
|
-
}
|
|
185
|
+
if (!positionals[0])
|
|
186
|
+
return usageError("export playwright", "missing <workspace-dir>");
|
|
142
187
|
const projectDir = positionals[0];
|
|
143
188
|
const flow = flags.get("flow");
|
|
144
189
|
const outFlag = flags.get("out");
|
|
@@ -158,11 +203,7 @@ async function cmdExportPlaywright(rest) {
|
|
|
158
203
|
return 0;
|
|
159
204
|
}
|
|
160
205
|
catch (e) {
|
|
161
|
-
|
|
162
|
-
process.stderr.write(`export playwright: ${e.message}\n`);
|
|
163
|
-
return 1;
|
|
164
|
-
}
|
|
165
|
-
process.stderr.write(`export playwright: ${e.message}\n`);
|
|
206
|
+
process.stderr.write(`export playwright: ${withNext(e.message, `docsxai lint ${shellQuote(projectDir)}`)}\n`);
|
|
166
207
|
return 1;
|
|
167
208
|
}
|
|
168
209
|
}
|
|
@@ -180,10 +221,8 @@ async function copyIfExists(src, dest) {
|
|
|
180
221
|
}
|
|
181
222
|
export async function cmdBaseline(args) {
|
|
182
223
|
const { positionals, flags } = parseFlags(args);
|
|
183
|
-
if (!positionals[0])
|
|
184
|
-
|
|
185
|
-
return 2;
|
|
186
|
-
}
|
|
224
|
+
if (!positionals[0])
|
|
225
|
+
return usageError("baseline", "missing <workspace-dir>");
|
|
187
226
|
const projectDir = positionals[0];
|
|
188
227
|
const outFlag = flags.get("out");
|
|
189
228
|
const outDir = typeof outFlag === "string"
|
|
@@ -222,6 +261,10 @@ export async function cmdBaseline(args) {
|
|
|
222
261
|
}
|
|
223
262
|
}
|
|
224
263
|
process.stdout.write(`baseline: snapshotted ${copied} file${copied === 1 ? "" : "s"} to ${outDir}\n`);
|
|
264
|
+
if (copied === 0) {
|
|
265
|
+
const note = withNext("warning — no flows/ or docs/ files found to snapshot", `docsxai run ${shellQuote(projectDir)}`);
|
|
266
|
+
process.stderr.write(`baseline: ${note}\n`);
|
|
267
|
+
}
|
|
225
268
|
return 0;
|
|
226
269
|
}
|
|
227
270
|
catch (e) {
|
|
@@ -231,10 +274,8 @@ export async function cmdBaseline(args) {
|
|
|
231
274
|
}
|
|
232
275
|
export async function cmdDiff(args) {
|
|
233
276
|
const { positionals, flags } = parseFlags(args);
|
|
234
|
-
if (!positionals[0])
|
|
235
|
-
|
|
236
|
-
return 2;
|
|
237
|
-
}
|
|
277
|
+
if (!positionals[0])
|
|
278
|
+
return usageError("diff", "missing <workspace-dir>");
|
|
238
279
|
const projectDir = positionals[0];
|
|
239
280
|
const againstFlag = flags.get("against");
|
|
240
281
|
const againstDir = typeof againstFlag === "string"
|
|
@@ -242,15 +283,13 @@ export async function cmdDiff(args) {
|
|
|
242
283
|
: resolveWorkspacePath(projectDir, ".baseline");
|
|
243
284
|
const format = typeof flags.get("format") === "string" ? flags.get("format") : "text";
|
|
244
285
|
if (format !== "json" && format !== "md" && format !== "text") {
|
|
245
|
-
|
|
246
|
-
return 2;
|
|
286
|
+
return usageError("diff", `--format must be json | md | text (got "${format}")`);
|
|
247
287
|
}
|
|
248
288
|
const failOnFlag = flags.get("fail-on");
|
|
249
289
|
let failOn = null;
|
|
250
290
|
if (failOnFlag !== undefined) {
|
|
251
291
|
if (failOnFlag !== "warn" && failOnFlag !== "fail") {
|
|
252
|
-
|
|
253
|
-
return 2;
|
|
292
|
+
return usageError("diff", `--fail-on must be warn | fail (got "${String(failOnFlag)}")`);
|
|
254
293
|
}
|
|
255
294
|
failOn = failOnFlag;
|
|
256
295
|
}
|
|
@@ -258,7 +297,8 @@ export async function cmdDiff(args) {
|
|
|
258
297
|
await fs.access(path.join(againstDir, "flows"));
|
|
259
298
|
}
|
|
260
299
|
catch {
|
|
261
|
-
|
|
300
|
+
const note = withNext(`no baseline at ${againstDir}`, `docsxai baseline ${shellQuote(projectDir)} (or pass --against <dir>)`);
|
|
301
|
+
process.stderr.write(`diff: ${note}\n`);
|
|
262
302
|
return 2;
|
|
263
303
|
}
|
|
264
304
|
try {
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Screenshot-pack command — `pack` builds the hash-named, optimised PNG set plus manifest.json a
|
|
2
|
+
// docs site or README consumes, and `pack --check` rebuilds it in memory and compares it with the
|
|
3
|
+
// committed pack. The logic lives in `@docsxai/viewer` (it owns the burner); like `burn`, these
|
|
4
|
+
// validate the argv edge and run the viewer's command through the shared bin resolution, so the
|
|
5
|
+
// engine still does not depend on the viewer.
|
|
6
|
+
import { usageError } from "./cli-messages.js";
|
|
7
|
+
import { runViewerBin } from "./viewer-bin.js";
|
|
8
|
+
/** Parse argv against a spec. Returns the argv to pass on (flags in the order given) or the usage-error message. */
|
|
9
|
+
function checkArgs(args, spec) {
|
|
10
|
+
const rest = [];
|
|
11
|
+
const positionals = [];
|
|
12
|
+
for (let i = 0; i < args.length; i++) {
|
|
13
|
+
const a = args[i];
|
|
14
|
+
if (spec.bare.includes(a)) {
|
|
15
|
+
rest.push(a);
|
|
16
|
+
}
|
|
17
|
+
else if (spec.valued.includes(a)) {
|
|
18
|
+
const value = args[++i];
|
|
19
|
+
if (value === undefined || value.startsWith("--"))
|
|
20
|
+
return `${a} needs a value`;
|
|
21
|
+
rest.push(a, value);
|
|
22
|
+
}
|
|
23
|
+
else if (a.startsWith("--")) {
|
|
24
|
+
return `unknown flag ${a}`;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
positionals.push(a);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (positionals.length === 0)
|
|
31
|
+
return "missing <workspace-or-raw-dir>";
|
|
32
|
+
if (positionals.length > 1)
|
|
33
|
+
return `unexpected argument "${positionals[1]}"`;
|
|
34
|
+
return { dir: positionals[0], rest };
|
|
35
|
+
}
|
|
36
|
+
/** `pack` — burn, optimise, hash-name and write the screenshot pack; with `--check`, compare instead of write. */
|
|
37
|
+
export async function cmdPack(args) {
|
|
38
|
+
if (args.includes("--check"))
|
|
39
|
+
return cmdPackCheck(args.filter((a) => a !== "--check"));
|
|
40
|
+
const parsed = checkArgs(args, {
|
|
41
|
+
valued: ["--out", "--public-prefix", "--generated-for"],
|
|
42
|
+
bare: ["--from-raw", "--no-optimise"],
|
|
43
|
+
});
|
|
44
|
+
if (typeof parsed === "string")
|
|
45
|
+
return usageError("pack", parsed);
|
|
46
|
+
return runViewerBin("pack", ["pack", parsed.dir, ...parsed.rest]);
|
|
47
|
+
}
|
|
48
|
+
/** `pack --check` — rebuild the pack in memory and compare it with the committed one. `args` has no `--check`. */
|
|
49
|
+
async function cmdPackCheck(args) {
|
|
50
|
+
const label = "pack --check";
|
|
51
|
+
const parsed = checkArgs(args, { valued: ["--against", "--threshold"], bare: ["--from-raw"] });
|
|
52
|
+
if (typeof parsed === "string")
|
|
53
|
+
return usageError(label, parsed);
|
|
54
|
+
const against = parsed.rest.indexOf("--against");
|
|
55
|
+
if (against === -1)
|
|
56
|
+
return usageError(label, "--against <pack-dir> is required");
|
|
57
|
+
const pct = parsed.rest.indexOf("--threshold");
|
|
58
|
+
if (pct !== -1) {
|
|
59
|
+
const value = Number(parsed.rest[pct + 1]);
|
|
60
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
61
|
+
return usageError(label, "--threshold needs a percentage >= 0");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return runViewerBin(label, ["pack", parsed.dir, "--check", ...parsed.rest]);
|
|
65
|
+
}
|