terminal-pilot 0.0.12 → 0.0.14
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/cli.js +27 -127
- package/dist/cli.js.map +4 -4
- package/dist/commands/close-session.d.ts +4 -4
- package/dist/commands/close-session.js +6 -6
- package/dist/commands/close-session.js.map +3 -3
- package/dist/commands/create-session.d.ts +16 -16
- package/dist/commands/create-session.js +6 -6
- package/dist/commands/create-session.js.map +3 -3
- package/dist/commands/fill.d.ts +6 -6
- package/dist/commands/fill.js +6 -6
- package/dist/commands/fill.js.map +3 -3
- package/dist/commands/get-session.d.ts +4 -4
- package/dist/commands/get-session.js +6 -6
- package/dist/commands/get-session.js.map +3 -3
- package/dist/commands/index.d.ts +107 -107
- package/dist/commands/index.js +7 -7
- package/dist/commands/index.js.map +3 -3
- package/dist/commands/install.d.ts +8 -8
- package/dist/commands/install.js +6 -6
- package/dist/commands/install.js.map +3 -3
- package/dist/commands/installer.js +1 -1
- package/dist/commands/installer.js.map +2 -2
- package/dist/commands/list-sessions.d.ts +2 -2
- package/dist/commands/list-sessions.js +6 -6
- package/dist/commands/list-sessions.js.map +3 -3
- package/dist/commands/press-key.d.ts +6 -6
- package/dist/commands/press-key.js +6 -6
- package/dist/commands/press-key.js.map +3 -3
- package/dist/commands/read-history.d.ts +6 -6
- package/dist/commands/read-history.js +6 -6
- package/dist/commands/read-history.js.map +3 -3
- package/dist/commands/read-screen.d.ts +4 -4
- package/dist/commands/read-screen.js +6 -6
- package/dist/commands/read-screen.js.map +3 -3
- package/dist/commands/resize.d.ts +8 -8
- package/dist/commands/resize.js +6 -6
- package/dist/commands/resize.js.map +3 -3
- package/dist/commands/runtime.d.ts +1 -1
- package/dist/commands/runtime.js +1 -1
- package/dist/commands/runtime.js.map +2 -2
- package/dist/commands/screenshot.d.ts +10 -10
- package/dist/commands/screenshot.js +6 -6
- package/dist/commands/screenshot.js.map +3 -3
- package/dist/commands/send-signal.d.ts +6 -6
- package/dist/commands/send-signal.js +6 -6
- package/dist/commands/send-signal.js.map +3 -3
- package/dist/commands/type.d.ts +6 -6
- package/dist/commands/type.js +6 -6
- package/dist/commands/type.js.map +3 -3
- package/dist/commands/uninstall.d.ts +4 -4
- package/dist/commands/uninstall.js +6 -6
- package/dist/commands/uninstall.js.map +3 -3
- package/dist/commands/wait-for-exit.d.ts +6 -6
- package/dist/commands/wait-for-exit.js +6 -6
- package/dist/commands/wait-for-exit.js.map +3 -3
- package/dist/commands/wait-for.d.ts +10 -10
- package/dist/commands/wait-for.js +6 -6
- package/dist/commands/wait-for.js.map +3 -3
- package/dist/testing/cli-repl.js +27 -128
- package/dist/testing/cli-repl.js.map +4 -4
- package/dist/testing/qa-cli.js +27 -128
- package/dist/testing/qa-cli.js.map +4 -4
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -1,92 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
|
|
28
|
-
// ../../node_modules/sisteransi/src/index.js
|
|
29
|
-
var require_src = __commonJS({
|
|
30
|
-
"../../node_modules/sisteransi/src/index.js"(exports, module) {
|
|
31
|
-
"use strict";
|
|
32
|
-
var ESC3 = "\x1B";
|
|
33
|
-
var CSI2 = `${ESC3}[`;
|
|
34
|
-
var beep = "\x07";
|
|
35
|
-
var cursor = {
|
|
36
|
-
to(x, y) {
|
|
37
|
-
if (!y) return `${CSI2}${x + 1}G`;
|
|
38
|
-
return `${CSI2}${y + 1};${x + 1}H`;
|
|
39
|
-
},
|
|
40
|
-
move(x, y) {
|
|
41
|
-
let ret = "";
|
|
42
|
-
if (x < 0) ret += `${CSI2}${-x}D`;
|
|
43
|
-
else if (x > 0) ret += `${CSI2}${x}C`;
|
|
44
|
-
if (y < 0) ret += `${CSI2}${-y}A`;
|
|
45
|
-
else if (y > 0) ret += `${CSI2}${y}B`;
|
|
46
|
-
return ret;
|
|
47
|
-
},
|
|
48
|
-
up: (count = 1) => `${CSI2}${count}A`,
|
|
49
|
-
down: (count = 1) => `${CSI2}${count}B`,
|
|
50
|
-
forward: (count = 1) => `${CSI2}${count}C`,
|
|
51
|
-
backward: (count = 1) => `${CSI2}${count}D`,
|
|
52
|
-
nextLine: (count = 1) => `${CSI2}E`.repeat(count),
|
|
53
|
-
prevLine: (count = 1) => `${CSI2}F`.repeat(count),
|
|
54
|
-
left: `${CSI2}G`,
|
|
55
|
-
hide: `${CSI2}?25l`,
|
|
56
|
-
show: `${CSI2}?25h`,
|
|
57
|
-
save: `${ESC3}7`,
|
|
58
|
-
restore: `${ESC3}8`
|
|
59
|
-
};
|
|
60
|
-
var scroll = {
|
|
61
|
-
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
62
|
-
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
63
|
-
};
|
|
64
|
-
var erase = {
|
|
65
|
-
screen: `${CSI2}2J`,
|
|
66
|
-
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
67
|
-
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
68
|
-
line: `${CSI2}2K`,
|
|
69
|
-
lineEnd: `${CSI2}K`,
|
|
70
|
-
lineStart: `${CSI2}1K`,
|
|
71
|
-
lines(count) {
|
|
72
|
-
let clear = "";
|
|
73
|
-
for (let i = 0; i < count; i++)
|
|
74
|
-
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
75
|
-
if (count)
|
|
76
|
-
clear += cursor.left;
|
|
77
|
-
return clear;
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
module.exports = { cursor, scroll, erase, beep };
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
2
|
|
|
84
3
|
// src/cli.ts
|
|
85
4
|
import { realpath } from "node:fs/promises";
|
|
86
5
|
import path6 from "node:path";
|
|
87
6
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
88
7
|
|
|
89
|
-
// ../
|
|
8
|
+
// ../toolcraft/src/cli.ts
|
|
90
9
|
import { access, readFile, writeFile } from "node:fs/promises";
|
|
91
10
|
import path from "node:path";
|
|
92
11
|
import { Command as CommanderCommand, CommanderError, InvalidArgumentError, Option } from "commander";
|
|
@@ -660,31 +579,7 @@ import * as clack from "@clack/prompts";
|
|
|
660
579
|
|
|
661
580
|
// ../design-system/src/prompts/primitives/cancel.ts
|
|
662
581
|
import chalk9 from "chalk";
|
|
663
|
-
|
|
664
|
-
// ../../node_modules/@clack/core/dist/index.mjs
|
|
665
|
-
var import_sisteransi = __toESM(require_src(), 1);
|
|
666
|
-
import { stdout as R, stdin as q } from "node:process";
|
|
667
|
-
import * as k from "node:readline";
|
|
668
|
-
import ot from "node:readline";
|
|
669
|
-
import { ReadStream as J } from "node:tty";
|
|
670
|
-
var P = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
|
|
671
|
-
var ct = new RegExp("\\p{M}+", "gu");
|
|
672
|
-
var pt = { limit: 1 / 0, ellipsis: "" };
|
|
673
|
-
var ft = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
|
|
674
|
-
var j = "\x07";
|
|
675
|
-
var Q = "[";
|
|
676
|
-
var dt = "]";
|
|
677
|
-
var U = `${dt}8;;`;
|
|
678
|
-
var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
|
|
679
|
-
var At = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
680
|
-
var _ = { actions: new Set(At), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
|
|
681
|
-
var bt = globalThis.process.platform.startsWith("win");
|
|
682
|
-
var z = /* @__PURE__ */ Symbol("clack:cancel");
|
|
683
|
-
function Ct(t) {
|
|
684
|
-
return t === z;
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
// ../design-system/src/prompts/primitives/cancel.ts
|
|
582
|
+
import { isCancel } from "@clack/prompts";
|
|
688
583
|
function cancel(msg = "") {
|
|
689
584
|
if (resolveOutputFormat() !== "terminal") {
|
|
690
585
|
return;
|
|
@@ -770,10 +665,10 @@ async function confirm2(opts) {
|
|
|
770
665
|
// ../design-system/src/static/menu.ts
|
|
771
666
|
import chalk16 from "chalk";
|
|
772
667
|
|
|
773
|
-
// ../
|
|
668
|
+
// ../toolcraft/src/index.ts
|
|
774
669
|
import { fileURLToPath } from "node:url";
|
|
775
670
|
|
|
776
|
-
// ../
|
|
671
|
+
// ../toolcraft-schema/src/index.ts
|
|
777
672
|
function assertValidEnumValues(values) {
|
|
778
673
|
if (values.length === 0) {
|
|
779
674
|
throw new Error("Enum schema requires at least one value");
|
|
@@ -832,10 +727,10 @@ var S = {
|
|
|
832
727
|
}
|
|
833
728
|
};
|
|
834
729
|
|
|
835
|
-
// ../
|
|
836
|
-
var commandConfigSymbol = /* @__PURE__ */ Symbol("
|
|
837
|
-
var groupConfigSymbol = /* @__PURE__ */ Symbol("
|
|
838
|
-
var commandSourcePathSymbol = /* @__PURE__ */ Symbol("
|
|
730
|
+
// ../toolcraft/src/index.ts
|
|
731
|
+
var commandConfigSymbol = /* @__PURE__ */ Symbol("toolcraft.command.config");
|
|
732
|
+
var groupConfigSymbol = /* @__PURE__ */ Symbol("toolcraft.group.config");
|
|
733
|
+
var commandSourcePathSymbol = /* @__PURE__ */ Symbol("toolcraft.command.sourcePath");
|
|
839
734
|
var UserError = class extends Error {
|
|
840
735
|
constructor(message2) {
|
|
841
736
|
super(message2);
|
|
@@ -913,7 +808,7 @@ function inferCommandSourcePath() {
|
|
|
913
808
|
if (candidate === void 0) {
|
|
914
809
|
continue;
|
|
915
810
|
}
|
|
916
|
-
if (candidate.includes("/packages/
|
|
811
|
+
if (candidate.includes("/packages/toolcraft/src/index.ts") || candidate.includes("/packages/toolcraft/dist/index.js") || candidate.includes("/node_modules/toolcraft/dist/index.js")) {
|
|
917
812
|
continue;
|
|
918
813
|
}
|
|
919
814
|
return candidate;
|
|
@@ -1205,7 +1100,7 @@ function getCommandSourcePath(command) {
|
|
|
1205
1100
|
return command[commandSourcePathSymbol];
|
|
1206
1101
|
}
|
|
1207
1102
|
|
|
1208
|
-
// ../
|
|
1103
|
+
// ../toolcraft/src/number-schema.ts
|
|
1209
1104
|
function isValidNumberSchemaValue(value, schema) {
|
|
1210
1105
|
return typeof value === "number" && Number.isFinite(value) && (schema.jsonType !== "integer" || Number.isInteger(value));
|
|
1211
1106
|
}
|
|
@@ -1213,7 +1108,7 @@ function getExpectedNumberDescription(schema) {
|
|
|
1213
1108
|
return schema.jsonType === "integer" ? "an integer" : "a number";
|
|
1214
1109
|
}
|
|
1215
1110
|
|
|
1216
|
-
// ../
|
|
1111
|
+
// ../toolcraft/src/renderer.ts
|
|
1217
1112
|
function isObject(value) {
|
|
1218
1113
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1219
1114
|
}
|
|
@@ -1374,15 +1269,15 @@ function renderResult(command, result, output, primitives, write2 = (chunk) => {
|
|
|
1374
1269
|
}
|
|
1375
1270
|
}
|
|
1376
1271
|
|
|
1377
|
-
// ../
|
|
1272
|
+
// ../toolcraft/src/cli.ts
|
|
1378
1273
|
var RESERVED_SERVICE_NAMES = /* @__PURE__ */ new Set(["params", "secrets", "fetch", "fs", "env", "progress"]);
|
|
1379
1274
|
function inferProgramName(argv) {
|
|
1380
1275
|
const entrypoint = argv[1];
|
|
1381
1276
|
if (typeof entrypoint !== "string" || entrypoint.length === 0) {
|
|
1382
|
-
return "
|
|
1277
|
+
return "toolcraft";
|
|
1383
1278
|
}
|
|
1384
1279
|
const parsed = path.parse(entrypoint);
|
|
1385
|
-
return parsed.name.length > 0 ? parsed.name : "
|
|
1280
|
+
return parsed.name.length > 0 ? parsed.name : "toolcraft";
|
|
1386
1281
|
}
|
|
1387
1282
|
function normalizeRoots(roots, argv) {
|
|
1388
1283
|
if (!Array.isArray(roots)) {
|
|
@@ -1613,8 +1508,13 @@ function createOption(field) {
|
|
|
1613
1508
|
if (collidesWithGlobalFlag) {
|
|
1614
1509
|
return [createCommanderOption(flags, field.description, field)];
|
|
1615
1510
|
}
|
|
1511
|
+
const mainOption = createCommanderOption(`${flags} [value]`, field.description, field);
|
|
1512
|
+
mainOption.preset(true);
|
|
1513
|
+
mainOption.argParser(
|
|
1514
|
+
(value) => typeof value === "boolean" ? value : parseBooleanText(value, field.displayPath)
|
|
1515
|
+
);
|
|
1616
1516
|
return [
|
|
1617
|
-
|
|
1517
|
+
mainOption,
|
|
1618
1518
|
createCommanderOption(`--no-${field.optionFlag.slice(2)}`, field.description, field)
|
|
1619
1519
|
];
|
|
1620
1520
|
}
|
|
@@ -1732,7 +1632,7 @@ function formatHelpFieldFlags(field) {
|
|
|
1732
1632
|
return formatPositionalToken(field);
|
|
1733
1633
|
}
|
|
1734
1634
|
if (field.schema.kind === "boolean") {
|
|
1735
|
-
return formatOptionFlags(field)
|
|
1635
|
+
return `${formatOptionFlags(field)} [value]`;
|
|
1736
1636
|
}
|
|
1737
1637
|
return `${formatOptionFlags(field)} <${describeSchemaType(field.schema)}>`;
|
|
1738
1638
|
}
|
|
@@ -1984,7 +1884,7 @@ async function promptForField(field) {
|
|
|
1984
1884
|
options,
|
|
1985
1885
|
initialValue: field.hasDefault ? field.defaultValue : void 0
|
|
1986
1886
|
});
|
|
1987
|
-
if (
|
|
1887
|
+
if (isCancel(selected)) {
|
|
1988
1888
|
cancel("Operation cancelled.");
|
|
1989
1889
|
throw new UserError("Operation cancelled.");
|
|
1990
1890
|
}
|
|
@@ -1995,7 +1895,7 @@ async function promptForField(field) {
|
|
|
1995
1895
|
message: field.displayPath,
|
|
1996
1896
|
initialValue: field.hasDefault ? Boolean(field.defaultValue) : void 0
|
|
1997
1897
|
});
|
|
1998
|
-
if (
|
|
1898
|
+
if (isCancel(selected)) {
|
|
1999
1899
|
cancel("Operation cancelled.");
|
|
2000
1900
|
throw new UserError("Operation cancelled.");
|
|
2001
1901
|
}
|
|
@@ -2005,7 +1905,7 @@ async function promptForField(field) {
|
|
|
2005
1905
|
message: field.displayPath,
|
|
2006
1906
|
initialValue: field.hasDefault && field.defaultValue !== void 0 ? formatResolvedValue(field.defaultValue) : void 0
|
|
2007
1907
|
});
|
|
2008
|
-
if (
|
|
1908
|
+
if (isCancel(entered)) {
|
|
2009
1909
|
cancel("Operation cancelled.");
|
|
2010
1910
|
throw new UserError("Operation cancelled.");
|
|
2011
1911
|
}
|
|
@@ -2431,7 +2331,7 @@ function createFixtureEnvValues(command) {
|
|
|
2431
2331
|
return values;
|
|
2432
2332
|
}
|
|
2433
2333
|
async function resolveFixtureRuntime(command, services, requirementOptions) {
|
|
2434
|
-
const selector = process.env.
|
|
2334
|
+
const selector = process.env.TOOLCRAFT_FIXTURE;
|
|
2435
2335
|
if (selector === void 0 || selector.length === 0) {
|
|
2436
2336
|
return {
|
|
2437
2337
|
env: createEnv(),
|
|
@@ -2578,7 +2478,7 @@ async function executeCommand(state, services, requirementOptions) {
|
|
|
2578
2478
|
message: "Proceed?",
|
|
2579
2479
|
initialValue: true
|
|
2580
2480
|
});
|
|
2581
|
-
if (
|
|
2481
|
+
if (isCancel(proceed)) {
|
|
2582
2482
|
cancel("Operation cancelled.");
|
|
2583
2483
|
throw new UserError("Operation cancelled.");
|
|
2584
2484
|
}
|
|
@@ -3309,7 +3209,7 @@ var NAMED_KEY_SEQUENCES = {
|
|
|
3309
3209
|
Space: " "
|
|
3310
3210
|
};
|
|
3311
3211
|
var NAMED_KEY_LOWER = new Map(
|
|
3312
|
-
Object.entries(NAMED_KEY_SEQUENCES).map(([
|
|
3212
|
+
Object.entries(NAMED_KEY_SEQUENCES).map(([k, v]) => [k.toLowerCase(), v])
|
|
3313
3213
|
);
|
|
3314
3214
|
var VALID_KEYS_HINT = `Valid keys: ${Object.keys(NAMED_KEY_SEQUENCES).join(", ")}, Control+<letter>, Alt+<key>`;
|
|
3315
3215
|
function unknownKeyError(key) {
|