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
package/dist/cli.js CHANGED
@@ -65,12 +65,12 @@ var styleNames = Object.keys(ansiStyles);
65
65
  function replaceAll(value, search, replacement) {
66
66
  return value.split(search).join(replacement);
67
67
  }
68
- function applyStyles(text5, styles) {
68
+ function applyStyles(text4, styles) {
69
69
  if (!supportsColor() || styles.length === 0) {
70
- return text5;
70
+ return text4;
71
71
  }
72
72
  const open = styles.map((style) => style.open).join("");
73
- const output = text5.includes(reset) ? replaceAll(text5, reset, `${reset}${open}`) : text5;
73
+ const output = text4.includes(reset) ? replaceAll(text4, reset, `${reset}${open}`) : text4;
74
74
  return `${open}${output}${reset}`;
75
75
  }
76
76
  function clampRgb(value) {
@@ -114,7 +114,7 @@ function bgRgbStyle(red, green, blue) {
114
114
  };
115
115
  }
116
116
  function createColor(styles = []) {
117
- const builder = ((text5) => applyStyles(String(text5), styles));
117
+ const builder = ((text4) => applyStyles(String(text4), styles));
118
118
  for (const name of styleNames) {
119
119
  Object.defineProperty(builder, name, {
120
120
  configurable: true,
@@ -196,24 +196,24 @@ function createPalette(activeBrand, mode) {
196
196
  const number2 = isPurple ? color.hex("#0077cc") : active2;
197
197
  return withStyles(
198
198
  {
199
- header: (text5) => active2.bold(text5),
200
- divider: (text5) => color.hex("#666666")(text5),
201
- prompt: (text5) => prompt2.bold(text5),
202
- number: (text5) => number2.bold(text5),
203
- intro: (text5) => color.bgHex(activeBrand.primary).white(` ${getThemeConfig().label} - ${text5} `),
199
+ header: (text4) => active2.bold(text4),
200
+ divider: (text4) => color.hex("#666666")(text4),
201
+ prompt: (text4) => prompt2.bold(text4),
202
+ number: (text4) => number2.bold(text4),
203
+ intro: (text4) => color.bgHex(activeBrand.primary).white(` ${getThemeConfig().label} - ${text4} `),
204
204
  get resolvedSymbol() {
205
205
  return active2("\u25C7");
206
206
  },
207
207
  get errorSymbol() {
208
208
  return color.hex("#cc0000")("\u25A0");
209
209
  },
210
- accent: (text5) => prompt2.bold(text5),
211
- muted: (text5) => color.hex("#666666")(text5),
212
- success: (text5) => color.hex("#008800")(text5),
213
- warning: (text5) => color.hex("#cc6600")(text5),
214
- error: (text5) => color.hex("#cc0000")(text5),
215
- info: (text5) => active2(text5),
216
- badge: (text5) => color.bgHex("#cc6600").white(` ${text5} `)
210
+ accent: (text4) => prompt2.bold(text4),
211
+ muted: (text4) => color.hex("#666666")(text4),
212
+ success: (text4) => color.hex("#008800")(text4),
213
+ warning: (text4) => color.hex("#cc6600")(text4),
214
+ error: (text4) => color.hex("#cc0000")(text4),
215
+ info: (text4) => active2(text4),
216
+ badge: (text4) => color.bgHex("#cc6600").white(` ${text4} `)
217
217
  },
218
218
  {
219
219
  accent: { fg: isPurple ? "#006699" : activeBrand.primary, bold: true },
@@ -232,24 +232,24 @@ function createPalette(activeBrand, mode) {
232
232
  const number = isPurple ? color.cyanBright : active;
233
233
  return withStyles(
234
234
  {
235
- header: (text5) => activeBright.bold(text5),
236
- divider: (text5) => color.dim(text5),
237
- prompt: (text5) => prompt(text5),
238
- number: (text5) => number(text5),
239
- intro: (text5) => activeBackground.white(` ${getThemeConfig().label} - ${text5} `),
235
+ header: (text4) => activeBright.bold(text4),
236
+ divider: (text4) => color.dim(text4),
237
+ prompt: (text4) => prompt(text4),
238
+ number: (text4) => number(text4),
239
+ intro: (text4) => activeBackground.white(` ${getThemeConfig().label} - ${text4} `),
240
240
  get resolvedSymbol() {
241
241
  return active("\u25C7");
242
242
  },
243
243
  get errorSymbol() {
244
244
  return color.red("\u25A0");
245
245
  },
246
- accent: (text5) => prompt(text5),
247
- muted: (text5) => color.dim(text5),
248
- success: (text5) => color.green(text5),
249
- warning: (text5) => color.yellow(text5),
250
- error: (text5) => color.red(text5),
251
- info: (text5) => active(text5),
252
- badge: (text5) => color.bgYellow.black(` ${text5} `)
246
+ accent: (text4) => prompt(text4),
247
+ muted: (text4) => color.dim(text4),
248
+ success: (text4) => color.green(text4),
249
+ warning: (text4) => color.yellow(text4),
250
+ error: (text4) => color.red(text4),
251
+ info: (text4) => active(text4),
252
+ badge: (text4) => color.bgYellow.black(` ${text4} `)
253
253
  },
254
254
  {
255
255
  accent: { fg: isPurple ? "cyan" : activeBrand.primary, bold: true },
@@ -266,11 +266,11 @@ var light = createPalette(brands.purple, "light");
266
266
 
267
267
  // ../toolcraft-design/src/tokens/typography.ts
268
268
  var typography = {
269
- bold: (text5) => color.bold(text5),
270
- dim: (text5) => color.dim(text5),
271
- italic: (text5) => color.italic(text5),
272
- underline: (text5) => color.underline(text5),
273
- strikethrough: (text5) => color.strikethrough(text5)
269
+ bold: (text4) => color.bold(text4),
270
+ dim: (text4) => color.dim(text4),
271
+ italic: (text4) => color.italic(text4),
272
+ underline: (text4) => color.underline(text4),
273
+ strikethrough: (text4) => color.strikethrough(text4)
274
274
  };
275
275
 
276
276
  // ../toolcraft-design/src/tokens/widths.ts
@@ -541,7 +541,7 @@ function renderMarkdownInline2(value) {
541
541
  return stripAnsi(value).replaceAll("\r\n", " ").replaceAll("\n", " ").replaceAll("\r", " ");
542
542
  }
543
543
  function writeTerminalMessage(msg, {
544
- symbol = color.gray("\u2502"),
544
+ symbol: symbol2 = color.gray("\u2502"),
545
545
  secondarySymbol = color.gray("\u2502"),
546
546
  spacing: spacing2 = 1,
547
547
  withGuide = true
@@ -549,7 +549,7 @@ function writeTerminalMessage(msg, {
549
549
  const lines = [];
550
550
  const showGuide = withGuide !== false;
551
551
  const contentLines = msg.split("\n");
552
- const prefix = showGuide ? `${symbol} ` : "";
552
+ const prefix = showGuide ? `${symbol2} ` : "";
553
553
  const continuationPrefix = showGuide ? `${secondarySymbol} ` : "";
554
554
  const emptyGuide = showGuide ? secondarySymbol : "";
555
555
  for (let index = 0; index < spacing2; index += 1) {
@@ -563,7 +563,7 @@ function writeTerminalMessage(msg, {
563
563
  if (firstLine.length > 0) {
564
564
  lines.push(`${prefix}${firstLine}`);
565
565
  } else {
566
- lines.push(showGuide ? symbol : "");
566
+ lines.push(showGuide ? symbol2 : "");
567
567
  }
568
568
  for (const line of continuationLines) {
569
569
  if (line.length > 0) {
@@ -713,12 +713,12 @@ function createLogger(emitter) {
713
713
  log.message(`${label}
714
714
  ${value}`, { symbol: symbols.errorResolved });
715
715
  },
716
- message(message2, symbol) {
716
+ message(message2, symbol2) {
717
717
  if (emitter) {
718
718
  emitter(message2);
719
719
  return;
720
720
  }
721
- log.message(message2, { symbol: symbol ?? color.gray("\u2502") });
721
+ log.message(message2, { symbol: symbol2 ?? color.gray("\u2502") });
722
722
  }
723
723
  };
724
724
  }
@@ -1521,18 +1521,18 @@ function getStandalone(template, tagStart, tagEnd, kind) {
1521
1521
  if (!isWhitespace3(template.slice(lineStart, tagStart))) {
1522
1522
  return void 0;
1523
1523
  }
1524
- let cursor = tagEnd;
1525
- while (cursor < template.length && (template[cursor] === " " || template[cursor] === " ")) {
1526
- cursor += 1;
1524
+ let cursor2 = tagEnd;
1525
+ while (cursor2 < template.length && (template[cursor2] === " " || template[cursor2] === " ")) {
1526
+ cursor2 += 1;
1527
1527
  }
1528
- if (template.startsWith("\r\n", cursor)) {
1529
- return { lineStart, nextIndex: cursor + 2 };
1528
+ if (template.startsWith("\r\n", cursor2)) {
1529
+ return { lineStart, nextIndex: cursor2 + 2 };
1530
1530
  }
1531
- if (template[cursor] === "\n") {
1532
- return { lineStart, nextIndex: cursor + 1 };
1531
+ if (template[cursor2] === "\n") {
1532
+ return { lineStart, nextIndex: cursor2 + 1 };
1533
1533
  }
1534
- if (cursor === template.length) {
1535
- return { lineStart, nextIndex: cursor };
1534
+ if (cursor2 === template.length) {
1535
+ return { lineStart, nextIndex: cursor2 };
1536
1536
  }
1537
1537
  return void 0;
1538
1538
  }
@@ -1630,13 +1630,13 @@ function lookup(context, name) {
1630
1630
  if (name === ".") {
1631
1631
  return { hit: true, value: callLambda(context.view, context.view) };
1632
1632
  }
1633
- let cursor = context;
1634
- while (cursor !== void 0) {
1635
- const result = name.includes(".") ? lookupDotted(cursor.view, name) : lookupName(cursor.view, name);
1633
+ let cursor2 = context;
1634
+ while (cursor2 !== void 0) {
1635
+ const result = name.includes(".") ? lookupDotted(cursor2.view, name) : lookupName(cursor2.view, name);
1636
1636
  if (result.hit) {
1637
- return { hit: true, value: callLambda(result.value, cursor.view) };
1637
+ return { hit: true, value: callLambda(result.value, cursor2.view) };
1638
1638
  }
1639
- cursor = cursor.parent;
1639
+ cursor2 = cursor2.parent;
1640
1640
  }
1641
1641
  return { hit: false, value: void 0 };
1642
1642
  }
@@ -1800,6 +1800,12 @@ function hasProperty(value, key2) {
1800
1800
  import { spawn } from "node:child_process";
1801
1801
  import process2 from "node:process";
1802
1802
 
1803
+ // ../frontmatter/src/parse.ts
1804
+ import { LineCounter, parse, parseDocument } from "yaml";
1805
+
1806
+ // ../frontmatter/src/stringify.ts
1807
+ import { stringify } from "yaml";
1808
+
1803
1809
  // ../toolcraft-design/src/acp/writer.ts
1804
1810
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
1805
1811
  var storage = new AsyncLocalStorage2();
@@ -1820,11 +1826,629 @@ var REGION_MODAL = 1 << 4;
1820
1826
  var REGION_TOAST = 1 << 5;
1821
1827
  var REGION_ALL = REGION_HEADER | REGION_LIST | REGION_DETAIL | REGION_FOOTER | REGION_MODAL | REGION_TOAST;
1822
1828
 
1823
- // ../toolcraft-design/src/prompts/index.ts
1824
- import * as clack from "@clack/prompts";
1829
+ // ../toolcraft-design/src/prompts/interactive/glyphs.ts
1830
+ function supportsUnicode() {
1831
+ if (!process.platform.startsWith("win")) {
1832
+ return process.env.TERM !== "linux";
1833
+ }
1834
+ return Boolean(
1835
+ 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"
1836
+ );
1837
+ }
1838
+ var UNICODE = supportsUnicode();
1839
+ function glyph(unicode, ascii) {
1840
+ return UNICODE ? unicode : ascii;
1841
+ }
1842
+ var GLYPHS = {
1843
+ stepActive: glyph("\u25C6", "*"),
1844
+ stepCancel: glyph("\u25A0", "x"),
1845
+ stepError: glyph("\u25B2", "x"),
1846
+ stepSubmit: glyph("\u25C7", "o"),
1847
+ barStart: glyph("\u250C", "T"),
1848
+ bar: glyph("\u2502", "|"),
1849
+ barEnd: glyph("\u2514", "-"),
1850
+ radioActive: glyph("\u25CF", ">"),
1851
+ radioInactive: glyph("\u25CB", " "),
1852
+ checkboxActive: glyph("\u25FB", "[ ]"),
1853
+ checkboxSelected: glyph("\u25FC", "[+]"),
1854
+ checkboxInactive: glyph("\u25FB", "[ ]"),
1855
+ passwordMask: glyph("\u2022", "*"),
1856
+ ellipsis: "..."
1857
+ };
1858
+ function symbol(state) {
1859
+ if (state === "cancel") return color.red(GLYPHS.stepCancel);
1860
+ if (state === "error") return color.yellow(GLYPHS.stepError);
1861
+ if (state === "submit") return color.green(GLYPHS.stepSubmit);
1862
+ return color.cyan(GLYPHS.stepActive);
1863
+ }
1864
+ function symbolBar(state) {
1865
+ if (state === "cancel") return color.red(GLYPHS.bar);
1866
+ if (state === "error") return color.yellow(GLYPHS.bar);
1867
+ if (state === "submit") return color.green(GLYPHS.bar);
1868
+ return color.cyan(GLYPHS.bar);
1869
+ }
1870
+
1871
+ // ../toolcraft-design/src/prompts/interactive/core.ts
1872
+ import { EventEmitter } from "node:events";
1873
+ import * as readline2 from "node:readline";
1874
+
1875
+ // ../toolcraft-design/src/prompts/interactive/cancel-symbol.ts
1876
+ var CANCEL = /* @__PURE__ */ Symbol.for("poe.cancel");
1877
+ function isCancel(value) {
1878
+ return value === CANCEL;
1879
+ }
1880
+
1881
+ // ../toolcraft-design/src/prompts/interactive/keys.ts
1882
+ var aliases = {
1883
+ k: "up",
1884
+ j: "down",
1885
+ h: "left",
1886
+ l: "right"
1887
+ };
1888
+ var keyActions = {
1889
+ up: "up",
1890
+ down: "down",
1891
+ left: "left",
1892
+ right: "right",
1893
+ space: "space",
1894
+ return: "enter",
1895
+ enter: "enter",
1896
+ escape: "cancel"
1897
+ };
1898
+ function mapKey(name, char) {
1899
+ if (char === "") {
1900
+ return "cancel";
1901
+ }
1902
+ if (char === " ") {
1903
+ return "space";
1904
+ }
1905
+ if (!name) {
1906
+ return void 0;
1907
+ }
1908
+ return keyActions[name] ?? aliases[name];
1909
+ }
1910
+
1911
+ // ../toolcraft-design/src/prompts/interactive/wrap.ts
1912
+ import { wrapAnsi } from "fast-wrap-ansi";
1913
+ import stringWidth from "fast-string-width";
1914
+ function getColumns(output) {
1915
+ return Math.max(1, output.columns ?? 80);
1916
+ }
1917
+ function getRows(output) {
1918
+ return Math.max(1, output.rows ?? 20);
1919
+ }
1920
+ function wrapFrame(output, frame) {
1921
+ return wrapAnsi(frame, getColumns(output), { hard: true, trim: false });
1922
+ }
1923
+
1924
+ // ../toolcraft-design/src/prompts/interactive/core.ts
1925
+ var cursor = {
1926
+ hide: "\x1B[?25l",
1927
+ show: "\x1B[?25h",
1928
+ move: (x, y) => {
1929
+ let output = "";
1930
+ if (x < 0) output += `\x1B[${-x}D`;
1931
+ if (x > 0) output += `\x1B[${x}C`;
1932
+ if (y < 0) output += `\x1B[${-y}A`;
1933
+ if (y > 0) output += `\x1B[${y}B`;
1934
+ return output;
1935
+ }
1936
+ };
1937
+ var erase = {
1938
+ down: "\x1B[J"
1939
+ };
1940
+ var Prompt = class extends EventEmitter {
1941
+ state = "initial";
1942
+ value;
1943
+ error = "";
1944
+ userInput = "";
1945
+ _cursor = 0;
1946
+ input;
1947
+ output;
1948
+ renderFrame;
1949
+ validate;
1950
+ signal;
1951
+ trackValue;
1952
+ previousFrame = "";
1953
+ readlineInterface;
1954
+ abortListener;
1955
+ closed = false;
1956
+ constructor(opts, trackValue = true) {
1957
+ super();
1958
+ this.input = opts.input ?? process.stdin;
1959
+ this.output = opts.output ?? process.stdout;
1960
+ this.renderFrame = opts.render;
1961
+ this.validate = opts.validate;
1962
+ this.signal = opts.signal;
1963
+ this.value = opts.initialValue;
1964
+ this.trackValue = trackValue;
1965
+ this.userInput = opts.initialUserInput ?? "";
1966
+ this._cursor = this.userInput.length;
1967
+ }
1968
+ get cursor() {
1969
+ return this._cursor;
1970
+ }
1971
+ prompt() {
1972
+ if (this.signal?.aborted) {
1973
+ this.state = "cancel";
1974
+ return Promise.resolve(CANCEL);
1975
+ }
1976
+ if (this.input.isTTY !== true) {
1977
+ return this.promptNonTty();
1978
+ }
1979
+ return new Promise((resolve) => {
1980
+ const onSubmit = (value) => resolve(value);
1981
+ const onCancel = () => resolve(CANCEL);
1982
+ this.once("submit", onSubmit);
1983
+ this.once("cancel", onCancel);
1984
+ this.abortListener = () => {
1985
+ this.state = "cancel";
1986
+ this.emit("finalize");
1987
+ this.render();
1988
+ this.close();
1989
+ };
1990
+ this.signal?.addEventListener("abort", this.abortListener, { once: true });
1991
+ this.readlineInterface = readline2.createInterface({
1992
+ input: this.input,
1993
+ output: void 0,
1994
+ tabSize: 2,
1995
+ prompt: "",
1996
+ escapeCodeTimeout: 50,
1997
+ terminal: true
1998
+ });
1999
+ readline2.emitKeypressEvents(this.input, this.readlineInterface);
2000
+ this.readlineInterface.prompt();
2001
+ this.input.on("keypress", this.onKeypress);
2002
+ if (this.input.setRawMode) {
2003
+ this.input.setRawMode(true);
2004
+ }
2005
+ this.output.on("resize", this.render);
2006
+ this.render();
2007
+ });
2008
+ }
2009
+ promptNonTty() {
2010
+ return Promise.reject(new Error("Interactive prompt requires a TTY. Set POE_NO_PROMPT=1 to accept defaults non-interactively."));
2011
+ }
2012
+ readNonTtyLine() {
2013
+ return new Promise((resolve) => {
2014
+ const rl = readline2.createInterface({ input: this.input, terminal: false });
2015
+ let settled = false;
2016
+ const settle = (value) => {
2017
+ if (settled) {
2018
+ return;
2019
+ }
2020
+ settled = true;
2021
+ rl.close();
2022
+ resolve(value);
2023
+ };
2024
+ rl.once("line", settle);
2025
+ rl.once("close", () => settle(rl.line));
2026
+ });
2027
+ }
2028
+ setValue(value) {
2029
+ this.value = value;
2030
+ this.emit("value", value);
2031
+ }
2032
+ setError(message2) {
2033
+ this.error = message2;
2034
+ }
2035
+ setUserInput(value) {
2036
+ this.userInput = value;
2037
+ this._cursor = Math.min(this._cursor, this.userInput.length);
2038
+ this.emit("userInput", this.userInput);
2039
+ }
2040
+ clearUserInput() {
2041
+ this.userInput = "";
2042
+ this._cursor = 0;
2043
+ this.emit("userInput", this.userInput);
2044
+ }
2045
+ onKeypress = (char, key2 = {}) => {
2046
+ let action = mapKey(key2.name, char);
2047
+ if (this.trackValue && char && char >= " " && key2.name !== "return" && key2.name !== "enter" && key2.name !== "escape") {
2048
+ action = void 0;
2049
+ }
2050
+ if (this.trackValue && action !== "enter") {
2051
+ this.updateTrackedInput(char, key2, action);
2052
+ }
2053
+ if (this.state === "error") {
2054
+ this.state = "active";
2055
+ this.error = "";
2056
+ }
2057
+ if (!this.trackValue && action) {
2058
+ this.emit("cursor", action);
2059
+ } else if (this.trackValue && action && action !== "enter") {
2060
+ this.emit("cursor", action);
2061
+ }
2062
+ if (char && /^[yn]$/i.test(char)) {
2063
+ this.emit("confirm", char.toLowerCase() === "y");
2064
+ }
2065
+ if (char) {
2066
+ this.emit("key", char.toLowerCase(), key2);
2067
+ }
2068
+ if (action === "enter") {
2069
+ const error3 = this.validate?.(this.value);
2070
+ if (error3) {
2071
+ this.error = error3 instanceof Error ? error3.message : error3;
2072
+ this.state = "error";
2073
+ } else {
2074
+ this.state = "submit";
2075
+ }
2076
+ }
2077
+ if (action === "cancel") {
2078
+ this.state = "cancel";
2079
+ }
2080
+ if (this.state === "submit" || this.state === "cancel") {
2081
+ this.emit("finalize");
2082
+ }
2083
+ this.render();
2084
+ if (this.state === "submit" || this.state === "cancel") {
2085
+ this.close();
2086
+ }
2087
+ };
2088
+ updateTrackedInput(char, key2, action) {
2089
+ if (key2.ctrl) {
2090
+ if (key2.name === "a") {
2091
+ this._cursor = 0;
2092
+ return;
2093
+ }
2094
+ if (key2.name === "e") {
2095
+ this._cursor = this.userInput.length;
2096
+ return;
2097
+ }
2098
+ if (key2.name === "u") {
2099
+ this.userInput = this.userInput.slice(this._cursor);
2100
+ this._cursor = 0;
2101
+ this.emit("userInput", this.userInput);
2102
+ return;
2103
+ }
2104
+ if (key2.name === "k") {
2105
+ this.userInput = this.userInput.slice(0, this._cursor);
2106
+ this.emit("userInput", this.userInput);
2107
+ return;
2108
+ }
2109
+ }
2110
+ if (action === "left") {
2111
+ this._cursor = Math.max(0, this._cursor - 1);
2112
+ return;
2113
+ }
2114
+ if (action === "right") {
2115
+ this._cursor = Math.min(this.userInput.length, this._cursor + 1);
2116
+ return;
2117
+ }
2118
+ if (action === "cancel" || action === "up" || action === "down" || action === "space") {
2119
+ return;
2120
+ }
2121
+ if (key2.name === "backspace" || char === "\b" || char === "\x7F") {
2122
+ if (this._cursor > 0) {
2123
+ this.userInput = `${this.userInput.slice(0, this._cursor - 1)}${this.userInput.slice(this._cursor)}`;
2124
+ this._cursor -= 1;
2125
+ this.emit("userInput", this.userInput);
2126
+ }
2127
+ return;
2128
+ }
2129
+ if (key2.name === "delete") {
2130
+ if (this._cursor < this.userInput.length) {
2131
+ this.userInput = `${this.userInput.slice(0, this._cursor)}${this.userInput.slice(this._cursor + 1)}`;
2132
+ this.emit("userInput", this.userInput);
2133
+ }
2134
+ return;
2135
+ }
2136
+ if (!char || char < " " || key2.ctrl) {
2137
+ return;
2138
+ }
2139
+ this.userInput = `${this.userInput.slice(0, this._cursor)}${char}${this.userInput.slice(this._cursor)}`;
2140
+ this._cursor += char.length;
2141
+ this.emit("userInput", this.userInput);
2142
+ }
2143
+ render = () => {
2144
+ if (this.closed) {
2145
+ return;
2146
+ }
2147
+ const frame = wrapFrame(this.output, this.renderFrame(this) ?? "");
2148
+ if (frame === this.previousFrame) {
2149
+ return;
2150
+ }
2151
+ if (!this.previousFrame) {
2152
+ this.output.write(`${cursor.hide}${frame}`);
2153
+ this.previousFrame = frame;
2154
+ if (this.state === "initial") {
2155
+ this.state = "active";
2156
+ }
2157
+ return;
2158
+ }
2159
+ const previousLineCount = this.previousFrame.split("\n").length - 1;
2160
+ this.output.write(`${cursor.move(-999, -previousLineCount)}${erase.down}${frame}`);
2161
+ this.previousFrame = frame;
2162
+ };
2163
+ close() {
2164
+ if (this.closed) {
2165
+ return;
2166
+ }
2167
+ this.closed = true;
2168
+ this.input.removeListener("keypress", this.onKeypress);
2169
+ this.output.removeListener("resize", this.render);
2170
+ if (this.abortListener) {
2171
+ this.signal?.removeEventListener("abort", this.abortListener);
2172
+ }
2173
+ this.output.write(`${cursor.show}
2174
+ `);
2175
+ if (!process.platform.startsWith("win") && this.input.setRawMode) {
2176
+ this.input.setRawMode(false);
2177
+ }
2178
+ this.readlineInterface?.close();
2179
+ this.input.unpipe?.();
2180
+ if (this.state === "cancel") {
2181
+ this.emit("cancel");
2182
+ } else {
2183
+ this.emit("submit", this.value);
2184
+ }
2185
+ this.removeAllListeners();
2186
+ }
2187
+ };
2188
+
2189
+ // ../toolcraft-design/src/prompts/interactive/confirm.ts
2190
+ var ConfirmPrompt = class extends Prompt {
2191
+ constructor(opts) {
2192
+ super({
2193
+ ...opts,
2194
+ initialValue: opts.initialValue ?? true,
2195
+ render: (prompt) => renderConfirmPrompt(prompt, opts)
2196
+ }, false);
2197
+ this.on("confirm", (value) => {
2198
+ this.setValue(value);
2199
+ this.state = "submit";
2200
+ this.emit("finalize");
2201
+ this.render();
2202
+ this.close();
2203
+ });
2204
+ this.on("cursor", (action) => {
2205
+ if (action === "up" || action === "down" || action === "left" || action === "right") {
2206
+ this.setValue(!this.value);
2207
+ }
2208
+ });
2209
+ }
2210
+ promptNonTty() {
2211
+ if (process.env.POE_NO_PROMPT === "1") {
2212
+ return Promise.resolve(this.value ?? true);
2213
+ }
2214
+ return super.promptNonTty();
2215
+ }
2216
+ };
2217
+ function choices(value) {
2218
+ const yes = value ? `${color.green(GLYPHS.radioActive)} ${color.bold("Yes")}` : `${color.dim(GLYPHS.radioInactive)} ${color.dim("Yes")}`;
2219
+ const no = value ? `${color.dim(GLYPHS.radioInactive)} ${color.dim("No")}` : `${color.green(GLYPHS.radioActive)} ${color.bold("No")}`;
2220
+ return `${yes} ${color.dim("/")} ${no}`;
2221
+ }
2222
+ function renderConfirmPrompt(prompt, opts) {
2223
+ if (prompt.state === "submit") {
2224
+ return `${color.gray(GLYPHS.barStart)} ${symbol(prompt.state)} ${opts.message}
2225
+ ${color.gray(GLYPHS.bar)} ${color.dim(prompt.value ? "Yes" : "No")}
2226
+ ${color.green(GLYPHS.barEnd)}`;
2227
+ }
2228
+ if (prompt.state === "cancel") {
2229
+ return `${color.gray(GLYPHS.barStart)} ${symbol(prompt.state)} ${opts.message}
2230
+ ${color.gray(GLYPHS.bar)} ${color.dim.strikethrough(prompt.value ? "Yes" : "No")}
2231
+ ${color.red(GLYPHS.barEnd)}`;
2232
+ }
2233
+ return `${color.gray(GLYPHS.barStart)} ${symbol(prompt.state)} ${opts.message}
2234
+ ${symbolBar(prompt.state)} ${choices(prompt.value)}
2235
+ ${color.cyan(GLYPHS.barEnd)}`;
2236
+ }
2237
+ function confirmPrompt(opts) {
2238
+ return new ConfirmPrompt(opts).prompt();
2239
+ }
2240
+
2241
+ // ../toolcraft-design/src/prompts/interactive/pagination.ts
2242
+ import { wrapAnsi as wrapAnsi2 } from "fast-wrap-ansi";
2243
+ function countLines(values) {
2244
+ return values.reduce((sum, value) => sum + value.split("\n").length, 0);
2245
+ }
2246
+ function trimToRows(values, cursorOffset, rows, hasTop, hasBottom) {
2247
+ const output = [...values];
2248
+ while (countLines(output) > rows && output.length > 1) {
2249
+ const removeFromTop = hasTop && cursorOffset > 0;
2250
+ const removeFromBottom = hasBottom && cursorOffset < output.length - 1;
2251
+ if (removeFromTop) {
2252
+ output.shift();
2253
+ cursorOffset -= 1;
2254
+ } else if (removeFromBottom) {
2255
+ output.pop();
2256
+ } else {
2257
+ output.pop();
2258
+ }
2259
+ }
2260
+ return output;
2261
+ }
2262
+ function limitOptions(opts) {
2263
+ const {
2264
+ cursor: cursor2,
2265
+ options,
2266
+ style,
2267
+ output,
2268
+ maxItems = Number.POSITIVE_INFINITY,
2269
+ columnPadding = 0,
2270
+ rowPadding = 4
2271
+ } = opts;
2272
+ if (options.length === 0) {
2273
+ return [];
2274
+ }
2275
+ const columns = Math.max(1, getColumns(output) - columnPadding);
2276
+ const rowBudget = Math.max(getRows(output) - rowPadding, 0);
2277
+ const visibleCount = Math.max(Math.min(maxItems, rowBudget), 5);
2278
+ const cappedVisibleCount = Math.min(visibleCount, options.length);
2279
+ let start = 0;
2280
+ if (cursor2 >= cappedVisibleCount - 3) {
2281
+ start = Math.max(Math.min(cursor2 - cappedVisibleCount + 3, options.length - cappedVisibleCount), 0);
2282
+ }
2283
+ const hasTopMarker = cappedVisibleCount < options.length && start > 0;
2284
+ const hasBottomMarker = cappedVisibleCount < options.length && start + cappedVisibleCount < options.length;
2285
+ const visible = options.slice(start, start + cappedVisibleCount).map((option, index) => wrapAnsi2(style(option, start + index === cursor2), columns, { hard: true, trim: false }));
2286
+ const trimmed = trimToRows(
2287
+ visible,
2288
+ Math.max(cursor2 - start, 0),
2289
+ Math.max(rowBudget - Number(hasTopMarker) - Number(hasBottomMarker), 1),
2290
+ hasTopMarker,
2291
+ hasBottomMarker
2292
+ );
2293
+ if (hasTopMarker) {
2294
+ trimmed.unshift(color.dim(GLYPHS.ellipsis));
2295
+ }
2296
+ if (hasBottomMarker) {
2297
+ trimmed.push(color.dim(GLYPHS.ellipsis));
2298
+ }
2299
+ return trimmed;
2300
+ }
2301
+
2302
+ // ../toolcraft-design/src/prompts/interactive/select.ts
2303
+ var SelectPrompt = class extends Prompt {
2304
+ options;
2305
+ constructor(opts) {
2306
+ if (opts.options.length === 0) {
2307
+ throw new Error("Select prompt requires at least one option.");
2308
+ }
2309
+ if (opts.options.every((option) => option.disabled)) {
2310
+ throw new Error("Select prompt requires at least one enabled option.");
2311
+ }
2312
+ const initialIndex = Math.max(opts.options.findIndex((option) => option.value === opts.initialValue), 0);
2313
+ const cursor2 = findNonDisabled(initialIndex, 1, opts.options);
2314
+ super({
2315
+ ...opts,
2316
+ initialValue: opts.options[cursor2]?.value,
2317
+ render: (prompt) => renderSelectPrompt(prompt, opts)
2318
+ }, false);
2319
+ this.options = opts.options;
2320
+ this._cursor = cursor2;
2321
+ this.setValue(this.options[this._cursor]?.value);
2322
+ this.on("cursor", (action) => {
2323
+ if (action === "up" || action === "left") {
2324
+ this._cursor = findNonDisabled(this._cursor - 1, -1, this.options);
2325
+ } else if (action === "down" || action === "right") {
2326
+ this._cursor = findNonDisabled(this._cursor + 1, 1, this.options);
2327
+ }
2328
+ this.setValue(this.options[this._cursor]?.value);
2329
+ });
2330
+ }
2331
+ get visibleOptions() {
2332
+ return this.options;
2333
+ }
2334
+ promptNonTty() {
2335
+ if (process.env.POE_NO_PROMPT === "1") {
2336
+ return Promise.resolve(this.value);
2337
+ }
2338
+ return super.promptNonTty();
2339
+ }
2340
+ };
2341
+ function findNonDisabled(start, direction, options) {
2342
+ if (options.every((option) => option.disabled)) {
2343
+ return start;
2344
+ }
2345
+ let index = start;
2346
+ for (let checked = 0; checked < options.length; checked += 1) {
2347
+ index = (index + options.length) % options.length;
2348
+ if (!options[index]?.disabled) {
2349
+ return index;
2350
+ }
2351
+ index += direction;
2352
+ }
2353
+ return start;
2354
+ }
2355
+ function renderOption(option, active, submitted, cancelled) {
2356
+ const hint = option.hint ? color.dim(` (${option.hint})`) : "";
2357
+ if (submitted) return color.dim(option.label);
2358
+ if (cancelled) return color.dim.strikethrough(option.label);
2359
+ if (option.disabled) return `${color.gray(GLYPHS.radioInactive)} ${color.gray.strikethrough(option.label)}${hint}`;
2360
+ if (active) return `${color.green(GLYPHS.radioActive)} ${option.label}${hint}`;
2361
+ return `${color.dim(GLYPHS.radioInactive)} ${color.dim(option.label)}${hint}`;
2362
+ }
2363
+ function renderSelectPrompt(prompt, opts) {
2364
+ if (prompt.state === "submit" || prompt.state === "cancel") {
2365
+ const option = prompt.visibleOptions[prompt.cursor];
2366
+ const rendered = option ? renderOption(option, false, prompt.state === "submit", prompt.state === "cancel") : "";
2367
+ const end = prompt.state === "submit" ? color.green(GLYPHS.barEnd) : color.red(GLYPHS.barEnd);
2368
+ return `${color.gray(GLYPHS.barStart)} ${symbol(prompt.state)} ${opts.message}
2369
+ ${color.gray(GLYPHS.bar)} ${rendered}
2370
+ ${end}`;
2371
+ }
2372
+ const lines = limitOptions({
2373
+ cursor: prompt.cursor,
2374
+ options: prompt.visibleOptions,
2375
+ output: opts.output ?? process.stdout,
2376
+ maxItems: opts.maxItems,
2377
+ columnPadding: 3,
2378
+ style: (option, active) => renderOption(option, active, false, false)
2379
+ }).map((line) => `${color.cyan(GLYPHS.bar)} ${line}`);
2380
+ return `${color.gray(GLYPHS.barStart)} ${symbol(prompt.state)} ${opts.message}
2381
+ ${lines.join("\n")}
2382
+ ${color.cyan(GLYPHS.barEnd)}`;
2383
+ }
2384
+ function selectPrompt(opts) {
2385
+ return new SelectPrompt(opts).prompt();
2386
+ }
2387
+
2388
+ // ../toolcraft-design/src/prompts/interactive/text.ts
2389
+ var TextPrompt = class extends Prompt {
2390
+ constructor(opts) {
2391
+ const initialUserInput = opts.initialValue ?? "";
2392
+ super({
2393
+ ...opts,
2394
+ initialValue: initialUserInput,
2395
+ initialUserInput,
2396
+ render: (prompt) => renderTextPrompt(prompt, opts),
2397
+ validate: opts.validate
2398
+ });
2399
+ this.on("userInput", (value) => this.setValue(value));
2400
+ this.on("finalize", () => {
2401
+ if (this.state === "submit") {
2402
+ this.setValue(this.value || opts.defaultValue || "");
2403
+ }
2404
+ });
2405
+ }
2406
+ get userInputWithCursor() {
2407
+ if (this.state === "submit") {
2408
+ return this.userInput;
2409
+ }
2410
+ const before = this.userInput.slice(0, this.cursor);
2411
+ const current = this.userInput[this.cursor];
2412
+ const after = this.userInput.slice(this.cursor + 1);
2413
+ if (current) {
2414
+ return `${before}${color.inverse(current)}${after}`;
2415
+ }
2416
+ return `${before}${color.inverse("\u2588")}`;
2417
+ }
2418
+ promptNonTty() {
2419
+ return this.readNonTtyLine();
2420
+ }
2421
+ };
2422
+ function renderHeader2(prompt, message2) {
2423
+ return `${color.gray(GLYPHS.barStart)} ${symbol(prompt.state)} ${message2}`;
2424
+ }
2425
+ function renderTextPrompt(prompt, opts) {
2426
+ const value = prompt.value ?? "";
2427
+ if (prompt.state === "submit") {
2428
+ return `${renderHeader2(prompt, opts.message)}
2429
+ ${color.gray(GLYPHS.bar)} ${color.dim(value)}
2430
+ ${color.green(GLYPHS.barEnd)}`;
2431
+ }
2432
+ if (prompt.state === "cancel") {
2433
+ return `${renderHeader2(prompt, opts.message)}
2434
+ ${color.gray(GLYPHS.bar)} ${color.dim.strikethrough(value)}
2435
+ ${color.red(GLYPHS.barEnd)}`;
2436
+ }
2437
+ const input = prompt.userInput.length > 0 ? prompt.userInputWithCursor : opts.placeholder ? `${color.inverse(opts.placeholder[0] ?? " ")}${color.dim(opts.placeholder.slice(1))}` : color.inverse("_");
2438
+ if (prompt.state === "error") {
2439
+ return `${renderHeader2(prompt, opts.message)}
2440
+ ${symbolBar(prompt.state)} ${input}
2441
+ ${color.yellow(GLYPHS.barEnd)} ${color.yellow(prompt.error)}`;
2442
+ }
2443
+ return `${renderHeader2(prompt, opts.message)}
2444
+ ${symbolBar(prompt.state)} ${input}
2445
+ ${color.cyan(GLYPHS.barEnd)}`;
2446
+ }
2447
+ function textPrompt(opts) {
2448
+ return new TextPrompt(opts).prompt();
2449
+ }
1825
2450
 
1826
2451
  // ../toolcraft-design/src/prompts/primitives/cancel.ts
1827
- import { isCancel } from "@clack/prompts";
1828
2452
  function cancel(msg = "") {
1829
2453
  if (resolveOutputFormat() !== "terminal") {
1830
2454
  return;
@@ -1887,14 +2511,14 @@ function note(message2, title) {
1887
2511
  var SPINNER_FRAMES = Object.freeze(["\u25D2", "\u25D0", "\u25D3", "\u25D1"]);
1888
2512
 
1889
2513
  // ../toolcraft-design/src/prompts/index.ts
1890
- async function select2(opts) {
1891
- return clack.select(opts);
2514
+ async function select(opts) {
2515
+ return selectPrompt(opts);
1892
2516
  }
1893
- async function text3(opts) {
1894
- return clack.text(opts);
2517
+ async function text2(opts) {
2518
+ return textPrompt(opts);
1895
2519
  }
1896
- async function confirm2(opts) {
1897
- return clack.confirm(opts);
2520
+ async function confirm(opts) {
2521
+ return confirmPrompt(opts);
1898
2522
  }
1899
2523
 
1900
2524
  // ../toolcraft/src/index.ts
@@ -2269,6 +2893,12 @@ function cloneRequires(requires) {
2269
2893
  function cloneStringArray(values) {
2270
2894
  return values === void 0 ? void 0 : [...values];
2271
2895
  }
2896
+ function cloneCommandExamples(examples) {
2897
+ return (examples ?? []).map((example) => ({
2898
+ title: example.title,
2899
+ params: { ...example.params }
2900
+ }));
2901
+ }
2272
2902
  function cloneStringRecord(values) {
2273
2903
  return values === void 0 ? void 0 : { ...values };
2274
2904
  }
@@ -2533,9 +3163,11 @@ function createBaseCommand(config2) {
2533
3163
  kind: "command",
2534
3164
  name: config2.name,
2535
3165
  description: config2.description,
3166
+ examples: cloneCommandExamples(config2.examples),
2536
3167
  aliases: [...config2.aliases ?? []],
2537
3168
  positional: [...config2.positional ?? []],
2538
3169
  params: config2.params,
3170
+ result: config2.result,
2539
3171
  secrets: cloneSecrets(config2.secrets),
2540
3172
  scope: resolveCommandScope(config2.scope, void 0),
2541
3173
  confirm: config2.confirm ?? false,
@@ -2547,6 +3179,8 @@ function createBaseCommand(config2) {
2547
3179
  Object.defineProperty(command, commandConfigSymbol, {
2548
3180
  value: {
2549
3181
  scope: cloneScope(config2.scope),
3182
+ examples: cloneCommandExamples(config2.examples),
3183
+ result: config2.result,
2550
3184
  humanInLoop: config2.humanInLoop,
2551
3185
  secrets: cloneSecrets(config2.secrets),
2552
3186
  requires: cloneRequires(config2.requires),
@@ -2595,9 +3229,11 @@ function materializeCommand(command, inherited) {
2595
3229
  kind: "command",
2596
3230
  name: command.name,
2597
3231
  description: command.description,
3232
+ examples: cloneCommandExamples(internal.examples),
2598
3233
  aliases: [...command.aliases],
2599
3234
  positional: [...command.positional],
2600
3235
  params: command.params,
3236
+ result: internal.result,
2601
3237
  secrets: mergeSecrets(inherited.secrets, internal.secrets),
2602
3238
  scope: resolveCommandScope(internal.scope, inherited.scope),
2603
3239
  confirm: command.confirm,
@@ -2609,6 +3245,8 @@ function materializeCommand(command, inherited) {
2609
3245
  Object.defineProperty(materialized, commandConfigSymbol, {
2610
3246
  value: {
2611
3247
  scope: cloneScope(internal.scope),
3248
+ examples: cloneCommandExamples(internal.examples),
3249
+ result: internal.result,
2612
3250
  humanInLoop: internal.humanInLoop,
2613
3251
  secrets: cloneSecrets(internal.secrets),
2614
3252
  requires: cloneRequires(internal.requires),
@@ -2850,7 +3488,7 @@ var AnchorNotFoundError = class extends Error {
2850
3488
  };
2851
3489
 
2852
3490
  // ../task-list/src/backends/gh-issues-client.ts
2853
- import { text as text4 } from "node:stream/consumers";
3491
+ import { text as text3 } from "node:stream/consumers";
2854
3492
 
2855
3493
  // ../process-runner/src/docker/context.ts
2856
3494
  import { execSync } from "node:child_process";
@@ -3059,8 +3697,8 @@ async function resolveAuth(options) {
3059
3697
  stderr: "pipe"
3060
3698
  });
3061
3699
  const [stdout, , result] = await Promise.all([
3062
- handle.stdout === null ? Promise.resolve("") : text4(handle.stdout),
3063
- handle.stderr === null ? Promise.resolve("") : text4(handle.stderr),
3700
+ handle.stdout === null ? Promise.resolve("") : text3(handle.stdout),
3701
+ handle.stderr === null ? Promise.resolve("") : text3(handle.stderr),
3064
3702
  handle.result
3065
3703
  ]);
3066
3704
  const token = stdout.trim();
@@ -4259,7 +4897,7 @@ function parseQualifiedId(qualifiedId, listName) {
4259
4897
 
4260
4898
  // ../task-list/src/backends/markdown-dir.ts
4261
4899
  import path7 from "node:path";
4262
- import { parseDocument, stringify } from "yaml";
4900
+ import { parseDocument as parseDocument2, stringify as stringify2 } from "yaml";
4263
4901
 
4264
4902
  // ../task-list/src/schema/task.schema.json
4265
4903
  var task_schema_default = {
@@ -4450,7 +5088,7 @@ function splitTaskDocument(content, filePath, mode) {
4450
5088
  };
4451
5089
  }
4452
5090
  function readFrontmatter(frontmatterContent, filePath) {
4453
- const document = parseDocument(frontmatterContent);
5091
+ const document = parseDocument2(frontmatterContent);
4454
5092
  if (document.errors.length > 0) {
4455
5093
  throw malformedTask(filePath, "frontmatter");
4456
5094
  }
@@ -4520,7 +5158,7 @@ function createTask(list, id, frontmatter, body, mode, sourcePath) {
4520
5158
  }
4521
5159
  function serializeTaskDocument(frontmatter, description) {
4522
5160
  return `---
4523
- ${stringify(frontmatter)}---
5161
+ ${stringify2(frontmatter)}---
4524
5162
 
4525
5163
  ${description}`;
4526
5164
  }
@@ -5258,7 +5896,7 @@ async function markdownDirBackend(deps) {
5258
5896
 
5259
5897
  // ../task-list/src/backends/yaml-file.ts
5260
5898
  import path8 from "node:path";
5261
- import { isMap, parseDocument as parseDocument2 } from "yaml";
5899
+ import { isMap, parseDocument as parseDocument3 } from "yaml";
5262
5900
 
5263
5901
  // ../task-list/src/schema/store.schema.json
5264
5902
  var store_schema_default = {
@@ -5435,7 +6073,7 @@ function buildFiredTaskRecord(existing, to, metadataPatch) {
5435
6073
  function parseStoreDocument(filePath, content) {
5436
6074
  let document;
5437
6075
  try {
5438
- document = parseDocument2(content, { keepSourceTokens: true, prettyErrors: false });
6076
+ document = parseDocument3(content, { keepSourceTokens: true, prettyErrors: false });
5439
6077
  } catch {
5440
6078
  throw malformedStore(filePath, "yaml");
5441
6079
  }
@@ -5612,7 +6250,7 @@ async function ensureStorePath(deps) {
5612
6250
  deps.fs,
5613
6251
  deps.path,
5614
6252
  serializeDocument(
5615
- parseDocument2(
6253
+ parseDocument3(
5616
6254
  [
5617
6255
  `$schema: ${STORE_SCHEMA_ID}`,
5618
6256
  `kind: ${STORE_KIND}`,
@@ -7616,8 +8254,8 @@ function validateAuthorizationCallbackBinding(callback, expected) {
7616
8254
  function createAuthorizationError(error3, description) {
7617
8255
  return new Error(`OAuth authorization failed: ${error3} \u2014 ${description}`);
7618
8256
  }
7619
- function escapeHtml2(text5) {
7620
- return text5.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
8257
+ function escapeHtml2(text4) {
8258
+ return text4.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
7621
8259
  }
7622
8260
  function buildSuccessPage(landingPage) {
7623
8261
  const title = landingPage?.title ?? "Connected";
@@ -10164,6 +10802,9 @@ function isCallToolResult(value) {
10164
10802
  if (!isObjectRecord5(value) || !Array.isArray(value.content)) {
10165
10803
  return false;
10166
10804
  }
10805
+ if (value.structuredContent !== void 0 && !isObjectRecord5(value.structuredContent)) {
10806
+ return false;
10807
+ }
10167
10808
  if (value.isError !== void 0 && typeof value.isError !== "boolean") {
10168
10809
  return false;
10169
10810
  }
@@ -10903,13 +11544,13 @@ var proxyNodeSymbol = /* @__PURE__ */ Symbol("toolcraft.mcpProxyNode");
10903
11544
  var proxyConnectionSymbol = /* @__PURE__ */ Symbol("toolcraft.mcpProxyConnection");
10904
11545
  var shutdownDisposers = /* @__PURE__ */ new Set();
10905
11546
  function getInternalGroupConfig2(group) {
10906
- const symbol = Object.getOwnPropertySymbols(group).find(
11547
+ const symbol2 = Object.getOwnPropertySymbols(group).find(
10907
11548
  (candidate) => candidate.description === GROUP_CONFIG_SYMBOL_DESCRIPTION
10908
11549
  );
10909
- if (symbol === void 0) {
11550
+ if (symbol2 === void 0) {
10910
11551
  return {};
10911
11552
  }
10912
- return group[symbol] ?? {};
11553
+ return group[symbol2] ?? {};
10913
11554
  }
10914
11555
  function isProxyNode(node) {
10915
11556
  return node[proxyNodeSymbol] === true;
@@ -10956,23 +11597,38 @@ function createProxyCommand(parent, tool, commandName, connection) {
10956
11597
  if (params17.kind !== "object") {
10957
11598
  throw new Error(`upstream tool "${tool.name}" must define an object input schema`);
10958
11599
  }
11600
+ const result = tool.outputSchema === void 0 ? void 0 : convertJsonSchema(tool.outputSchema);
11601
+ if (result !== void 0 && result.kind !== "object") {
11602
+ throw new Error(`upstream tool "${tool.name}" must define an object output schema`);
11603
+ }
10959
11604
  return markProxyNode({
10960
11605
  kind: "command",
10961
11606
  name: commandName,
10962
11607
  description: tool.description,
11608
+ examples: [],
10963
11609
  aliases: [],
10964
11610
  positional: [],
10965
11611
  params: params17,
11612
+ ...result === void 0 ? {} : { result },
10966
11613
  secrets: cloneSecrets2(parent.secrets),
10967
11614
  scope: cloneScope2(parent.scope) ?? ["cli", "sdk"],
10968
11615
  confirm: false,
10969
11616
  requires: parent.requires,
10970
11617
  handler: async (ctx) => {
10971
11618
  const client = await ensureConnected(connection);
10972
- return client.callTool({
11619
+ const toolResult = await client.callTool({
10973
11620
  name: tool.name,
10974
11621
  arguments: ctx.params
10975
11622
  });
11623
+ if (result === void 0) {
11624
+ return toolResult;
11625
+ }
11626
+ if (toolResult.structuredContent === void 0) {
11627
+ throw new Error(
11628
+ `upstream tool "${tool.name}" declared outputSchema but returned no structuredContent`
11629
+ );
11630
+ }
11631
+ return toolResult.structuredContent;
10976
11632
  },
10977
11633
  render: void 0
10978
11634
  });
@@ -11103,12 +11759,12 @@ async function fetchCache(name, config2) {
11103
11759
  try {
11104
11760
  logger2.info(`MCP ${name}: listing tools`);
11105
11761
  const tools = [];
11106
- let cursor;
11762
+ let cursor2;
11107
11763
  do {
11108
- const page = await client.listTools(cursor === void 0 ? {} : { cursor });
11764
+ const page = await client.listTools(cursor2 === void 0 ? {} : { cursor: cursor2 });
11109
11765
  tools.push(...page.tools);
11110
- cursor = page.nextCursor;
11111
- } while (cursor !== void 0);
11766
+ cursor2 = page.nextCursor;
11767
+ } while (cursor2 !== void 0);
11112
11768
  logger2.info(`MCP ${name}: found ${tools.length} tools`);
11113
11769
  const upstream = client.serverInfo ?? {
11114
11770
  name,
@@ -11882,8 +12538,8 @@ function extractMcpPayload(envelope) {
11882
12538
  return structuredContent;
11883
12539
  }
11884
12540
  if (Array.isArray(envelope.content)) {
11885
- const text5 = envelope.content.filter(isMcpTextContent).map((block) => block.text).join("\n");
11886
- return text5.length > 0 ? text5 : void 0;
12541
+ const text4 = envelope.content.filter(isMcpTextContent).map((block) => block.text).join("\n");
12542
+ return text4.length > 0 ? text4 : void 0;
11887
12543
  }
11888
12544
  return void 0;
11889
12545
  }
@@ -12441,6 +13097,7 @@ function collectFields(schema, casing, globalLongOptionFlags, path24 = [], inher
12441
13097
  globalLongOptionFlags
12442
13098
  ),
12443
13099
  optionFlag: toOptionFlag([...nextPath, childSchema.discriminator], casing),
13100
+ longAliases: [],
12444
13101
  shortFlag: void 0,
12445
13102
  schema: createSyntheticEnumSchema(branchIds),
12446
13103
  description: childSchema.description,
@@ -12494,6 +13151,7 @@ function collectFields(schema, casing, globalLongOptionFlags, path24 = [], inher
12494
13151
  globalLongOptionFlags
12495
13152
  ),
12496
13153
  optionFlag: toOptionFlag(controlPath, casing),
13154
+ longAliases: [],
12497
13155
  shortFlag: void 0,
12498
13156
  schema: createSyntheticEnumSchema(branchIds),
12499
13157
  description: childSchema.description,
@@ -12576,6 +13234,9 @@ function collectFields(schema, casing, globalLongOptionFlags, path24 = [], inher
12576
13234
  optionAttribute: toOptionAttribute(nextPath, casing),
12577
13235
  commanderOptionAttribute: toCommanderOptionAttribute(nextPath, casing, globalLongOptionFlags),
12578
13236
  optionFlag: toOptionFlag(nextPath, casing),
13237
+ longAliases: [...childSchema.cliAliases ?? []].map(
13238
+ (alias) => alias.startsWith("--") ? alias : `--${alias}`
13239
+ ),
12579
13240
  shortFlag: childSchema.short,
12580
13241
  schema: childSchema,
12581
13242
  description: childSchema.description,
@@ -12634,9 +13295,9 @@ function formatOptionFlags(field, globalLongOptionFlags) {
12634
13295
  return `-${field.shortFlag}`;
12635
13296
  }
12636
13297
  if (field.shortFlag === void 0) {
12637
- return field.optionFlag;
13298
+ return [field.optionFlag, ...field.longAliases].join(", ");
12638
13299
  }
12639
- return `-${field.shortFlag}, ${field.optionFlag}`;
13300
+ return [`-${field.shortFlag}`, field.optionFlag, ...field.longAliases].join(", ");
12640
13301
  }
12641
13302
  function formatPositionalToken(field) {
12642
13303
  const optionalPositional = field.optional || field.hasDefault;
@@ -12916,24 +13577,34 @@ function getGlobalLongOptionFlags(presetsEnabled, versionEnabled, controls) {
12916
13577
  }
12917
13578
  return new Set(flags);
12918
13579
  }
12919
- function validateUniqueOptionFlags(fields) {
13580
+ function validateUniqueOptionFlags(fields, globalLongOptionFlags) {
12920
13581
  const fieldsByFlag = /* @__PURE__ */ new Map();
12921
13582
  for (const field of fields) {
12922
13583
  if (field.positionalIndex !== void 0) {
12923
13584
  continue;
12924
13585
  }
12925
- const existing = fieldsByFlag.get(field.optionFlag);
12926
- if (existing !== void 0) {
12927
- throw new UserError(
12928
- `Parameters "${existing.displayPath}" and "${field.displayPath}" use conflicting CLI flag "${field.optionFlag}".`
12929
- );
13586
+ for (const flag of [field.optionFlag, ...field.longAliases]) {
13587
+ if (globalLongOptionFlags.has(flag)) {
13588
+ if (flag === field.optionFlag && field.shortFlag !== void 0) {
13589
+ continue;
13590
+ }
13591
+ throw new UserError(
13592
+ `Parameter "${field.displayPath}" uses reserved CLI flag "${flag}". Add a short flag or rename the parameter.`
13593
+ );
13594
+ }
13595
+ const existing = fieldsByFlag.get(flag);
13596
+ if (existing !== void 0) {
13597
+ throw new UserError(
13598
+ `Parameters "${existing.displayPath}" and "${field.displayPath}" use conflicting CLI flag "${flag}".`
13599
+ );
13600
+ }
13601
+ fieldsByFlag.set(flag, field);
12930
13602
  }
12931
- fieldsByFlag.set(field.optionFlag, field);
12932
13603
  }
12933
13604
  }
12934
13605
  function createCommanderOption(flags, description, field) {
12935
13606
  const option = new Option(flags, description);
12936
- if (field.commanderOptionAttribute !== field.optionAttribute) {
13607
+ if (field.commanderOptionAttribute !== field.optionAttribute || field.longAliases.length > 0) {
12937
13608
  option.attributeName = () => field.commanderOptionAttribute;
12938
13609
  }
12939
13610
  return option;
@@ -13254,6 +13925,26 @@ function formatSecretDescription(secret) {
13254
13925
  }
13255
13926
  return secret.optional === true ? "Optional secret" : "Required secret";
13256
13927
  }
13928
+ function formatExampleValue(value) {
13929
+ if (typeof value === "string" && value.length > 0 && !value.includes(" ")) {
13930
+ return value;
13931
+ }
13932
+ return JSON.stringify(value);
13933
+ }
13934
+ function formatExampleCommand(breadcrumb, rootUsageName, params17) {
13935
+ const commandPath = buildUsageLine(breadcrumb, rootUsageName, "");
13936
+ const flags = Object.entries(params17).map(([key2, value]) => {
13937
+ const flag = `--${key2}`;
13938
+ return typeof value === "boolean" ? value ? flag : `--no-${key2}` : `${flag} ${formatExampleValue(value)}`;
13939
+ });
13940
+ return [commandPath, ...flags].filter((token) => token.length > 0).join(" ");
13941
+ }
13942
+ function formatExampleRows(examples, breadcrumb, rootUsageName) {
13943
+ return examples.map(
13944
+ (example) => `${example.title}
13945
+ ${formatExampleCommand(breadcrumb, rootUsageName, example.params)}`
13946
+ );
13947
+ }
13257
13948
  function wrapOptionalCommandParameterToken(token, optional) {
13258
13949
  return optional ? `[${token}]` : token;
13259
13950
  }
@@ -13412,6 +14103,12 @@ ${formatHelpOptionList(optionRows)}`);
13412
14103
  ${formatHelpOptionList(secretRows)}`
13413
14104
  );
13414
14105
  }
14106
+ if (command.examples.length > 0) {
14107
+ sections.push(
14108
+ `${text.sectionHeader("Examples")}
14109
+ ${formatExampleRows(command.examples, breadcrumb, rootUsageName).join("\n")}`
14110
+ );
14111
+ }
13415
14112
  const positionalFields = fields.filter((f) => f.positionalIndex !== void 0);
13416
14113
  const usageSuffix = positionalFields.length > 0 ? `[OPTIONS] ${positionalFields.map(formatPositionalToken).join(" ")}` : "[OPTIONS]";
13417
14114
  return renderHelpDocument({
@@ -13487,7 +14184,7 @@ function createNodeCommand(node, casing, globalLongOptionFlags, execute, presets
13487
14184
  const command = new CommanderCommand(node.name);
13488
14185
  const collected = collectFields(node.params, casing, globalLongOptionFlags);
13489
14186
  const fields = assignPositionals(collected.fields, node.positional);
13490
- validateUniqueOptionFlags(fields);
14187
+ validateUniqueOptionFlags(fields, globalLongOptionFlags);
13491
14188
  if (node.description !== void 0) {
13492
14189
  command.description(node.description);
13493
14190
  }
@@ -13618,26 +14315,26 @@ function parseDebugStackMode(value) {
13618
14315
  );
13619
14316
  }
13620
14317
  function setNestedValue(target, path24, value) {
13621
- let cursor = target;
14318
+ let cursor2 = target;
13622
14319
  for (let index = 0; index < path24.length - 1; index += 1) {
13623
14320
  const segment = path24[index] ?? "";
13624
- const existing = Object.prototype.hasOwnProperty.call(cursor, segment) ? cursor[segment] : void 0;
14321
+ const existing = Object.prototype.hasOwnProperty.call(cursor2, segment) ? cursor2[segment] : void 0;
13625
14322
  if (typeof existing === "object" && existing !== null) {
13626
- cursor = existing;
14323
+ cursor2 = existing;
13627
14324
  continue;
13628
14325
  }
13629
14326
  const next = {};
13630
- Object.defineProperty(cursor, segment, {
14327
+ Object.defineProperty(cursor2, segment, {
13631
14328
  value: next,
13632
14329
  enumerable: true,
13633
14330
  configurable: true,
13634
14331
  writable: true
13635
14332
  });
13636
- cursor = next;
14333
+ cursor2 = next;
13637
14334
  }
13638
14335
  const leaf = path24[path24.length - 1];
13639
14336
  if (leaf !== void 0) {
13640
- Object.defineProperty(cursor, leaf, {
14337
+ Object.defineProperty(cursor2, leaf, {
13641
14338
  value,
13642
14339
  enumerable: true,
13643
14340
  configurable: true,
@@ -13671,7 +14368,7 @@ async function promptForField(field) {
13671
14368
  label: enumOptionLabel(schema, value),
13672
14369
  value
13673
14370
  }));
13674
- const selected = await select2({
14371
+ const selected = await select({
13675
14372
  message: field.description ?? fieldPromptLabel(field),
13676
14373
  options,
13677
14374
  initialValue: field.hasDefault ? field.defaultValue : void 0
@@ -13683,7 +14380,7 @@ async function promptForField(field) {
13683
14380
  return selected;
13684
14381
  }
13685
14382
  if (field.schema.kind === "boolean") {
13686
- const selected = await confirm2({
14383
+ const selected = await confirm({
13687
14384
  message: fieldPromptLabel(field),
13688
14385
  initialValue: field.hasDefault ? Boolean(field.defaultValue) : void 0
13689
14386
  });
@@ -13693,7 +14390,7 @@ async function promptForField(field) {
13693
14390
  }
13694
14391
  return selected;
13695
14392
  }
13696
- const entered = await text3({
14393
+ const entered = await text2({
13697
14394
  message: fieldPromptLabel(field),
13698
14395
  initialValue: field.hasDefault && field.defaultValue !== void 0 ? formatResolvedValue(field.defaultValue) : void 0
13699
14396
  });
@@ -14168,12 +14865,12 @@ function createFixtureEnvValues(command) {
14168
14865
  }
14169
14866
  return values;
14170
14867
  }
14171
- async function resolveFixtureRuntime(command, services, requirementOptions) {
14868
+ async function resolveFixtureRuntime(command, services, requirementOptions, runtimeFetch) {
14172
14869
  const selector = process.env.TOOLCRAFT_FIXTURE;
14173
14870
  if (selector === void 0 || selector.length === 0) {
14174
14871
  return {
14175
14872
  env: createEnv2(),
14176
- fetch: globalThis.fetch,
14873
+ fetch: runtimeFetch,
14177
14874
  fs: createFs2(),
14178
14875
  isFixture: false,
14179
14876
  requirementOptions,
@@ -14312,22 +15009,22 @@ function consumeFieldValue(args, index, schema, label, inlineValue) {
14312
15009
  if (schema.kind === "array") {
14313
15010
  const values = [];
14314
15011
  let nextIndex = index;
14315
- let cursor = index + 1;
14316
- while (cursor < args.length) {
14317
- const token = args[cursor] ?? "";
15012
+ let cursor2 = index + 1;
15013
+ while (cursor2 < args.length) {
15014
+ const token = args[cursor2] ?? "";
14318
15015
  if (token.startsWith("-")) {
14319
15016
  break;
14320
15017
  }
14321
15018
  const parsed = parseArrayValue(token, schema, label);
14322
15019
  if (parsed === null) {
14323
15020
  return {
14324
- nextIndex: cursor,
15021
+ nextIndex: cursor2,
14325
15022
  value: null
14326
15023
  };
14327
15024
  }
14328
15025
  values.push(...parsed);
14329
- nextIndex = cursor;
14330
- cursor += 1;
15026
+ nextIndex = cursor2;
15027
+ cursor2 += 1;
14331
15028
  }
14332
15029
  if (values.length === 0) {
14333
15030
  throw new InvalidArgumentError(`option '${label}' argument missing`);
@@ -14860,7 +15557,7 @@ function getResolvedFlags(command) {
14860
15557
  const flags = command.optsWithGlobals();
14861
15558
  return flags;
14862
15559
  }
14863
- async function executeCommand(state, services, requirementOptions, runtimeOptions, onErrorReportContext) {
15560
+ async function executeCommand(state, services, requirementOptions, runtimeFetch, runtimeOptions, onErrorReportContext) {
14864
15561
  const logger2 = createLogger();
14865
15562
  const primitives = {
14866
15563
  logger: logger2,
@@ -14872,7 +15569,12 @@ async function executeCommand(state, services, requirementOptions, runtimeOption
14872
15569
  const resolvedFlags = optionValues;
14873
15570
  const output = resolveOutput(resolvedFlags);
14874
15571
  const shouldPrompt = !resolvedFlags.yes && Boolean(process.stdin.isTTY);
14875
- const runtime = await resolveFixtureRuntime(state.command, services, requirementOptions);
15572
+ const runtime = await resolveFixtureRuntime(
15573
+ state.command,
15574
+ services,
15575
+ requirementOptions,
15576
+ runtimeFetch
15577
+ );
14876
15578
  const preflightContext = {
14877
15579
  ...runtime.services,
14878
15580
  secrets: runtime.secrets,
@@ -14915,7 +15617,7 @@ async function executeCommand(state, services, requirementOptions, runtimeOption
14915
15617
  logger2.resolved(field.displayPath, formatResolvedValue(value));
14916
15618
  }
14917
15619
  }
14918
- const proceed = await confirm2({
15620
+ const proceed = await confirm({
14919
15621
  message: "Proceed?",
14920
15622
  initialValue: true
14921
15623
  });
@@ -15403,6 +16105,7 @@ async function runCLI(roots, options = {}) {
15403
16105
  const casing = options.casing ?? "kebab";
15404
16106
  const services = options.services ?? {};
15405
16107
  const runtimeOptions = options.humanInLoop ?? {};
16108
+ const runtimeFetch = options.fetch ?? globalThis.fetch;
15406
16109
  const version = options.version ?? findEntrypointPackageMetadata(process.argv[1])?.version;
15407
16110
  const rootUsageName = options.rootUsageName ?? inferProgramName(process.argv);
15408
16111
  const controls = resolveCLIControls(options.controls);
@@ -15444,6 +16147,7 @@ async function runCLI(roots, options = {}) {
15444
16147
  state,
15445
16148
  servicesWithBuiltIns,
15446
16149
  requirementOptions,
16150
+ runtimeFetch,
15447
16151
  runtimeOptions,
15448
16152
  (context) => {
15449
16153
  errorReportContext = context;
@@ -15522,7 +16226,7 @@ async function runCLI(roots, options = {}) {
15522
16226
  import { randomUUID as randomUUID6 } from "node:crypto";
15523
16227
 
15524
16228
  // src/terminal-session.ts
15525
- import { EventEmitter } from "node:events";
16229
+ import { EventEmitter as EventEmitter2 } from "node:events";
15526
16230
  import { accessSync, chmodSync, constants } from "node:fs";
15527
16231
  import { createRequire } from "node:module";
15528
16232
  import { dirname, join } from "node:path";
@@ -16420,12 +17124,12 @@ var TerminalScreen = class {
16420
17124
  constructor({
16421
17125
  lines,
16422
17126
  rawLines,
16423
- cursor,
17127
+ cursor: cursor2,
16424
17128
  size
16425
17129
  }) {
16426
17130
  this.lines = Object.freeze(lines.map((line) => stripAnsi4(line)));
16427
17131
  this.rawLines = Object.freeze([...rawLines]);
16428
- this.cursor = Object.freeze({ ...cursor });
17132
+ this.cursor = Object.freeze({ ...cursor2 });
16429
17133
  this.size = Object.freeze({ ...size });
16430
17134
  Object.freeze(this);
16431
17135
  }
@@ -16461,7 +17165,7 @@ var TerminalSession = class {
16461
17165
  exitCode = null;
16462
17166
  pty;
16463
17167
  terminal;
16464
- emitter = new EventEmitter();
17168
+ emitter = new EventEmitter2();
16465
17169
  exitPromise;
16466
17170
  rawBuffer = "";
16467
17171
  lastDataAt = Date.now();
@@ -16509,14 +17213,14 @@ var TerminalSession = class {
16509
17213
  });
16510
17214
  });
16511
17215
  }
16512
- async type(text5) {
16513
- for (const character of text5) {
17216
+ async type(text4) {
17217
+ for (const character of text4) {
16514
17218
  await this.send(character);
16515
17219
  await sleep(TYPE_DELAY_MS);
16516
17220
  }
16517
17221
  }
16518
- async fill(text5) {
16519
- await this.send(text5.replace(/\r?\n/g, "\r"));
17222
+ async fill(text4) {
17223
+ await this.send(text4.replace(/\r?\n/g, "\r"));
16520
17224
  }
16521
17225
  async press(key2) {
16522
17226
  await this.send(keyToSequence(key2));
@@ -16738,25 +17442,25 @@ function splitHistoryLines(input) {
16738
17442
  function normalizeHistoryBuffer(input) {
16739
17443
  let output = "";
16740
17444
  let line = "";
16741
- let cursor = 0;
17445
+ let cursor2 = 0;
16742
17446
  for (const character of input) {
16743
17447
  if (character === "\r") {
16744
- cursor = 0;
17448
+ cursor2 = 0;
16745
17449
  continue;
16746
17450
  }
16747
17451
  if (character === "\b") {
16748
- cursor = Math.max(0, cursor - 1);
17452
+ cursor2 = Math.max(0, cursor2 - 1);
16749
17453
  continue;
16750
17454
  }
16751
17455
  if (character === "\n") {
16752
17456
  output += `${line}
16753
17457
  `;
16754
17458
  line = "";
16755
- cursor = 0;
17459
+ cursor2 = 0;
16756
17460
  continue;
16757
17461
  }
16758
- line = `${line.slice(0, cursor)}${character}${line.slice(cursor + 1)}`;
16759
- cursor += 1;
17462
+ line = `${line.slice(0, cursor2)}${character}${line.slice(cursor2 + 1)}`;
17463
+ cursor2 += 1;
16760
17464
  }
16761
17465
  return output + line;
16762
17466
  }
@@ -17468,7 +18172,7 @@ function detectIndent(content) {
17468
18172
  }
17469
18173
  return " ";
17470
18174
  }
17471
- function parse3(content) {
18175
+ function parse4(content) {
17472
18176
  if (!content || content.trim() === "") {
17473
18177
  return {};
17474
18178
  }
@@ -17593,7 +18297,7 @@ function applyObjectUpdate(content, path24, current, next) {
17593
18297
  return result;
17594
18298
  }
17595
18299
  var jsonFormat = {
17596
- parse: parse3,
18300
+ parse: parse4,
17597
18301
  serialize,
17598
18302
  serializeUpdate,
17599
18303
  merge,
@@ -17605,7 +18309,7 @@ import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
17605
18309
  function isConfigObject2(value) {
17606
18310
  return typeof value === "object" && value !== null && !Array.isArray(value);
17607
18311
  }
17608
- function parse4(content) {
18312
+ function parse5(content) {
17609
18313
  if (!content || content.trim() === "") {
17610
18314
  return {};
17611
18315
  }
@@ -17671,7 +18375,7 @@ function prune2(obj, shape) {
17671
18375
  return { changed, result };
17672
18376
  }
17673
18377
  var tomlFormat = {
17674
- parse: parse4,
18378
+ parse: parse5,
17675
18379
  serialize: serialize2,
17676
18380
  merge: merge2,
17677
18381
  prune: prune2
@@ -17682,7 +18386,7 @@ import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
17682
18386
  function isConfigObject3(value) {
17683
18387
  return typeof value === "object" && value !== null && !Array.isArray(value);
17684
18388
  }
17685
- function parse5(content) {
18389
+ function parse6(content) {
17686
18390
  if (!content || content.trim() === "") {
17687
18391
  return {};
17688
18392
  }
@@ -17748,7 +18452,7 @@ function prune3(obj, shape) {
17748
18452
  return { changed, result };
17749
18453
  }
17750
18454
  var yamlFormat = {
17751
- parse: parse5,
18455
+ parse: parse6,
17752
18456
  serialize: serialize3,
17753
18457
  merge: merge3,
17754
18458
  prune: prune3
@@ -19009,17 +19713,17 @@ function colorsEqual(left, right) {
19009
19713
  }
19010
19714
  return false;
19011
19715
  }
19012
- function pushRun(runs, style, text5) {
19013
- if (text5.length === 0) {
19716
+ function pushRun(runs, style, text4) {
19717
+ if (text4.length === 0) {
19014
19718
  return;
19015
19719
  }
19016
19720
  const previous = runs.at(-1);
19017
- if (previous && text5 !== "\n" && previous.text !== "\n" && stylesEqual(previous, style)) {
19018
- previous.text += text5;
19721
+ if (previous && text4 !== "\n" && previous.text !== "\n" && stylesEqual(previous, style)) {
19722
+ previous.text += text4;
19019
19723
  return;
19020
19724
  }
19021
19725
  runs.push({
19022
- text: text5,
19726
+ text: text4,
19023
19727
  fg: style.fg,
19024
19728
  bg: style.bg,
19025
19729
  bold: style.bold,
@@ -19349,10 +20053,10 @@ function parseAnsi2(input) {
19349
20053
  continue;
19350
20054
  }
19351
20055
  const codePoint = input.codePointAt(index);
19352
- const text5 = codePoint === void 0 ? "" : String.fromCodePoint(codePoint);
19353
- lines[row][column] = { text: text5, style: cloneStyle(style) };
20056
+ const text4 = codePoint === void 0 ? "" : String.fromCodePoint(codePoint);
20057
+ lines[row][column] = { text: text4, style: cloneStyle(style) };
19354
20058
  column += 1;
19355
- index += text5.length;
20059
+ index += text4.length;
19356
20060
  }
19357
20061
  return buildRuns(lines, lineBreakStyles);
19358
20062
  }
@@ -19763,10 +20467,10 @@ function measureLines(lines) {
19763
20467
  0
19764
20468
  );
19765
20469
  }
19766
- function displayWidth3(text5, startColumn = 0) {
20470
+ function displayWidth3(text4, startColumn = 0) {
19767
20471
  const segmenter = new Intl.Segmenter();
19768
20472
  let column = startColumn;
19769
- for (const { segment } of segmenter.segment(text5)) {
20473
+ for (const { segment } of segmenter.segment(text4)) {
19770
20474
  if (segment === " ") {
19771
20475
  column += 8 - column % 8;
19772
20476
  continue;
@@ -19859,8 +20563,8 @@ function renderRun(run) {
19859
20563
  if (run.dim) {
19860
20564
  attributes.push('opacity="0.7"');
19861
20565
  }
19862
- const text5 = run.conceal ? " ".repeat(displayWidth3(run.text)) : run.text;
19863
- return `<tspan ${attributes.join(" ")}>${escapeXmlText(text5)}</tspan>`;
20566
+ const text4 = run.conceal ? " ".repeat(displayWidth3(run.text)) : run.text;
20567
+ return `<tspan ${attributes.join(" ")}>${escapeXmlText(text4)}</tspan>`;
19864
20568
  }
19865
20569
  function renderWindowControls() {
19866
20570
  return [