terminal-pilot 0.0.27 → 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.
Files changed (44) hide show
  1. package/dist/cli.js +849 -145
  2. package/dist/cli.js.map +4 -4
  3. package/dist/commands/close-session.js +14 -0
  4. package/dist/commands/close-session.js.map +2 -2
  5. package/dist/commands/create-session.js +14 -0
  6. package/dist/commands/create-session.js.map +2 -2
  7. package/dist/commands/fill.js +14 -0
  8. package/dist/commands/fill.js.map +2 -2
  9. package/dist/commands/get-session.js +14 -0
  10. package/dist/commands/get-session.js.map +2 -2
  11. package/dist/commands/index.js +114 -59
  12. package/dist/commands/index.js.map +4 -4
  13. package/dist/commands/install.js +98 -43
  14. package/dist/commands/install.js.map +4 -4
  15. package/dist/commands/installer.js +78 -37
  16. package/dist/commands/installer.js.map +4 -4
  17. package/dist/commands/list-sessions.js +14 -0
  18. package/dist/commands/list-sessions.js.map +2 -2
  19. package/dist/commands/press-key.js +14 -0
  20. package/dist/commands/press-key.js.map +2 -2
  21. package/dist/commands/read-history.js +14 -0
  22. package/dist/commands/read-history.js.map +2 -2
  23. package/dist/commands/read-screen.js +14 -0
  24. package/dist/commands/read-screen.js.map +2 -2
  25. package/dist/commands/resize.js +14 -0
  26. package/dist/commands/resize.js.map +2 -2
  27. package/dist/commands/runtime.js.map +1 -1
  28. package/dist/commands/screenshot.js +14 -0
  29. package/dist/commands/screenshot.js.map +2 -2
  30. package/dist/commands/send-signal.js +14 -0
  31. package/dist/commands/send-signal.js.map +2 -2
  32. package/dist/commands/type.js +14 -0
  33. package/dist/commands/type.js.map +2 -2
  34. package/dist/commands/uninstall.js +92 -37
  35. package/dist/commands/uninstall.js.map +4 -4
  36. package/dist/commands/wait-for-exit.js +14 -0
  37. package/dist/commands/wait-for-exit.js.map +2 -2
  38. package/dist/commands/wait-for.js +14 -0
  39. package/dist/commands/wait-for.js.map +2 -2
  40. package/dist/testing/cli-repl.js +854 -150
  41. package/dist/testing/cli-repl.js.map +4 -4
  42. package/dist/testing/qa-cli.js +854 -150
  43. package/dist/testing/qa-cli.js.map +4 -4
  44. 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(text4, styles) {
759
+ function applyStyles(text3, styles) {
746
760
  if (!supportsColor() || styles.length === 0) {
747
- return text4;
761
+ return text3;
748
762
  }
749
763
  const open = styles.map((style) => style.open).join("");
750
- const output = text4.includes(reset) ? replaceAll(text4, reset, `${reset}${open}`) : text4;
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 = ((text4) => applyStyles(String(text4), styles));
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: (text4) => active2.bold(text4),
864
- divider: (text4) => color.hex("#666666")(text4),
865
- prompt: (text4) => prompt2.bold(text4),
866
- number: (text4) => number2.bold(text4),
867
- intro: (text4) => color.bgHex(activeBrand.primary).white(` ${getThemeConfig().label} - ${text4} `),
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: (text4) => prompt2.bold(text4),
875
- muted: (text4) => color.hex("#666666")(text4),
876
- success: (text4) => color.hex("#008800")(text4),
877
- warning: (text4) => color.hex("#cc6600")(text4),
878
- error: (text4) => color.hex("#cc0000")(text4),
879
- info: (text4) => active2(text4),
880
- badge: (text4) => color.bgHex("#cc6600").white(` ${text4} `)
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: (text4) => activeBright.bold(text4),
900
- divider: (text4) => color.dim(text4),
901
- prompt: (text4) => prompt(text4),
902
- number: (text4) => number(text4),
903
- intro: (text4) => activeBackground.white(` ${getThemeConfig().label} - ${text4} `),
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: (text4) => prompt(text4),
911
- muted: (text4) => color.dim(text4),
912
- success: (text4) => color.green(text4),
913
- warning: (text4) => color.yellow(text4),
914
- error: (text4) => color.red(text4),
915
- info: (text4) => active(text4),
916
- badge: (text4) => color.bgYellow.black(` ${text4} `)
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 ? `${symbol} ` : "";
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 ? symbol : "");
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, symbol) {
1259
+ message(message2, symbol2) {
1246
1260
  if (emitter) {
1247
1261
  emitter(message2);
1248
1262
  return;
1249
1263
  }
1250
- log.message(message2, { symbol: symbol ?? color.gray("\u2502") });
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/index.ts
1287
- import * as clack from "@clack/prompts";
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/primitives/cancel.ts
1290
- import { isCancel } from "@clack/prompts";
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"]);