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.
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
@@ -402,12 +402,12 @@ var styleNames = Object.keys(ansiStyles);
402
402
  function replaceAll(value, search, replacement) {
403
403
  return value.split(search).join(replacement);
404
404
  }
405
- function applyStyles(text4, styles) {
405
+ function applyStyles(text3, styles) {
406
406
  if (!supportsColor() || styles.length === 0) {
407
- return text4;
407
+ return text3;
408
408
  }
409
409
  const open = styles.map((style) => style.open).join("");
410
- const output = text4.includes(reset) ? replaceAll(text4, reset, `${reset}${open}`) : text4;
410
+ const output = text3.includes(reset) ? replaceAll(text3, reset, `${reset}${open}`) : text3;
411
411
  return `${open}${output}${reset}`;
412
412
  }
413
413
  function clampRgb(value) {
@@ -451,7 +451,7 @@ function bgRgbStyle(red, green, blue) {
451
451
  };
452
452
  }
453
453
  function createColor(styles = []) {
454
- const builder = ((text4) => applyStyles(String(text4), styles));
454
+ const builder = ((text3) => applyStyles(String(text3), styles));
455
455
  for (const name of styleNames) {
456
456
  Object.defineProperty(builder, name, {
457
457
  configurable: true,
@@ -520,24 +520,24 @@ function createPalette(activeBrand, mode) {
520
520
  const number2 = isPurple ? color.hex("#0077cc") : active2;
521
521
  return withStyles(
522
522
  {
523
- header: (text4) => active2.bold(text4),
524
- divider: (text4) => color.hex("#666666")(text4),
525
- prompt: (text4) => prompt2.bold(text4),
526
- number: (text4) => number2.bold(text4),
527
- intro: (text4) => color.bgHex(activeBrand.primary).white(` ${getThemeConfig().label} - ${text4} `),
523
+ header: (text3) => active2.bold(text3),
524
+ divider: (text3) => color.hex("#666666")(text3),
525
+ prompt: (text3) => prompt2.bold(text3),
526
+ number: (text3) => number2.bold(text3),
527
+ intro: (text3) => color.bgHex(activeBrand.primary).white(` ${getThemeConfig().label} - ${text3} `),
528
528
  get resolvedSymbol() {
529
529
  return active2("\u25C7");
530
530
  },
531
531
  get errorSymbol() {
532
532
  return color.hex("#cc0000")("\u25A0");
533
533
  },
534
- accent: (text4) => prompt2.bold(text4),
535
- muted: (text4) => color.hex("#666666")(text4),
536
- success: (text4) => color.hex("#008800")(text4),
537
- warning: (text4) => color.hex("#cc6600")(text4),
538
- error: (text4) => color.hex("#cc0000")(text4),
539
- info: (text4) => active2(text4),
540
- badge: (text4) => color.bgHex("#cc6600").white(` ${text4} `)
534
+ accent: (text3) => prompt2.bold(text3),
535
+ muted: (text3) => color.hex("#666666")(text3),
536
+ success: (text3) => color.hex("#008800")(text3),
537
+ warning: (text3) => color.hex("#cc6600")(text3),
538
+ error: (text3) => color.hex("#cc0000")(text3),
539
+ info: (text3) => active2(text3),
540
+ badge: (text3) => color.bgHex("#cc6600").white(` ${text3} `)
541
541
  },
542
542
  {
543
543
  accent: { fg: isPurple ? "#006699" : activeBrand.primary, bold: true },
@@ -556,24 +556,24 @@ function createPalette(activeBrand, mode) {
556
556
  const number = isPurple ? color.cyanBright : active;
557
557
  return withStyles(
558
558
  {
559
- header: (text4) => activeBright.bold(text4),
560
- divider: (text4) => color.dim(text4),
561
- prompt: (text4) => prompt(text4),
562
- number: (text4) => number(text4),
563
- intro: (text4) => activeBackground.white(` ${getThemeConfig().label} - ${text4} `),
559
+ header: (text3) => activeBright.bold(text3),
560
+ divider: (text3) => color.dim(text3),
561
+ prompt: (text3) => prompt(text3),
562
+ number: (text3) => number(text3),
563
+ intro: (text3) => activeBackground.white(` ${getThemeConfig().label} - ${text3} `),
564
564
  get resolvedSymbol() {
565
565
  return active("\u25C7");
566
566
  },
567
567
  get errorSymbol() {
568
568
  return color.red("\u25A0");
569
569
  },
570
- accent: (text4) => prompt(text4),
571
- muted: (text4) => color.dim(text4),
572
- success: (text4) => color.green(text4),
573
- warning: (text4) => color.yellow(text4),
574
- error: (text4) => color.red(text4),
575
- info: (text4) => active(text4),
576
- badge: (text4) => color.bgYellow.black(` ${text4} `)
570
+ accent: (text3) => prompt(text3),
571
+ muted: (text3) => color.dim(text3),
572
+ success: (text3) => color.green(text3),
573
+ warning: (text3) => color.yellow(text3),
574
+ error: (text3) => color.red(text3),
575
+ info: (text3) => active(text3),
576
+ badge: (text3) => color.bgYellow.black(` ${text3} `)
577
577
  },
578
578
  {
579
579
  accent: { fg: isPurple ? "cyan" : activeBrand.primary, bold: true },
@@ -730,7 +730,7 @@ function renderMarkdownInline(value) {
730
730
  return stripAnsi(value).replaceAll("\r\n", " ").replaceAll("\n", " ").replaceAll("\r", " ");
731
731
  }
732
732
  function writeTerminalMessage(msg, {
733
- symbol = color.gray("\u2502"),
733
+ symbol: symbol2 = color.gray("\u2502"),
734
734
  secondarySymbol = color.gray("\u2502"),
735
735
  spacing: spacing2 = 1,
736
736
  withGuide = true
@@ -738,7 +738,7 @@ function writeTerminalMessage(msg, {
738
738
  const lines = [];
739
739
  const showGuide = withGuide !== false;
740
740
  const contentLines = msg.split("\n");
741
- const prefix = showGuide ? `${symbol} ` : "";
741
+ const prefix = showGuide ? `${symbol2} ` : "";
742
742
  const continuationPrefix = showGuide ? `${secondarySymbol} ` : "";
743
743
  const emptyGuide = showGuide ? secondarySymbol : "";
744
744
  for (let index = 0; index < spacing2; index += 1) {
@@ -752,7 +752,7 @@ function writeTerminalMessage(msg, {
752
752
  if (firstLine.length > 0) {
753
753
  lines.push(`${prefix}${firstLine}`);
754
754
  } else {
755
- lines.push(showGuide ? symbol : "");
755
+ lines.push(showGuide ? symbol2 : "");
756
756
  }
757
757
  for (const line of continuationLines) {
758
758
  if (line.length > 0) {
@@ -902,12 +902,12 @@ function createLogger(emitter) {
902
902
  log.message(`${label}
903
903
  ${value}`, { symbol: symbols.errorResolved });
904
904
  },
905
- message(message2, symbol) {
905
+ message(message2, symbol2) {
906
906
  if (emitter) {
907
907
  emitter(message2);
908
908
  return;
909
909
  }
910
- log.message(message2, { symbol: symbol ?? color.gray("\u2502") });
910
+ log.message(message2, { symbol: symbol2 ?? color.gray("\u2502") });
911
911
  }
912
912
  };
913
913
  }
@@ -1335,6 +1335,12 @@ function hasProperty(value, key) {
1335
1335
  import { spawn } from "node:child_process";
1336
1336
  import process2 from "node:process";
1337
1337
 
1338
+ // ../frontmatter/src/parse.ts
1339
+ import { LineCounter, parse, parseDocument } from "yaml";
1340
+
1341
+ // ../frontmatter/src/stringify.ts
1342
+ import { stringify } from "yaml";
1343
+
1338
1344
  // ../toolcraft-design/src/acp/writer.ts
1339
1345
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
1340
1346
  var storage = new AsyncLocalStorage2();
@@ -1355,11 +1361,46 @@ var REGION_MODAL = 1 << 4;
1355
1361
  var REGION_TOAST = 1 << 5;
1356
1362
  var REGION_ALL = REGION_HEADER | REGION_LIST | REGION_DETAIL | REGION_FOOTER | REGION_MODAL | REGION_TOAST;
1357
1363
 
1358
- // ../toolcraft-design/src/prompts/index.ts
1359
- import * as clack from "@clack/prompts";
1364
+ // ../toolcraft-design/src/prompts/interactive/glyphs.ts
1365
+ function supportsUnicode() {
1366
+ if (!process.platform.startsWith("win")) {
1367
+ return process.env.TERM !== "linux";
1368
+ }
1369
+ return Boolean(
1370
+ 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"
1371
+ );
1372
+ }
1373
+ var UNICODE = supportsUnicode();
1374
+ function glyph(unicode, ascii) {
1375
+ return UNICODE ? unicode : ascii;
1376
+ }
1377
+ var GLYPHS = {
1378
+ stepActive: glyph("\u25C6", "*"),
1379
+ stepCancel: glyph("\u25A0", "x"),
1380
+ stepError: glyph("\u25B2", "x"),
1381
+ stepSubmit: glyph("\u25C7", "o"),
1382
+ barStart: glyph("\u250C", "T"),
1383
+ bar: glyph("\u2502", "|"),
1384
+ barEnd: glyph("\u2514", "-"),
1385
+ radioActive: glyph("\u25CF", ">"),
1386
+ radioInactive: glyph("\u25CB", " "),
1387
+ checkboxActive: glyph("\u25FB", "[ ]"),
1388
+ checkboxSelected: glyph("\u25FC", "[+]"),
1389
+ checkboxInactive: glyph("\u25FB", "[ ]"),
1390
+ passwordMask: glyph("\u2022", "*"),
1391
+ ellipsis: "..."
1392
+ };
1393
+
1394
+ // ../toolcraft-design/src/prompts/interactive/core.ts
1395
+ import { EventEmitter } from "node:events";
1396
+ import * as readline2 from "node:readline";
1360
1397
 
1361
- // ../toolcraft-design/src/prompts/primitives/cancel.ts
1362
- import { isCancel } from "@clack/prompts";
1398
+ // ../toolcraft-design/src/prompts/interactive/wrap.ts
1399
+ import { wrapAnsi } from "fast-wrap-ansi";
1400
+ import stringWidth from "fast-string-width";
1401
+
1402
+ // ../toolcraft-design/src/prompts/interactive/pagination.ts
1403
+ import { wrapAnsi as wrapAnsi2 } from "fast-wrap-ansi";
1363
1404
 
1364
1405
  // ../toolcraft-design/src/static/spinner.ts
1365
1406
  var SPINNER_FRAMES = Object.freeze(["\u25D2", "\u25D0", "\u25D3", "\u25D1"]);
@@ -1407,7 +1448,7 @@ function detectIndent(content) {
1407
1448
  }
1408
1449
  return " ";
1409
1450
  }
1410
- function parse3(content) {
1451
+ function parse4(content) {
1411
1452
  if (!content || content.trim() === "") {
1412
1453
  return {};
1413
1454
  }
@@ -1532,7 +1573,7 @@ function applyObjectUpdate(content, path10, current, next) {
1532
1573
  return result;
1533
1574
  }
1534
1575
  var jsonFormat = {
1535
- parse: parse3,
1576
+ parse: parse4,
1536
1577
  serialize,
1537
1578
  serializeUpdate,
1538
1579
  merge,
@@ -1544,7 +1585,7 @@ import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
1544
1585
  function isConfigObject2(value) {
1545
1586
  return typeof value === "object" && value !== null && !Array.isArray(value);
1546
1587
  }
1547
- function parse4(content) {
1588
+ function parse5(content) {
1548
1589
  if (!content || content.trim() === "") {
1549
1590
  return {};
1550
1591
  }
@@ -1610,7 +1651,7 @@ function prune2(obj, shape) {
1610
1651
  return { changed, result };
1611
1652
  }
1612
1653
  var tomlFormat = {
1613
- parse: parse4,
1654
+ parse: parse5,
1614
1655
  serialize: serialize2,
1615
1656
  merge: merge2,
1616
1657
  prune: prune2
@@ -1621,7 +1662,7 @@ import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
1621
1662
  function isConfigObject3(value) {
1622
1663
  return typeof value === "object" && value !== null && !Array.isArray(value);
1623
1664
  }
1624
- function parse5(content) {
1665
+ function parse6(content) {
1625
1666
  if (!content || content.trim() === "") {
1626
1667
  return {};
1627
1668
  }
@@ -1687,7 +1728,7 @@ function prune3(obj, shape) {
1687
1728
  return { changed, result };
1688
1729
  }
1689
1730
  var yamlFormat = {
1690
- parse: parse5,
1731
+ parse: parse6,
1691
1732
  serialize: serialize3,
1692
1733
  merge: merge3,
1693
1734
  prune: prune3
@@ -2919,6 +2960,12 @@ function cloneRequires(requires) {
2919
2960
  check: requires.check
2920
2961
  };
2921
2962
  }
2963
+ function cloneCommandExamples(examples) {
2964
+ return (examples ?? []).map((example) => ({
2965
+ title: example.title,
2966
+ params: { ...example.params }
2967
+ }));
2968
+ }
2922
2969
  function parseStackPath(candidate) {
2923
2970
  if (candidate.startsWith("file://")) {
2924
2971
  try {
@@ -3012,9 +3059,11 @@ function createBaseCommand(config2) {
3012
3059
  kind: "command",
3013
3060
  name: config2.name,
3014
3061
  description: config2.description,
3062
+ examples: cloneCommandExamples(config2.examples),
3015
3063
  aliases: [...config2.aliases ?? []],
3016
3064
  positional: [...config2.positional ?? []],
3017
3065
  params: config2.params,
3066
+ result: config2.result,
3018
3067
  secrets: cloneSecrets(config2.secrets),
3019
3068
  scope: resolveCommandScope(config2.scope, void 0),
3020
3069
  confirm: config2.confirm ?? false,
@@ -3026,6 +3075,8 @@ function createBaseCommand(config2) {
3026
3075
  Object.defineProperty(command, commandConfigSymbol, {
3027
3076
  value: {
3028
3077
  scope: cloneScope(config2.scope),
3078
+ examples: cloneCommandExamples(config2.examples),
3079
+ result: config2.result,
3029
3080
  humanInLoop: config2.humanInLoop,
3030
3081
  secrets: cloneSecrets(config2.secrets),
3031
3082
  requires: cloneRequires(config2.requires),
@@ -3043,9 +3094,11 @@ function materializeCommand(command, inherited) {
3043
3094
  kind: "command",
3044
3095
  name: command.name,
3045
3096
  description: command.description,
3097
+ examples: cloneCommandExamples(internal.examples),
3046
3098
  aliases: [...command.aliases],
3047
3099
  positional: [...command.positional],
3048
3100
  params: command.params,
3101
+ result: internal.result,
3049
3102
  secrets: mergeSecrets(inherited.secrets, internal.secrets),
3050
3103
  scope: resolveCommandScope(internal.scope, inherited.scope),
3051
3104
  confirm: command.confirm,
@@ -3057,6 +3110,8 @@ function materializeCommand(command, inherited) {
3057
3110
  Object.defineProperty(materialized, commandConfigSymbol, {
3058
3111
  value: {
3059
3112
  scope: cloneScope(internal.scope),
3113
+ examples: cloneCommandExamples(internal.examples),
3114
+ result: internal.result,
3060
3115
  humanInLoop: internal.humanInLoop,
3061
3116
  secrets: cloneSecrets(internal.secrets),
3062
3117
  requires: cloneRequires(internal.requires),