@cnc-tools/storm 0.16.0 → 0.17.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/dist/application.d.ts +22 -13
- package/dist/application.js +21 -10
- package/dist/bin/run.d.ts +18 -0
- package/dist/bin/run.js +31 -0
- package/dist/bin/storm.js +42 -26
- package/dist/build-info.js +1 -1
- package/dist/chunks/{chunk-5CCP36QQ.js → chunk-2RNDPDTJ.js} +2 -2
- package/dist/chunks/chunk-2VP4GRJM.js +1219 -0
- package/dist/chunks/{chunk-P357TZAY.js → chunk-4O5C2XGJ.js} +18 -15
- package/dist/chunks/{chunk-VL7WFTVQ.js → chunk-4WAMTUWZ.js} +419 -340
- package/dist/chunks/{chunk-OIY3DMF2.js → chunk-6UHIJXZG.js} +3 -3
- package/dist/chunks/{chunk-CN4EFA5J.js → chunk-72ZFEMAW.js} +1 -1
- package/dist/chunks/{chunk-CK2GZEPK.js → chunk-7DZE67QM.js} +2 -2
- package/dist/chunks/{chunk-VUPZH7J2.js → chunk-BCBKYOHW.js} +1 -1
- package/dist/chunks/{chunk-2MAD5NKK.js → chunk-CKGZA25H.js} +1 -18
- package/dist/chunks/{chunk-ZG3WQ4UF.js → chunk-D27KILIA.js} +1 -1
- package/dist/chunks/{chunk-V4IKA3WI.js → chunk-DADEYJDW.js} +24 -17
- package/dist/chunks/{chunk-R7XVBZOY.js → chunk-EEENLQHE.js} +59 -11
- package/dist/chunks/chunk-F4MOYHRY.js +198 -0
- package/dist/chunks/{chunk-HVNK3I45.js → chunk-FNBB6V4R.js} +1 -1
- package/dist/chunks/{chunk-G3PHMXH5.js → chunk-GRT3UIBV.js} +18 -1
- package/dist/chunks/chunk-HP3CURSZ.js +88 -0
- package/dist/chunks/{chunk-DWEAHX4T.js → chunk-HWIQ2S7K.js} +5 -5
- package/dist/chunks/chunk-JN3YY6ZH.js +2166 -0
- package/dist/chunks/{chunk-TJNFVNKR.js → chunk-LKTZ5OXS.js} +1 -1
- package/dist/chunks/{chunk-3L52KNQA.js → chunk-M7EKRGVD.js} +8 -8
- package/dist/chunks/chunk-MR77L2GK.js +340 -0
- package/dist/chunks/{chunk-DC2CDHNK.js → chunk-RNAS7JHE.js} +1438 -445
- package/dist/chunks/{chunk-FCQUJDA4.js → chunk-RWIXDDCK.js} +4 -189
- package/dist/chunks/{chunk-5VXBKPW6.js → chunk-WV3DP6NR.js} +1 -1
- package/dist/chunks/{chunk-AWBSONHB.js → chunk-XBDRVFEV.js} +55 -16
- package/dist/chunks/{chunk-FOZWA52V.js → chunk-YEPFSLQR.js} +480 -375
- package/dist/chunks/{live-app-WECQOQ4C.js → live-app-R76JQXZL.js} +15 -13
- package/dist/commands/exec/across-sandboxes-outcomes.d.ts +1 -1
- package/dist/commands/exec/across-sandboxes-outcomes.js +2 -2
- package/dist/commands/exec/before-run.d.ts +123 -0
- package/dist/commands/exec/before-run.js +105 -0
- package/dist/commands/exec/command.d.ts +31 -2
- package/dist/commands/exec/command.js +31 -95
- package/dist/commands/exec/driver-plan.d.ts +9 -4
- package/dist/commands/exec/driver-plan.js +8 -8
- package/dist/commands/exec/exec-words.js +1 -1
- package/dist/commands/exec/execute-run.d.ts +39 -0
- package/dist/commands/exec/execute-run.js +325 -0
- package/dist/commands/exec/live-view.d.ts +3 -3
- package/dist/commands/exec/live-view.js +16 -15
- package/dist/commands/exec/metadata.js +1 -1
- package/dist/commands/exec/mint-failed.d.ts +38 -0
- package/dist/commands/exec/mint-failed.js +27 -4
- package/dist/commands/exec/outcomes.d.ts +34 -8
- package/dist/commands/exec/outcomes.js +30 -23
- package/dist/commands/exec/plan-run.d.ts +58 -150
- package/dist/commands/exec/plan-run.js +232 -88
- package/dist/commands/exec/progress.d.ts +10 -6
- package/dist/commands/exec/progress.js +38 -25
- package/dist/commands/exec/run-bin.d.ts +11 -11
- package/dist/commands/exec/run-bin.js +9 -9
- package/dist/commands/exec/run-flags.d.ts +69 -0
- package/dist/commands/exec/run-flags.js +58 -0
- package/dist/commands/exec/run-metadata.js +4 -4
- package/dist/commands/exec/run-summary.d.ts +58 -0
- package/dist/commands/exec/run-summary.js +205 -0
- package/dist/commands/exec/runner-refusals.d.ts +82 -0
- package/dist/commands/exec/runner-refusals.js +71 -0
- package/dist/commands/exec/sandbox-progress.js +3 -0
- package/dist/commands/exec/stopped-outcome.d.ts +12 -0
- package/dist/commands/exec/stopped-outcome.js +77 -0
- package/dist/commands/exec/view.d.ts +20 -11
- package/dist/commands/exec/view.js +103 -47
- package/dist/commands/runs/facts.d.ts +7 -3
- package/dist/commands/runs/facts.js +17 -8
- package/dist/commands/runs/list/command.d.ts +14 -6
- package/dist/commands/runs/list/command.js +10 -10
- package/dist/commands/runs/list/outcomes.d.ts +7 -3
- package/dist/commands/runs/logs/command.js +10 -10
- package/dist/commands/runs/show/command.d.ts +14 -6
- package/dist/commands/runs/show/command.js +30 -28
- package/dist/commands/runs/show/outcomes.d.ts +7 -3
- package/dist/commands/runs/show/outcomes.js +7 -5
- package/dist/commands/snapshots/access.d.ts +111 -0
- package/dist/commands/snapshots/access.js +96 -0
- package/dist/commands/snapshots/build/command.d.ts +360 -93
- package/dist/commands/snapshots/build/command.js +446 -150
- package/dist/commands/snapshots/build/metadata.d.ts +10 -0
- package/dist/commands/snapshots/build/metadata.js +31 -11
- package/dist/commands/snapshots/build/outcomes.d.ts +234 -43
- package/dist/commands/snapshots/build/outcomes.js +200 -36
- package/dist/commands/snapshots/list/command.d.ts +366 -25
- package/dist/commands/snapshots/list/command.js +296 -66
- package/dist/commands/snapshots/list/metadata.d.ts +16 -0
- package/dist/commands/snapshots/list/metadata.js +29 -6
- package/dist/commands/snapshots/list/outcomes.d.ts +245 -13
- package/dist/commands/snapshots/list/outcomes.js +221 -50
- package/dist/commands/snapshots/metadata.js +1 -1
- package/dist/commands/snapshots/prune/command.d.ts +430 -0
- package/dist/commands/snapshots/prune/command.js +161 -0
- package/dist/commands/snapshots/prune/metadata.d.ts +28 -0
- package/dist/commands/snapshots/prune/metadata.js +39 -0
- package/dist/commands/snapshots/prune/outcomes.d.ts +208 -0
- package/dist/commands/snapshots/prune/outcomes.js +78 -0
- package/dist/commands/suites/list/command.js +17 -17
- package/dist/commands/suites/list/outcomes.js +2 -2
- package/dist/commands/test/command.d.ts +31 -2
- package/dist/commands/test/command.js +49 -252
- package/dist/commands/test/outcomes.d.ts +15 -1
- package/dist/config/check-runner.d.ts +3 -3
- package/dist/config/check-runner.js +8 -7
- package/dist/config/credential-resolver.d.ts +50 -5
- package/dist/config/credential-resolver.js +51 -19
- package/dist/config/credential-settle.d.ts +6 -2
- package/dist/config/credential-settle.js +11 -5
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +1 -1
- package/dist/config/runner.d.ts +5 -5
- package/dist/config/runner.js +1 -1
- package/dist/config/schema.d.ts +2 -2
- package/dist/config/schema.js +1 -1
- package/dist/config-file/define.d.ts +1 -1
- package/dist/config-file/define.js +1 -1
- package/dist/config-file/runner.d.ts +5 -5
- package/dist/config-file/toolchain.d.ts +1 -1
- package/dist/config-file/toolchain.js +2 -2
- package/dist/context.d.ts +8 -6
- package/dist/context.js +7 -6
- package/dist/core/across-sandboxes.d.ts +7 -6
- package/dist/core/across-sandboxes.js +123 -152
- package/dist/core/coordinator.d.ts +166 -0
- package/dist/core/coordinator.js +233 -0
- package/dist/core/events.d.ts +2 -2
- package/dist/core/index.d.ts +4 -2
- package/dist/core/index.js +1 -1
- package/dist/core/outcomes.d.ts +148 -0
- package/dist/core/{sandbox-end.js → outcomes.js} +28 -4
- package/dist/core/resources.d.ts +31 -53
- package/dist/core/resources.js +32 -70
- package/dist/core/run-state.d.ts +7 -1
- package/dist/core/run-state.js +2 -0
- package/dist/core/run.d.ts +32 -236
- package/dist/core/run.js +106 -266
- package/dist/core/state-directory.d.ts +1 -1
- package/dist/core/state-directory.js +2 -2
- package/dist/credential/gateways.d.ts +15 -1
- package/dist/credential/index.d.ts +4 -3
- package/dist/credential/index.js +3 -2
- package/dist/credential/live/vercel-cli-gateway.d.ts +1 -1
- package/dist/credential/live/vercel-cli-gateway.js +1 -1
- package/dist/credential/live/vercel-oidc-token-gateway.d.ts +11 -0
- package/dist/credential/live/vercel-oidc-token-gateway.js +16 -0
- package/dist/credential/source.d.ts +73 -6
- package/dist/credential/source.js +55 -2
- package/dist/extension-commands.d.ts +6 -1
- package/dist/extension-commands.js +15 -1
- package/dist/extensions/testserver/commands/pool/create/command.d.ts +35 -2
- package/dist/extensions/testserver/commands/pool/create/command.js +7 -7
- package/dist/extensions/testserver/commands/pool/create/metadata.js +5 -5
- package/dist/extensions/testserver/commands/pool/create/outcomes.d.ts +17 -1
- package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
- package/dist/extensions/testserver/credential-facts.d.ts +6 -2
- package/dist/extensions/testserver/credential-facts.js +29 -11
- package/dist/extensions/testserver/lifecycle.js +7 -1
- package/dist/extensions/testserver/limit.d.ts +3 -0
- package/dist/extensions/testserver/limit.js +3 -0
- package/dist/extensions/testserver/provision.d.ts +8 -1
- package/dist/extensions/testserver/provision.js +8 -3
- package/dist/extensions/testserver/refusals.d.ts +6 -1
- package/dist/extensions/testserver/refusals.js +16 -1
- package/dist/extensions/testserver/resource.d.ts +1 -1
- package/dist/extensions/testserver/resource.js +1 -1
- package/dist/extensions/testserver/result.d.ts +1 -1
- package/dist/extensions/testserver/result.js +9 -4
- package/dist/planning/driver-file-lists.d.ts +0 -15
- package/dist/planning/driver-file-lists.js +2 -21
- package/dist/planning/plan-only.d.ts +3 -14
- package/dist/planning/plan-only.js +11 -20
- package/dist/planning/run-kind-flags.js +2 -2
- package/dist/planning/run-plan.d.ts +45 -12
- package/dist/planning/run-plan.js +4 -3
- package/dist/planning/suites.d.ts +1 -1
- package/dist/planning/suites.js +2 -2
- package/dist/planning/test-plan.d.ts +9 -0
- package/dist/planning/test-plan.js +9 -0
- package/dist/run-directory/recording.js +2 -2
- package/dist/run-directory/run-record.d.ts +21 -6
- package/dist/run-directory/run-record.js +12 -9
- package/dist/runner/base.js +1 -1
- package/dist/runner/build-snapshots.d.ts +55 -29
- package/dist/runner/build-snapshots.js +130 -29
- package/dist/runner/context.d.ts +15 -7
- package/dist/runner/context.js +19 -6
- package/dist/runner/events.d.ts +16 -10
- package/dist/runner/gateways.d.ts +87 -21
- package/dist/runner/gateways.js +1 -1
- package/dist/runner/index.d.ts +11 -7
- package/dist/runner/index.js +9 -4
- package/dist/runner/live/sandbox-errors.d.ts +2 -0
- package/dist/runner/live/sandbox-errors.js +4 -0
- package/dist/runner/live/sandbox-gateway.js +129 -3
- package/dist/runner/live/snapshot-index-gateway.d.ts +12 -0
- package/dist/runner/live/{snapshot-cache-gateway.js → snapshot-index-gateway.js} +11 -11
- package/dist/runner/live/snapshot-records.js +6 -7
- package/dist/runner/local-snapshot-index.d.ts +199 -0
- package/dist/runner/local-snapshot-index.js +211 -0
- package/dist/runner/network-policy.d.ts +6 -6
- package/dist/runner/network-policy.js +7 -7
- package/dist/runner/policy-writes.d.ts +1 -1
- package/dist/runner/policy-writes.js +1 -1
- package/dist/runner/prepare.d.ts +14 -14
- package/dist/runner/prepare.js +20 -11
- package/dist/runner/ready.d.ts +18 -10
- package/dist/runner/ready.js +104 -33
- package/dist/runner/sandboxed-command.d.ts +3 -3
- package/dist/runner/sandboxed-command.js +3 -3
- package/dist/runner/scope.d.ts +10 -6
- package/dist/runner/scope.js +10 -3
- package/dist/runner/secrets.d.ts +13 -13
- package/dist/runner/secrets.js +18 -15
- package/dist/runner/session.d.ts +8 -8
- package/dist/runner/session.js +3 -3
- package/dist/runner/shared-snapshot-entry.d.ts +92 -0
- package/dist/runner/shared-snapshot-entry.js +168 -0
- package/dist/runner/shared-snapshot-list.d.ts +81 -0
- package/dist/runner/shared-snapshot-list.js +155 -0
- package/dist/runner/shared-snapshot-lookup.d.ts +51 -0
- package/dist/runner/shared-snapshot-lookup.js +118 -0
- package/dist/runner/shared-snapshot-prune.d.ts +58 -0
- package/dist/runner/shared-snapshot-prune.js +133 -0
- package/dist/runner/snapshot-build.d.ts +42 -14
- package/dist/runner/snapshot-build.js +32 -29
- package/dist/runner/snapshot-choice.js +1 -1
- package/dist/runner/snapshot-inspect.d.ts +39 -40
- package/dist/runner/snapshot-inspect.js +55 -35
- package/dist/runner/snapshot-key.d.ts +13 -12
- package/dist/runner/snapshot-key.js +13 -12
- package/dist/runner/steps.d.ts +1 -1
- package/dist/runner/steps.js +1 -1
- package/dist/runner/{recipe-check.d.ts → vercel-sandbox-check.d.ts} +2 -2
- package/dist/runner/{recipe-check.js → vercel-sandbox-check.js} +3 -2
- package/dist/runner/{recipe.d.ts → vercel-sandbox-options.d.ts} +24 -23
- package/dist/runner/{recipe.js → vercel-sandbox-options.js} +70 -69
- package/dist/runner/{recipe-secrets.d.ts → vercel-sandbox-secrets.d.ts} +6 -6
- package/dist/runner/{recipe-secrets.js → vercel-sandbox-secrets.js} +20 -20
- package/dist/sdk/extension/commands.d.ts +8 -3
- package/dist/sdk/extension/commands.js +3 -1
- package/dist/sdk/extension/credential-diagnosis.d.ts +3 -1
- package/dist/sdk/extension/credential-diagnosis.js +25 -5
- package/dist/sdk/extension/credential-source.d.ts +20 -3
- package/dist/sdk/extension/credential-source.js +4 -4
- package/dist/sdk/extension/index.d.ts +3 -2
- package/dist/sdk/extension/index.js +2 -1
- package/dist/sdk/extension/resource-definition.d.ts +1 -1
- package/dist/sdk/extension/secret-source.d.ts +1 -1
- package/dist/sdk/extension/secret-source.js +1 -1
- package/dist/sdk/extension/vercel-oidc-facts.d.ts +20 -0
- package/dist/sdk/extension/vercel-oidc-facts.js +20 -0
- package/dist/shared/cleanup.d.ts +3 -3
- package/dist/shared/cleanup.js +15 -5
- package/dist/shared/snapshot-text.d.ts +4 -4
- package/dist/shared/snapshot-text.js +11 -11
- package/dist/time/duration.js +1 -1
- package/package.json +3 -2
- package/skills/overview.md +4 -4
- package/skills/plan-runs.md +1 -1
- package/skills/read-run-output.md +6 -6
- package/dist/chunks/chunk-7EENF73W.js +0 -782
- package/dist/chunks/chunk-Z5PBVG3Y.js +0 -2599
- package/dist/commands/exec/across-sandboxes-run.d.ts +0 -180
- package/dist/commands/exec/across-sandboxes-run.js +0 -339
- package/dist/commands/exec/plan-only.d.ts +0 -10
- package/dist/commands/exec/plan-only.js +0 -45
- package/dist/commands/exec/run-command.d.ts +0 -475
- package/dist/commands/exec/run-command.js +0 -603
- package/dist/commands/exec/run-planned.d.ts +0 -20
- package/dist/commands/exec/run-planned.js +0 -22
- package/dist/commands/exec/sandbox-view.d.ts +0 -19
- package/dist/commands/exec/sandbox-view.js +0 -72
- package/dist/commands/test/plan.d.ts +0 -92
- package/dist/commands/test/plan.js +0 -125
- package/dist/core/sandbox-end.d.ts +0 -64
- package/dist/runner/live/snapshot-cache-gateway.d.ts +0 -12
- package/dist/runner/snapshot-cache.d.ts +0 -148
- package/dist/runner/snapshot-cache.js +0 -126
|
@@ -1,14 +1,214 @@
|
|
|
1
|
-
// ../../../libs/clinkr/ts/dist/outcomes/
|
|
1
|
+
// ../../../libs/clinkr/ts/dist/outcomes/names.js
|
|
2
|
+
var CAMEL_CASE = /^[a-z][a-zA-Z0-9]*$/u;
|
|
3
|
+
var SNAKE_CASE = /^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$/u;
|
|
4
|
+
function isSnakeCase(name) {
|
|
5
|
+
return typeof name === "string" && SNAKE_CASE.test(name);
|
|
6
|
+
}
|
|
7
|
+
function snakeCase(key) {
|
|
8
|
+
return key.replace(/[A-Z]/gu, (letter) => `_${letter.toLowerCase()}`);
|
|
9
|
+
}
|
|
10
|
+
var CLINKR_REASON_KEYS = ["invalidArguments", "internalError", "canceled", "confirmationRequired"];
|
|
11
|
+
function checkKeys(subject, keys, reserved) {
|
|
12
|
+
for (const key of keys) {
|
|
13
|
+
if (!CAMEL_CASE.test(key))
|
|
14
|
+
throw new TypeError(`${subject} key ${JSON.stringify(key)} is not camelCase`);
|
|
15
|
+
if (reserved.includes(key))
|
|
16
|
+
throw new TypeError(`${subject} key ${JSON.stringify(key)} is reserved`);
|
|
17
|
+
if (CLINKR_REASON_KEYS.includes(key))
|
|
18
|
+
throw new TypeError(`${subject} key ${JSON.stringify(key)} is reserved: ${snakeCase(key)} is Clinkr's own reason`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ../../../libs/clinkr/ts/dist/outcomes/schema-code.js
|
|
2
23
|
import { z } from "zod";
|
|
3
|
-
var
|
|
4
|
-
z.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
24
|
+
var RULE = [
|
|
25
|
+
"Command schemas check only shape: types, built-in checks such as min(1) and formats such as z.email(), defaults,",
|
|
26
|
+
"enums, positionals, and overwrite normalizers such as trim().",
|
|
27
|
+
"Move the logic out of the schema: refuse a request that makes no sense in the command's validate, and have the",
|
|
28
|
+
"handler build outcome values that already have their final shape."
|
|
29
|
+
].join(" ");
|
|
30
|
+
function isSchema(value) {
|
|
31
|
+
if (typeof value !== "object" || value === null || !("_zod" in value))
|
|
32
|
+
return false;
|
|
33
|
+
const { def } = value._zod;
|
|
34
|
+
return typeof def === "object" && typeof def.type === "string";
|
|
35
|
+
}
|
|
36
|
+
function codeIn(def) {
|
|
37
|
+
if (def["type"] === "custom")
|
|
38
|
+
return "z.custom or z.instanceof";
|
|
39
|
+
if (def["type"] === "catch")
|
|
40
|
+
return "a catch (.catch)";
|
|
41
|
+
if (def["type"] === "transform")
|
|
42
|
+
return "a transform (.transform or z.preprocess)";
|
|
43
|
+
if (def["type"] !== "pipe")
|
|
44
|
+
return void 0;
|
|
45
|
+
if ("transform" in def)
|
|
46
|
+
return "a codec (z.codec or z.stringbool)";
|
|
47
|
+
const ends = [def["in"], def["out"]];
|
|
48
|
+
return ends.some((end) => isSchema(end) && end._zod.def.type === "transform") ? void 0 : "a pipe (.pipe)";
|
|
49
|
+
}
|
|
50
|
+
function children(schema) {
|
|
51
|
+
const def = schema._zod.def;
|
|
52
|
+
if (def["type"] === "lazy")
|
|
53
|
+
return [["", def["getter"]()]];
|
|
54
|
+
const keys = Object.keys(def).filter((key) => key !== "checks" && key !== "defaultValue");
|
|
55
|
+
return keys.flatMap((key) => {
|
|
56
|
+
const value = def[key];
|
|
57
|
+
if (isSchema(value))
|
|
58
|
+
return [[key === "element" ? "[]" : "", value]];
|
|
59
|
+
if (Array.isArray(value))
|
|
60
|
+
return value.filter(isSchema).map((item) => ["", item]);
|
|
61
|
+
if (typeof value === "object" && value !== null)
|
|
62
|
+
return Object.entries(value).flatMap(([field, item]) => isSchema(item) ? [[`.${field}`, item]] : []);
|
|
63
|
+
return [];
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function schemaCodeProblems(label, schema, ancestors = /* @__PURE__ */ new Set()) {
|
|
67
|
+
if (ancestors.has(schema))
|
|
68
|
+
return [];
|
|
69
|
+
const def = schema._zod.def;
|
|
70
|
+
const checks = schema._zod.def.checks ?? [];
|
|
71
|
+
const customFormat = schema instanceof z.ZodCustomStringFormat || checks.some((check) => check instanceof z.ZodCustomStringFormat);
|
|
72
|
+
const found = [
|
|
73
|
+
...checks.some((check) => check._zod.def.check === "custom") ? ["a refinement (.refine, .superRefine, or .check)"] : [],
|
|
74
|
+
...customFormat ? ["a custom string format (z.stringFormat)"] : [],
|
|
75
|
+
...[codeIn(def)].filter((what) => what !== void 0)
|
|
76
|
+
].map((what) => `${label} uses ${what}`);
|
|
77
|
+
const inside = /* @__PURE__ */ new Set([...ancestors, schema]);
|
|
78
|
+
return [
|
|
79
|
+
...found,
|
|
80
|
+
...children(schema).flatMap(([segment, child]) => schemaCodeProblems(`${label}${segment}`, child, inside))
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
function inputSchemaCoercion(schema, path = "", ancestors = /* @__PURE__ */ new Set()) {
|
|
84
|
+
if (ancestors.has(schema))
|
|
85
|
+
return void 0;
|
|
86
|
+
const def = schema._zod.def;
|
|
87
|
+
const type = def["type"];
|
|
88
|
+
if (def["coerce"] === true && (type === "string" || type === "number" || type === "boolean"))
|
|
89
|
+
return { path, type };
|
|
90
|
+
const inside = /* @__PURE__ */ new Set([...ancestors, schema]);
|
|
91
|
+
const inputChildren = type === "pipe" && isSchema(def["in"]) ? [["", def["in"]]] : children(schema);
|
|
92
|
+
for (const [segment, child] of inputChildren) {
|
|
93
|
+
const found = inputSchemaCoercion(child, `${path}${segment}`, inside);
|
|
94
|
+
if (found !== void 0)
|
|
95
|
+
return found;
|
|
96
|
+
}
|
|
97
|
+
return void 0;
|
|
98
|
+
}
|
|
99
|
+
function assertNoSchemaCode(problems) {
|
|
100
|
+
const found = [...new Set(problems)];
|
|
101
|
+
if (found.length > 0)
|
|
102
|
+
throw new TypeError(`${found.join("; ")}. ${RULE}`);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// ../../../libs/clinkr/ts/dist/outcomes/values.js
|
|
106
|
+
import { z as z2 } from "zod";
|
|
107
|
+
var OutcomeValueError = class extends Error {
|
|
108
|
+
constructor(name, cause) {
|
|
109
|
+
super(`Outcome ${name} value does not match its schema:
|
|
110
|
+
${z2.prettifyError(cause)}`, { cause });
|
|
111
|
+
this.name = "OutcomeValueError";
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
function parseOutcomeValue(name, schema, value) {
|
|
115
|
+
const parsed = schema.safeParse(value);
|
|
116
|
+
if (!parsed.success)
|
|
117
|
+
throw new OutcomeValueError(name, parsed.error);
|
|
118
|
+
return parsed.data;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// ../../../libs/clinkr/ts/dist/outcomes/errors.js
|
|
122
|
+
function checkDescription(subject, description) {
|
|
123
|
+
if (description === void 0)
|
|
124
|
+
return;
|
|
125
|
+
if (typeof description !== "string" || description.trim() === "" || description.includes("\n"))
|
|
126
|
+
throw new TypeError(`${subject} description must be one non-empty line`);
|
|
127
|
+
}
|
|
128
|
+
function isObjectSchema(value) {
|
|
129
|
+
if (typeof value !== "object" || value === null || !("_zod" in value))
|
|
130
|
+
return false;
|
|
131
|
+
const { def } = value._zod;
|
|
132
|
+
return typeof def === "object" && def.type === "object";
|
|
133
|
+
}
|
|
134
|
+
function declareError(reason, value) {
|
|
135
|
+
if (typeof value !== "object" || value === null)
|
|
136
|
+
throw new TypeError(`Error ${reason} is not an error definition`);
|
|
137
|
+
const { exitCode, status, description, schema, render } = value;
|
|
138
|
+
if (exitCode !== 1 && exitCode !== 2)
|
|
139
|
+
throw new TypeError(`Error ${reason} exit code must be 1 or 2`);
|
|
140
|
+
if (status !== void 0 && status !== "action_required" && status !== "error")
|
|
141
|
+
throw new TypeError(`Error ${reason} status must be action_required or error`);
|
|
142
|
+
checkDescription(`Error ${reason}`, description);
|
|
143
|
+
if (schema !== void 0 && !isObjectSchema(schema))
|
|
144
|
+
throw new TypeError(`Error ${reason} schema must be an object schema`);
|
|
145
|
+
if (render === void 0) {
|
|
146
|
+
if (schema !== void 0)
|
|
147
|
+
throw new TypeError(`Error ${reason} has a schema, so it needs a render function`);
|
|
148
|
+
if (description === void 0)
|
|
149
|
+
throw new TypeError(`Error ${reason} needs a render function, or a description to show as its message`);
|
|
150
|
+
} else if (typeof render !== "function")
|
|
151
|
+
throw new TypeError(`Error ${reason} needs a render function`);
|
|
152
|
+
return Object.freeze({
|
|
153
|
+
exitCode,
|
|
154
|
+
...status === void 0 ? {} : { status },
|
|
155
|
+
...description === void 0 ? {} : { description },
|
|
156
|
+
...schema === void 0 ? {} : { schema },
|
|
157
|
+
render: render === void 0 ? () => ({ message: description }) : render
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function buildError(reason, definition, facts) {
|
|
161
|
+
const { schema, status } = definition;
|
|
162
|
+
const data = schema === void 0 ? void 0 : parseOutcomeValue(reason, schema, facts[0]);
|
|
163
|
+
const render = definition.render;
|
|
164
|
+
const { message, next, rows } = data === void 0 ? render(...facts) : render(data, ...facts.slice(1));
|
|
165
|
+
const content = {
|
|
166
|
+
message,
|
|
167
|
+
...next === void 0 ? {} : { next },
|
|
168
|
+
...status === void 0 ? {} : { status },
|
|
169
|
+
// Only an error with a schema shows rows, and they come from its data.
|
|
170
|
+
...data === void 0 ? {} : { ...rows === void 0 ? {} : { rows }, data }
|
|
171
|
+
};
|
|
172
|
+
return { kind: "error", reason, exitCode: definition.exitCode, content };
|
|
173
|
+
}
|
|
174
|
+
function defineErrors(definitions) {
|
|
175
|
+
const keys = Object.keys(definitions);
|
|
176
|
+
checkKeys("Error", keys, []);
|
|
177
|
+
const named = keys.map((key) => {
|
|
178
|
+
const reason = snakeCase(key);
|
|
179
|
+
const definition = declareError(reason, definitions[key]);
|
|
180
|
+
const { schema } = definition;
|
|
181
|
+
if (schema !== void 0)
|
|
182
|
+
assertNoSchemaCode(schemaCodeProblems(`${reason} error data`, schema));
|
|
183
|
+
const build = (...facts) => buildError(reason, definition, facts);
|
|
184
|
+
return [key, Object.freeze(Object.assign(build, { reason, definition }))];
|
|
185
|
+
});
|
|
186
|
+
return Object.freeze(Object.fromEntries(named));
|
|
187
|
+
}
|
|
188
|
+
function isSharedError(value) {
|
|
189
|
+
if (typeof value !== "function")
|
|
190
|
+
return false;
|
|
191
|
+
const { reason, definition } = value;
|
|
192
|
+
if (typeof reason !== "string" || typeof definition !== "object" || definition === null)
|
|
193
|
+
return false;
|
|
194
|
+
const { exitCode } = definition;
|
|
195
|
+
return exitCode === 1 || exitCode === 2;
|
|
196
|
+
}
|
|
197
|
+
function isCommandError(value) {
|
|
198
|
+
return typeof value === "object" && value !== null && value.kind === "error";
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// ../../../libs/clinkr/ts/dist/outcomes/steps.js
|
|
202
|
+
import { z as z3 } from "zod";
|
|
203
|
+
var stepDocumentSchema = z3.discriminatedUnion("type", [
|
|
204
|
+
z3.object({
|
|
205
|
+
type: z3.enum(["command", "external"]),
|
|
206
|
+
command: z3.string(),
|
|
207
|
+
argv: z3.array(z3.string()),
|
|
208
|
+
when: z3.string().optional()
|
|
9
209
|
}),
|
|
10
|
-
|
|
11
|
-
|
|
210
|
+
z3.object({ type: z3.literal("url"), url: z3.string() }),
|
|
211
|
+
z3.object({ type: z3.literal("text"), text: z3.string() })
|
|
12
212
|
]);
|
|
13
213
|
var SHELL_SAFE = /^[A-Za-z0-9_@%+=:,./-]+$/u;
|
|
14
214
|
function commandLine(argv) {
|
|
@@ -137,261 +337,61 @@ function formatSteps(steps) {
|
|
|
137
337
|
}
|
|
138
338
|
return lines;
|
|
139
339
|
}
|
|
140
|
-
function formatTable(table, options) {
|
|
141
|
-
const lines = [table.columns, ...table.rows];
|
|
142
|
-
if (!options.padded)
|
|
143
|
-
return lines.map((row) => row.map(cellText).join(" ")).join("\n");
|
|
144
|
-
const widths = table.columns.map((column, index) => Math.max(column.length, ...table.rows.map((row) => cellText(row[index] ?? "").length)));
|
|
145
|
-
return lines.map((row) => {
|
|
146
|
-
const cells = row.map((cell, index) => {
|
|
147
|
-
const drawn = drawnCell(cell, options.links);
|
|
148
|
-
return index === row.length - 1 ? drawn : drawn + " ".repeat(widths[index] + 2 - cellText(cell).length);
|
|
149
|
-
});
|
|
150
|
-
return ` ${cells.join("")}`;
|
|
151
|
-
}).join("\n");
|
|
152
|
-
}
|
|
153
|
-
function cellText(cell) {
|
|
154
|
-
return typeof cell === "string" ? cell : cell.text;
|
|
155
|
-
}
|
|
156
|
-
function hasControlCharacter(text) {
|
|
157
|
-
for (const char of text) {
|
|
158
|
-
const code2 = char.codePointAt(0) ?? 0;
|
|
159
|
-
if (code2 < 32 || code2 >= 127 && code2 <= 159)
|
|
160
|
-
return true;
|
|
161
|
-
}
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
function drawnCell(cell, links) {
|
|
165
|
-
if (typeof cell === "string")
|
|
166
|
-
return cell;
|
|
167
|
-
if (!links || hasControlCharacter(cell.url))
|
|
168
|
-
return cell.text;
|
|
169
|
-
return `\x1B]8;;${cell.url}\x1B\\${cell.text}\x1B]8;;\x1B\\`;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// ../../../libs/clinkr/ts/dist/outcomes/rendered.js
|
|
173
|
-
function createOutcomeRenderer() {
|
|
174
|
-
return (content) => Object.freeze({
|
|
175
|
-
content,
|
|
176
|
-
draw: (terminal) => {
|
|
177
|
-
const { stdout, stderr } = presentContent(content, {
|
|
178
|
-
stdoutTerminal: terminal.stdout.tty,
|
|
179
|
-
doneOnStdout: false,
|
|
180
|
-
stdoutLinks: takesLinks(terminal.stdout),
|
|
181
|
-
stderrLinks: takesLinks(terminal.stderr)
|
|
182
|
-
});
|
|
183
|
-
return stdout === "" ? { report: stderr } : { report: stderr, answer: stdout };
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
function takesLinks(stream) {
|
|
188
|
-
return stream.tty && stream.color !== "none";
|
|
189
|
-
}
|
|
190
|
-
var renderOutcome = createOutcomeRenderer();
|
|
191
|
-
var plainUi = Object.freeze({
|
|
192
|
-
error: (view) => [presentError(view), view.usage, view.stack].filter((block) => block !== void 0).join("\n\n"),
|
|
193
|
-
canceled: presentCanceled
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
// ../../../libs/clinkr/ts/dist/outcomes/names.js
|
|
197
|
-
var CAMEL_CASE = /^[a-z][a-zA-Z0-9]*$/u;
|
|
198
|
-
var SNAKE_CASE = /^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$/u;
|
|
199
|
-
function isSnakeCase(name) {
|
|
200
|
-
return typeof name === "string" && SNAKE_CASE.test(name);
|
|
201
|
-
}
|
|
202
|
-
function snakeCase(key) {
|
|
203
|
-
return key.replace(/[A-Z]/gu, (letter) => `_${letter.toLowerCase()}`);
|
|
204
|
-
}
|
|
205
|
-
var CLINKR_REASON_KEYS = ["invalidArguments", "internalError", "canceled", "confirmationRequired"];
|
|
206
|
-
function checkKeys(subject, keys, reserved) {
|
|
207
|
-
for (const key of keys) {
|
|
208
|
-
if (!CAMEL_CASE.test(key))
|
|
209
|
-
throw new TypeError(`${subject} key ${JSON.stringify(key)} is not camelCase`);
|
|
210
|
-
if (reserved.includes(key))
|
|
211
|
-
throw new TypeError(`${subject} key ${JSON.stringify(key)} is reserved`);
|
|
212
|
-
if (CLINKR_REASON_KEYS.includes(key))
|
|
213
|
-
throw new TypeError(`${subject} key ${JSON.stringify(key)} is reserved: ${snakeCase(key)} is Clinkr's own reason`);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// ../../../libs/clinkr/ts/dist/outcomes/schema-code.js
|
|
218
|
-
import { z as z2 } from "zod";
|
|
219
|
-
var RULE = [
|
|
220
|
-
"Command schemas check only shape: types, built-in checks such as min(1) and formats such as z.email(), defaults,",
|
|
221
|
-
"enums, positionals, and overwrite normalizers such as trim().",
|
|
222
|
-
"Move the logic out of the schema: refuse a request that makes no sense in the command's validate, and have the",
|
|
223
|
-
"handler build outcome values that already have their final shape."
|
|
224
|
-
].join(" ");
|
|
225
|
-
function isSchema(value) {
|
|
226
|
-
if (typeof value !== "object" || value === null || !("_zod" in value))
|
|
227
|
-
return false;
|
|
228
|
-
const { def } = value._zod;
|
|
229
|
-
return typeof def === "object" && typeof def.type === "string";
|
|
230
|
-
}
|
|
231
|
-
function codeIn(def) {
|
|
232
|
-
if (def["type"] === "custom")
|
|
233
|
-
return "z.custom or z.instanceof";
|
|
234
|
-
if (def["type"] === "catch")
|
|
235
|
-
return "a catch (.catch)";
|
|
236
|
-
if (def["type"] === "transform")
|
|
237
|
-
return "a transform (.transform or z.preprocess)";
|
|
238
|
-
if (def["type"] !== "pipe")
|
|
239
|
-
return void 0;
|
|
240
|
-
if ("transform" in def)
|
|
241
|
-
return "a codec (z.codec or z.stringbool)";
|
|
242
|
-
const ends = [def["in"], def["out"]];
|
|
243
|
-
return ends.some((end) => isSchema(end) && end._zod.def.type === "transform") ? void 0 : "a pipe (.pipe)";
|
|
244
|
-
}
|
|
245
|
-
function children(schema) {
|
|
246
|
-
const def = schema._zod.def;
|
|
247
|
-
if (def["type"] === "lazy")
|
|
248
|
-
return [["", def["getter"]()]];
|
|
249
|
-
const keys = Object.keys(def).filter((key) => key !== "checks" && key !== "defaultValue");
|
|
250
|
-
return keys.flatMap((key) => {
|
|
251
|
-
const value = def[key];
|
|
252
|
-
if (isSchema(value))
|
|
253
|
-
return [[key === "element" ? "[]" : "", value]];
|
|
254
|
-
if (Array.isArray(value))
|
|
255
|
-
return value.filter(isSchema).map((item) => ["", item]);
|
|
256
|
-
if (typeof value === "object" && value !== null)
|
|
257
|
-
return Object.entries(value).flatMap(([field, item]) => isSchema(item) ? [[`.${field}`, item]] : []);
|
|
258
|
-
return [];
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
function schemaCodeProblems(label, schema, ancestors = /* @__PURE__ */ new Set()) {
|
|
262
|
-
if (ancestors.has(schema))
|
|
263
|
-
return [];
|
|
264
|
-
const def = schema._zod.def;
|
|
265
|
-
const checks = schema._zod.def.checks ?? [];
|
|
266
|
-
const customFormat = schema instanceof z2.ZodCustomStringFormat || checks.some((check) => check instanceof z2.ZodCustomStringFormat);
|
|
267
|
-
const found = [
|
|
268
|
-
...checks.some((check) => check._zod.def.check === "custom") ? ["a refinement (.refine, .superRefine, or .check)"] : [],
|
|
269
|
-
...customFormat ? ["a custom string format (z.stringFormat)"] : [],
|
|
270
|
-
...[codeIn(def)].filter((what) => what !== void 0)
|
|
271
|
-
].map((what) => `${label} uses ${what}`);
|
|
272
|
-
const inside = /* @__PURE__ */ new Set([...ancestors, schema]);
|
|
273
|
-
return [
|
|
274
|
-
...found,
|
|
275
|
-
...children(schema).flatMap(([segment, child]) => schemaCodeProblems(`${label}${segment}`, child, inside))
|
|
276
|
-
];
|
|
277
|
-
}
|
|
278
|
-
function inputSchemaCoercion(schema, path = "", ancestors = /* @__PURE__ */ new Set()) {
|
|
279
|
-
if (ancestors.has(schema))
|
|
280
|
-
return void 0;
|
|
281
|
-
const def = schema._zod.def;
|
|
282
|
-
const type = def["type"];
|
|
283
|
-
if (def["coerce"] === true && (type === "string" || type === "number" || type === "boolean"))
|
|
284
|
-
return { path, type };
|
|
285
|
-
const inside = /* @__PURE__ */ new Set([...ancestors, schema]);
|
|
286
|
-
const inputChildren = type === "pipe" && isSchema(def["in"]) ? [["", def["in"]]] : children(schema);
|
|
287
|
-
for (const [segment, child] of inputChildren) {
|
|
288
|
-
const found = inputSchemaCoercion(child, `${path}${segment}`, inside);
|
|
289
|
-
if (found !== void 0)
|
|
290
|
-
return found;
|
|
291
|
-
}
|
|
292
|
-
return void 0;
|
|
293
|
-
}
|
|
294
|
-
function assertNoSchemaCode(problems) {
|
|
295
|
-
const found = [...new Set(problems)];
|
|
296
|
-
if (found.length > 0)
|
|
297
|
-
throw new TypeError(`${found.join("; ")}. ${RULE}`);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
// ../../../libs/clinkr/ts/dist/outcomes/values.js
|
|
301
|
-
import { z as z3 } from "zod";
|
|
302
|
-
var OutcomeValueError = class extends Error {
|
|
303
|
-
constructor(name, cause) {
|
|
304
|
-
super(`Outcome ${name} value does not match its schema:
|
|
305
|
-
${z3.prettifyError(cause)}`, { cause });
|
|
306
|
-
this.name = "OutcomeValueError";
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
function parseOutcomeValue(name, schema, value) {
|
|
310
|
-
const parsed = schema.safeParse(value);
|
|
311
|
-
if (!parsed.success)
|
|
312
|
-
throw new OutcomeValueError(name, parsed.error);
|
|
313
|
-
return parsed.data;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// ../../../libs/clinkr/ts/dist/outcomes/errors.js
|
|
317
|
-
function checkDescription(subject, description) {
|
|
318
|
-
if (description === void 0)
|
|
319
|
-
return;
|
|
320
|
-
if (typeof description !== "string" || description.trim() === "" || description.includes("\n"))
|
|
321
|
-
throw new TypeError(`${subject} description must be one non-empty line`);
|
|
340
|
+
function formatTable(table, options) {
|
|
341
|
+
const lines = [table.columns, ...table.rows];
|
|
342
|
+
if (!options.padded)
|
|
343
|
+
return lines.map((row) => row.map(cellText).join(" ")).join("\n");
|
|
344
|
+
const widths = table.columns.map((column, index) => Math.max(column.length, ...table.rows.map((row) => cellText(row[index] ?? "").length)));
|
|
345
|
+
return lines.map((row) => {
|
|
346
|
+
const cells = row.map((cell, index) => {
|
|
347
|
+
const drawn = drawnCell(cell, options.links);
|
|
348
|
+
return index === row.length - 1 ? drawn : drawn + " ".repeat(widths[index] + 2 - cellText(cell).length);
|
|
349
|
+
});
|
|
350
|
+
return ` ${cells.join("")}`;
|
|
351
|
+
}).join("\n");
|
|
322
352
|
}
|
|
323
|
-
function
|
|
324
|
-
|
|
325
|
-
return false;
|
|
326
|
-
const { def } = value._zod;
|
|
327
|
-
return typeof def === "object" && def.type === "object";
|
|
353
|
+
function cellText(cell) {
|
|
354
|
+
return typeof cell === "string" ? cell : cell.text;
|
|
328
355
|
}
|
|
329
|
-
function
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
throw new TypeError(`Error ${reason} status must be action_required or error`);
|
|
337
|
-
checkDescription(`Error ${reason}`, description);
|
|
338
|
-
if (schema !== void 0 && !isObjectSchema(schema))
|
|
339
|
-
throw new TypeError(`Error ${reason} schema must be an object schema`);
|
|
340
|
-
if (render === void 0) {
|
|
341
|
-
if (schema !== void 0)
|
|
342
|
-
throw new TypeError(`Error ${reason} has a schema, so it needs a render function`);
|
|
343
|
-
if (description === void 0)
|
|
344
|
-
throw new TypeError(`Error ${reason} needs a render function, or a description to show as its message`);
|
|
345
|
-
} else if (typeof render !== "function")
|
|
346
|
-
throw new TypeError(`Error ${reason} needs a render function`);
|
|
347
|
-
return Object.freeze({
|
|
348
|
-
exitCode,
|
|
349
|
-
...status === void 0 ? {} : { status },
|
|
350
|
-
...description === void 0 ? {} : { description },
|
|
351
|
-
...schema === void 0 ? {} : { schema },
|
|
352
|
-
render: render === void 0 ? () => ({ message: description }) : render
|
|
353
|
-
});
|
|
356
|
+
function hasControlCharacter(text) {
|
|
357
|
+
for (const char of text) {
|
|
358
|
+
const code2 = char.codePointAt(0) ?? 0;
|
|
359
|
+
if (code2 < 32 || code2 >= 127 && code2 <= 159)
|
|
360
|
+
return true;
|
|
361
|
+
}
|
|
362
|
+
return false;
|
|
354
363
|
}
|
|
355
|
-
function
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
message,
|
|
362
|
-
...next === void 0 ? {} : { next },
|
|
363
|
-
...status === void 0 ? {} : { status },
|
|
364
|
-
// Only an error with a schema shows rows, and they come from its data.
|
|
365
|
-
...data === void 0 ? {} : { ...rows === void 0 ? {} : { rows }, data }
|
|
366
|
-
};
|
|
367
|
-
return { kind: "error", reason, exitCode: definition.exitCode, content };
|
|
364
|
+
function drawnCell(cell, links) {
|
|
365
|
+
if (typeof cell === "string")
|
|
366
|
+
return cell;
|
|
367
|
+
if (!links || hasControlCharacter(cell.url))
|
|
368
|
+
return cell.text;
|
|
369
|
+
return `\x1B]8;;${cell.url}\x1B\\${cell.text}\x1B]8;;\x1B\\`;
|
|
368
370
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
371
|
+
|
|
372
|
+
// ../../../libs/clinkr/ts/dist/outcomes/rendered.js
|
|
373
|
+
function createOutcomeRenderer() {
|
|
374
|
+
return (content) => Object.freeze({
|
|
375
|
+
content,
|
|
376
|
+
draw: (terminal) => {
|
|
377
|
+
const { stdout, stderr } = presentContent(content, {
|
|
378
|
+
stdoutTerminal: terminal.stdout.tty,
|
|
379
|
+
doneOnStdout: false,
|
|
380
|
+
stdoutLinks: takesLinks(terminal.stdout),
|
|
381
|
+
stderrLinks: takesLinks(terminal.stderr)
|
|
382
|
+
});
|
|
383
|
+
return stdout === "" ? { report: stderr } : { report: stderr, answer: stdout };
|
|
384
|
+
}
|
|
380
385
|
});
|
|
381
|
-
return Object.freeze(Object.fromEntries(named));
|
|
382
|
-
}
|
|
383
|
-
function isSharedError(value) {
|
|
384
|
-
if (typeof value !== "function")
|
|
385
|
-
return false;
|
|
386
|
-
const { reason, definition } = value;
|
|
387
|
-
if (typeof reason !== "string" || typeof definition !== "object" || definition === null)
|
|
388
|
-
return false;
|
|
389
|
-
const { exitCode } = definition;
|
|
390
|
-
return exitCode === 1 || exitCode === 2;
|
|
391
386
|
}
|
|
392
|
-
function
|
|
393
|
-
return
|
|
387
|
+
function takesLinks(stream) {
|
|
388
|
+
return stream.tty && stream.color !== "none";
|
|
394
389
|
}
|
|
390
|
+
var renderOutcome = createOutcomeRenderer();
|
|
391
|
+
var plainUi = Object.freeze({
|
|
392
|
+
error: (view) => [presentError(view), view.usage, view.stack].filter((block) => block !== void 0).join("\n\n"),
|
|
393
|
+
canceled: presentCanceled
|
|
394
|
+
});
|
|
395
395
|
|
|
396
396
|
// ../../../libs/clinkr/ts/dist/outcomes/outcomes.js
|
|
397
397
|
import { z as z5 } from "zod";
|
|
@@ -716,58 +716,6 @@ function checkContent(name, content) {
|
|
|
716
716
|
return content;
|
|
717
717
|
}
|
|
718
718
|
|
|
719
|
-
// ../../../libs/clinkr/ts/dist/terminal.js
|
|
720
|
-
var PIPE = Object.freeze({ tty: false, columns: void 0, color: "none" });
|
|
721
|
-
function createTerminal(facts = {}) {
|
|
722
|
-
return Object.freeze({
|
|
723
|
-
interactive: facts.interactive ?? false,
|
|
724
|
-
unicode: facts.unicode ?? true,
|
|
725
|
-
stdout: Object.freeze({ ...PIPE, ...facts.stdout }),
|
|
726
|
-
stderr: Object.freeze({ ...PIPE, ...facts.stderr })
|
|
727
|
-
});
|
|
728
|
-
}
|
|
729
|
-
function withoutColor(terminal) {
|
|
730
|
-
return Object.freeze({
|
|
731
|
-
...terminal,
|
|
732
|
-
stdout: Object.freeze({ ...terminal.stdout, color: "none" }),
|
|
733
|
-
stderr: Object.freeze({ ...terminal.stderr, color: "none" })
|
|
734
|
-
});
|
|
735
|
-
}
|
|
736
|
-
function scriptReadsStdout(terminal) {
|
|
737
|
-
return !terminal.stdout.tty || !terminal.interactive;
|
|
738
|
-
}
|
|
739
|
-
function resolveColorDepth(facts) {
|
|
740
|
-
const { env } = facts;
|
|
741
|
-
const noColor = env["NO_COLOR"];
|
|
742
|
-
if (noColor !== void 0 && noColor !== "")
|
|
743
|
-
return "none";
|
|
744
|
-
const forced = env["FORCE_COLOR"];
|
|
745
|
-
if (forced !== void 0 && forced !== "") {
|
|
746
|
-
if (forced === "0" || forced === "false")
|
|
747
|
-
return "none";
|
|
748
|
-
if (forced === "2")
|
|
749
|
-
return "ansi256";
|
|
750
|
-
if (forced === "3")
|
|
751
|
-
return "truecolor";
|
|
752
|
-
return "ansi16";
|
|
753
|
-
}
|
|
754
|
-
const term = env["TERM"];
|
|
755
|
-
if (!facts.tty || term === "dumb")
|
|
756
|
-
return "none";
|
|
757
|
-
const colorterm = env["COLORTERM"];
|
|
758
|
-
if (colorterm === "truecolor" || colorterm === "24bit")
|
|
759
|
-
return "truecolor";
|
|
760
|
-
if (term !== void 0 && term.includes("256color"))
|
|
761
|
-
return "ansi256";
|
|
762
|
-
return "ansi16";
|
|
763
|
-
}
|
|
764
|
-
function resolveUnicode(env) {
|
|
765
|
-
const locale = [env["LC_ALL"], env["LC_CTYPE"], env["LANG"]].find((value) => value !== void 0 && value !== "");
|
|
766
|
-
if (locale === void 0)
|
|
767
|
-
return true;
|
|
768
|
-
return /utf-?8/iu.test(locale);
|
|
769
|
-
}
|
|
770
|
-
|
|
771
719
|
// ../../../libs/clinkr/ts/dist/command-tree.js
|
|
772
720
|
import { isAbsolute } from "node:path";
|
|
773
721
|
|
|
@@ -1584,6 +1532,11 @@ function commandTree(tree) {
|
|
|
1584
1532
|
if (typeof directory !== "string" || !isAbsolute(directory))
|
|
1585
1533
|
throw new Error(`Command tree ${tag.id}: directory takes an absolute path`);
|
|
1586
1534
|
return Object.freeze({ kind: "directory", tree: tag.id, directory });
|
|
1535
|
+
},
|
|
1536
|
+
manifest: (commands) => {
|
|
1537
|
+
if (typeof commands !== "object" || commands === null || Array.isArray(commands))
|
|
1538
|
+
throw new TypeError(`Command tree ${tag.id}: manifest takes a record of names to manifest entries`);
|
|
1539
|
+
return Object.freeze({ kind: "manifest", tree: tag.id, commands: Object.freeze({ ...commands }) });
|
|
1587
1540
|
}
|
|
1588
1541
|
});
|
|
1589
1542
|
}
|
|
@@ -1607,11 +1560,11 @@ function isTreeGroup(value) {
|
|
|
1607
1560
|
const { kind, tree, navigation } = value;
|
|
1608
1561
|
if (typeof tree !== "string")
|
|
1609
1562
|
return false;
|
|
1610
|
-
return kind === "directory" || kind === "inline-group" && typeof navigation === "object" && navigation !== null;
|
|
1563
|
+
return kind === "directory" || kind === "manifest" || kind === "inline-group" && typeof navigation === "object" && navigation !== null;
|
|
1611
1564
|
}
|
|
1612
1565
|
function mount(group, options) {
|
|
1613
1566
|
if (!isTreeGroup(group))
|
|
1614
|
-
throw new TypeError("mount takes a group from a command tree's group or
|
|
1567
|
+
throw new TypeError("mount takes a group from a command tree's group, directory, or manifest");
|
|
1615
1568
|
return Object.freeze({ ...options, group });
|
|
1616
1569
|
}
|
|
1617
1570
|
|
|
@@ -1668,7 +1621,11 @@ var SourceDiscoveryError = class extends Error {
|
|
|
1668
1621
|
}
|
|
1669
1622
|
};
|
|
1670
1623
|
function discoverGroup(group, scope, prefix = []) {
|
|
1671
|
-
|
|
1624
|
+
if (group.kind === "directory")
|
|
1625
|
+
return discoverChildren(scope, prefix, group.directory);
|
|
1626
|
+
if (group.kind === "manifest")
|
|
1627
|
+
return manifestChildren(scope, group.commands, prefix);
|
|
1628
|
+
return inlineChildren(scope, group, prefix);
|
|
1672
1629
|
}
|
|
1673
1630
|
async function atLocation(source, location, read) {
|
|
1674
1631
|
try {
|
|
@@ -1687,11 +1644,11 @@ function checkedSiblings(scope, prefix, read) {
|
|
|
1687
1644
|
return Object.freeze(nodes);
|
|
1688
1645
|
});
|
|
1689
1646
|
}
|
|
1690
|
-
function checkNode(scope, { name, metadata,
|
|
1647
|
+
function checkNode(scope, { name, metadata, metadataLabel }, leaf) {
|
|
1691
1648
|
const undeclared2 = undeclaredSection(metadata.helpSection, scope.declaredSections);
|
|
1692
1649
|
if (undeclared2 !== void 0)
|
|
1693
|
-
throw new Error(`${undeclared2}${
|
|
1694
|
-
const at =
|
|
1650
|
+
throw new Error(`${undeclared2}${metadataLabel === void 0 ? "" : ` in ${metadataLabel}`}`);
|
|
1651
|
+
const at = metadataLabel === void 0 ? "" : ` (${metadataLabel})`;
|
|
1695
1652
|
if (leaf) {
|
|
1696
1653
|
if (metadata.default === true && metadata.hidden === true)
|
|
1697
1654
|
throw new Error(`Command ${name} cannot be both default and hidden${at}`);
|
|
@@ -1727,14 +1684,23 @@ async function groupNode(scope, found, children2) {
|
|
|
1727
1684
|
function inlineChildren(scope, group, prefix) {
|
|
1728
1685
|
return checkedSiblings(scope, prefix, () => Promise.all(Object.keys(group.commands).toSorted(compareCodeUnits).map((name) => inlineNode(scope, name, group.commands[name], prefix))));
|
|
1729
1686
|
}
|
|
1687
|
+
function checkCommandName(name) {
|
|
1688
|
+
if (!isCommandNameSegment(name))
|
|
1689
|
+
throw new Error(`Invalid command name ${JSON.stringify(name)}: names are nonempty, without whitespace, control characters, or separators, and are not . or .. or begin with -`);
|
|
1690
|
+
}
|
|
1691
|
+
function parseCommandMetadata(value, where) {
|
|
1692
|
+
const result = commandMetadataSchema.safeParse(value);
|
|
1693
|
+
if (!result.success)
|
|
1694
|
+
throw new Error(`Invalid metadata ${where}: ${navigationIssues(result.error, "metadata")}`);
|
|
1695
|
+
return Object.freeze(result.data);
|
|
1696
|
+
}
|
|
1730
1697
|
function inlineNode(scope, name, member, prefix) {
|
|
1731
1698
|
const location = [...prefix, name];
|
|
1732
1699
|
return atLocation(scope.source, location, async () => {
|
|
1733
|
-
|
|
1734
|
-
throw new Error(`Invalid command name ${JSON.stringify(name)}: names are nonempty, without whitespace, control characters, or separators, and are not . or .. or begin with -`);
|
|
1700
|
+
checkCommandName(name);
|
|
1735
1701
|
const value = member;
|
|
1736
|
-
if (isTreeGroup(value) && value.kind === "directory")
|
|
1737
|
-
throw new Error("A group's commands hold commands and inline groups; mount a directory group with mount");
|
|
1702
|
+
if (isTreeGroup(value) && (value.kind === "directory" || value.kind === "manifest"))
|
|
1703
|
+
throw new Error("A group's commands hold commands and inline groups; mount a directory or manifest group with mount");
|
|
1738
1704
|
if (isTreeGroup(member)) {
|
|
1739
1705
|
const group = member;
|
|
1740
1706
|
return groupNode(scope, inlineFound(name, member.navigation, location), () => inlineChildren(scope, group, location));
|
|
@@ -1751,6 +1717,50 @@ function inlineFound(name, navigation, location) {
|
|
|
1751
1717
|
throw new Error("A group's commands and nested groups each need a description in their definition");
|
|
1752
1718
|
return { name, metadata: Object.freeze({ ...navigation, description }), where: location.join(" ") };
|
|
1753
1719
|
}
|
|
1720
|
+
function manifestChildren(scope, commands, prefix) {
|
|
1721
|
+
return checkedSiblings(scope, prefix, () => Promise.all(Object.keys(commands).toSorted(compareCodeUnits).map((name) => manifestNode(scope, name, commands[name], prefix))));
|
|
1722
|
+
}
|
|
1723
|
+
function manifestNode(scope, name, entry, prefix) {
|
|
1724
|
+
const location = [...prefix, name];
|
|
1725
|
+
const label = location.join("/");
|
|
1726
|
+
return atLocation(scope.source, location, async () => {
|
|
1727
|
+
checkCommandName(name);
|
|
1728
|
+
if (typeof entry !== "object" || entry === null)
|
|
1729
|
+
throw new Error(`Invalid manifest entry for ${label}: expected { metadata, load } or { metadata, commands }`);
|
|
1730
|
+
const candidate = entry;
|
|
1731
|
+
const metadata = parseCommandMetadata(candidate.metadata, `for ${label}`);
|
|
1732
|
+
const hasLoad = candidate.load !== void 0;
|
|
1733
|
+
const hasCommands = candidate.commands !== void 0;
|
|
1734
|
+
if (hasLoad && hasCommands)
|
|
1735
|
+
throw new Error(`Manifest entry ${label} cannot declare both load and commands; set one of them`);
|
|
1736
|
+
if (!hasLoad && !hasCommands)
|
|
1737
|
+
throw new Error(`Manifest entry ${label} must declare either load (leaf) or commands (group)`);
|
|
1738
|
+
const metadataLabel = `manifest entry ${label} metadata`;
|
|
1739
|
+
const found = { name, metadata, metadataLabel, where: location.join(" ") };
|
|
1740
|
+
if (hasLoad) {
|
|
1741
|
+
if (typeof candidate.load !== "function")
|
|
1742
|
+
throw new Error(`Manifest entry ${label}: load must be a function returning the command module`);
|
|
1743
|
+
const load = candidate.load;
|
|
1744
|
+
const treeId = scope.source.id;
|
|
1745
|
+
const commandLabel = `manifest entry ${label} command`;
|
|
1746
|
+
return leafNode(scope, found, location, async () => {
|
|
1747
|
+
const module = await load();
|
|
1748
|
+
return commandOfModule({
|
|
1749
|
+
treeId,
|
|
1750
|
+
metadata,
|
|
1751
|
+
exported: module?.default,
|
|
1752
|
+
metadataLabel,
|
|
1753
|
+
metadataName: "metadata",
|
|
1754
|
+
commandLabel
|
|
1755
|
+
});
|
|
1756
|
+
});
|
|
1757
|
+
}
|
|
1758
|
+
if (typeof candidate.commands !== "object" || candidate.commands === null || Array.isArray(candidate.commands))
|
|
1759
|
+
throw new Error(`Manifest entry ${label}: commands must be a record of names to manifest entries`);
|
|
1760
|
+
const children2 = candidate.commands;
|
|
1761
|
+
return groupNode(scope, found, () => manifestChildren(scope, children2, location));
|
|
1762
|
+
});
|
|
1763
|
+
}
|
|
1754
1764
|
async function discoverChildren(scope, prefix, directory) {
|
|
1755
1765
|
return checkedSiblings(scope, prefix, async () => {
|
|
1756
1766
|
const entries = await readdir(directory, { withFileTypes: true });
|
|
@@ -1766,7 +1776,7 @@ function discoverNode(scope, name, prefix, parentDirectory) {
|
|
|
1766
1776
|
if (metadataPath === void 0)
|
|
1767
1777
|
throw new Error(`Missing metadata.ts or metadata.js for command node: ${directory}`);
|
|
1768
1778
|
const metadata = await loadMetadata(metadataPath);
|
|
1769
|
-
const found = { name, metadata, metadataPath, where: directory };
|
|
1779
|
+
const found = { name, metadata, metadataLabel: metadataPath, where: directory };
|
|
1770
1780
|
const entries = await readdir(directory, { withFileTypes: true });
|
|
1771
1781
|
const hasChildDirectories = entries.some((entry) => entry.isDirectory());
|
|
1772
1782
|
const commandModule = await findModule(directory, "command");
|
|
@@ -1806,36 +1816,40 @@ function checkDefaultConflicts(nodes, prefix) {
|
|
|
1806
1816
|
}
|
|
1807
1817
|
async function loadMetadata(path) {
|
|
1808
1818
|
const module = await import(pathToFileURL(path).href);
|
|
1809
|
-
|
|
1810
|
-
if (!result.success)
|
|
1811
|
-
throw new Error(`Invalid metadata export in ${path}: ${navigationIssues(result.error, "metadata")}`);
|
|
1812
|
-
return Object.freeze(result.data);
|
|
1819
|
+
return parseCommandMetadata(module.metadata, `export in ${path}`);
|
|
1813
1820
|
}
|
|
1814
1821
|
async function importCommand(treeId, directory, metadata, metadataPath, modulePath) {
|
|
1815
1822
|
const module = await import(pathToFileURL(modulePath).href);
|
|
1816
|
-
return commandOfModule({
|
|
1823
|
+
return commandOfModule({
|
|
1824
|
+
treeId,
|
|
1825
|
+
directory,
|
|
1826
|
+
metadata,
|
|
1827
|
+
metadataLabel: metadataPath,
|
|
1828
|
+
commandLabel: modulePath,
|
|
1829
|
+
exported: module.default
|
|
1830
|
+
});
|
|
1817
1831
|
}
|
|
1818
1832
|
function commandOfModule(module) {
|
|
1819
|
-
const { treeId, metadata, exported,
|
|
1833
|
+
const { treeId, metadata, exported, metadataLabel, metadataName, commandLabel, directory } = module;
|
|
1820
1834
|
if (!isOutcomeCommandDefinition(exported))
|
|
1821
|
-
throw new Error(`Invalid command export in ${
|
|
1835
|
+
throw new Error(`Invalid command export in ${commandLabel}: export default ${treeId}.define({ \u2026 })`);
|
|
1822
1836
|
const tag = treeTagOf(exported);
|
|
1823
1837
|
if (tag === void 0)
|
|
1824
|
-
throw new Error(`Invalid command export in ${
|
|
1838
|
+
throw new Error(`Invalid command export in ${commandLabel}: define it with command tree ${treeId}'s define`);
|
|
1825
1839
|
if (tag.id !== treeId)
|
|
1826
|
-
throw new Error(`Invalid command export in ${
|
|
1840
|
+
throw new Error(`Invalid command export in ${commandLabel}: it belongs to command tree ${tag.id}, not to command tree ${treeId}${directory === void 0 ? "" : ` (${directory})`}`);
|
|
1827
1841
|
const own = typeof exported.navigation === "object" && exported.navigation !== null ? Object.keys(exported.navigation) : [];
|
|
1828
1842
|
if (own.length > 0)
|
|
1829
|
-
throw new Error(`Invalid command export in ${
|
|
1843
|
+
throw new Error(`Invalid command export in ${commandLabel}: navigation parts go in ${metadataName ?? basename(metadataLabel)}, not ${own.join(", ")}`);
|
|
1830
1844
|
let checked;
|
|
1831
1845
|
try {
|
|
1832
1846
|
checked = checkCommandDefinition(exported);
|
|
1833
1847
|
} catch (error) {
|
|
1834
|
-
throw new Error(`Invalid command definition exported by ${
|
|
1848
|
+
throw new Error(`Invalid command definition exported by ${commandLabel}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
1835
1849
|
}
|
|
1836
1850
|
const { help, ...navigation } = metadata;
|
|
1837
1851
|
if (help !== void 0 && checked.help !== void 0)
|
|
1838
|
-
throw new Error(`Command help is set in both ${
|
|
1852
|
+
throw new Error(`Command help is set in both ${metadataLabel} and ${commandLabel}; set it in one of them`);
|
|
1839
1853
|
return Object.freeze({ ...checked, navigation: Object.freeze(navigation), ...help === void 0 ? {} : { help } });
|
|
1840
1854
|
}
|
|
1841
1855
|
async function findModule(directory, stem) {
|
|
@@ -2108,6 +2122,19 @@ function fileStem(path) {
|
|
|
2108
2122
|
}
|
|
2109
2123
|
|
|
2110
2124
|
// ../../../libs/clinkr/ts/dist/skills/read-skills.js
|
|
2125
|
+
function parseSkillRecord(files) {
|
|
2126
|
+
if (typeof files !== "object" || files === null || Array.isArray(files))
|
|
2127
|
+
throw new Error("skills must be an absolute directory path or a record of <name>.md to Markdown text");
|
|
2128
|
+
const names = Object.keys(files).toSorted((left, right) => left < right ? -1 : left > right ? 1 : 0);
|
|
2129
|
+
return Object.freeze(names.map((name) => {
|
|
2130
|
+
if (!name.endsWith(".md") || name.startsWith(".") || name.includes("/") || name.includes("\\"))
|
|
2131
|
+
throw new Error(`Invalid skill file name ${JSON.stringify(name)}: expected a plain <name>.md file name`);
|
|
2132
|
+
const text = files[name];
|
|
2133
|
+
if (typeof text !== "string")
|
|
2134
|
+
throw new Error(`Invalid skill file ${name}: content must be a string`);
|
|
2135
|
+
return parseSkillFile(name, text);
|
|
2136
|
+
}));
|
|
2137
|
+
}
|
|
2111
2138
|
async function readSkillFiles(directory) {
|
|
2112
2139
|
if (typeof directory !== "string" || !isAbsolute2(directory))
|
|
2113
2140
|
throw new Error(`skills must be an absolute directory path; received ${JSON.stringify(directory)}`);
|
|
@@ -2830,7 +2857,7 @@ async function createApplication(name, options) {
|
|
|
2830
2857
|
const declaredSections = new Set(helpSections);
|
|
2831
2858
|
const group = options.commands;
|
|
2832
2859
|
if (!isTreeGroup(group))
|
|
2833
|
-
throw new Error("createApplication requires commands, a group from a command tree's directory or
|
|
2860
|
+
throw new Error("createApplication requires commands, a group from a command tree's group, directory, or manifest");
|
|
2834
2861
|
checkNoGroupNavigation(group, "createApplication's commands take no navigation parts; root help takes description");
|
|
2835
2862
|
const builtIn = sourceOf(group);
|
|
2836
2863
|
const commands = await discoverBuiltIn(group, declaredSections);
|
|
@@ -2861,7 +2888,7 @@ async function createApplication(name, options) {
|
|
|
2861
2888
|
checkProjectedTreeIds(mounts);
|
|
2862
2889
|
const root = await mountAll(commands, mounts, builtIn, declaredSections);
|
|
2863
2890
|
await checkGroupsFilled(root, builtIn);
|
|
2864
|
-
const skills = options.skills === void 0 ? [] : await readSkillFiles(options.skills);
|
|
2891
|
+
const skills = options.skills === void 0 ? [] : typeof options.skills === "string" ? await readSkillFiles(options.skills) : parseSkillRecord(options.skills);
|
|
2865
2892
|
const application = Object.freeze({
|
|
2866
2893
|
name,
|
|
2867
2894
|
...description === void 0 ? {} : { description },
|
|
@@ -2995,6 +3022,58 @@ function leafSelection(leaf, path, argv) {
|
|
|
2995
3022
|
};
|
|
2996
3023
|
}
|
|
2997
3024
|
|
|
3025
|
+
// ../../../libs/clinkr/ts/dist/terminal.js
|
|
3026
|
+
var PIPE = Object.freeze({ tty: false, columns: void 0, color: "none" });
|
|
3027
|
+
function createTerminal(facts = {}) {
|
|
3028
|
+
return Object.freeze({
|
|
3029
|
+
interactive: facts.interactive ?? false,
|
|
3030
|
+
unicode: facts.unicode ?? true,
|
|
3031
|
+
stdout: Object.freeze({ ...PIPE, ...facts.stdout }),
|
|
3032
|
+
stderr: Object.freeze({ ...PIPE, ...facts.stderr })
|
|
3033
|
+
});
|
|
3034
|
+
}
|
|
3035
|
+
function withoutColor(terminal) {
|
|
3036
|
+
return Object.freeze({
|
|
3037
|
+
...terminal,
|
|
3038
|
+
stdout: Object.freeze({ ...terminal.stdout, color: "none" }),
|
|
3039
|
+
stderr: Object.freeze({ ...terminal.stderr, color: "none" })
|
|
3040
|
+
});
|
|
3041
|
+
}
|
|
3042
|
+
function scriptReadsStdout(terminal) {
|
|
3043
|
+
return !terminal.stdout.tty || !terminal.interactive;
|
|
3044
|
+
}
|
|
3045
|
+
function resolveColorDepth(facts) {
|
|
3046
|
+
const { env } = facts;
|
|
3047
|
+
const noColor = env["NO_COLOR"];
|
|
3048
|
+
if (noColor !== void 0 && noColor !== "")
|
|
3049
|
+
return "none";
|
|
3050
|
+
const forced = env["FORCE_COLOR"];
|
|
3051
|
+
if (forced !== void 0 && forced !== "") {
|
|
3052
|
+
if (forced === "0" || forced === "false")
|
|
3053
|
+
return "none";
|
|
3054
|
+
if (forced === "2")
|
|
3055
|
+
return "ansi256";
|
|
3056
|
+
if (forced === "3")
|
|
3057
|
+
return "truecolor";
|
|
3058
|
+
return "ansi16";
|
|
3059
|
+
}
|
|
3060
|
+
const term = env["TERM"];
|
|
3061
|
+
if (!facts.tty || term === "dumb")
|
|
3062
|
+
return "none";
|
|
3063
|
+
const colorterm = env["COLORTERM"];
|
|
3064
|
+
if (colorterm === "truecolor" || colorterm === "24bit")
|
|
3065
|
+
return "truecolor";
|
|
3066
|
+
if (term !== void 0 && term.includes("256color"))
|
|
3067
|
+
return "ansi256";
|
|
3068
|
+
return "ansi16";
|
|
3069
|
+
}
|
|
3070
|
+
function resolveUnicode(env) {
|
|
3071
|
+
const locale = [env["LC_ALL"], env["LC_CTYPE"], env["LANG"]].find((value) => value !== void 0 && value !== "");
|
|
3072
|
+
if (locale === void 0)
|
|
3073
|
+
return true;
|
|
3074
|
+
return /utf-?8/iu.test(locale);
|
|
3075
|
+
}
|
|
3076
|
+
|
|
2998
3077
|
// ../../../libs/clinkr/ts/dist/outcomes/refusals.js
|
|
2999
3078
|
function refused(error) {
|
|
3000
3079
|
return { ok: false, refusal: error };
|
|
@@ -4379,20 +4458,20 @@ function groupListing(application, commands) {
|
|
|
4379
4458
|
}
|
|
4380
4459
|
|
|
4381
4460
|
export {
|
|
4382
|
-
|
|
4383
|
-
lazyAppSource,
|
|
4461
|
+
defineErrors,
|
|
4384
4462
|
stepDocument,
|
|
4385
4463
|
renderOutcome,
|
|
4386
|
-
defineErrors,
|
|
4387
4464
|
defineOutcomes,
|
|
4465
|
+
commandTree,
|
|
4466
|
+
mount,
|
|
4467
|
+
createApplication,
|
|
4468
|
+
appSourceOf,
|
|
4469
|
+
lazyAppSource,
|
|
4388
4470
|
INVALID_VALUE,
|
|
4389
4471
|
CLINKR_PARSE_PARAMS,
|
|
4390
4472
|
createTerminal,
|
|
4391
4473
|
resolveColorDepth,
|
|
4392
4474
|
resolveUnicode,
|
|
4393
|
-
commandTree,
|
|
4394
|
-
mount,
|
|
4395
4475
|
runCliWith,
|
|
4396
|
-
createApplication,
|
|
4397
4476
|
refused
|
|
4398
4477
|
};
|