@wirecat/cli-base 0.0.0-stage → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +204 -0
- package/README.md +376 -2
- package/config/biome.base.json +56 -0
- package/config/cspell.json +57 -0
- package/config/lefthook.yml +34 -0
- package/config/rumdl.toml +9 -0
- package/config/tsconfig.base.json +21 -0
- package/config/tsconfig.scripts.json +13 -0
- package/config/tsconfig.test.json +11 -0
- package/config/vale/CliDocs/Filler.yml +9 -0
- package/config/vale/CliDocs/SentenceLength.yml +6 -0
- package/config/vale/Tg/Tone.yml +7 -0
- package/config/wirecat/LICENSE +204 -0
- package/config/wirecat/biome.base.json +56 -0
- package/config/wirecat/check.mjs +41 -0
- package/config/wirecat/cspell.json +80 -0
- package/config/wirecat/lefthook.yml +26 -0
- package/config/wirecat/manifest.json +23 -0
- package/config/wirecat/markdownlint.json +10 -0
- package/config/wirecat/rumdl.toml +9 -0
- package/dist/codegen/index.d.ts +12 -0
- package/dist/codegen/index.d.ts.map +1 -0
- package/dist/codegen/index.js +11 -0
- package/dist/codegen/index.js.map +1 -0
- package/dist/codegen/manifest.d.ts +47 -0
- package/dist/codegen/manifest.d.ts.map +1 -0
- package/dist/codegen/manifest.js +73 -0
- package/dist/codegen/manifest.js.map +1 -0
- package/dist/codegen/model.d.ts +146 -0
- package/dist/codegen/model.d.ts.map +1 -0
- package/dist/codegen/model.js +7 -0
- package/dist/codegen/model.js.map +1 -0
- package/dist/codegen/names.d.ts +4 -0
- package/dist/codegen/names.d.ts.map +1 -0
- package/dist/codegen/names.js +46 -0
- package/dist/codegen/names.js.map +1 -0
- package/dist/codegen/pipeline.d.ts +24 -0
- package/dist/codegen/pipeline.d.ts.map +1 -0
- package/dist/codegen/pipeline.js +193 -0
- package/dist/codegen/pipeline.js.map +1 -0
- package/dist/codegen/runtime.d.ts +24 -0
- package/dist/codegen/runtime.d.ts.map +1 -0
- package/dist/codegen/runtime.js +38 -0
- package/dist/codegen/runtime.js.map +1 -0
- package/dist/codegen/tree.d.ts +29 -0
- package/dist/codegen/tree.d.ts.map +1 -0
- package/dist/codegen/tree.js +87 -0
- package/dist/codegen/tree.js.map +1 -0
- package/dist/codegen/typescript.d.ts +6 -0
- package/dist/codegen/typescript.d.ts.map +1 -0
- package/dist/codegen/typescript.js +78 -0
- package/dist/codegen/typescript.js.map +1 -0
- package/dist/codegen/valibot.d.ts +10 -0
- package/dist/codegen/valibot.d.ts.map +1 -0
- package/dist/codegen/valibot.js +132 -0
- package/dist/codegen/valibot.js.map +1 -0
- package/dist/commands/index.d.ts +76 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +62 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/page.d.ts +80 -0
- package/dist/commands/page.d.ts.map +1 -0
- package/dist/commands/page.js +100 -0
- package/dist/commands/page.js.map +1 -0
- package/dist/completion/index.d.ts +37 -0
- package/dist/completion/index.d.ts.map +1 -0
- package/dist/completion/index.js +87 -0
- package/dist/completion/index.js.map +1 -0
- package/dist/config.d.ts +20 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +61 -0
- package/dist/config.js.map +1 -0
- package/dist/credentials.d.ts +48 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +120 -0
- package/dist/credentials.js.map +1 -0
- package/dist/deadline.d.ts +14 -0
- package/dist/deadline.d.ts.map +1 -0
- package/dist/deadline.js +88 -0
- package/dist/deadline.js.map +1 -0
- package/dist/dev/bin.d.ts +3 -0
- package/dist/dev/bin.d.ts.map +1 -0
- package/dist/dev/bin.js +8 -0
- package/dist/dev/bin.js.map +1 -0
- package/dist/dev/main.d.ts +7 -0
- package/dist/dev/main.d.ts.map +1 -0
- package/dist/dev/main.js +149 -0
- package/dist/dev/main.js.map +1 -0
- package/dist/dev/next-version.d.ts +11 -0
- package/dist/dev/next-version.d.ts.map +1 -0
- package/dist/dev/next-version.js +33 -0
- package/dist/dev/next-version.js.map +1 -0
- package/dist/dev/slow-tests.d.ts +14 -0
- package/dist/dev/slow-tests.d.ts.map +1 -0
- package/dist/dev/slow-tests.js +17 -0
- package/dist/dev/slow-tests.js.map +1 -0
- package/dist/dev/test-matrix.d.ts +35 -0
- package/dist/dev/test-matrix.d.ts.map +1 -0
- package/dist/dev/test-matrix.js +93 -0
- package/dist/dev/test-matrix.js.map +1 -0
- package/dist/errors.d.ts +34 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +36 -0
- package/dist/errors.js.map +1 -0
- package/dist/executable.d.ts +3 -0
- package/dist/executable.d.ts.map +1 -0
- package/dist/executable.js +41 -0
- package/dist/executable.js.map +1 -0
- package/dist/exit-codes.d.ts +11 -0
- package/dist/exit-codes.d.ts.map +1 -0
- package/dist/exit-codes.js +25 -0
- package/dist/exit-codes.js.map +1 -0
- package/dist/http/index.d.ts +20 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +46 -0
- package/dist/http/index.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/keyring.d.ts +27 -0
- package/dist/keyring.d.ts.map +1 -0
- package/dist/keyring.js +45 -0
- package/dist/keyring.js.map +1 -0
- package/dist/legacy-paths.d.ts +33 -0
- package/dist/legacy-paths.d.ts.map +1 -0
- package/dist/legacy-paths.js +128 -0
- package/dist/legacy-paths.js.map +1 -0
- package/dist/logger.d.ts +12 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +7 -0
- package/dist/logger.js.map +1 -0
- package/dist/logging.d.ts +31 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +58 -0
- package/dist/logging.js.map +1 -0
- package/dist/mcp/index.d.ts +32 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +113 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/output-buffer.d.ts +16 -0
- package/dist/output-buffer.d.ts.map +1 -0
- package/dist/output-buffer.js +69 -0
- package/dist/output-buffer.js.map +1 -0
- package/dist/paths.d.ts +35 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +45 -0
- package/dist/paths.js.map +1 -0
- package/dist/pretty.d.ts +12 -0
- package/dist/pretty.d.ts.map +1 -0
- package/dist/pretty.js +83 -0
- package/dist/pretty.js.map +1 -0
- package/dist/release/index.d.ts +38 -0
- package/dist/release/index.d.ts.map +1 -0
- package/dist/release/index.js +91 -0
- package/dist/release/index.js.map +1 -0
- package/dist/release/markdown.d.ts +36 -0
- package/dist/release/markdown.d.ts.map +1 -0
- package/dist/release/markdown.js +153 -0
- package/dist/release/markdown.js.map +1 -0
- package/dist/release/structure.d.ts +16 -0
- package/dist/release/structure.d.ts.map +1 -0
- package/dist/release/structure.js +74 -0
- package/dist/release/structure.js.map +1 -0
- package/dist/renderer.d.ts +34 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +55 -0
- package/dist/renderer.js.map +1 -0
- package/dist/result-fields.d.ts +4 -0
- package/dist/result-fields.d.ts.map +1 -0
- package/dist/result-fields.js +56 -0
- package/dist/result-fields.js.map +1 -0
- package/dist/retry.d.ts +27 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +26 -0
- package/dist/retry.js.map +1 -0
- package/dist/sanitize.d.ts +25 -0
- package/dist/sanitize.d.ts.map +1 -0
- package/dist/sanitize.js +52 -0
- package/dist/sanitize.js.map +1 -0
- package/dist/skill/index.d.ts +78 -0
- package/dist/skill/index.d.ts.map +1 -0
- package/dist/skill/index.js +190 -0
- package/dist/skill/index.js.map +1 -0
- package/dist/streams.d.ts +24 -0
- package/dist/streams.d.ts.map +1 -0
- package/dist/streams.js +26 -0
- package/dist/streams.js.map +1 -0
- package/dist/testing/index.d.ts +24 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +29 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/time.d.ts +21 -0
- package/dist/time.d.ts.map +1 -0
- package/dist/time.js +19 -0
- package/dist/time.js.map +1 -0
- package/dist/update/index.d.ts +76 -0
- package/dist/update/index.d.ts.map +1 -0
- package/dist/update/index.js +160 -0
- package/dist/update/index.js.map +1 -0
- package/package.json +126 -3
package/dist/deadline.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { CliError } from "./errors.js";
|
|
2
|
+
import { realSleep } from "./time.js";
|
|
3
|
+
export const createDeadline = ({ timeoutMs, signal, sleep = realSleep } = {}) => {
|
|
4
|
+
if (timeoutMs !== undefined && (!Number.isSafeInteger(timeoutMs) || timeoutMs < 0 || timeoutMs > 2147483647))
|
|
5
|
+
throw new CliError("validation_error", "timeoutMs must be an integer from zero through 2147483647");
|
|
6
|
+
const controller = new AbortController();
|
|
7
|
+
const timer = new AbortController();
|
|
8
|
+
let disposed = false;
|
|
9
|
+
const abort = (reason) => {
|
|
10
|
+
if (controller.signal.aborted)
|
|
11
|
+
return;
|
|
12
|
+
controller.abort(reason);
|
|
13
|
+
timer.abort();
|
|
14
|
+
signal?.removeEventListener("abort", onAbort);
|
|
15
|
+
};
|
|
16
|
+
const onAbort = () => abort(signal?.reason instanceof CliError ? signal.reason : new CliError("cancelled", "command cancelled"));
|
|
17
|
+
if (signal?.aborted)
|
|
18
|
+
onAbort();
|
|
19
|
+
else
|
|
20
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
21
|
+
const expire = () => abort(new CliError("timeout", "the command did not finish before its deadline", {
|
|
22
|
+
reason: "command_timeout",
|
|
23
|
+
timeoutMs,
|
|
24
|
+
retryable: false,
|
|
25
|
+
}));
|
|
26
|
+
if (timeoutMs === 0)
|
|
27
|
+
expire();
|
|
28
|
+
if (timeoutMs !== undefined && timeoutMs > 0 && !controller.signal.aborted) {
|
|
29
|
+
let waiting;
|
|
30
|
+
try {
|
|
31
|
+
waiting = sleep(timeoutMs, timer.signal, "timeout");
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
waiting = Promise.reject(new Error("deadline timer failed"));
|
|
35
|
+
}
|
|
36
|
+
void waiting.then(() => {
|
|
37
|
+
if (!disposed && !timer.signal.aborted)
|
|
38
|
+
expire();
|
|
39
|
+
}, () => {
|
|
40
|
+
if (!disposed && !timer.signal.aborted)
|
|
41
|
+
abort(new CliError("configuration_error", "command deadline timer failed"));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
signal: controller.signal,
|
|
46
|
+
async race(body) {
|
|
47
|
+
if (disposed)
|
|
48
|
+
throw new CliError("validation_error", "deadline is already disposed");
|
|
49
|
+
if (controller.signal.aborted)
|
|
50
|
+
throw controller.signal.reason;
|
|
51
|
+
let interrupt = () => { };
|
|
52
|
+
const interrupted = new Promise((_, reject) => {
|
|
53
|
+
interrupt = () => reject(controller.signal.reason);
|
|
54
|
+
controller.signal.addEventListener("abort", interrupt, { once: true });
|
|
55
|
+
});
|
|
56
|
+
const running = Promise.resolve().then(() => {
|
|
57
|
+
if (controller.signal.aborted)
|
|
58
|
+
throw controller.signal.reason;
|
|
59
|
+
return body(controller.signal);
|
|
60
|
+
});
|
|
61
|
+
try {
|
|
62
|
+
return await Promise.race([running, interrupted]);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (controller.signal.aborted) {
|
|
66
|
+
// A caller may close resources only after its operation can no longer use them.
|
|
67
|
+
let settled;
|
|
68
|
+
await running.catch((reason) => {
|
|
69
|
+
settled = reason;
|
|
70
|
+
});
|
|
71
|
+
if (settled instanceof CliError && settled.code === "outcome_unknown")
|
|
72
|
+
throw settled;
|
|
73
|
+
throw controller.signal.reason;
|
|
74
|
+
}
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
controller.signal.removeEventListener("abort", interrupt);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
dispose() {
|
|
82
|
+
disposed = true;
|
|
83
|
+
timer.abort();
|
|
84
|
+
signal?.removeEventListener("abort", onAbort);
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=deadline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deadline.js","sourceRoot":"","sources":["../src/deadline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,SAAS,EAAkB,MAAM,WAAW,CAAA;AAcrD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,GAAG,SAAS,EAAE,GAAoB,EAAE,EAAY,EAAE;IACzG,IAAI,SAAS,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,CAAC,IAAI,SAAS,GAAG,UAAU,CAAC;QAC1G,MAAM,IAAI,QAAQ,CAAC,kBAAkB,EAAE,2DAA2D,CAAC,CAAA;IACrG,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAA;IACxC,MAAM,KAAK,GAAG,IAAI,eAAe,EAAE,CAAA;IACnC,IAAI,QAAQ,GAAG,KAAK,CAAA;IACpB,MAAM,KAAK,GAAG,CAAC,MAAgB,EAAE,EAAE;QACjC,IAAI,UAAU,CAAC,MAAM,CAAC,OAAO;YAAE,OAAM;QACrC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QACxB,KAAK,CAAC,KAAK,EAAE,CAAA;QACb,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC/C,CAAC,CAAA;IACD,MAAM,OAAO,GAAG,GAAG,EAAE,CACnB,KAAK,CAAC,MAAM,EAAE,MAAM,YAAY,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC,CAAA;IAC5G,IAA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CAAA;gBAChC,CAAC;gBACD,MAAM,KAAK,CAAA;YACb,CAAC;oBAAS,CAAC;gBACT,UAAU,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;YAC3D,CAAC;QACH,CAAC;QACD,OAAO;YACL,QAAQ,GAAG,IAAI,CAAA;YACf,KAAK,CAAC,KAAK,EAAE,CAAA;YACb,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC/C,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../src/dev/bin.ts"],"names":[],"mappings":""}
|
package/dist/dev/bin.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { main } from "./main.js";
|
|
3
|
+
process.exitCode = await main(process.argv.slice(2), {
|
|
4
|
+
cwd: process.cwd(),
|
|
5
|
+
out: (text) => process.stdout.write(`${text}\n`),
|
|
6
|
+
err: (text) => process.stderr.write(`${text}\n`),
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=bin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/dev/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACnD,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;IAClB,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC;IAChD,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC;CACjD,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/dev/main.ts"],"names":[],"mappings":"AAsBA,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3B,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5B;AAqGD,eAAO,MAAM,IAAI,SAAgB,SAAS,MAAM,EAAE,MAAM,KAAK,KAAG,OAAO,CAAC,MAAM,CA0C7E,CAAA"}
|
package/dist/dev/main.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cli-dev`: the development scripts every CLI on cli-base used to carry a copy of. Each command
|
|
3
|
+
* reads and writes under `cwd` and reports through `out` and `err`; `main` returns the exit code.
|
|
4
|
+
*/
|
|
5
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { isAbsolute, join } from "node:path";
|
|
7
|
+
import { pathToFileURL } from "node:url";
|
|
8
|
+
import { parseArgs } from "node:util";
|
|
9
|
+
import { changelogProblems, docsProblems, JOURNAL_IDS, markdownFiles, structureProblems, versionScript, } from "../release/index.js";
|
|
10
|
+
import { nextVersion } from "./next-version.js";
|
|
11
|
+
import { slowTests } from "./slow-tests.js";
|
|
12
|
+
import { matrixPage, matrixRows, parseArgvLog } from "./test-matrix.js";
|
|
13
|
+
const USAGE = `usage: cli-dev <command> [options]
|
|
14
|
+
|
|
15
|
+
slow-tests [report] [count] the slowest tests and files (report: coverage/tests.json, count: 20)
|
|
16
|
+
next-version <wanted> <latest> <versions-json>
|
|
17
|
+
the version bin/release publishes, given npm's answers
|
|
18
|
+
version [--sync] [--file <path>] package.json's version against src/version.ts
|
|
19
|
+
docs-check [--rules <module>] [--ids <A,B>] [--pages]
|
|
20
|
+
links, anchors and the changelog's shape; --pages also
|
|
21
|
+
docs/ against docs/meta.json, the docs portal's structure
|
|
22
|
+
test-matrix --program <module> --untested <module> --name <cli> [--page <path>] [--check]
|
|
23
|
+
docs/dev/test-matrix.md from coverage/argv.jsonl`;
|
|
24
|
+
const load = async (cwd, path) => (await import(pathToFileURL(isAbsolute(path) ? path : join(cwd, path)).href));
|
|
25
|
+
const report = (io, problems, ok) => {
|
|
26
|
+
for (const problem of problems)
|
|
27
|
+
io.err(problem);
|
|
28
|
+
if (problems.length > 0)
|
|
29
|
+
return 1;
|
|
30
|
+
io.out(ok);
|
|
31
|
+
return 0;
|
|
32
|
+
};
|
|
33
|
+
const docsCheck = async (args, io) => {
|
|
34
|
+
const { values } = parseArgs({
|
|
35
|
+
args,
|
|
36
|
+
options: { rules: { type: "string" }, ids: { type: "string" }, pages: { type: "boolean" } },
|
|
37
|
+
});
|
|
38
|
+
const root = io.cwd;
|
|
39
|
+
let changelog;
|
|
40
|
+
let docs;
|
|
41
|
+
if (values.rules) {
|
|
42
|
+
// A module exporting the rules the release check uses too: `CHANGELOG` and `docsRules(root)`.
|
|
43
|
+
const rules = await load(root, values.rules);
|
|
44
|
+
changelog = rules.CHANGELOG;
|
|
45
|
+
docs = rules.docsRules(root);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const ids = [...JOURNAL_IDS, ...(values.ids?.split(",").filter(Boolean) ?? [])];
|
|
49
|
+
changelog = {
|
|
50
|
+
headings: ["Added", "Changed — may break callers", "Fixed", "Security", "Removed"],
|
|
51
|
+
unreleased: "Unreleased",
|
|
52
|
+
ids,
|
|
53
|
+
};
|
|
54
|
+
docs = { files: markdownFiles(root, new Set(["node_modules", "dist", "coverage", ".git", "docs_ai"])), ids };
|
|
55
|
+
}
|
|
56
|
+
return report(io, [
|
|
57
|
+
...changelogProblems(readFileSync(join(root, "CHANGELOG.md"), "utf8"), { ...changelog, release: false }),
|
|
58
|
+
...docsProblems(root, docs),
|
|
59
|
+
...(values.pages ? structureProblems(root) : []),
|
|
60
|
+
], "docs: ok");
|
|
61
|
+
};
|
|
62
|
+
const testMatrix = async (args, io) => {
|
|
63
|
+
const { values } = parseArgs({
|
|
64
|
+
args,
|
|
65
|
+
options: {
|
|
66
|
+
program: { type: "string" },
|
|
67
|
+
untested: { type: "string" },
|
|
68
|
+
name: { type: "string" },
|
|
69
|
+
page: { type: "string", default: "docs/dev/test-matrix.md" },
|
|
70
|
+
check: { type: "boolean", default: false },
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
if (!values.program || !values.untested || !values.name) {
|
|
74
|
+
io.err("test-matrix needs --program, --untested and --name");
|
|
75
|
+
return 2;
|
|
76
|
+
}
|
|
77
|
+
const log = join(io.cwd, "coverage", "argv.jsonl");
|
|
78
|
+
if (!existsSync(log)) {
|
|
79
|
+
io.err("no coverage/argv.jsonl — run the suite first (pnpm test:matrix does)");
|
|
80
|
+
return 1;
|
|
81
|
+
}
|
|
82
|
+
const program = (await load(io.cwd, values.program)).createProgram();
|
|
83
|
+
const untested = (await load(io.cwd, values.untested)).UNTESTED;
|
|
84
|
+
const { rows, stale } = matrixRows(program, parseArgvLog(readFileSync(log, "utf8")), untested);
|
|
85
|
+
writeFileSync(join(io.cwd, values.page), matrixPage(rows, values.name));
|
|
86
|
+
let failed = false;
|
|
87
|
+
if (stale.length > 0) {
|
|
88
|
+
failed = true;
|
|
89
|
+
io.err("untested entries that name nothing in the program any more:");
|
|
90
|
+
for (const entry of stale)
|
|
91
|
+
io.err(` ${entry.command}${entry.option ? ` ${entry.option}` : ""}`);
|
|
92
|
+
}
|
|
93
|
+
const missing = rows.filter((row) => row.state === "missing");
|
|
94
|
+
if (missing.length > 0 && values.check) {
|
|
95
|
+
failed = true;
|
|
96
|
+
io.err(`${missing.length} commands or options with no test and no reason — see ${values.page}:`);
|
|
97
|
+
for (const row of missing)
|
|
98
|
+
io.err(` ${row.command || "(global)"}${row.option ? ` ${row.option}` : ""}`);
|
|
99
|
+
}
|
|
100
|
+
const count = (state) => rows.filter((row) => row.state === state).length;
|
|
101
|
+
io.err(`test matrix: ${count("tested")} tested, ${count("untested")} untested with a reason, ${missing.length} missing`);
|
|
102
|
+
return failed ? 1 : 0;
|
|
103
|
+
};
|
|
104
|
+
export const main = async (argv, io) => {
|
|
105
|
+
const [command, ...args] = argv;
|
|
106
|
+
switch (command) {
|
|
107
|
+
case "slow-tests": {
|
|
108
|
+
const [file = "coverage/tests.json", count = "20"] = args;
|
|
109
|
+
const parsed = JSON.parse(readFileSync(join(io.cwd, file), "utf8"));
|
|
110
|
+
io.out(slowTests(parsed, io.cwd, Number(count)));
|
|
111
|
+
return 0;
|
|
112
|
+
}
|
|
113
|
+
case "next-version": {
|
|
114
|
+
const [wanted = "", latest = "", versions = ""] = args;
|
|
115
|
+
const found = nextVersion(wanted, latest, versions);
|
|
116
|
+
if ("error" in found) {
|
|
117
|
+
io.err(found.error);
|
|
118
|
+
return 1;
|
|
119
|
+
}
|
|
120
|
+
io.out(found.version);
|
|
121
|
+
return 0;
|
|
122
|
+
}
|
|
123
|
+
case "version": {
|
|
124
|
+
const { values } = parseArgs({
|
|
125
|
+
args,
|
|
126
|
+
options: { sync: { type: "boolean", default: false }, file: { type: "string", default: "src/version.ts" } },
|
|
127
|
+
});
|
|
128
|
+
const { code, message } = versionScript(io.cwd, values.sync ? ["--sync"] : [], values.file);
|
|
129
|
+
if (code === 0)
|
|
130
|
+
io.out(message);
|
|
131
|
+
else
|
|
132
|
+
io.err(message);
|
|
133
|
+
return code;
|
|
134
|
+
}
|
|
135
|
+
case "docs-check":
|
|
136
|
+
return docsCheck(args, io);
|
|
137
|
+
case "test-matrix":
|
|
138
|
+
return testMatrix(args, io);
|
|
139
|
+
case "help":
|
|
140
|
+
case "--help":
|
|
141
|
+
case "-h":
|
|
142
|
+
io.out(USAGE);
|
|
143
|
+
return 0;
|
|
144
|
+
default:
|
|
145
|
+
io.err(command ? `cli-dev: no command "${command}"\n\n${USAGE}` : USAG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D,KAAK,YAAY;YACf,OAAO,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;QAC5B,KAAK,aAAa;YAChB,OAAO,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;QAC7B,KAAK,MAAM,CAAC;QACZ,KAAK,QAAQ,CAAC;QACd,KAAK,IAAI;YACP,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;YACb,OAAO,CAAC,CAAA;QACV;YACE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,OAAO,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;YACxE,OAAO,CAAC,CAAA;IACZ,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The version `bin/release` publishes: the one in package.json when npm has not taken it and it is
|
|
3
|
+
* above npm's latest, else the next free one at the same bump level (x.y.0 → minor, x.y.z → patch).
|
|
4
|
+
* npm's answers are arguments, not calls, so CI and a test can hand it any registry state.
|
|
5
|
+
*/
|
|
6
|
+
export declare const nextVersion: (wanted: string, latest: string, versionsJson: string) => {
|
|
7
|
+
version: string;
|
|
8
|
+
} | {
|
|
9
|
+
error: string;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=next-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-version.d.ts","sourceRoot":"","sources":["../../src/dev/next-version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,WAAW,WACd,MAAM,UACN,MAAM,gBACA,MAAM,KACnB;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CA6BvC,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The version `bin/release` publishes: the one in package.json when npm has not taken it and it is
|
|
3
|
+
* above npm's latest, else the next free one at the same bump level (x.y.0 → minor, x.y.z → patch).
|
|
4
|
+
* npm's answers are arguments, not calls, so CI and a test can hand it any registry state.
|
|
5
|
+
*/
|
|
6
|
+
export const nextVersion = (wanted, latest, versionsJson) => {
|
|
7
|
+
const parse = (version) => /^(\d+)\.(\d+)\.(\d+)$/.exec(version)?.slice(1).map(Number);
|
|
8
|
+
const compare = (a, b) => (a[0] ?? 0) - (b[0] ?? 0) || (a[1] ?? 0) - (b[1] ?? 0) || (a[2] ?? 0) - (b[2] ?? 0);
|
|
9
|
+
const want = parse(wanted);
|
|
10
|
+
// A pre-release is picked by hand; bin/release still refuses it if npm has it.
|
|
11
|
+
if (!want)
|
|
12
|
+
return { version: wanted };
|
|
13
|
+
let published = [];
|
|
14
|
+
try {
|
|
15
|
+
published = [JSON.parse(versionsJson || "[]")].flat();
|
|
16
|
+
}
|
|
17
|
+
catch { }
|
|
18
|
+
const taken = new Set(published);
|
|
19
|
+
const top = parse(latest);
|
|
20
|
+
if (!top) {
|
|
21
|
+
if (taken.has(wanted))
|
|
22
|
+
return { error: `${wanted} is on npm, and npm's latest "${latest}" is not a plain x.y.z version` };
|
|
23
|
+
return { version: wanted };
|
|
24
|
+
}
|
|
25
|
+
if (!taken.has(wanted) && compare(want, top) > 0)
|
|
26
|
+
return { version: wanted };
|
|
27
|
+
const step = ([major = 0, minor = 0, patch = 0]) => want[2] === 0 ? [major, minor + 1, 0] : [major, minor, patch + 1];
|
|
28
|
+
let next = step(top);
|
|
29
|
+
while (taken.has(next.join(".")))
|
|
30
|
+
next = step(next);
|
|
31
|
+
return { version: next.join(".") };
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=next-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-version.js","sourceRoot":"","sources":["../../src/dev/next-version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,MAAc,EACd,MAAc,EACd,YAAoB,EACqB,EAAE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IAED,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;IAE5E,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAW,EAAE,EAAE,CAC3D,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;IACnE,IAAI,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAA;IACpB,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAAE,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAA;IACnD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;AACpC,CAAC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** The slowest tests and files from vitest's JSON report (`--reporter=json`), slowest first. */
|
|
2
|
+
export interface VitestReport {
|
|
3
|
+
testResults: {
|
|
4
|
+
name: string;
|
|
5
|
+
startTime: number;
|
|
6
|
+
endTime: number;
|
|
7
|
+
assertionResults: {
|
|
8
|
+
title: string;
|
|
9
|
+
duration?: number;
|
|
10
|
+
}[];
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
export declare const slowTests: (report: VitestReport, cwd: string, count: number) => string;
|
|
14
|
+
//# sourceMappingURL=slow-tests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slow-tests.d.ts","sourceRoot":"","sources":["../../src/dev/slow-tests.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,SAAS,EAAE,MAAM,CAAA;QACjB,OAAO,EAAE,MAAM,CAAA;QACf,gBAAgB,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KACzD,EAAE,CAAA;CACJ;AAED,eAAO,MAAM,SAAS,WAAY,YAAY,OAAO,MAAM,SAAS,MAAM,KAAG,MAkB5E,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const slowTests = (report, cwd, count) => {
|
|
2
|
+
const relative = (path) => path.slice(cwd.length + 1);
|
|
3
|
+
const tests = report.testResults
|
|
4
|
+
.flatMap((result) => result.assertionResults.map((test) => ({ ms: test.duration ?? 0, file: result.name, test: test.title })))
|
|
5
|
+
.sort((a, b) => b.ms - a.ms);
|
|
6
|
+
const files = report.testResults
|
|
7
|
+
.map((result) => ({ ms: result.endTime - result.startTime, file: result.name }))
|
|
8
|
+
.sort((a, b) => b.ms - a.ms);
|
|
9
|
+
const total = tests.reduce((sum, test) => sum + test.ms, 0);
|
|
10
|
+
return [
|
|
11
|
+
`${tests.length} tests, ${(total / 1000).toFixed(1)} s of test time\n\nslowest tests:`,
|
|
12
|
+
...tests.slice(0, count).map(({ ms, file, test }) => `${ms.toFixed(0).padStart(6)} ms ${relative(file)} ${test}`),
|
|
13
|
+
"\nslowest files:",
|
|
14
|
+
...files.slice(0, 10).map(({ ms, file }) => `${ms.toFixed(0).padStart(6)} ms ${relative(file)}`),
|
|
15
|
+
].join("\n");
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=slow-tests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slow-tests.js","sourceRoot":"","sources":["../../src/dev/slow-tests.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,SA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,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,QAAQ,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QACnH,kBAAkB;QAClB,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;KAClG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACd,CAAC,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The test matrix page: every command and option of a commander program, and what exercises it — an
|
|
3
|
+
* offline test that drove it (one `{ command, options }` JSON line per parsed run, written by the
|
|
4
|
+
* CLI under vitest), or a written reason it is not tested offline.
|
|
5
|
+
*/
|
|
6
|
+
/** The part of commander's `Command` read here; structural, so commander stays an optional peer. */
|
|
7
|
+
export interface ProgramNode {
|
|
8
|
+
name(): string;
|
|
9
|
+
parent: ProgramNode | null;
|
|
10
|
+
commands: readonly ProgramNode[];
|
|
11
|
+
options: readonly {
|
|
12
|
+
long?: string;
|
|
13
|
+
short?: string;
|
|
14
|
+
}[];
|
|
15
|
+
}
|
|
16
|
+
/** `command` ending in ` *` covers every subcommand under it; `""` is the program's own options. */
|
|
17
|
+
export interface Untested {
|
|
18
|
+
command: string;
|
|
19
|
+
option?: string;
|
|
20
|
+
reason: string;
|
|
21
|
+
}
|
|
22
|
+
interface Row {
|
|
23
|
+
command: string;
|
|
24
|
+
option?: string;
|
|
25
|
+
state: "tested" | "untested" | "missing";
|
|
26
|
+
note: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const parseArgvLog: (text: string) => Map<string, Set<string>>;
|
|
29
|
+
export declare const matrixRows: (program: ProgramNode, seen: Map<string, Set<string>>, untested: readonly Untested[]) => {
|
|
30
|
+
rows: Row[];
|
|
31
|
+
stale: Untested[];
|
|
32
|
+
};
|
|
33
|
+
export declare const matrixPage: (rows: readonly Row[], cli: string) => string;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=test-matrix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-matrix.d.ts","sourceRoot":"","sources":["../../src/dev/test-matrix.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,oGAAoG;AACpG,MAAM,WAAW,WAAW;IAC1B,IAAI,IAAI,MAAM,CAAA;IACd,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;IAC1B,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAA;IAChC,OAAO,EAAE,SAAS;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CACtD;AAED,oGAAoG;AACpG,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;CACf;AAED,UAAU,GAAG;IACX,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAA;IACxC,IAAI,EAAE,MAAM,CAAA;CACb;AAED,eAAO,MAAM,YAAY,SAAU,MAAM,6BAUxC,CAAA;AAcD,eAAO,MAAM,UAAU,YAAa,WAAW,QAAQ,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,YAAY,SAAS,QAAQ,EAAE;;;CAoD7G,CAAA;AAID,eAAO,MAAM,UAAU,SAAU,SAAS,GAAG,EAAE,OAAO,MAAM,WAuB3D,CAAA"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The test matrix page: every command and option of a commander program, and what exercises it — an
|
|
3
|
+
* offline test that drove it (one `{ command, options }` JSON line per parsed run, written by the
|
|
4
|
+
* CLI under vitest), or a written reason it is not tested offline.
|
|
5
|
+
*/
|
|
6
|
+
export const parseArgvLog = (text) => {
|
|
7
|
+
const seen = new Map();
|
|
8
|
+
for (const line of text.split("\n")) {
|
|
9
|
+
if (!line)
|
|
10
|
+
continue;
|
|
11
|
+
const { command, options } = JSON.parse(line);
|
|
12
|
+
const known = seen.get(command) ?? new Set();
|
|
13
|
+
for (const option of options)
|
|
14
|
+
known.add(option);
|
|
15
|
+
seen.set(command, known);
|
|
16
|
+
}
|
|
17
|
+
return seen;
|
|
18
|
+
};
|
|
19
|
+
const runnable = (command) => command._actionHandler != null;
|
|
20
|
+
const pathOf = (command) => {
|
|
21
|
+
const words = [];
|
|
22
|
+
for (let at = command; at?.parent; at = at.parent)
|
|
23
|
+
words.unshift(at.name());
|
|
24
|
+
return words.join(" ");
|
|
25
|
+
};
|
|
26
|
+
const covers = (entry, command) => entry.command === command || (entry.command.endsWith(" *") && command.startsWith(entry.command.slice(0, -1)));
|
|
27
|
+
export const matrixRows = (program, seen, untested) => {
|
|
28
|
+
const skipFor = (command, option) => untested.find((entry) => covers(entry, command) && entry.option === option);
|
|
29
|
+
const rows = [];
|
|
30
|
+
const walk = (command) => {
|
|
31
|
+
if (command.parent && runnable(command)) {
|
|
32
|
+
const path = pathOf(command);
|
|
33
|
+
const ran = seen.get(path);
|
|
34
|
+
const skip = skipFor(path);
|
|
35
|
+
rows.push(ran
|
|
36
|
+
? { command: path, state: "tested", note: "" }
|
|
37
|
+
: skip
|
|
38
|
+
? { command: path, state: "untested", note: skip.reason }
|
|
39
|
+
: { command: path, state: "missing", note: "" });
|
|
40
|
+
for (const option of command.options) {
|
|
41
|
+
const name = option.long ?? option.short ?? "";
|
|
42
|
+
if (name === "--help")
|
|
43
|
+
continue;
|
|
44
|
+
const optionSkip = skipFor(path, name) ?? (skip && !ran ? skip : undefined);
|
|
45
|
+
rows.push(ran?.has(name)
|
|
46
|
+
? { command: path, option: name, state: "tested", note: "" }
|
|
47
|
+
: optionSkip
|
|
48
|
+
? { command: path, option: name, state: "untested", note: optionSkip.reason }
|
|
49
|
+
: { command: path, option: name, state: "missing", note: "" });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
for (const child of command.commands)
|
|
53
|
+
walk(child);
|
|
54
|
+
};
|
|
55
|
+
walk(program);
|
|
56
|
+
const globalSeen = new Set([...seen.values()].flatMap((options) => [...options]));
|
|
57
|
+
for (const option of program.options) {
|
|
58
|
+
const name = option.long;
|
|
59
|
+
if (!name || name === "--help")
|
|
60
|
+
continue;
|
|
61
|
+
const skip = skipFor("", name);
|
|
62
|
+
rows.push(globalSeen.has(name)
|
|
63
|
+
? { command: "", option: name, state: "tested", note: "" }
|
|
64
|
+
: skip
|
|
65
|
+
? { command: "", option: name, state: "untested", note: skip.reason }
|
|
66
|
+
: { command: "", option: name, state: "missing", note: "" });
|
|
67
|
+
}
|
|
68
|
+
const stale = untested.filter((entry) => !rows.some((row) => row.option === entry.option && covers(entry, row.command)));
|
|
69
|
+
return { rows, stale };
|
|
70
|
+
};
|
|
71
|
+
const MARK = { tested: "✅", untested: "⛔", missing: "❌" };
|
|
72
|
+
export const matrixPage = (rows, cli) => {
|
|
73
|
+
const count = (state) => rows.filter((row) => row.state === state).length;
|
|
74
|
+
const cell = (text) => text.replace(/\|/g, "\\|");
|
|
75
|
+
return `<!-- Generated by cli-dev test-matrix from the command tree and a test run. Do not edit; \`pnpm test:matrix\`. -->
|
|
76
|
+
|
|
77
|
+
# Test matrix
|
|
78
|
+
|
|
79
|
+
Every command and option of \`${cli}\`, and whether an offline test drives it through the CLI. ✅ a test
|
|
80
|
+
ran it · ⛔ not tested offline, with the reason and where it is checked instead · ❌ nothing.
|
|
81
|
+
Measured from the test run (\`coverage/argv.jsonl\`), not searched for — see
|
|
82
|
+
[TESTING.md](TESTING.md) for how, and for the states and failures that cut across commands.
|
|
83
|
+
|
|
84
|
+
**${count("tested")} ✅ · ${count("untested")} ⛔ · ${count("missing")} ❌** — ${rows.filter((row) => !row.option).length} commands, ${rows.filter((row) => row.option).length} options.
|
|
85
|
+
|
|
86
|
+
| Command | Option | | Note |
|
|
87
|
+
|---|---|---|---|
|
|
88
|
+
${rows
|
|
89
|
+
.map((row) => `| ${row.command ? `\`${row.command}\`` : "*global*"} | ${row.option ? `\`${row.option}\`` : ""} | ${MARK[row.state]} | ${cell(row.note)} |`)
|
|
90
|
+
.join("\n")}
|
|
91
|
+
`;
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=test-matrix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-matrix.js","sourceRoot":"","sources":["../../src/dev/test-matrix.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwBH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,EAAE;IAC3C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAuB,CAAA;IAC3C,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,IAAI,CAAC,IAAI;YAAE,SAAQ;QACnB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAA2C,CAAA;QACvF,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,GAAG,EAAU,CAAA;QACpD,KAAK,MAAM,MAAM,IAAI,OAAO;YAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QAC/C,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAC1B,CAAC;IACD,OAAO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AC,KAAK,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAC/I;SACA,IAAI,CAAC,IAAI,CAAC;CACZ,CAAA;AACD,CAAC,CAAA"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every failure a CLI built on this package, and anything consuming its output, can see. The list
|
|
3
|
+
* is closed on purpose: an agent branches on `code`, and a new code is a contract change.
|
|
4
|
+
*
|
|
5
|
+
* "provider" is whatever the CLI talks to — an HTTP API, a socket, a messenger. The word is
|
|
6
|
+
* deliberately not "server": a provider that answered with a refusal is not the same as one that
|
|
7
|
+
* never answered.
|
|
8
|
+
*/
|
|
9
|
+
export declare const errorCodes: readonly ["validation_error", "configuration_error", "authentication_error", "permission_error", "not_found", "confirmation_required", "rate_limited", "timeout", "network_error", "provider_error", "provider_unavailable", "invalid_response", "outcome_unknown", "cancelled"];
|
|
10
|
+
export type ErrorCode = (typeof errorCodes)[number];
|
|
11
|
+
/**
|
|
12
|
+
* Anything a caller may attach. Everything is optional because these are diagnostics, not a
|
|
13
|
+
* contract — the contract is `code`.
|
|
14
|
+
*
|
|
15
|
+
* `retryable` says whether **this** failure could be retried, not whether the operation is safe to
|
|
16
|
+
* retry. Those are different questions and conflating them is how a duplicate write happens.
|
|
17
|
+
*/
|
|
18
|
+
export interface CliErrorDetails {
|
|
19
|
+
readonly status?: number;
|
|
20
|
+
readonly retryable?: boolean;
|
|
21
|
+
readonly attempts?: number;
|
|
22
|
+
readonly requestId?: string;
|
|
23
|
+
readonly runId?: string;
|
|
24
|
+
readonly retryAfterMs?: number;
|
|
25
|
+
readonly operation?: string;
|
|
26
|
+
readonly [key: string]: unknown;
|
|
27
|
+
}
|
|
28
|
+
export declare class CliError extends Error {
|
|
29
|
+
readonly code: ErrorCode;
|
|
30
|
+
readonly details: CliErrorDetails;
|
|
31
|
+
constructor(code: ErrorCode, message: string, details?: CliErrorDetails);
|
|
32
|
+
}
|
|
33
|
+
export declare const isCliError: (value: unknown) => value is CliError;
|
|
34
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,YACrB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,uBAAuB,EACvB,cAAc,EACd,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,CACH,CAAA;AAEV,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;AAEnD;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAChC;AAED,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;IAEjC,YAAY,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,EAK1E;CACF;AAED,eAAO,MAAM,UAAU,UAAW,OAAO,KAAG,KAAK,IAAI,QAAqC,CAAA"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every failure a CLI built on this package, and anything consuming its output, can see. The list
|
|
3
|
+
* is closed on purpose: an agent branches on `code`, and a new code is a contract change.
|
|
4
|
+
*
|
|
5
|
+
* "provider" is whatever the CLI talks to — an HTTP API, a socket, a messenger. The word is
|
|
6
|
+
* deliberately not "server": a provider that answered with a refusal is not the same as one that
|
|
7
|
+
* never answered.
|
|
8
|
+
*/
|
|
9
|
+
export const errorCodes = [
|
|
10
|
+
"validation_error",
|
|
11
|
+
"configuration_error",
|
|
12
|
+
"authentication_error",
|
|
13
|
+
"permission_error",
|
|
14
|
+
"not_found",
|
|
15
|
+
"confirmation_required",
|
|
16
|
+
"rate_limited",
|
|
17
|
+
"timeout",
|
|
18
|
+
"network_error",
|
|
19
|
+
"provider_error",
|
|
20
|
+
"provider_unavailable",
|
|
21
|
+
"invalid_response",
|
|
22
|
+
"outcome_unknown",
|
|
23
|
+
"cancelled",
|
|
24
|
+
];
|
|
25
|
+
export class CliError extends Error {
|
|
26
|
+
code;
|
|
27
|
+
details;
|
|
28
|
+
constructor(code, message, details = {}) {
|
|
29
|
+
super(message);
|
|
30
|
+
this.name = "CliError";
|
|
31
|
+
this.code = code;
|
|
32
|
+
this.details = details;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export const isCliError = (value) => value instanceof CliError;
|
|
36
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,kBAAkB;IAClB,qBAAqB;IACrB,sBAAsB;IACtB,kBAAkB;IAClB,WAAW;IACX,uBAAuB;IACvB,cAAc;IACd,SAAS;IACT,eAAe;IACf,gBAAgB;IAChB,sBAAsB;IACtB,kBAAkB;IAClB,iBAAiB;IACjB,WAAW;CACH,CAAA;AAsBV,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,IAAI,CAAW;IACf,OAAO,CAAiB;IAEjC,YAAY,IAAe,EAAE,OAAe,EAAE,OAAO,GAAoB,EAAE;QACzE,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,UAAU,CAAA;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAc,EAAqB,EAAE,CAAC,KAAK,YAAY,QAAQ,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const executableOnPath: (command: string, env: NodeJS.ProcessEnv, platform?: NodeJS.Platform, exists?: (path: string) => boolean) => string;
|
|
2
|
+
export declare const executableEnvironment: (env: NodeJS.ProcessEnv, platform?: NodeJS.Platform) => NodeJS.ProcessEnv;
|
|
3
|
+
//# sourceMappingURL=executable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executable.d.ts","sourceRoot":"","sources":["../src/executable.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,YAClB,MAAM,OACV,MAAM,CAAC,UAAU,aACZ,MAAM,CAAC,QAAQ,WACjB,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,KAChC,MAcF,CAAA;AAED,eAAO,MAAM,qBAAqB,QAC3B,MAAM,CAAC,UAAU,aACZ,MAAM,CAAC,QAAQ,KACxB,MAAM,CAAC,UAcT,CAAA"}
|