terminal-pilot 0.0.26 → 0.0.28
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 +849 -145
- package/dist/cli.js.map +4 -4
- package/dist/commands/close-session.js +14 -0
- package/dist/commands/close-session.js.map +2 -2
- package/dist/commands/create-session.js +14 -0
- package/dist/commands/create-session.js.map +2 -2
- package/dist/commands/fill.js +14 -0
- package/dist/commands/fill.js.map +2 -2
- package/dist/commands/get-session.js +14 -0
- package/dist/commands/get-session.js.map +2 -2
- package/dist/commands/index.js +114 -59
- package/dist/commands/index.js.map +4 -4
- package/dist/commands/install.js +98 -43
- package/dist/commands/install.js.map +4 -4
- package/dist/commands/installer.js +78 -37
- package/dist/commands/installer.js.map +4 -4
- package/dist/commands/list-sessions.js +14 -0
- package/dist/commands/list-sessions.js.map +2 -2
- package/dist/commands/press-key.js +14 -0
- package/dist/commands/press-key.js.map +2 -2
- package/dist/commands/read-history.js +14 -0
- package/dist/commands/read-history.js.map +2 -2
- package/dist/commands/read-screen.js +14 -0
- package/dist/commands/read-screen.js.map +2 -2
- package/dist/commands/resize.js +14 -0
- package/dist/commands/resize.js.map +2 -2
- package/dist/commands/runtime.js.map +1 -1
- package/dist/commands/screenshot.js +14 -0
- package/dist/commands/screenshot.js.map +2 -2
- package/dist/commands/send-signal.js +14 -0
- package/dist/commands/send-signal.js.map +2 -2
- package/dist/commands/type.js +14 -0
- package/dist/commands/type.js.map +2 -2
- package/dist/commands/uninstall.js +92 -37
- package/dist/commands/uninstall.js.map +4 -4
- package/dist/commands/wait-for-exit.js +14 -0
- package/dist/commands/wait-for-exit.js.map +2 -2
- package/dist/commands/wait-for.js +14 -0
- package/dist/commands/wait-for.js.map +2 -2
- package/dist/testing/cli-repl.js +854 -150
- package/dist/testing/cli-repl.js.map +4 -4
- package/dist/testing/qa-cli.js +854 -150
- package/dist/testing/qa-cli.js.map +4 -4
- package/package.json +3 -2
|
@@ -252,6 +252,12 @@ function cloneRequires(requires) {
|
|
|
252
252
|
check: requires.check
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
|
+
function cloneCommandExamples(examples) {
|
|
256
|
+
return (examples ?? []).map((example) => ({
|
|
257
|
+
title: example.title,
|
|
258
|
+
params: { ...example.params }
|
|
259
|
+
}));
|
|
260
|
+
}
|
|
255
261
|
function parseStackPath(candidate) {
|
|
256
262
|
if (candidate.startsWith("file://")) {
|
|
257
263
|
try {
|
|
@@ -345,9 +351,11 @@ function createBaseCommand(config2) {
|
|
|
345
351
|
kind: "command",
|
|
346
352
|
name: config2.name,
|
|
347
353
|
description: config2.description,
|
|
354
|
+
examples: cloneCommandExamples(config2.examples),
|
|
348
355
|
aliases: [...config2.aliases ?? []],
|
|
349
356
|
positional: [...config2.positional ?? []],
|
|
350
357
|
params: config2.params,
|
|
358
|
+
result: config2.result,
|
|
351
359
|
secrets: cloneSecrets(config2.secrets),
|
|
352
360
|
scope: resolveCommandScope(config2.scope, void 0),
|
|
353
361
|
confirm: config2.confirm ?? false,
|
|
@@ -359,6 +367,8 @@ function createBaseCommand(config2) {
|
|
|
359
367
|
Object.defineProperty(command, commandConfigSymbol, {
|
|
360
368
|
value: {
|
|
361
369
|
scope: cloneScope(config2.scope),
|
|
370
|
+
examples: cloneCommandExamples(config2.examples),
|
|
371
|
+
result: config2.result,
|
|
362
372
|
humanInLoop: config2.humanInLoop,
|
|
363
373
|
secrets: cloneSecrets(config2.secrets),
|
|
364
374
|
requires: cloneRequires(config2.requires),
|
|
@@ -376,9 +386,11 @@ function materializeCommand(command, inherited) {
|
|
|
376
386
|
kind: "command",
|
|
377
387
|
name: command.name,
|
|
378
388
|
description: command.description,
|
|
389
|
+
examples: cloneCommandExamples(internal.examples),
|
|
379
390
|
aliases: [...command.aliases],
|
|
380
391
|
positional: [...command.positional],
|
|
381
392
|
params: command.params,
|
|
393
|
+
result: internal.result,
|
|
382
394
|
secrets: mergeSecrets(inherited.secrets, internal.secrets),
|
|
383
395
|
scope: resolveCommandScope(internal.scope, inherited.scope),
|
|
384
396
|
confirm: command.confirm,
|
|
@@ -390,6 +402,8 @@ function materializeCommand(command, inherited) {
|
|
|
390
402
|
Object.defineProperty(materialized, commandConfigSymbol, {
|
|
391
403
|
value: {
|
|
392
404
|
scope: cloneScope(internal.scope),
|
|
405
|
+
examples: cloneCommandExamples(internal.examples),
|
|
406
|
+
result: internal.result,
|
|
393
407
|
humanInLoop: internal.humanInLoop,
|
|
394
408
|
secrets: cloneSecrets(internal.secrets),
|
|
395
409
|
requires: cloneRequires(internal.requires),
|
|
@@ -742,12 +756,12 @@ var styleNames = Object.keys(ansiStyles);
|
|
|
742
756
|
function replaceAll(value, search, replacement) {
|
|
743
757
|
return value.split(search).join(replacement);
|
|
744
758
|
}
|
|
745
|
-
function applyStyles(
|
|
759
|
+
function applyStyles(text3, styles) {
|
|
746
760
|
if (!supportsColor() || styles.length === 0) {
|
|
747
|
-
return
|
|
761
|
+
return text3;
|
|
748
762
|
}
|
|
749
763
|
const open = styles.map((style) => style.open).join("");
|
|
750
|
-
const output =
|
|
764
|
+
const output = text3.includes(reset) ? replaceAll(text3, reset, `${reset}${open}`) : text3;
|
|
751
765
|
return `${open}${output}${reset}`;
|
|
752
766
|
}
|
|
753
767
|
function clampRgb(value) {
|
|
@@ -791,7 +805,7 @@ function bgRgbStyle(red, green, blue) {
|
|
|
791
805
|
};
|
|
792
806
|
}
|
|
793
807
|
function createColor(styles = []) {
|
|
794
|
-
const builder = ((
|
|
808
|
+
const builder = ((text3) => applyStyles(String(text3), styles));
|
|
795
809
|
for (const name of styleNames) {
|
|
796
810
|
Object.defineProperty(builder, name, {
|
|
797
811
|
configurable: true,
|
|
@@ -860,24 +874,24 @@ function createPalette(activeBrand, mode) {
|
|
|
860
874
|
const number2 = isPurple ? color.hex("#0077cc") : active2;
|
|
861
875
|
return withStyles(
|
|
862
876
|
{
|
|
863
|
-
header: (
|
|
864
|
-
divider: (
|
|
865
|
-
prompt: (
|
|
866
|
-
number: (
|
|
867
|
-
intro: (
|
|
877
|
+
header: (text3) => active2.bold(text3),
|
|
878
|
+
divider: (text3) => color.hex("#666666")(text3),
|
|
879
|
+
prompt: (text3) => prompt2.bold(text3),
|
|
880
|
+
number: (text3) => number2.bold(text3),
|
|
881
|
+
intro: (text3) => color.bgHex(activeBrand.primary).white(` ${getThemeConfig().label} - ${text3} `),
|
|
868
882
|
get resolvedSymbol() {
|
|
869
883
|
return active2("\u25C7");
|
|
870
884
|
},
|
|
871
885
|
get errorSymbol() {
|
|
872
886
|
return color.hex("#cc0000")("\u25A0");
|
|
873
887
|
},
|
|
874
|
-
accent: (
|
|
875
|
-
muted: (
|
|
876
|
-
success: (
|
|
877
|
-
warning: (
|
|
878
|
-
error: (
|
|
879
|
-
info: (
|
|
880
|
-
badge: (
|
|
888
|
+
accent: (text3) => prompt2.bold(text3),
|
|
889
|
+
muted: (text3) => color.hex("#666666")(text3),
|
|
890
|
+
success: (text3) => color.hex("#008800")(text3),
|
|
891
|
+
warning: (text3) => color.hex("#cc6600")(text3),
|
|
892
|
+
error: (text3) => color.hex("#cc0000")(text3),
|
|
893
|
+
info: (text3) => active2(text3),
|
|
894
|
+
badge: (text3) => color.bgHex("#cc6600").white(` ${text3} `)
|
|
881
895
|
},
|
|
882
896
|
{
|
|
883
897
|
accent: { fg: isPurple ? "#006699" : activeBrand.primary, bold: true },
|
|
@@ -896,24 +910,24 @@ function createPalette(activeBrand, mode) {
|
|
|
896
910
|
const number = isPurple ? color.cyanBright : active;
|
|
897
911
|
return withStyles(
|
|
898
912
|
{
|
|
899
|
-
header: (
|
|
900
|
-
divider: (
|
|
901
|
-
prompt: (
|
|
902
|
-
number: (
|
|
903
|
-
intro: (
|
|
913
|
+
header: (text3) => activeBright.bold(text3),
|
|
914
|
+
divider: (text3) => color.dim(text3),
|
|
915
|
+
prompt: (text3) => prompt(text3),
|
|
916
|
+
number: (text3) => number(text3),
|
|
917
|
+
intro: (text3) => activeBackground.white(` ${getThemeConfig().label} - ${text3} `),
|
|
904
918
|
get resolvedSymbol() {
|
|
905
919
|
return active("\u25C7");
|
|
906
920
|
},
|
|
907
921
|
get errorSymbol() {
|
|
908
922
|
return color.red("\u25A0");
|
|
909
923
|
},
|
|
910
|
-
accent: (
|
|
911
|
-
muted: (
|
|
912
|
-
success: (
|
|
913
|
-
warning: (
|
|
914
|
-
error: (
|
|
915
|
-
info: (
|
|
916
|
-
badge: (
|
|
924
|
+
accent: (text3) => prompt(text3),
|
|
925
|
+
muted: (text3) => color.dim(text3),
|
|
926
|
+
success: (text3) => color.green(text3),
|
|
927
|
+
warning: (text3) => color.yellow(text3),
|
|
928
|
+
error: (text3) => color.red(text3),
|
|
929
|
+
info: (text3) => active(text3),
|
|
930
|
+
badge: (text3) => color.bgYellow.black(` ${text3} `)
|
|
917
931
|
},
|
|
918
932
|
{
|
|
919
933
|
accent: { fg: isPurple ? "cyan" : activeBrand.primary, bold: true },
|
|
@@ -1070,7 +1084,7 @@ function renderMarkdownInline(value) {
|
|
|
1070
1084
|
return stripAnsi(value).replaceAll("\r\n", " ").replaceAll("\n", " ").replaceAll("\r", " ");
|
|
1071
1085
|
}
|
|
1072
1086
|
function writeTerminalMessage(msg, {
|
|
1073
|
-
symbol = color.gray("\u2502"),
|
|
1087
|
+
symbol: symbol2 = color.gray("\u2502"),
|
|
1074
1088
|
secondarySymbol = color.gray("\u2502"),
|
|
1075
1089
|
spacing: spacing2 = 1,
|
|
1076
1090
|
withGuide = true
|
|
@@ -1078,7 +1092,7 @@ function writeTerminalMessage(msg, {
|
|
|
1078
1092
|
const lines = [];
|
|
1079
1093
|
const showGuide = withGuide !== false;
|
|
1080
1094
|
const contentLines = msg.split("\n");
|
|
1081
|
-
const prefix = showGuide ? `${
|
|
1095
|
+
const prefix = showGuide ? `${symbol2} ` : "";
|
|
1082
1096
|
const continuationPrefix = showGuide ? `${secondarySymbol} ` : "";
|
|
1083
1097
|
const emptyGuide = showGuide ? secondarySymbol : "";
|
|
1084
1098
|
for (let index = 0; index < spacing2; index += 1) {
|
|
@@ -1092,7 +1106,7 @@ function writeTerminalMessage(msg, {
|
|
|
1092
1106
|
if (firstLine.length > 0) {
|
|
1093
1107
|
lines.push(`${prefix}${firstLine}`);
|
|
1094
1108
|
} else {
|
|
1095
|
-
lines.push(showGuide ?
|
|
1109
|
+
lines.push(showGuide ? symbol2 : "");
|
|
1096
1110
|
}
|
|
1097
1111
|
for (const line of continuationLines) {
|
|
1098
1112
|
if (line.length > 0) {
|
|
@@ -1242,12 +1256,12 @@ function createLogger(emitter) {
|
|
|
1242
1256
|
log.message(`${label}
|
|
1243
1257
|
${value}`, { symbol: symbols.errorResolved });
|
|
1244
1258
|
},
|
|
1245
|
-
message(message2,
|
|
1259
|
+
message(message2, symbol2) {
|
|
1246
1260
|
if (emitter) {
|
|
1247
1261
|
emitter(message2);
|
|
1248
1262
|
return;
|
|
1249
1263
|
}
|
|
1250
|
-
log.message(message2, { symbol:
|
|
1264
|
+
log.message(message2, { symbol: symbol2 ?? color.gray("\u2502") });
|
|
1251
1265
|
}
|
|
1252
1266
|
};
|
|
1253
1267
|
}
|
|
@@ -1263,6 +1277,12 @@ var graphemeSegmenter2 = new Intl.Segmenter(void 0, { granularity: "grapheme" })
|
|
|
1263
1277
|
import { spawn } from "node:child_process";
|
|
1264
1278
|
import process2 from "node:process";
|
|
1265
1279
|
|
|
1280
|
+
// ../frontmatter/src/parse.ts
|
|
1281
|
+
import { LineCounter, parse, parseDocument } from "yaml";
|
|
1282
|
+
|
|
1283
|
+
// ../frontmatter/src/stringify.ts
|
|
1284
|
+
import { stringify } from "yaml";
|
|
1285
|
+
|
|
1266
1286
|
// ../toolcraft-design/src/acp/writer.ts
|
|
1267
1287
|
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
1268
1288
|
var storage = new AsyncLocalStorage2();
|
|
@@ -1283,11 +1303,46 @@ var REGION_MODAL = 1 << 4;
|
|
|
1283
1303
|
var REGION_TOAST = 1 << 5;
|
|
1284
1304
|
var REGION_ALL = REGION_HEADER | REGION_LIST | REGION_DETAIL | REGION_FOOTER | REGION_MODAL | REGION_TOAST;
|
|
1285
1305
|
|
|
1286
|
-
// ../toolcraft-design/src/prompts/
|
|
1287
|
-
|
|
1306
|
+
// ../toolcraft-design/src/prompts/interactive/glyphs.ts
|
|
1307
|
+
function supportsUnicode() {
|
|
1308
|
+
if (!process.platform.startsWith("win")) {
|
|
1309
|
+
return process.env.TERM !== "linux";
|
|
1310
|
+
}
|
|
1311
|
+
return Boolean(
|
|
1312
|
+
process.env.CI || process.env.WT_SESSION || process.env.TERMINUS_SUBLIME || process.env.ConEmuTask === "{cmd::Cmder}" || process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm"
|
|
1313
|
+
);
|
|
1314
|
+
}
|
|
1315
|
+
var UNICODE = supportsUnicode();
|
|
1316
|
+
function glyph(unicode, ascii) {
|
|
1317
|
+
return UNICODE ? unicode : ascii;
|
|
1318
|
+
}
|
|
1319
|
+
var GLYPHS = {
|
|
1320
|
+
stepActive: glyph("\u25C6", "*"),
|
|
1321
|
+
stepCancel: glyph("\u25A0", "x"),
|
|
1322
|
+
stepError: glyph("\u25B2", "x"),
|
|
1323
|
+
stepSubmit: glyph("\u25C7", "o"),
|
|
1324
|
+
barStart: glyph("\u250C", "T"),
|
|
1325
|
+
bar: glyph("\u2502", "|"),
|
|
1326
|
+
barEnd: glyph("\u2514", "-"),
|
|
1327
|
+
radioActive: glyph("\u25CF", ">"),
|
|
1328
|
+
radioInactive: glyph("\u25CB", " "),
|
|
1329
|
+
checkboxActive: glyph("\u25FB", "[ ]"),
|
|
1330
|
+
checkboxSelected: glyph("\u25FC", "[+]"),
|
|
1331
|
+
checkboxInactive: glyph("\u25FB", "[ ]"),
|
|
1332
|
+
passwordMask: glyph("\u2022", "*"),
|
|
1333
|
+
ellipsis: "..."
|
|
1334
|
+
};
|
|
1335
|
+
|
|
1336
|
+
// ../toolcraft-design/src/prompts/interactive/core.ts
|
|
1337
|
+
import { EventEmitter } from "node:events";
|
|
1338
|
+
import * as readline2 from "node:readline";
|
|
1339
|
+
|
|
1340
|
+
// ../toolcraft-design/src/prompts/interactive/wrap.ts
|
|
1341
|
+
import { wrapAnsi } from "fast-wrap-ansi";
|
|
1342
|
+
import stringWidth from "fast-string-width";
|
|
1288
1343
|
|
|
1289
|
-
// ../toolcraft-design/src/prompts/
|
|
1290
|
-
import {
|
|
1344
|
+
// ../toolcraft-design/src/prompts/interactive/pagination.ts
|
|
1345
|
+
import { wrapAnsi as wrapAnsi2 } from "fast-wrap-ansi";
|
|
1291
1346
|
|
|
1292
1347
|
// ../toolcraft-design/src/static/spinner.ts
|
|
1293
1348
|
var SPINNER_FRAMES = Object.freeze(["\u25D2", "\u25D0", "\u25D3", "\u25D1"]);
|