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
@@ -137,12 +137,12 @@ var styleNames = Object.keys(ansiStyles);
137
137
  function replaceAll(value, search, replacement) {
138
138
  return value.split(search).join(replacement);
139
139
  }
140
- function applyStyles(text5, styles) {
140
+ function applyStyles(text4, styles) {
141
141
  if (!supportsColor() || styles.length === 0) {
142
- return text5;
142
+ return text4;
143
143
  }
144
144
  const open = styles.map((style) => style.open).join("");
145
- const output = text5.includes(reset) ? replaceAll(text5, reset, `${reset}${open}`) : text5;
145
+ const output = text4.includes(reset) ? replaceAll(text4, reset, `${reset}${open}`) : text4;
146
146
  return `${open}${output}${reset}`;
147
147
  }
148
148
  function clampRgb(value) {
@@ -186,7 +186,7 @@ function bgRgbStyle(red, green, blue) {
186
186
  };
187
187
  }
188
188
  function createColor(styles = []) {
189
- const builder = ((text5) => applyStyles(String(text5), styles));
189
+ const builder = ((text4) => applyStyles(String(text4), styles));
190
190
  for (const name of styleNames) {
191
191
  Object.defineProperty(builder, name, {
192
192
  configurable: true,
@@ -268,24 +268,24 @@ function createPalette(activeBrand, mode) {
268
268
  const number2 = isPurple ? color.hex("#0077cc") : active2;
269
269
  return withStyles(
270
270
  {
271
- header: (text5) => active2.bold(text5),
272
- divider: (text5) => color.hex("#666666")(text5),
273
- prompt: (text5) => prompt2.bold(text5),
274
- number: (text5) => number2.bold(text5),
275
- intro: (text5) => color.bgHex(activeBrand.primary).white(` ${getThemeConfig().label} - ${text5} `),
271
+ header: (text4) => active2.bold(text4),
272
+ divider: (text4) => color.hex("#666666")(text4),
273
+ prompt: (text4) => prompt2.bold(text4),
274
+ number: (text4) => number2.bold(text4),
275
+ intro: (text4) => color.bgHex(activeBrand.primary).white(` ${getThemeConfig().label} - ${text4} `),
276
276
  get resolvedSymbol() {
277
277
  return active2("\u25C7");
278
278
  },
279
279
  get errorSymbol() {
280
280
  return color.hex("#cc0000")("\u25A0");
281
281
  },
282
- accent: (text5) => prompt2.bold(text5),
283
- muted: (text5) => color.hex("#666666")(text5),
284
- success: (text5) => color.hex("#008800")(text5),
285
- warning: (text5) => color.hex("#cc6600")(text5),
286
- error: (text5) => color.hex("#cc0000")(text5),
287
- info: (text5) => active2(text5),
288
- badge: (text5) => color.bgHex("#cc6600").white(` ${text5} `)
282
+ accent: (text4) => prompt2.bold(text4),
283
+ muted: (text4) => color.hex("#666666")(text4),
284
+ success: (text4) => color.hex("#008800")(text4),
285
+ warning: (text4) => color.hex("#cc6600")(text4),
286
+ error: (text4) => color.hex("#cc0000")(text4),
287
+ info: (text4) => active2(text4),
288
+ badge: (text4) => color.bgHex("#cc6600").white(` ${text4} `)
289
289
  },
290
290
  {
291
291
  accent: { fg: isPurple ? "#006699" : activeBrand.primary, bold: true },
@@ -304,24 +304,24 @@ function createPalette(activeBrand, mode) {
304
304
  const number = isPurple ? color.cyanBright : active;
305
305
  return withStyles(
306
306
  {
307
- header: (text5) => activeBright.bold(text5),
308
- divider: (text5) => color.dim(text5),
309
- prompt: (text5) => prompt(text5),
310
- number: (text5) => number(text5),
311
- intro: (text5) => activeBackground.white(` ${getThemeConfig().label} - ${text5} `),
307
+ header: (text4) => activeBright.bold(text4),
308
+ divider: (text4) => color.dim(text4),
309
+ prompt: (text4) => prompt(text4),
310
+ number: (text4) => number(text4),
311
+ intro: (text4) => activeBackground.white(` ${getThemeConfig().label} - ${text4} `),
312
312
  get resolvedSymbol() {
313
313
  return active("\u25C7");
314
314
  },
315
315
  get errorSymbol() {
316
316
  return color.red("\u25A0");
317
317
  },
318
- accent: (text5) => prompt(text5),
319
- muted: (text5) => color.dim(text5),
320
- success: (text5) => color.green(text5),
321
- warning: (text5) => color.yellow(text5),
322
- error: (text5) => color.red(text5),
323
- info: (text5) => active(text5),
324
- badge: (text5) => color.bgYellow.black(` ${text5} `)
318
+ accent: (text4) => prompt(text4),
319
+ muted: (text4) => color.dim(text4),
320
+ success: (text4) => color.green(text4),
321
+ warning: (text4) => color.yellow(text4),
322
+ error: (text4) => color.red(text4),
323
+ info: (text4) => active(text4),
324
+ badge: (text4) => color.bgYellow.black(` ${text4} `)
325
325
  },
326
326
  {
327
327
  accent: { fg: isPurple ? "cyan" : activeBrand.primary, bold: true },
@@ -338,11 +338,11 @@ var light = createPalette(brands.purple, "light");
338
338
 
339
339
  // ../toolcraft-design/src/tokens/typography.ts
340
340
  var typography = {
341
- bold: (text5) => color.bold(text5),
342
- dim: (text5) => color.dim(text5),
343
- italic: (text5) => color.italic(text5),
344
- underline: (text5) => color.underline(text5),
345
- strikethrough: (text5) => color.strikethrough(text5)
341
+ bold: (text4) => color.bold(text4),
342
+ dim: (text4) => color.dim(text4),
343
+ italic: (text4) => color.italic(text4),
344
+ underline: (text4) => color.underline(text4),
345
+ strikethrough: (text4) => color.strikethrough(text4)
346
346
  };
347
347
 
348
348
  // ../toolcraft-design/src/tokens/widths.ts
@@ -613,7 +613,7 @@ function renderMarkdownInline2(value) {
613
613
  return stripAnsi2(value).replaceAll("\r\n", " ").replaceAll("\n", " ").replaceAll("\r", " ");
614
614
  }
615
615
  function writeTerminalMessage(msg, {
616
- symbol = color.gray("\u2502"),
616
+ symbol: symbol2 = color.gray("\u2502"),
617
617
  secondarySymbol = color.gray("\u2502"),
618
618
  spacing: spacing2 = 1,
619
619
  withGuide = true
@@ -621,7 +621,7 @@ function writeTerminalMessage(msg, {
621
621
  const lines = [];
622
622
  const showGuide = withGuide !== false;
623
623
  const contentLines = msg.split("\n");
624
- const prefix = showGuide ? `${symbol} ` : "";
624
+ const prefix = showGuide ? `${symbol2} ` : "";
625
625
  const continuationPrefix = showGuide ? `${secondarySymbol} ` : "";
626
626
  const emptyGuide = showGuide ? secondarySymbol : "";
627
627
  for (let index = 0; index < spacing2; index += 1) {
@@ -635,7 +635,7 @@ function writeTerminalMessage(msg, {
635
635
  if (firstLine.length > 0) {
636
636
  lines.push(`${prefix}${firstLine}`);
637
637
  } else {
638
- lines.push(showGuide ? symbol : "");
638
+ lines.push(showGuide ? symbol2 : "");
639
639
  }
640
640
  for (const line of continuationLines) {
641
641
  if (line.length > 0) {
@@ -785,12 +785,12 @@ function createLogger(emitter) {
785
785
  log.message(`${label}
786
786
  ${value}`, { symbol: symbols.errorResolved });
787
787
  },
788
- message(message2, symbol) {
788
+ message(message2, symbol2) {
789
789
  if (emitter) {
790
790
  emitter(message2);
791
791
  return;
792
792
  }
793
- log.message(message2, { symbol: symbol ?? color.gray("\u2502") });
793
+ log.message(message2, { symbol: symbol2 ?? color.gray("\u2502") });
794
794
  }
795
795
  };
796
796
  }
@@ -1593,18 +1593,18 @@ function getStandalone(template, tagStart, tagEnd, kind) {
1593
1593
  if (!isWhitespace3(template.slice(lineStart, tagStart))) {
1594
1594
  return void 0;
1595
1595
  }
1596
- let cursor = tagEnd;
1597
- while (cursor < template.length && (template[cursor] === " " || template[cursor] === " ")) {
1598
- cursor += 1;
1596
+ let cursor2 = tagEnd;
1597
+ while (cursor2 < template.length && (template[cursor2] === " " || template[cursor2] === " ")) {
1598
+ cursor2 += 1;
1599
1599
  }
1600
- if (template.startsWith("\r\n", cursor)) {
1601
- return { lineStart, nextIndex: cursor + 2 };
1600
+ if (template.startsWith("\r\n", cursor2)) {
1601
+ return { lineStart, nextIndex: cursor2 + 2 };
1602
1602
  }
1603
- if (template[cursor] === "\n") {
1604
- return { lineStart, nextIndex: cursor + 1 };
1603
+ if (template[cursor2] === "\n") {
1604
+ return { lineStart, nextIndex: cursor2 + 1 };
1605
1605
  }
1606
- if (cursor === template.length) {
1607
- return { lineStart, nextIndex: cursor };
1606
+ if (cursor2 === template.length) {
1607
+ return { lineStart, nextIndex: cursor2 };
1608
1608
  }
1609
1609
  return void 0;
1610
1610
  }
@@ -1702,13 +1702,13 @@ function lookup(context, name) {
1702
1702
  if (name === ".") {
1703
1703
  return { hit: true, value: callLambda(context.view, context.view) };
1704
1704
  }
1705
- let cursor = context;
1706
- while (cursor !== void 0) {
1707
- const result = name.includes(".") ? lookupDotted(cursor.view, name) : lookupName(cursor.view, name);
1705
+ let cursor2 = context;
1706
+ while (cursor2 !== void 0) {
1707
+ const result = name.includes(".") ? lookupDotted(cursor2.view, name) : lookupName(cursor2.view, name);
1708
1708
  if (result.hit) {
1709
- return { hit: true, value: callLambda(result.value, cursor.view) };
1709
+ return { hit: true, value: callLambda(result.value, cursor2.view) };
1710
1710
  }
1711
- cursor = cursor.parent;
1711
+ cursor2 = cursor2.parent;
1712
1712
  }
1713
1713
  return { hit: false, value: void 0 };
1714
1714
  }
@@ -1872,6 +1872,12 @@ function hasProperty(value, key2) {
1872
1872
  import { spawn } from "node:child_process";
1873
1873
  import process2 from "node:process";
1874
1874
 
1875
+ // ../frontmatter/src/parse.ts
1876
+ import { LineCounter, parse, parseDocument } from "yaml";
1877
+
1878
+ // ../frontmatter/src/stringify.ts
1879
+ import { stringify } from "yaml";
1880
+
1875
1881
  // ../toolcraft-design/src/acp/writer.ts
1876
1882
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
1877
1883
  var storage = new AsyncLocalStorage2();
@@ -1892,11 +1898,629 @@ var REGION_MODAL = 1 << 4;
1892
1898
  var REGION_TOAST = 1 << 5;
1893
1899
  var REGION_ALL = REGION_HEADER | REGION_LIST | REGION_DETAIL | REGION_FOOTER | REGION_MODAL | REGION_TOAST;
1894
1900
 
1895
- // ../toolcraft-design/src/prompts/index.ts
1896
- import * as clack from "@clack/prompts";
1901
+ // ../toolcraft-design/src/prompts/interactive/glyphs.ts
1902
+ function supportsUnicode() {
1903
+ if (!process.platform.startsWith("win")) {
1904
+ return process.env.TERM !== "linux";
1905
+ }
1906
+ return Boolean(
1907
+ 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"
1908
+ );
1909
+ }
1910
+ var UNICODE = supportsUnicode();
1911
+ function glyph(unicode, ascii) {
1912
+ return UNICODE ? unicode : ascii;
1913
+ }
1914
+ var GLYPHS = {
1915
+ stepActive: glyph("\u25C6", "*"),
1916
+ stepCancel: glyph("\u25A0", "x"),
1917
+ stepError: glyph("\u25B2", "x"),
1918
+ stepSubmit: glyph("\u25C7", "o"),
1919
+ barStart: glyph("\u250C", "T"),
1920
+ bar: glyph("\u2502", "|"),
1921
+ barEnd: glyph("\u2514", "-"),
1922
+ radioActive: glyph("\u25CF", ">"),
1923
+ radioInactive: glyph("\u25CB", " "),
1924
+ checkboxActive: glyph("\u25FB", "[ ]"),
1925
+ checkboxSelected: glyph("\u25FC", "[+]"),
1926
+ checkboxInactive: glyph("\u25FB", "[ ]"),
1927
+ passwordMask: glyph("\u2022", "*"),
1928
+ ellipsis: "..."
1929
+ };
1930
+ function symbol(state) {
1931
+ if (state === "cancel") return color.red(GLYPHS.stepCancel);
1932
+ if (state === "error") return color.yellow(GLYPHS.stepError);
1933
+ if (state === "submit") return color.green(GLYPHS.stepSubmit);
1934
+ return color.cyan(GLYPHS.stepActive);
1935
+ }
1936
+ function symbolBar(state) {
1937
+ if (state === "cancel") return color.red(GLYPHS.bar);
1938
+ if (state === "error") return color.yellow(GLYPHS.bar);
1939
+ if (state === "submit") return color.green(GLYPHS.bar);
1940
+ return color.cyan(GLYPHS.bar);
1941
+ }
1942
+
1943
+ // ../toolcraft-design/src/prompts/interactive/core.ts
1944
+ import { EventEmitter } from "node:events";
1945
+ import * as readline2 from "node:readline";
1946
+
1947
+ // ../toolcraft-design/src/prompts/interactive/cancel-symbol.ts
1948
+ var CANCEL = /* @__PURE__ */ Symbol.for("poe.cancel");
1949
+ function isCancel(value) {
1950
+ return value === CANCEL;
1951
+ }
1952
+
1953
+ // ../toolcraft-design/src/prompts/interactive/keys.ts
1954
+ var aliases = {
1955
+ k: "up",
1956
+ j: "down",
1957
+ h: "left",
1958
+ l: "right"
1959
+ };
1960
+ var keyActions = {
1961
+ up: "up",
1962
+ down: "down",
1963
+ left: "left",
1964
+ right: "right",
1965
+ space: "space",
1966
+ return: "enter",
1967
+ enter: "enter",
1968
+ escape: "cancel"
1969
+ };
1970
+ function mapKey(name, char) {
1971
+ if (char === "") {
1972
+ return "cancel";
1973
+ }
1974
+ if (char === " ") {
1975
+ return "space";
1976
+ }
1977
+ if (!name) {
1978
+ return void 0;
1979
+ }
1980
+ return keyActions[name] ?? aliases[name];
1981
+ }
1982
+
1983
+ // ../toolcraft-design/src/prompts/interactive/wrap.ts
1984
+ import { wrapAnsi } from "fast-wrap-ansi";
1985
+ import stringWidth from "fast-string-width";
1986
+ function getColumns(output) {
1987
+ return Math.max(1, output.columns ?? 80);
1988
+ }
1989
+ function getRows(output) {
1990
+ return Math.max(1, output.rows ?? 20);
1991
+ }
1992
+ function wrapFrame(output, frame) {
1993
+ return wrapAnsi(frame, getColumns(output), { hard: true, trim: false });
1994
+ }
1995
+
1996
+ // ../toolcraft-design/src/prompts/interactive/core.ts
1997
+ var cursor = {
1998
+ hide: "\x1B[?25l",
1999
+ show: "\x1B[?25h",
2000
+ move: (x, y) => {
2001
+ let output = "";
2002
+ if (x < 0) output += `\x1B[${-x}D`;
2003
+ if (x > 0) output += `\x1B[${x}C`;
2004
+ if (y < 0) output += `\x1B[${-y}A`;
2005
+ if (y > 0) output += `\x1B[${y}B`;
2006
+ return output;
2007
+ }
2008
+ };
2009
+ var erase = {
2010
+ down: "\x1B[J"
2011
+ };
2012
+ var Prompt = class extends EventEmitter {
2013
+ state = "initial";
2014
+ value;
2015
+ error = "";
2016
+ userInput = "";
2017
+ _cursor = 0;
2018
+ input;
2019
+ output;
2020
+ renderFrame;
2021
+ validate;
2022
+ signal;
2023
+ trackValue;
2024
+ previousFrame = "";
2025
+ readlineInterface;
2026
+ abortListener;
2027
+ closed = false;
2028
+ constructor(opts, trackValue = true) {
2029
+ super();
2030
+ this.input = opts.input ?? process.stdin;
2031
+ this.output = opts.output ?? process.stdout;
2032
+ this.renderFrame = opts.render;
2033
+ this.validate = opts.validate;
2034
+ this.signal = opts.signal;
2035
+ this.value = opts.initialValue;
2036
+ this.trackValue = trackValue;
2037
+ this.userInput = opts.initialUserInput ?? "";
2038
+ this._cursor = this.userInput.length;
2039
+ }
2040
+ get cursor() {
2041
+ return this._cursor;
2042
+ }
2043
+ prompt() {
2044
+ if (this.signal?.aborted) {
2045
+ this.state = "cancel";
2046
+ return Promise.resolve(CANCEL);
2047
+ }
2048
+ if (this.input.isTTY !== true) {
2049
+ return this.promptNonTty();
2050
+ }
2051
+ return new Promise((resolve) => {
2052
+ const onSubmit = (value) => resolve(value);
2053
+ const onCancel = () => resolve(CANCEL);
2054
+ this.once("submit", onSubmit);
2055
+ this.once("cancel", onCancel);
2056
+ this.abortListener = () => {
2057
+ this.state = "cancel";
2058
+ this.emit("finalize");
2059
+ this.render();
2060
+ this.close();
2061
+ };
2062
+ this.signal?.addEventListener("abort", this.abortListener, { once: true });
2063
+ this.readlineInterface = readline2.createInterface({
2064
+ input: this.input,
2065
+ output: void 0,
2066
+ tabSize: 2,
2067
+ prompt: "",
2068
+ escapeCodeTimeout: 50,
2069
+ terminal: true
2070
+ });
2071
+ readline2.emitKeypressEvents(this.input, this.readlineInterface);
2072
+ this.readlineInterface.prompt();
2073
+ this.input.on("keypress", this.onKeypress);
2074
+ if (this.input.setRawMode) {
2075
+ this.input.setRawMode(true);
2076
+ }
2077
+ this.output.on("resize", this.render);
2078
+ this.render();
2079
+ });
2080
+ }
2081
+ promptNonTty() {
2082
+ return Promise.reject(new Error("Interactive prompt requires a TTY. Set POE_NO_PROMPT=1 to accept defaults non-interactively."));
2083
+ }
2084
+ readNonTtyLine() {
2085
+ return new Promise((resolve) => {
2086
+ const rl = readline2.createInterface({ input: this.input, terminal: false });
2087
+ let settled = false;
2088
+ const settle = (value) => {
2089
+ if (settled) {
2090
+ return;
2091
+ }
2092
+ settled = true;
2093
+ rl.close();
2094
+ resolve(value);
2095
+ };
2096
+ rl.once("line", settle);
2097
+ rl.once("close", () => settle(rl.line));
2098
+ });
2099
+ }
2100
+ setValue(value) {
2101
+ this.value = value;
2102
+ this.emit("value", value);
2103
+ }
2104
+ setError(message2) {
2105
+ this.error = message2;
2106
+ }
2107
+ setUserInput(value) {
2108
+ this.userInput = value;
2109
+ this._cursor = Math.min(this._cursor, this.userInput.length);
2110
+ this.emit("userInput", this.userInput);
2111
+ }
2112
+ clearUserInput() {
2113
+ this.userInput = "";
2114
+ this._cursor = 0;
2115
+ this.emit("userInput", this.userInput);
2116
+ }
2117
+ onKeypress = (char, key2 = {}) => {
2118
+ let action = mapKey(key2.name, char);
2119
+ if (this.trackValue && char && char >= " " && key2.name !== "return" && key2.name !== "enter" && key2.name !== "escape") {
2120
+ action = void 0;
2121
+ }
2122
+ if (this.trackValue && action !== "enter") {
2123
+ this.updateTrackedInput(char, key2, action);
2124
+ }
2125
+ if (this.state === "error") {
2126
+ this.state = "active";
2127
+ this.error = "";
2128
+ }
2129
+ if (!this.trackValue && action) {
2130
+ this.emit("cursor", action);
2131
+ } else if (this.trackValue && action && action !== "enter") {
2132
+ this.emit("cursor", action);
2133
+ }
2134
+ if (char && /^[yn]$/i.test(char)) {
2135
+ this.emit("confirm", char.toLowerCase() === "y");
2136
+ }
2137
+ if (char) {
2138
+ this.emit("key", char.toLowerCase(), key2);
2139
+ }
2140
+ if (action === "enter") {
2141
+ const error3 = this.validate?.(this.value);
2142
+ if (error3) {
2143
+ this.error = error3 instanceof Error ? error3.message : error3;
2144
+ this.state = "error";
2145
+ } else {
2146
+ this.state = "submit";
2147
+ }
2148
+ }
2149
+ if (action === "cancel") {
2150
+ this.state = "cancel";
2151
+ }
2152
+ if (this.state === "submit" || this.state === "cancel") {
2153
+ this.emit("finalize");
2154
+ }
2155
+ this.render();
2156
+ if (this.state === "submit" || this.state === "cancel") {
2157
+ this.close();
2158
+ }
2159
+ };
2160
+ updateTrackedInput(char, key2, action) {
2161
+ if (key2.ctrl) {
2162
+ if (key2.name === "a") {
2163
+ this._cursor = 0;
2164
+ return;
2165
+ }
2166
+ if (key2.name === "e") {
2167
+ this._cursor = this.userInput.length;
2168
+ return;
2169
+ }
2170
+ if (key2.name === "u") {
2171
+ this.userInput = this.userInput.slice(this._cursor);
2172
+ this._cursor = 0;
2173
+ this.emit("userInput", this.userInput);
2174
+ return;
2175
+ }
2176
+ if (key2.name === "k") {
2177
+ this.userInput = this.userInput.slice(0, this._cursor);
2178
+ this.emit("userInput", this.userInput);
2179
+ return;
2180
+ }
2181
+ }
2182
+ if (action === "left") {
2183
+ this._cursor = Math.max(0, this._cursor - 1);
2184
+ return;
2185
+ }
2186
+ if (action === "right") {
2187
+ this._cursor = Math.min(this.userInput.length, this._cursor + 1);
2188
+ return;
2189
+ }
2190
+ if (action === "cancel" || action === "up" || action === "down" || action === "space") {
2191
+ return;
2192
+ }
2193
+ if (key2.name === "backspace" || char === "\b" || char === "\x7F") {
2194
+ if (this._cursor > 0) {
2195
+ this.userInput = `${this.userInput.slice(0, this._cursor - 1)}${this.userInput.slice(this._cursor)}`;
2196
+ this._cursor -= 1;
2197
+ this.emit("userInput", this.userInput);
2198
+ }
2199
+ return;
2200
+ }
2201
+ if (key2.name === "delete") {
2202
+ if (this._cursor < this.userInput.length) {
2203
+ this.userInput = `${this.userInput.slice(0, this._cursor)}${this.userInput.slice(this._cursor + 1)}`;
2204
+ this.emit("userInput", this.userInput);
2205
+ }
2206
+ return;
2207
+ }
2208
+ if (!char || char < " " || key2.ctrl) {
2209
+ return;
2210
+ }
2211
+ this.userInput = `${this.userInput.slice(0, this._cursor)}${char}${this.userInput.slice(this._cursor)}`;
2212
+ this._cursor += char.length;
2213
+ this.emit("userInput", this.userInput);
2214
+ }
2215
+ render = () => {
2216
+ if (this.closed) {
2217
+ return;
2218
+ }
2219
+ const frame = wrapFrame(this.output, this.renderFrame(this) ?? "");
2220
+ if (frame === this.previousFrame) {
2221
+ return;
2222
+ }
2223
+ if (!this.previousFrame) {
2224
+ this.output.write(`${cursor.hide}${frame}`);
2225
+ this.previousFrame = frame;
2226
+ if (this.state === "initial") {
2227
+ this.state = "active";
2228
+ }
2229
+ return;
2230
+ }
2231
+ const previousLineCount = this.previousFrame.split("\n").length - 1;
2232
+ this.output.write(`${cursor.move(-999, -previousLineCount)}${erase.down}${frame}`);
2233
+ this.previousFrame = frame;
2234
+ };
2235
+ close() {
2236
+ if (this.closed) {
2237
+ return;
2238
+ }
2239
+ this.closed = true;
2240
+ this.input.removeListener("keypress", this.onKeypress);
2241
+ this.output.removeListener("resize", this.render);
2242
+ if (this.abortListener) {
2243
+ this.signal?.removeEventListener("abort", this.abortListener);
2244
+ }
2245
+ this.output.write(`${cursor.show}
2246
+ `);
2247
+ if (!process.platform.startsWith("win") && this.input.setRawMode) {
2248
+ this.input.setRawMode(false);
2249
+ }
2250
+ this.readlineInterface?.close();
2251
+ this.input.unpipe?.();
2252
+ if (this.state === "cancel") {
2253
+ this.emit("cancel");
2254
+ } else {
2255
+ this.emit("submit", this.value);
2256
+ }
2257
+ this.removeAllListeners();
2258
+ }
2259
+ };
2260
+
2261
+ // ../toolcraft-design/src/prompts/interactive/confirm.ts
2262
+ var ConfirmPrompt = class extends Prompt {
2263
+ constructor(opts) {
2264
+ super({
2265
+ ...opts,
2266
+ initialValue: opts.initialValue ?? true,
2267
+ render: (prompt) => renderConfirmPrompt(prompt, opts)
2268
+ }, false);
2269
+ this.on("confirm", (value) => {
2270
+ this.setValue(value);
2271
+ this.state = "submit";
2272
+ this.emit("finalize");
2273
+ this.render();
2274
+ this.close();
2275
+ });
2276
+ this.on("cursor", (action) => {
2277
+ if (action === "up" || action === "down" || action === "left" || action === "right") {
2278
+ this.setValue(!this.value);
2279
+ }
2280
+ });
2281
+ }
2282
+ promptNonTty() {
2283
+ if (process.env.POE_NO_PROMPT === "1") {
2284
+ return Promise.resolve(this.value ?? true);
2285
+ }
2286
+ return super.promptNonTty();
2287
+ }
2288
+ };
2289
+ function choices(value) {
2290
+ const yes = value ? `${color.green(GLYPHS.radioActive)} ${color.bold("Yes")}` : `${color.dim(GLYPHS.radioInactive)} ${color.dim("Yes")}`;
2291
+ const no = value ? `${color.dim(GLYPHS.radioInactive)} ${color.dim("No")}` : `${color.green(GLYPHS.radioActive)} ${color.bold("No")}`;
2292
+ return `${yes} ${color.dim("/")} ${no}`;
2293
+ }
2294
+ function renderConfirmPrompt(prompt, opts) {
2295
+ if (prompt.state === "submit") {
2296
+ return `${color.gray(GLYPHS.barStart)} ${symbol(prompt.state)} ${opts.message}
2297
+ ${color.gray(GLYPHS.bar)} ${color.dim(prompt.value ? "Yes" : "No")}
2298
+ ${color.green(GLYPHS.barEnd)}`;
2299
+ }
2300
+ if (prompt.state === "cancel") {
2301
+ return `${color.gray(GLYPHS.barStart)} ${symbol(prompt.state)} ${opts.message}
2302
+ ${color.gray(GLYPHS.bar)} ${color.dim.strikethrough(prompt.value ? "Yes" : "No")}
2303
+ ${color.red(GLYPHS.barEnd)}`;
2304
+ }
2305
+ return `${color.gray(GLYPHS.barStart)} ${symbol(prompt.state)} ${opts.message}
2306
+ ${symbolBar(prompt.state)} ${choices(prompt.value)}
2307
+ ${color.cyan(GLYPHS.barEnd)}`;
2308
+ }
2309
+ function confirmPrompt(opts) {
2310
+ return new ConfirmPrompt(opts).prompt();
2311
+ }
2312
+
2313
+ // ../toolcraft-design/src/prompts/interactive/pagination.ts
2314
+ import { wrapAnsi as wrapAnsi2 } from "fast-wrap-ansi";
2315
+ function countLines(values) {
2316
+ return values.reduce((sum, value) => sum + value.split("\n").length, 0);
2317
+ }
2318
+ function trimToRows(values, cursorOffset, rows, hasTop, hasBottom) {
2319
+ const output = [...values];
2320
+ while (countLines(output) > rows && output.length > 1) {
2321
+ const removeFromTop = hasTop && cursorOffset > 0;
2322
+ const removeFromBottom = hasBottom && cursorOffset < output.length - 1;
2323
+ if (removeFromTop) {
2324
+ output.shift();
2325
+ cursorOffset -= 1;
2326
+ } else if (removeFromBottom) {
2327
+ output.pop();
2328
+ } else {
2329
+ output.pop();
2330
+ }
2331
+ }
2332
+ return output;
2333
+ }
2334
+ function limitOptions(opts) {
2335
+ const {
2336
+ cursor: cursor2,
2337
+ options,
2338
+ style,
2339
+ output,
2340
+ maxItems = Number.POSITIVE_INFINITY,
2341
+ columnPadding = 0,
2342
+ rowPadding = 4
2343
+ } = opts;
2344
+ if (options.length === 0) {
2345
+ return [];
2346
+ }
2347
+ const columns = Math.max(1, getColumns(output) - columnPadding);
2348
+ const rowBudget = Math.max(getRows(output) - rowPadding, 0);
2349
+ const visibleCount = Math.max(Math.min(maxItems, rowBudget), 5);
2350
+ const cappedVisibleCount = Math.min(visibleCount, options.length);
2351
+ let start = 0;
2352
+ if (cursor2 >= cappedVisibleCount - 3) {
2353
+ start = Math.max(Math.min(cursor2 - cappedVisibleCount + 3, options.length - cappedVisibleCount), 0);
2354
+ }
2355
+ const hasTopMarker = cappedVisibleCount < options.length && start > 0;
2356
+ const hasBottomMarker = cappedVisibleCount < options.length && start + cappedVisibleCount < options.length;
2357
+ const visible = options.slice(start, start + cappedVisibleCount).map((option, index) => wrapAnsi2(style(option, start + index === cursor2), columns, { hard: true, trim: false }));
2358
+ const trimmed = trimToRows(
2359
+ visible,
2360
+ Math.max(cursor2 - start, 0),
2361
+ Math.max(rowBudget - Number(hasTopMarker) - Number(hasBottomMarker), 1),
2362
+ hasTopMarker,
2363
+ hasBottomMarker
2364
+ );
2365
+ if (hasTopMarker) {
2366
+ trimmed.unshift(color.dim(GLYPHS.ellipsis));
2367
+ }
2368
+ if (hasBottomMarker) {
2369
+ trimmed.push(color.dim(GLYPHS.ellipsis));
2370
+ }
2371
+ return trimmed;
2372
+ }
2373
+
2374
+ // ../toolcraft-design/src/prompts/interactive/select.ts
2375
+ var SelectPrompt = class extends Prompt {
2376
+ options;
2377
+ constructor(opts) {
2378
+ if (opts.options.length === 0) {
2379
+ throw new Error("Select prompt requires at least one option.");
2380
+ }
2381
+ if (opts.options.every((option) => option.disabled)) {
2382
+ throw new Error("Select prompt requires at least one enabled option.");
2383
+ }
2384
+ const initialIndex = Math.max(opts.options.findIndex((option) => option.value === opts.initialValue), 0);
2385
+ const cursor2 = findNonDisabled(initialIndex, 1, opts.options);
2386
+ super({
2387
+ ...opts,
2388
+ initialValue: opts.options[cursor2]?.value,
2389
+ render: (prompt) => renderSelectPrompt(prompt, opts)
2390
+ }, false);
2391
+ this.options = opts.options;
2392
+ this._cursor = cursor2;
2393
+ this.setValue(this.options[this._cursor]?.value);
2394
+ this.on("cursor", (action) => {
2395
+ if (action === "up" || action === "left") {
2396
+ this._cursor = findNonDisabled(this._cursor - 1, -1, this.options);
2397
+ } else if (action === "down" || action === "right") {
2398
+ this._cursor = findNonDisabled(this._cursor + 1, 1, this.options);
2399
+ }
2400
+ this.setValue(this.options[this._cursor]?.value);
2401
+ });
2402
+ }
2403
+ get visibleOptions() {
2404
+ return this.options;
2405
+ }
2406
+ promptNonTty() {
2407
+ if (process.env.POE_NO_PROMPT === "1") {
2408
+ return Promise.resolve(this.value);
2409
+ }
2410
+ return super.promptNonTty();
2411
+ }
2412
+ };
2413
+ function findNonDisabled(start, direction, options) {
2414
+ if (options.every((option) => option.disabled)) {
2415
+ return start;
2416
+ }
2417
+ let index = start;
2418
+ for (let checked = 0; checked < options.length; checked += 1) {
2419
+ index = (index + options.length) % options.length;
2420
+ if (!options[index]?.disabled) {
2421
+ return index;
2422
+ }
2423
+ index += direction;
2424
+ }
2425
+ return start;
2426
+ }
2427
+ function renderOption(option, active, submitted, cancelled) {
2428
+ const hint = option.hint ? color.dim(` (${option.hint})`) : "";
2429
+ if (submitted) return color.dim(option.label);
2430
+ if (cancelled) return color.dim.strikethrough(option.label);
2431
+ if (option.disabled) return `${color.gray(GLYPHS.radioInactive)} ${color.gray.strikethrough(option.label)}${hint}`;
2432
+ if (active) return `${color.green(GLYPHS.radioActive)} ${option.label}${hint}`;
2433
+ return `${color.dim(GLYPHS.radioInactive)} ${color.dim(option.label)}${hint}`;
2434
+ }
2435
+ function renderSelectPrompt(prompt, opts) {
2436
+ if (prompt.state === "submit" || prompt.state === "cancel") {
2437
+ const option = prompt.visibleOptions[prompt.cursor];
2438
+ const rendered = option ? renderOption(option, false, prompt.state === "submit", prompt.state === "cancel") : "";
2439
+ const end = prompt.state === "submit" ? color.green(GLYPHS.barEnd) : color.red(GLYPHS.barEnd);
2440
+ return `${color.gray(GLYPHS.barStart)} ${symbol(prompt.state)} ${opts.message}
2441
+ ${color.gray(GLYPHS.bar)} ${rendered}
2442
+ ${end}`;
2443
+ }
2444
+ const lines = limitOptions({
2445
+ cursor: prompt.cursor,
2446
+ options: prompt.visibleOptions,
2447
+ output: opts.output ?? process.stdout,
2448
+ maxItems: opts.maxItems,
2449
+ columnPadding: 3,
2450
+ style: (option, active) => renderOption(option, active, false, false)
2451
+ }).map((line) => `${color.cyan(GLYPHS.bar)} ${line}`);
2452
+ return `${color.gray(GLYPHS.barStart)} ${symbol(prompt.state)} ${opts.message}
2453
+ ${lines.join("\n")}
2454
+ ${color.cyan(GLYPHS.barEnd)}`;
2455
+ }
2456
+ function selectPrompt(opts) {
2457
+ return new SelectPrompt(opts).prompt();
2458
+ }
2459
+
2460
+ // ../toolcraft-design/src/prompts/interactive/text.ts
2461
+ var TextPrompt = class extends Prompt {
2462
+ constructor(opts) {
2463
+ const initialUserInput = opts.initialValue ?? "";
2464
+ super({
2465
+ ...opts,
2466
+ initialValue: initialUserInput,
2467
+ initialUserInput,
2468
+ render: (prompt) => renderTextPrompt(prompt, opts),
2469
+ validate: opts.validate
2470
+ });
2471
+ this.on("userInput", (value) => this.setValue(value));
2472
+ this.on("finalize", () => {
2473
+ if (this.state === "submit") {
2474
+ this.setValue(this.value || opts.defaultValue || "");
2475
+ }
2476
+ });
2477
+ }
2478
+ get userInputWithCursor() {
2479
+ if (this.state === "submit") {
2480
+ return this.userInput;
2481
+ }
2482
+ const before = this.userInput.slice(0, this.cursor);
2483
+ const current = this.userInput[this.cursor];
2484
+ const after = this.userInput.slice(this.cursor + 1);
2485
+ if (current) {
2486
+ return `${before}${color.inverse(current)}${after}`;
2487
+ }
2488
+ return `${before}${color.inverse("\u2588")}`;
2489
+ }
2490
+ promptNonTty() {
2491
+ return this.readNonTtyLine();
2492
+ }
2493
+ };
2494
+ function renderHeader2(prompt, message2) {
2495
+ return `${color.gray(GLYPHS.barStart)} ${symbol(prompt.state)} ${message2}`;
2496
+ }
2497
+ function renderTextPrompt(prompt, opts) {
2498
+ const value = prompt.value ?? "";
2499
+ if (prompt.state === "submit") {
2500
+ return `${renderHeader2(prompt, opts.message)}
2501
+ ${color.gray(GLYPHS.bar)} ${color.dim(value)}
2502
+ ${color.green(GLYPHS.barEnd)}`;
2503
+ }
2504
+ if (prompt.state === "cancel") {
2505
+ return `${renderHeader2(prompt, opts.message)}
2506
+ ${color.gray(GLYPHS.bar)} ${color.dim.strikethrough(value)}
2507
+ ${color.red(GLYPHS.barEnd)}`;
2508
+ }
2509
+ const input = prompt.userInput.length > 0 ? prompt.userInputWithCursor : opts.placeholder ? `${color.inverse(opts.placeholder[0] ?? " ")}${color.dim(opts.placeholder.slice(1))}` : color.inverse("_");
2510
+ if (prompt.state === "error") {
2511
+ return `${renderHeader2(prompt, opts.message)}
2512
+ ${symbolBar(prompt.state)} ${input}
2513
+ ${color.yellow(GLYPHS.barEnd)} ${color.yellow(prompt.error)}`;
2514
+ }
2515
+ return `${renderHeader2(prompt, opts.message)}
2516
+ ${symbolBar(prompt.state)} ${input}
2517
+ ${color.cyan(GLYPHS.barEnd)}`;
2518
+ }
2519
+ function textPrompt(opts) {
2520
+ return new TextPrompt(opts).prompt();
2521
+ }
1897
2522
 
1898
2523
  // ../toolcraft-design/src/prompts/primitives/cancel.ts
1899
- import { isCancel } from "@clack/prompts";
1900
2524
  function cancel(msg = "") {
1901
2525
  if (resolveOutputFormat() !== "terminal") {
1902
2526
  return;
@@ -1959,14 +2583,14 @@ function note(message2, title) {
1959
2583
  var SPINNER_FRAMES = Object.freeze(["\u25D2", "\u25D0", "\u25D3", "\u25D1"]);
1960
2584
 
1961
2585
  // ../toolcraft-design/src/prompts/index.ts
1962
- async function select2(opts) {
1963
- return clack.select(opts);
2586
+ async function select(opts) {
2587
+ return selectPrompt(opts);
1964
2588
  }
1965
- async function text3(opts) {
1966
- return clack.text(opts);
2589
+ async function text2(opts) {
2590
+ return textPrompt(opts);
1967
2591
  }
1968
- async function confirm2(opts) {
1969
- return clack.confirm(opts);
2592
+ async function confirm(opts) {
2593
+ return confirmPrompt(opts);
1970
2594
  }
1971
2595
 
1972
2596
  // ../toolcraft/src/index.ts
@@ -2341,6 +2965,12 @@ function cloneRequires(requires) {
2341
2965
  function cloneStringArray(values) {
2342
2966
  return values === void 0 ? void 0 : [...values];
2343
2967
  }
2968
+ function cloneCommandExamples(examples) {
2969
+ return (examples ?? []).map((example) => ({
2970
+ title: example.title,
2971
+ params: { ...example.params }
2972
+ }));
2973
+ }
2344
2974
  function cloneStringRecord(values) {
2345
2975
  return values === void 0 ? void 0 : { ...values };
2346
2976
  }
@@ -2605,9 +3235,11 @@ function createBaseCommand(config2) {
2605
3235
  kind: "command",
2606
3236
  name: config2.name,
2607
3237
  description: config2.description,
3238
+ examples: cloneCommandExamples(config2.examples),
2608
3239
  aliases: [...config2.aliases ?? []],
2609
3240
  positional: [...config2.positional ?? []],
2610
3241
  params: config2.params,
3242
+ result: config2.result,
2611
3243
  secrets: cloneSecrets(config2.secrets),
2612
3244
  scope: resolveCommandScope(config2.scope, void 0),
2613
3245
  confirm: config2.confirm ?? false,
@@ -2619,6 +3251,8 @@ function createBaseCommand(config2) {
2619
3251
  Object.defineProperty(command, commandConfigSymbol, {
2620
3252
  value: {
2621
3253
  scope: cloneScope(config2.scope),
3254
+ examples: cloneCommandExamples(config2.examples),
3255
+ result: config2.result,
2622
3256
  humanInLoop: config2.humanInLoop,
2623
3257
  secrets: cloneSecrets(config2.secrets),
2624
3258
  requires: cloneRequires(config2.requires),
@@ -2667,9 +3301,11 @@ function materializeCommand(command, inherited) {
2667
3301
  kind: "command",
2668
3302
  name: command.name,
2669
3303
  description: command.description,
3304
+ examples: cloneCommandExamples(internal.examples),
2670
3305
  aliases: [...command.aliases],
2671
3306
  positional: [...command.positional],
2672
3307
  params: command.params,
3308
+ result: internal.result,
2673
3309
  secrets: mergeSecrets(inherited.secrets, internal.secrets),
2674
3310
  scope: resolveCommandScope(internal.scope, inherited.scope),
2675
3311
  confirm: command.confirm,
@@ -2681,6 +3317,8 @@ function materializeCommand(command, inherited) {
2681
3317
  Object.defineProperty(materialized, commandConfigSymbol, {
2682
3318
  value: {
2683
3319
  scope: cloneScope(internal.scope),
3320
+ examples: cloneCommandExamples(internal.examples),
3321
+ result: internal.result,
2684
3322
  humanInLoop: internal.humanInLoop,
2685
3323
  secrets: cloneSecrets(internal.secrets),
2686
3324
  requires: cloneRequires(internal.requires),
@@ -2922,7 +3560,7 @@ var AnchorNotFoundError = class extends Error {
2922
3560
  };
2923
3561
 
2924
3562
  // ../task-list/src/backends/gh-issues-client.ts
2925
- import { text as text4 } from "node:stream/consumers";
3563
+ import { text as text3 } from "node:stream/consumers";
2926
3564
 
2927
3565
  // ../process-runner/src/docker/context.ts
2928
3566
  import { execSync } from "node:child_process";
@@ -3131,8 +3769,8 @@ async function resolveAuth(options) {
3131
3769
  stderr: "pipe"
3132
3770
  });
3133
3771
  const [stdout, , result] = await Promise.all([
3134
- handle.stdout === null ? Promise.resolve("") : text4(handle.stdout),
3135
- handle.stderr === null ? Promise.resolve("") : text4(handle.stderr),
3772
+ handle.stdout === null ? Promise.resolve("") : text3(handle.stdout),
3773
+ handle.stderr === null ? Promise.resolve("") : text3(handle.stderr),
3136
3774
  handle.result
3137
3775
  ]);
3138
3776
  const token = stdout.trim();
@@ -4331,7 +4969,7 @@ function parseQualifiedId(qualifiedId, listName) {
4331
4969
 
4332
4970
  // ../task-list/src/backends/markdown-dir.ts
4333
4971
  import path7 from "node:path";
4334
- import { parseDocument, stringify } from "yaml";
4972
+ import { parseDocument as parseDocument2, stringify as stringify2 } from "yaml";
4335
4973
 
4336
4974
  // ../task-list/src/schema/task.schema.json
4337
4975
  var task_schema_default = {
@@ -4522,7 +5160,7 @@ function splitTaskDocument(content, filePath, mode) {
4522
5160
  };
4523
5161
  }
4524
5162
  function readFrontmatter(frontmatterContent, filePath) {
4525
- const document = parseDocument(frontmatterContent);
5163
+ const document = parseDocument2(frontmatterContent);
4526
5164
  if (document.errors.length > 0) {
4527
5165
  throw malformedTask(filePath, "frontmatter");
4528
5166
  }
@@ -4592,7 +5230,7 @@ function createTask(list, id, frontmatter, body, mode, sourcePath) {
4592
5230
  }
4593
5231
  function serializeTaskDocument(frontmatter, description) {
4594
5232
  return `---
4595
- ${stringify(frontmatter)}---
5233
+ ${stringify2(frontmatter)}---
4596
5234
 
4597
5235
  ${description}`;
4598
5236
  }
@@ -5330,7 +5968,7 @@ async function markdownDirBackend(deps) {
5330
5968
 
5331
5969
  // ../task-list/src/backends/yaml-file.ts
5332
5970
  import path8 from "node:path";
5333
- import { isMap, parseDocument as parseDocument2 } from "yaml";
5971
+ import { isMap, parseDocument as parseDocument3 } from "yaml";
5334
5972
 
5335
5973
  // ../task-list/src/schema/store.schema.json
5336
5974
  var store_schema_default = {
@@ -5507,7 +6145,7 @@ function buildFiredTaskRecord(existing, to, metadataPatch) {
5507
6145
  function parseStoreDocument(filePath, content) {
5508
6146
  let document;
5509
6147
  try {
5510
- document = parseDocument2(content, { keepSourceTokens: true, prettyErrors: false });
6148
+ document = parseDocument3(content, { keepSourceTokens: true, prettyErrors: false });
5511
6149
  } catch {
5512
6150
  throw malformedStore(filePath, "yaml");
5513
6151
  }
@@ -5684,7 +6322,7 @@ async function ensureStorePath(deps) {
5684
6322
  deps.fs,
5685
6323
  deps.path,
5686
6324
  serializeDocument(
5687
- parseDocument2(
6325
+ parseDocument3(
5688
6326
  [
5689
6327
  `$schema: ${STORE_SCHEMA_ID}`,
5690
6328
  `kind: ${STORE_KIND}`,
@@ -7688,8 +8326,8 @@ function validateAuthorizationCallbackBinding(callback, expected) {
7688
8326
  function createAuthorizationError(error3, description) {
7689
8327
  return new Error(`OAuth authorization failed: ${error3} \u2014 ${description}`);
7690
8328
  }
7691
- function escapeHtml2(text5) {
7692
- return text5.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
8329
+ function escapeHtml2(text4) {
8330
+ return text4.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;");
7693
8331
  }
7694
8332
  function buildSuccessPage(landingPage) {
7695
8333
  const title = landingPage?.title ?? "Connected";
@@ -10236,6 +10874,9 @@ function isCallToolResult(value) {
10236
10874
  if (!isObjectRecord5(value) || !Array.isArray(value.content)) {
10237
10875
  return false;
10238
10876
  }
10877
+ if (value.structuredContent !== void 0 && !isObjectRecord5(value.structuredContent)) {
10878
+ return false;
10879
+ }
10239
10880
  if (value.isError !== void 0 && typeof value.isError !== "boolean") {
10240
10881
  return false;
10241
10882
  }
@@ -10975,13 +11616,13 @@ var proxyNodeSymbol = /* @__PURE__ */ Symbol("toolcraft.mcpProxyNode");
10975
11616
  var proxyConnectionSymbol = /* @__PURE__ */ Symbol("toolcraft.mcpProxyConnection");
10976
11617
  var shutdownDisposers = /* @__PURE__ */ new Set();
10977
11618
  function getInternalGroupConfig2(group) {
10978
- const symbol = Object.getOwnPropertySymbols(group).find(
11619
+ const symbol2 = Object.getOwnPropertySymbols(group).find(
10979
11620
  (candidate) => candidate.description === GROUP_CONFIG_SYMBOL_DESCRIPTION
10980
11621
  );
10981
- if (symbol === void 0) {
11622
+ if (symbol2 === void 0) {
10982
11623
  return {};
10983
11624
  }
10984
- return group[symbol] ?? {};
11625
+ return group[symbol2] ?? {};
10985
11626
  }
10986
11627
  function isProxyNode(node) {
10987
11628
  return node[proxyNodeSymbol] === true;
@@ -11028,23 +11669,38 @@ function createProxyCommand(parent, tool, commandName, connection) {
11028
11669
  if (params17.kind !== "object") {
11029
11670
  throw new Error(`upstream tool "${tool.name}" must define an object input schema`);
11030
11671
  }
11672
+ const result = tool.outputSchema === void 0 ? void 0 : convertJsonSchema(tool.outputSchema);
11673
+ if (result !== void 0 && result.kind !== "object") {
11674
+ throw new Error(`upstream tool "${tool.name}" must define an object output schema`);
11675
+ }
11031
11676
  return markProxyNode({
11032
11677
  kind: "command",
11033
11678
  name: commandName,
11034
11679
  description: tool.description,
11680
+ examples: [],
11035
11681
  aliases: [],
11036
11682
  positional: [],
11037
11683
  params: params17,
11684
+ ...result === void 0 ? {} : { result },
11038
11685
  secrets: cloneSecrets2(parent.secrets),
11039
11686
  scope: cloneScope2(parent.scope) ?? ["cli", "sdk"],
11040
11687
  confirm: false,
11041
11688
  requires: parent.requires,
11042
11689
  handler: async (ctx) => {
11043
11690
  const client = await ensureConnected(connection);
11044
- return client.callTool({
11691
+ const toolResult = await client.callTool({
11045
11692
  name: tool.name,
11046
11693
  arguments: ctx.params
11047
11694
  });
11695
+ if (result === void 0) {
11696
+ return toolResult;
11697
+ }
11698
+ if (toolResult.structuredContent === void 0) {
11699
+ throw new Error(
11700
+ `upstream tool "${tool.name}" declared outputSchema but returned no structuredContent`
11701
+ );
11702
+ }
11703
+ return toolResult.structuredContent;
11048
11704
  },
11049
11705
  render: void 0
11050
11706
  });
@@ -11175,12 +11831,12 @@ async function fetchCache(name, config2) {
11175
11831
  try {
11176
11832
  logger2.info(`MCP ${name}: listing tools`);
11177
11833
  const tools = [];
11178
- let cursor;
11834
+ let cursor2;
11179
11835
  do {
11180
- const page = await client.listTools(cursor === void 0 ? {} : { cursor });
11836
+ const page = await client.listTools(cursor2 === void 0 ? {} : { cursor: cursor2 });
11181
11837
  tools.push(...page.tools);
11182
- cursor = page.nextCursor;
11183
- } while (cursor !== void 0);
11838
+ cursor2 = page.nextCursor;
11839
+ } while (cursor2 !== void 0);
11184
11840
  logger2.info(`MCP ${name}: found ${tools.length} tools`);
11185
11841
  const upstream = client.serverInfo ?? {
11186
11842
  name,
@@ -11954,8 +12610,8 @@ function extractMcpPayload(envelope) {
11954
12610
  return structuredContent;
11955
12611
  }
11956
12612
  if (Array.isArray(envelope.content)) {
11957
- const text5 = envelope.content.filter(isMcpTextContent).map((block) => block.text).join("\n");
11958
- return text5.length > 0 ? text5 : void 0;
12613
+ const text4 = envelope.content.filter(isMcpTextContent).map((block) => block.text).join("\n");
12614
+ return text4.length > 0 ? text4 : void 0;
11959
12615
  }
11960
12616
  return void 0;
11961
12617
  }
@@ -12513,6 +13169,7 @@ function collectFields(schema, casing, globalLongOptionFlags, path24 = [], inher
12513
13169
  globalLongOptionFlags
12514
13170
  ),
12515
13171
  optionFlag: toOptionFlag([...nextPath, childSchema.discriminator], casing),
13172
+ longAliases: [],
12516
13173
  shortFlag: void 0,
12517
13174
  schema: createSyntheticEnumSchema(branchIds),
12518
13175
  description: childSchema.description,
@@ -12566,6 +13223,7 @@ function collectFields(schema, casing, globalLongOptionFlags, path24 = [], inher
12566
13223
  globalLongOptionFlags
12567
13224
  ),
12568
13225
  optionFlag: toOptionFlag(controlPath, casing),
13226
+ longAliases: [],
12569
13227
  shortFlag: void 0,
12570
13228
  schema: createSyntheticEnumSchema(branchIds),
12571
13229
  description: childSchema.description,
@@ -12648,6 +13306,9 @@ function collectFields(schema, casing, globalLongOptionFlags, path24 = [], inher
12648
13306
  optionAttribute: toOptionAttribute(nextPath, casing),
12649
13307
  commanderOptionAttribute: toCommanderOptionAttribute(nextPath, casing, globalLongOptionFlags),
12650
13308
  optionFlag: toOptionFlag(nextPath, casing),
13309
+ longAliases: [...childSchema.cliAliases ?? []].map(
13310
+ (alias) => alias.startsWith("--") ? alias : `--${alias}`
13311
+ ),
12651
13312
  shortFlag: childSchema.short,
12652
13313
  schema: childSchema,
12653
13314
  description: childSchema.description,
@@ -12706,9 +13367,9 @@ function formatOptionFlags(field, globalLongOptionFlags) {
12706
13367
  return `-${field.shortFlag}`;
12707
13368
  }
12708
13369
  if (field.shortFlag === void 0) {
12709
- return field.optionFlag;
13370
+ return [field.optionFlag, ...field.longAliases].join(", ");
12710
13371
  }
12711
- return `-${field.shortFlag}, ${field.optionFlag}`;
13372
+ return [`-${field.shortFlag}`, field.optionFlag, ...field.longAliases].join(", ");
12712
13373
  }
12713
13374
  function formatPositionalToken(field) {
12714
13375
  const optionalPositional = field.optional || field.hasDefault;
@@ -12988,24 +13649,34 @@ function getGlobalLongOptionFlags(presetsEnabled, versionEnabled, controls) {
12988
13649
  }
12989
13650
  return new Set(flags);
12990
13651
  }
12991
- function validateUniqueOptionFlags(fields) {
13652
+ function validateUniqueOptionFlags(fields, globalLongOptionFlags) {
12992
13653
  const fieldsByFlag = /* @__PURE__ */ new Map();
12993
13654
  for (const field of fields) {
12994
13655
  if (field.positionalIndex !== void 0) {
12995
13656
  continue;
12996
13657
  }
12997
- const existing = fieldsByFlag.get(field.optionFlag);
12998
- if (existing !== void 0) {
12999
- throw new UserError(
13000
- `Parameters "${existing.displayPath}" and "${field.displayPath}" use conflicting CLI flag "${field.optionFlag}".`
13001
- );
13658
+ for (const flag of [field.optionFlag, ...field.longAliases]) {
13659
+ if (globalLongOptionFlags.has(flag)) {
13660
+ if (flag === field.optionFlag && field.shortFlag !== void 0) {
13661
+ continue;
13662
+ }
13663
+ throw new UserError(
13664
+ `Parameter "${field.displayPath}" uses reserved CLI flag "${flag}". Add a short flag or rename the parameter.`
13665
+ );
13666
+ }
13667
+ const existing = fieldsByFlag.get(flag);
13668
+ if (existing !== void 0) {
13669
+ throw new UserError(
13670
+ `Parameters "${existing.displayPath}" and "${field.displayPath}" use conflicting CLI flag "${flag}".`
13671
+ );
13672
+ }
13673
+ fieldsByFlag.set(flag, field);
13002
13674
  }
13003
- fieldsByFlag.set(field.optionFlag, field);
13004
13675
  }
13005
13676
  }
13006
13677
  function createCommanderOption(flags, description, field) {
13007
13678
  const option = new Option(flags, description);
13008
- if (field.commanderOptionAttribute !== field.optionAttribute) {
13679
+ if (field.commanderOptionAttribute !== field.optionAttribute || field.longAliases.length > 0) {
13009
13680
  option.attributeName = () => field.commanderOptionAttribute;
13010
13681
  }
13011
13682
  return option;
@@ -13326,6 +13997,26 @@ function formatSecretDescription(secret) {
13326
13997
  }
13327
13998
  return secret.optional === true ? "Optional secret" : "Required secret";
13328
13999
  }
14000
+ function formatExampleValue(value) {
14001
+ if (typeof value === "string" && value.length > 0 && !value.includes(" ")) {
14002
+ return value;
14003
+ }
14004
+ return JSON.stringify(value);
14005
+ }
14006
+ function formatExampleCommand(breadcrumb, rootUsageName, params17) {
14007
+ const commandPath = buildUsageLine(breadcrumb, rootUsageName, "");
14008
+ const flags = Object.entries(params17).map(([key2, value]) => {
14009
+ const flag = `--${key2}`;
14010
+ return typeof value === "boolean" ? value ? flag : `--no-${key2}` : `${flag} ${formatExampleValue(value)}`;
14011
+ });
14012
+ return [commandPath, ...flags].filter((token) => token.length > 0).join(" ");
14013
+ }
14014
+ function formatExampleRows(examples, breadcrumb, rootUsageName) {
14015
+ return examples.map(
14016
+ (example) => `${example.title}
14017
+ ${formatExampleCommand(breadcrumb, rootUsageName, example.params)}`
14018
+ );
14019
+ }
13329
14020
  function wrapOptionalCommandParameterToken(token, optional) {
13330
14021
  return optional ? `[${token}]` : token;
13331
14022
  }
@@ -13484,6 +14175,12 @@ ${formatHelpOptionList(optionRows)}`);
13484
14175
  ${formatHelpOptionList(secretRows)}`
13485
14176
  );
13486
14177
  }
14178
+ if (command.examples.length > 0) {
14179
+ sections.push(
14180
+ `${text.sectionHeader("Examples")}
14181
+ ${formatExampleRows(command.examples, breadcrumb, rootUsageName).join("\n")}`
14182
+ );
14183
+ }
13487
14184
  const positionalFields = fields.filter((f) => f.positionalIndex !== void 0);
13488
14185
  const usageSuffix = positionalFields.length > 0 ? `[OPTIONS] ${positionalFields.map(formatPositionalToken).join(" ")}` : "[OPTIONS]";
13489
14186
  return renderHelpDocument({
@@ -13559,7 +14256,7 @@ function createNodeCommand(node, casing, globalLongOptionFlags, execute, presets
13559
14256
  const command = new CommanderCommand(node.name);
13560
14257
  const collected = collectFields(node.params, casing, globalLongOptionFlags);
13561
14258
  const fields = assignPositionals(collected.fields, node.positional);
13562
- validateUniqueOptionFlags(fields);
14259
+ validateUniqueOptionFlags(fields, globalLongOptionFlags);
13563
14260
  if (node.description !== void 0) {
13564
14261
  command.description(node.description);
13565
14262
  }
@@ -13690,26 +14387,26 @@ function parseDebugStackMode(value) {
13690
14387
  );
13691
14388
  }
13692
14389
  function setNestedValue(target, path24, value) {
13693
- let cursor = target;
14390
+ let cursor2 = target;
13694
14391
  for (let index = 0; index < path24.length - 1; index += 1) {
13695
14392
  const segment = path24[index] ?? "";
13696
- const existing = Object.prototype.hasOwnProperty.call(cursor, segment) ? cursor[segment] : void 0;
14393
+ const existing = Object.prototype.hasOwnProperty.call(cursor2, segment) ? cursor2[segment] : void 0;
13697
14394
  if (typeof existing === "object" && existing !== null) {
13698
- cursor = existing;
14395
+ cursor2 = existing;
13699
14396
  continue;
13700
14397
  }
13701
14398
  const next = {};
13702
- Object.defineProperty(cursor, segment, {
14399
+ Object.defineProperty(cursor2, segment, {
13703
14400
  value: next,
13704
14401
  enumerable: true,
13705
14402
  configurable: true,
13706
14403
  writable: true
13707
14404
  });
13708
- cursor = next;
14405
+ cursor2 = next;
13709
14406
  }
13710
14407
  const leaf = path24[path24.length - 1];
13711
14408
  if (leaf !== void 0) {
13712
- Object.defineProperty(cursor, leaf, {
14409
+ Object.defineProperty(cursor2, leaf, {
13713
14410
  value,
13714
14411
  enumerable: true,
13715
14412
  configurable: true,
@@ -13743,7 +14440,7 @@ async function promptForField(field) {
13743
14440
  label: enumOptionLabel(schema, value),
13744
14441
  value
13745
14442
  }));
13746
- const selected = await select2({
14443
+ const selected = await select({
13747
14444
  message: field.description ?? fieldPromptLabel(field),
13748
14445
  options,
13749
14446
  initialValue: field.hasDefault ? field.defaultValue : void 0
@@ -13755,7 +14452,7 @@ async function promptForField(field) {
13755
14452
  return selected;
13756
14453
  }
13757
14454
  if (field.schema.kind === "boolean") {
13758
- const selected = await confirm2({
14455
+ const selected = await confirm({
13759
14456
  message: fieldPromptLabel(field),
13760
14457
  initialValue: field.hasDefault ? Boolean(field.defaultValue) : void 0
13761
14458
  });
@@ -13765,7 +14462,7 @@ async function promptForField(field) {
13765
14462
  }
13766
14463
  return selected;
13767
14464
  }
13768
- const entered = await text3({
14465
+ const entered = await text2({
13769
14466
  message: fieldPromptLabel(field),
13770
14467
  initialValue: field.hasDefault && field.defaultValue !== void 0 ? formatResolvedValue(field.defaultValue) : void 0
13771
14468
  });
@@ -14240,12 +14937,12 @@ function createFixtureEnvValues(command) {
14240
14937
  }
14241
14938
  return values;
14242
14939
  }
14243
- async function resolveFixtureRuntime(command, services, requirementOptions) {
14940
+ async function resolveFixtureRuntime(command, services, requirementOptions, runtimeFetch) {
14244
14941
  const selector = process.env.TOOLCRAFT_FIXTURE;
14245
14942
  if (selector === void 0 || selector.length === 0) {
14246
14943
  return {
14247
14944
  env: createEnv2(),
14248
- fetch: globalThis.fetch,
14945
+ fetch: runtimeFetch,
14249
14946
  fs: createFs2(),
14250
14947
  isFixture: false,
14251
14948
  requirementOptions,
@@ -14384,22 +15081,22 @@ function consumeFieldValue(args, index, schema, label, inlineValue) {
14384
15081
  if (schema.kind === "array") {
14385
15082
  const values = [];
14386
15083
  let nextIndex = index;
14387
- let cursor = index + 1;
14388
- while (cursor < args.length) {
14389
- const token = args[cursor] ?? "";
15084
+ let cursor2 = index + 1;
15085
+ while (cursor2 < args.length) {
15086
+ const token = args[cursor2] ?? "";
14390
15087
  if (token.startsWith("-")) {
14391
15088
  break;
14392
15089
  }
14393
15090
  const parsed = parseArrayValue(token, schema, label);
14394
15091
  if (parsed === null) {
14395
15092
  return {
14396
- nextIndex: cursor,
15093
+ nextIndex: cursor2,
14397
15094
  value: null
14398
15095
  };
14399
15096
  }
14400
15097
  values.push(...parsed);
14401
- nextIndex = cursor;
14402
- cursor += 1;
15098
+ nextIndex = cursor2;
15099
+ cursor2 += 1;
14403
15100
  }
14404
15101
  if (values.length === 0) {
14405
15102
  throw new InvalidArgumentError(`option '${label}' argument missing`);
@@ -14932,7 +15629,7 @@ function getResolvedFlags(command) {
14932
15629
  const flags = command.optsWithGlobals();
14933
15630
  return flags;
14934
15631
  }
14935
- async function executeCommand(state, services, requirementOptions, runtimeOptions, onErrorReportContext) {
15632
+ async function executeCommand(state, services, requirementOptions, runtimeFetch, runtimeOptions, onErrorReportContext) {
14936
15633
  const logger2 = createLogger();
14937
15634
  const primitives = {
14938
15635
  logger: logger2,
@@ -14944,7 +15641,12 @@ async function executeCommand(state, services, requirementOptions, runtimeOption
14944
15641
  const resolvedFlags = optionValues;
14945
15642
  const output = resolveOutput(resolvedFlags);
14946
15643
  const shouldPrompt = !resolvedFlags.yes && Boolean(process.stdin.isTTY);
14947
- const runtime = await resolveFixtureRuntime(state.command, services, requirementOptions);
15644
+ const runtime = await resolveFixtureRuntime(
15645
+ state.command,
15646
+ services,
15647
+ requirementOptions,
15648
+ runtimeFetch
15649
+ );
14948
15650
  const preflightContext = {
14949
15651
  ...runtime.services,
14950
15652
  secrets: runtime.secrets,
@@ -14987,7 +15689,7 @@ async function executeCommand(state, services, requirementOptions, runtimeOption
14987
15689
  logger2.resolved(field.displayPath, formatResolvedValue(value));
14988
15690
  }
14989
15691
  }
14990
- const proceed = await confirm2({
15692
+ const proceed = await confirm({
14991
15693
  message: "Proceed?",
14992
15694
  initialValue: true
14993
15695
  });
@@ -15475,6 +16177,7 @@ async function runCLI(roots, options = {}) {
15475
16177
  const casing = options.casing ?? "kebab";
15476
16178
  const services = options.services ?? {};
15477
16179
  const runtimeOptions = options.humanInLoop ?? {};
16180
+ const runtimeFetch = options.fetch ?? globalThis.fetch;
15478
16181
  const version = options.version ?? findEntrypointPackageMetadata(process.argv[1])?.version;
15479
16182
  const rootUsageName = options.rootUsageName ?? inferProgramName(process.argv);
15480
16183
  const controls = resolveCLIControls(options.controls);
@@ -15516,6 +16219,7 @@ async function runCLI(roots, options = {}) {
15516
16219
  state,
15517
16220
  servicesWithBuiltIns,
15518
16221
  requirementOptions,
16222
+ runtimeFetch,
15519
16223
  runtimeOptions,
15520
16224
  (context) => {
15521
16225
  errorReportContext = context;
@@ -15594,7 +16298,7 @@ async function runCLI(roots, options = {}) {
15594
16298
  import { randomUUID as randomUUID6 } from "node:crypto";
15595
16299
 
15596
16300
  // src/terminal-session.ts
15597
- import { EventEmitter } from "node:events";
16301
+ import { EventEmitter as EventEmitter2 } from "node:events";
15598
16302
  import { accessSync, chmodSync, constants } from "node:fs";
15599
16303
  import { createRequire } from "node:module";
15600
16304
  import { dirname, join } from "node:path";
@@ -16419,12 +17123,12 @@ var TerminalScreen = class {
16419
17123
  constructor({
16420
17124
  lines,
16421
17125
  rawLines,
16422
- cursor,
17126
+ cursor: cursor2,
16423
17127
  size
16424
17128
  }) {
16425
17129
  this.lines = Object.freeze(lines.map((line) => stripAnsi(line)));
16426
17130
  this.rawLines = Object.freeze([...rawLines]);
16427
- this.cursor = Object.freeze({ ...cursor });
17131
+ this.cursor = Object.freeze({ ...cursor2 });
16428
17132
  this.size = Object.freeze({ ...size });
16429
17133
  Object.freeze(this);
16430
17134
  }
@@ -16460,7 +17164,7 @@ var TerminalSession = class {
16460
17164
  exitCode = null;
16461
17165
  pty;
16462
17166
  terminal;
16463
- emitter = new EventEmitter();
17167
+ emitter = new EventEmitter2();
16464
17168
  exitPromise;
16465
17169
  rawBuffer = "";
16466
17170
  lastDataAt = Date.now();
@@ -16508,14 +17212,14 @@ var TerminalSession = class {
16508
17212
  });
16509
17213
  });
16510
17214
  }
16511
- async type(text5) {
16512
- for (const character of text5) {
17215
+ async type(text4) {
17216
+ for (const character of text4) {
16513
17217
  await this.send(character);
16514
17218
  await sleep(TYPE_DELAY_MS);
16515
17219
  }
16516
17220
  }
16517
- async fill(text5) {
16518
- await this.send(text5.replace(/\r?\n/g, "\r"));
17221
+ async fill(text4) {
17222
+ await this.send(text4.replace(/\r?\n/g, "\r"));
16519
17223
  }
16520
17224
  async press(key2) {
16521
17225
  await this.send(keyToSequence(key2));
@@ -16737,25 +17441,25 @@ function splitHistoryLines(input) {
16737
17441
  function normalizeHistoryBuffer(input) {
16738
17442
  let output = "";
16739
17443
  let line = "";
16740
- let cursor = 0;
17444
+ let cursor2 = 0;
16741
17445
  for (const character of input) {
16742
17446
  if (character === "\r") {
16743
- cursor = 0;
17447
+ cursor2 = 0;
16744
17448
  continue;
16745
17449
  }
16746
17450
  if (character === "\b") {
16747
- cursor = Math.max(0, cursor - 1);
17451
+ cursor2 = Math.max(0, cursor2 - 1);
16748
17452
  continue;
16749
17453
  }
16750
17454
  if (character === "\n") {
16751
17455
  output += `${line}
16752
17456
  `;
16753
17457
  line = "";
16754
- cursor = 0;
17458
+ cursor2 = 0;
16755
17459
  continue;
16756
17460
  }
16757
- line = `${line.slice(0, cursor)}${character}${line.slice(cursor + 1)}`;
16758
- cursor += 1;
17461
+ line = `${line.slice(0, cursor2)}${character}${line.slice(cursor2 + 1)}`;
17462
+ cursor2 += 1;
16759
17463
  }
16760
17464
  return output + line;
16761
17465
  }
@@ -17474,7 +18178,7 @@ function detectIndent(content) {
17474
18178
  }
17475
18179
  return " ";
17476
18180
  }
17477
- function parse3(content) {
18181
+ function parse4(content) {
17478
18182
  if (!content || content.trim() === "") {
17479
18183
  return {};
17480
18184
  }
@@ -17599,7 +18303,7 @@ function applyObjectUpdate(content, path24, current, next) {
17599
18303
  return result;
17600
18304
  }
17601
18305
  var jsonFormat = {
17602
- parse: parse3,
18306
+ parse: parse4,
17603
18307
  serialize,
17604
18308
  serializeUpdate,
17605
18309
  merge,
@@ -17611,7 +18315,7 @@ import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
17611
18315
  function isConfigObject2(value) {
17612
18316
  return typeof value === "object" && value !== null && !Array.isArray(value);
17613
18317
  }
17614
- function parse4(content) {
18318
+ function parse5(content) {
17615
18319
  if (!content || content.trim() === "") {
17616
18320
  return {};
17617
18321
  }
@@ -17677,7 +18381,7 @@ function prune2(obj, shape) {
17677
18381
  return { changed, result };
17678
18382
  }
17679
18383
  var tomlFormat = {
17680
- parse: parse4,
18384
+ parse: parse5,
17681
18385
  serialize: serialize2,
17682
18386
  merge: merge2,
17683
18387
  prune: prune2
@@ -17688,7 +18392,7 @@ import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
17688
18392
  function isConfigObject3(value) {
17689
18393
  return typeof value === "object" && value !== null && !Array.isArray(value);
17690
18394
  }
17691
- function parse5(content) {
18395
+ function parse6(content) {
17692
18396
  if (!content || content.trim() === "") {
17693
18397
  return {};
17694
18398
  }
@@ -17754,7 +18458,7 @@ function prune3(obj, shape) {
17754
18458
  return { changed, result };
17755
18459
  }
17756
18460
  var yamlFormat = {
17757
- parse: parse5,
18461
+ parse: parse6,
17758
18462
  serialize: serialize3,
17759
18463
  merge: merge3,
17760
18464
  prune: prune3
@@ -19015,17 +19719,17 @@ function colorsEqual(left, right) {
19015
19719
  }
19016
19720
  return false;
19017
19721
  }
19018
- function pushRun(runs, style, text5) {
19019
- if (text5.length === 0) {
19722
+ function pushRun(runs, style, text4) {
19723
+ if (text4.length === 0) {
19020
19724
  return;
19021
19725
  }
19022
19726
  const previous = runs.at(-1);
19023
- if (previous && text5 !== "\n" && previous.text !== "\n" && stylesEqual(previous, style)) {
19024
- previous.text += text5;
19727
+ if (previous && text4 !== "\n" && previous.text !== "\n" && stylesEqual(previous, style)) {
19728
+ previous.text += text4;
19025
19729
  return;
19026
19730
  }
19027
19731
  runs.push({
19028
- text: text5,
19732
+ text: text4,
19029
19733
  fg: style.fg,
19030
19734
  bg: style.bg,
19031
19735
  bold: style.bold,
@@ -19355,10 +20059,10 @@ function parseAnsi2(input) {
19355
20059
  continue;
19356
20060
  }
19357
20061
  const codePoint = input.codePointAt(index);
19358
- const text5 = codePoint === void 0 ? "" : String.fromCodePoint(codePoint);
19359
- lines[row][column] = { text: text5, style: cloneStyle(style) };
20062
+ const text4 = codePoint === void 0 ? "" : String.fromCodePoint(codePoint);
20063
+ lines[row][column] = { text: text4, style: cloneStyle(style) };
19360
20064
  column += 1;
19361
- index += text5.length;
20065
+ index += text4.length;
19362
20066
  }
19363
20067
  return buildRuns(lines, lineBreakStyles);
19364
20068
  }
@@ -19769,10 +20473,10 @@ function measureLines(lines) {
19769
20473
  0
19770
20474
  );
19771
20475
  }
19772
- function displayWidth3(text5, startColumn = 0) {
20476
+ function displayWidth3(text4, startColumn = 0) {
19773
20477
  const segmenter = new Intl.Segmenter();
19774
20478
  let column = startColumn;
19775
- for (const { segment } of segmenter.segment(text5)) {
20479
+ for (const { segment } of segmenter.segment(text4)) {
19776
20480
  if (segment === " ") {
19777
20481
  column += 8 - column % 8;
19778
20482
  continue;
@@ -19865,8 +20569,8 @@ function renderRun(run) {
19865
20569
  if (run.dim) {
19866
20570
  attributes.push('opacity="0.7"');
19867
20571
  }
19868
- const text5 = run.conceal ? " ".repeat(displayWidth3(run.text)) : run.text;
19869
- return `<tspan ${attributes.join(" ")}>${escapeXmlText(text5)}</tspan>`;
20572
+ const text4 = run.conceal ? " ".repeat(displayWidth3(run.text)) : run.text;
20573
+ return `<tspan ${attributes.join(" ")}>${escapeXmlText(text4)}</tspan>`;
19870
20574
  }
19871
20575
  function renderWindowControls() {
19872
20576
  return [
@@ -20211,15 +20915,15 @@ function toText(chunk) {
20211
20915
  }
20212
20916
  return String(chunk);
20213
20917
  }
20214
- function normalizeOutput(text5) {
20215
- return stripAnsi(text5).replaceAll("\r", "").trim();
20918
+ function normalizeOutput(text4) {
20919
+ return stripAnsi(text4).replaceAll("\r", "").trim();
20216
20920
  }
20217
- function canParseJson(text5) {
20218
- if (text5.length === 0) {
20921
+ function canParseJson(text4) {
20922
+ if (text4.length === 0) {
20219
20923
  return false;
20220
20924
  }
20221
20925
  try {
20222
- JSON.parse(text5);
20926
+ JSON.parse(text4);
20223
20927
  return true;
20224
20928
  } catch {
20225
20929
  return false;