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
@@ -259,6 +259,12 @@ function cloneRequires(requires) {
259
259
  function cloneStringArray(values) {
260
260
  return values === void 0 ? void 0 : [...values];
261
261
  }
262
+ function cloneCommandExamples(examples) {
263
+ return (examples ?? []).map((example) => ({
264
+ title: example.title,
265
+ params: { ...example.params }
266
+ }));
267
+ }
262
268
  function cloneStringRecord(values) {
263
269
  return values === void 0 ? void 0 : { ...values };
264
270
  }
@@ -404,9 +410,11 @@ function createBaseCommand(config2) {
404
410
  kind: "command",
405
411
  name: config2.name,
406
412
  description: config2.description,
413
+ examples: cloneCommandExamples(config2.examples),
407
414
  aliases: [...config2.aliases ?? []],
408
415
  positional: [...config2.positional ?? []],
409
416
  params: config2.params,
417
+ result: config2.result,
410
418
  secrets: cloneSecrets(config2.secrets),
411
419
  scope: resolveCommandScope(config2.scope, void 0),
412
420
  confirm: config2.confirm ?? false,
@@ -418,6 +426,8 @@ function createBaseCommand(config2) {
418
426
  Object.defineProperty(command, commandConfigSymbol, {
419
427
  value: {
420
428
  scope: cloneScope(config2.scope),
429
+ examples: cloneCommandExamples(config2.examples),
430
+ result: config2.result,
421
431
  humanInLoop: config2.humanInLoop,
422
432
  secrets: cloneSecrets(config2.secrets),
423
433
  requires: cloneRequires(config2.requires),
@@ -466,9 +476,11 @@ function materializeCommand(command, inherited) {
466
476
  kind: "command",
467
477
  name: command.name,
468
478
  description: command.description,
479
+ examples: cloneCommandExamples(internal.examples),
469
480
  aliases: [...command.aliases],
470
481
  positional: [...command.positional],
471
482
  params: command.params,
483
+ result: internal.result,
472
484
  secrets: mergeSecrets(inherited.secrets, internal.secrets),
473
485
  scope: resolveCommandScope(internal.scope, inherited.scope),
474
486
  confirm: command.confirm,
@@ -480,6 +492,8 @@ function materializeCommand(command, inherited) {
480
492
  Object.defineProperty(materialized, commandConfigSymbol, {
481
493
  value: {
482
494
  scope: cloneScope(internal.scope),
495
+ examples: cloneCommandExamples(internal.examples),
496
+ result: internal.result,
483
497
  humanInLoop: internal.humanInLoop,
484
498
  secrets: cloneSecrets(internal.secrets),
485
499
  requires: cloneRequires(internal.requires),
@@ -1566,14 +1580,14 @@ var TerminalSession = class {
1566
1580
  });
1567
1581
  });
1568
1582
  }
1569
- async type(text4) {
1570
- for (const character of text4) {
1583
+ async type(text3) {
1584
+ for (const character of text3) {
1571
1585
  await this.send(character);
1572
1586
  await sleep(TYPE_DELAY_MS);
1573
1587
  }
1574
1588
  }
1575
- async fill(text4) {
1576
- await this.send(text4.replace(/\r?\n/g, "\r"));
1589
+ async fill(text3) {
1590
+ await this.send(text3.replace(/\r?\n/g, "\r"));
1577
1591
  }
1578
1592
  async press(key) {
1579
1593
  await this.send(keyToSequence(key));
@@ -2527,12 +2541,12 @@ var styleNames = Object.keys(ansiStyles);
2527
2541
  function replaceAll(value, search, replacement) {
2528
2542
  return value.split(search).join(replacement);
2529
2543
  }
2530
- function applyStyles(text4, styles) {
2544
+ function applyStyles(text3, styles) {
2531
2545
  if (!supportsColor() || styles.length === 0) {
2532
- return text4;
2546
+ return text3;
2533
2547
  }
2534
2548
  const open = styles.map((style) => style.open).join("");
2535
- const output = text4.includes(reset) ? replaceAll(text4, reset, `${reset}${open}`) : text4;
2549
+ const output = text3.includes(reset) ? replaceAll(text3, reset, `${reset}${open}`) : text3;
2536
2550
  return `${open}${output}${reset}`;
2537
2551
  }
2538
2552
  function clampRgb(value) {
@@ -2576,7 +2590,7 @@ function bgRgbStyle(red, green, blue) {
2576
2590
  };
2577
2591
  }
2578
2592
  function createColor(styles = []) {
2579
- const builder = ((text4) => applyStyles(String(text4), styles));
2593
+ const builder = ((text3) => applyStyles(String(text3), styles));
2580
2594
  for (const name of styleNames) {
2581
2595
  Object.defineProperty(builder, name, {
2582
2596
  configurable: true,
@@ -2645,24 +2659,24 @@ function createPalette(activeBrand, mode) {
2645
2659
  const number2 = isPurple ? color.hex("#0077cc") : active2;
2646
2660
  return withStyles(
2647
2661
  {
2648
- header: (text4) => active2.bold(text4),
2649
- divider: (text4) => color.hex("#666666")(text4),
2650
- prompt: (text4) => prompt2.bold(text4),
2651
- number: (text4) => number2.bold(text4),
2652
- intro: (text4) => color.bgHex(activeBrand.primary).white(` ${getThemeConfig().label} - ${text4} `),
2662
+ header: (text3) => active2.bold(text3),
2663
+ divider: (text3) => color.hex("#666666")(text3),
2664
+ prompt: (text3) => prompt2.bold(text3),
2665
+ number: (text3) => number2.bold(text3),
2666
+ intro: (text3) => color.bgHex(activeBrand.primary).white(` ${getThemeConfig().label} - ${text3} `),
2653
2667
  get resolvedSymbol() {
2654
2668
  return active2("\u25C7");
2655
2669
  },
2656
2670
  get errorSymbol() {
2657
2671
  return color.hex("#cc0000")("\u25A0");
2658
2672
  },
2659
- accent: (text4) => prompt2.bold(text4),
2660
- muted: (text4) => color.hex("#666666")(text4),
2661
- success: (text4) => color.hex("#008800")(text4),
2662
- warning: (text4) => color.hex("#cc6600")(text4),
2663
- error: (text4) => color.hex("#cc0000")(text4),
2664
- info: (text4) => active2(text4),
2665
- badge: (text4) => color.bgHex("#cc6600").white(` ${text4} `)
2673
+ accent: (text3) => prompt2.bold(text3),
2674
+ muted: (text3) => color.hex("#666666")(text3),
2675
+ success: (text3) => color.hex("#008800")(text3),
2676
+ warning: (text3) => color.hex("#cc6600")(text3),
2677
+ error: (text3) => color.hex("#cc0000")(text3),
2678
+ info: (text3) => active2(text3),
2679
+ badge: (text3) => color.bgHex("#cc6600").white(` ${text3} `)
2666
2680
  },
2667
2681
  {
2668
2682
  accent: { fg: isPurple ? "#006699" : activeBrand.primary, bold: true },
@@ -2681,24 +2695,24 @@ function createPalette(activeBrand, mode) {
2681
2695
  const number = isPurple ? color.cyanBright : active;
2682
2696
  return withStyles(
2683
2697
  {
2684
- header: (text4) => activeBright.bold(text4),
2685
- divider: (text4) => color.dim(text4),
2686
- prompt: (text4) => prompt(text4),
2687
- number: (text4) => number(text4),
2688
- intro: (text4) => activeBackground.white(` ${getThemeConfig().label} - ${text4} `),
2698
+ header: (text3) => activeBright.bold(text3),
2699
+ divider: (text3) => color.dim(text3),
2700
+ prompt: (text3) => prompt(text3),
2701
+ number: (text3) => number(text3),
2702
+ intro: (text3) => activeBackground.white(` ${getThemeConfig().label} - ${text3} `),
2689
2703
  get resolvedSymbol() {
2690
2704
  return active("\u25C7");
2691
2705
  },
2692
2706
  get errorSymbol() {
2693
2707
  return color.red("\u25A0");
2694
2708
  },
2695
- accent: (text4) => prompt(text4),
2696
- muted: (text4) => color.dim(text4),
2697
- success: (text4) => color.green(text4),
2698
- warning: (text4) => color.yellow(text4),
2699
- error: (text4) => color.red(text4),
2700
- info: (text4) => active(text4),
2701
- badge: (text4) => color.bgYellow.black(` ${text4} `)
2709
+ accent: (text3) => prompt(text3),
2710
+ muted: (text3) => color.dim(text3),
2711
+ success: (text3) => color.green(text3),
2712
+ warning: (text3) => color.yellow(text3),
2713
+ error: (text3) => color.red(text3),
2714
+ info: (text3) => active(text3),
2715
+ badge: (text3) => color.bgYellow.black(` ${text3} `)
2702
2716
  },
2703
2717
  {
2704
2718
  accent: { fg: isPurple ? "cyan" : activeBrand.primary, bold: true },
@@ -2855,7 +2869,7 @@ function renderMarkdownInline(value) {
2855
2869
  return stripAnsi2(value).replaceAll("\r\n", " ").replaceAll("\n", " ").replaceAll("\r", " ");
2856
2870
  }
2857
2871
  function writeTerminalMessage(msg, {
2858
- symbol = color.gray("\u2502"),
2872
+ symbol: symbol2 = color.gray("\u2502"),
2859
2873
  secondarySymbol = color.gray("\u2502"),
2860
2874
  spacing: spacing2 = 1,
2861
2875
  withGuide = true
@@ -2863,7 +2877,7 @@ function writeTerminalMessage(msg, {
2863
2877
  const lines = [];
2864
2878
  const showGuide = withGuide !== false;
2865
2879
  const contentLines = msg.split("\n");
2866
- const prefix = showGuide ? `${symbol} ` : "";
2880
+ const prefix = showGuide ? `${symbol2} ` : "";
2867
2881
  const continuationPrefix = showGuide ? `${secondarySymbol} ` : "";
2868
2882
  const emptyGuide = showGuide ? secondarySymbol : "";
2869
2883
  for (let index = 0; index < spacing2; index += 1) {
@@ -2877,7 +2891,7 @@ function writeTerminalMessage(msg, {
2877
2891
  if (firstLine.length > 0) {
2878
2892
  lines.push(`${prefix}${firstLine}`);
2879
2893
  } else {
2880
- lines.push(showGuide ? symbol : "");
2894
+ lines.push(showGuide ? symbol2 : "");
2881
2895
  }
2882
2896
  for (const line of continuationLines) {
2883
2897
  if (line.length > 0) {
@@ -3027,12 +3041,12 @@ function createLogger(emitter) {
3027
3041
  log.message(`${label}
3028
3042
  ${value}`, { symbol: symbols.errorResolved });
3029
3043
  },
3030
- message(message2, symbol) {
3044
+ message(message2, symbol2) {
3031
3045
  if (emitter) {
3032
3046
  emitter(message2);
3033
3047
  return;
3034
3048
  }
3035
- log.message(message2, { symbol: symbol ?? color.gray("\u2502") });
3049
+ log.message(message2, { symbol: symbol2 ?? color.gray("\u2502") });
3036
3050
  }
3037
3051
  };
3038
3052
  }
@@ -3460,6 +3474,12 @@ function hasProperty(value, key) {
3460
3474
  import { spawn as spawn2 } from "node:child_process";
3461
3475
  import process2 from "node:process";
3462
3476
 
3477
+ // ../frontmatter/src/parse.ts
3478
+ import { LineCounter, parse, parseDocument } from "yaml";
3479
+
3480
+ // ../frontmatter/src/stringify.ts
3481
+ import { stringify } from "yaml";
3482
+
3463
3483
  // ../toolcraft-design/src/acp/writer.ts
3464
3484
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
3465
3485
  var storage = new AsyncLocalStorage2();
@@ -3480,11 +3500,46 @@ var REGION_MODAL = 1 << 4;
3480
3500
  var REGION_TOAST = 1 << 5;
3481
3501
  var REGION_ALL = REGION_HEADER | REGION_LIST | REGION_DETAIL | REGION_FOOTER | REGION_MODAL | REGION_TOAST;
3482
3502
 
3483
- // ../toolcraft-design/src/prompts/index.ts
3484
- import * as clack from "@clack/prompts";
3503
+ // ../toolcraft-design/src/prompts/interactive/glyphs.ts
3504
+ function supportsUnicode() {
3505
+ if (!process.platform.startsWith("win")) {
3506
+ return process.env.TERM !== "linux";
3507
+ }
3508
+ return Boolean(
3509
+ 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"
3510
+ );
3511
+ }
3512
+ var UNICODE = supportsUnicode();
3513
+ function glyph(unicode, ascii) {
3514
+ return UNICODE ? unicode : ascii;
3515
+ }
3516
+ var GLYPHS = {
3517
+ stepActive: glyph("\u25C6", "*"),
3518
+ stepCancel: glyph("\u25A0", "x"),
3519
+ stepError: glyph("\u25B2", "x"),
3520
+ stepSubmit: glyph("\u25C7", "o"),
3521
+ barStart: glyph("\u250C", "T"),
3522
+ bar: glyph("\u2502", "|"),
3523
+ barEnd: glyph("\u2514", "-"),
3524
+ radioActive: glyph("\u25CF", ">"),
3525
+ radioInactive: glyph("\u25CB", " "),
3526
+ checkboxActive: glyph("\u25FB", "[ ]"),
3527
+ checkboxSelected: glyph("\u25FC", "[+]"),
3528
+ checkboxInactive: glyph("\u25FB", "[ ]"),
3529
+ passwordMask: glyph("\u2022", "*"),
3530
+ ellipsis: "..."
3531
+ };
3532
+
3533
+ // ../toolcraft-design/src/prompts/interactive/core.ts
3534
+ import { EventEmitter as EventEmitter2 } from "node:events";
3535
+ import * as readline2 from "node:readline";
3536
+
3537
+ // ../toolcraft-design/src/prompts/interactive/wrap.ts
3538
+ import { wrapAnsi } from "fast-wrap-ansi";
3539
+ import stringWidth from "fast-string-width";
3485
3540
 
3486
- // ../toolcraft-design/src/prompts/primitives/cancel.ts
3487
- import { isCancel } from "@clack/prompts";
3541
+ // ../toolcraft-design/src/prompts/interactive/pagination.ts
3542
+ import { wrapAnsi as wrapAnsi2 } from "fast-wrap-ansi";
3488
3543
 
3489
3544
  // ../toolcraft-design/src/static/spinner.ts
3490
3545
  var SPINNER_FRAMES = Object.freeze(["\u25D2", "\u25D0", "\u25D3", "\u25D1"]);
@@ -3532,7 +3587,7 @@ function detectIndent(content) {
3532
3587
  }
3533
3588
  return " ";
3534
3589
  }
3535
- function parse3(content) {
3590
+ function parse4(content) {
3536
3591
  if (!content || content.trim() === "") {
3537
3592
  return {};
3538
3593
  }
@@ -3657,7 +3712,7 @@ function applyObjectUpdate(content, path10, current, next) {
3657
3712
  return result;
3658
3713
  }
3659
3714
  var jsonFormat = {
3660
- parse: parse3,
3715
+ parse: parse4,
3661
3716
  serialize,
3662
3717
  serializeUpdate,
3663
3718
  merge,
@@ -3669,7 +3724,7 @@ import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
3669
3724
  function isConfigObject2(value) {
3670
3725
  return typeof value === "object" && value !== null && !Array.isArray(value);
3671
3726
  }
3672
- function parse4(content) {
3727
+ function parse5(content) {
3673
3728
  if (!content || content.trim() === "") {
3674
3729
  return {};
3675
3730
  }
@@ -3735,7 +3790,7 @@ function prune2(obj, shape) {
3735
3790
  return { changed, result };
3736
3791
  }
3737
3792
  var tomlFormat = {
3738
- parse: parse4,
3793
+ parse: parse5,
3739
3794
  serialize: serialize2,
3740
3795
  merge: merge2,
3741
3796
  prune: prune2
@@ -3746,7 +3801,7 @@ import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
3746
3801
  function isConfigObject3(value) {
3747
3802
  return typeof value === "object" && value !== null && !Array.isArray(value);
3748
3803
  }
3749
- function parse5(content) {
3804
+ function parse6(content) {
3750
3805
  if (!content || content.trim() === "") {
3751
3806
  return {};
3752
3807
  }
@@ -3812,7 +3867,7 @@ function prune3(obj, shape) {
3812
3867
  return { changed, result };
3813
3868
  }
3814
3869
  var yamlFormat = {
3815
- parse: parse5,
3870
+ parse: parse6,
3816
3871
  serialize: serialize3,
3817
3872
  merge: merge3,
3818
3873
  prune: prune3
@@ -5073,17 +5128,17 @@ function colorsEqual(left, right) {
5073
5128
  }
5074
5129
  return false;
5075
5130
  }
5076
- function pushRun(runs, style, text4) {
5077
- if (text4.length === 0) {
5131
+ function pushRun(runs, style, text3) {
5132
+ if (text3.length === 0) {
5078
5133
  return;
5079
5134
  }
5080
5135
  const previous = runs.at(-1);
5081
- if (previous && text4 !== "\n" && previous.text !== "\n" && stylesEqual(previous, style)) {
5082
- previous.text += text4;
5136
+ if (previous && text3 !== "\n" && previous.text !== "\n" && stylesEqual(previous, style)) {
5137
+ previous.text += text3;
5083
5138
  return;
5084
5139
  }
5085
5140
  runs.push({
5086
- text: text4,
5141
+ text: text3,
5087
5142
  fg: style.fg,
5088
5143
  bg: style.bg,
5089
5144
  bold: style.bold,
@@ -5413,10 +5468,10 @@ function parseAnsi2(input) {
5413
5468
  continue;
5414
5469
  }
5415
5470
  const codePoint = input.codePointAt(index);
5416
- const text4 = codePoint === void 0 ? "" : String.fromCodePoint(codePoint);
5417
- lines[row][column] = { text: text4, style: cloneStyle(style) };
5471
+ const text3 = codePoint === void 0 ? "" : String.fromCodePoint(codePoint);
5472
+ lines[row][column] = { text: text3, style: cloneStyle(style) };
5418
5473
  column += 1;
5419
- index += text4.length;
5474
+ index += text3.length;
5420
5475
  }
5421
5476
  return buildRuns(lines, lineBreakStyles);
5422
5477
  }
@@ -5827,10 +5882,10 @@ function measureLines(lines) {
5827
5882
  0
5828
5883
  );
5829
5884
  }
5830
- function displayWidth2(text4, startColumn = 0) {
5885
+ function displayWidth2(text3, startColumn = 0) {
5831
5886
  const segmenter = new Intl.Segmenter();
5832
5887
  let column = startColumn;
5833
- for (const { segment } of segmenter.segment(text4)) {
5888
+ for (const { segment } of segmenter.segment(text3)) {
5834
5889
  if (segment === " ") {
5835
5890
  column += 8 - column % 8;
5836
5891
  continue;
@@ -5923,8 +5978,8 @@ function renderRun(run) {
5923
5978
  if (run.dim) {
5924
5979
  attributes.push('opacity="0.7"');
5925
5980
  }
5926
- const text4 = run.conceal ? " ".repeat(displayWidth2(run.text)) : run.text;
5927
- return `<tspan ${attributes.join(" ")}>${escapeXmlText(text4)}</tspan>`;
5981
+ const text3 = run.conceal ? " ".repeat(displayWidth2(run.text)) : run.text;
5982
+ return `<tspan ${attributes.join(" ")}>${escapeXmlText(text3)}</tspan>`;
5928
5983
  }
5929
5984
  function renderWindowControls() {
5930
5985
  return [