@orbit-build/cli 1.8.0 → 1.8.1

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 (2) hide show
  1. package/dist/index.js +46 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -281187,6 +281187,22 @@ var TuiEnvironmentStatus = class {
281187
281187
  }
281188
281188
  };
281189
281189
 
281190
+ // src/tui/TuiTerminalLifecycle.ts
281191
+ var ENABLE_ALT_SCREEN = "\x1B[?1049h";
281192
+ var DISABLE_ALT_SCREEN = "\x1B[?1049l";
281193
+ var ENABLE_MOUSE = "\x1B[?1000h\x1B[?1006h";
281194
+ var DISABLE_MOUSE = "\x1B[?1006l\x1B[?1000l";
281195
+ var HIDE_CURSOR = "\x1B[?25l";
281196
+ var RESET_AND_SHOW_CURSOR = "\x1B[0m\x1B[?25h";
281197
+ function enterFullscreenTerminal(mouseEnabled, stdout2 = process.stdout) {
281198
+ const mouseMode = mouseEnabled ? ENABLE_MOUSE : "";
281199
+ stdout2.write(`${ENABLE_ALT_SCREEN}${mouseMode}${HIDE_CURSOR}`);
281200
+ }
281201
+ function leaveFullscreenTerminal(stdin2 = process.stdin, stdout2 = process.stdout) {
281202
+ stdout2.write(`${DISABLE_MOUSE}${DISABLE_ALT_SCREEN}${RESET_AND_SHOW_CURSOR}`);
281203
+ if (stdin2.setRawMode) stdin2.setRawMode(false);
281204
+ }
281205
+
281190
281206
  // src/tui/TextPager.ts
281191
281207
  import readline2 from "readline";
281192
281208
  async function pageText(text2) {
@@ -281788,8 +281804,7 @@ var FullscreenTui = class {
281788
281804
  process.stdin.emit = this.originalStdinEmit;
281789
281805
  this.originalStdinEmit = null;
281790
281806
  }
281791
- const mouseMode = this.config?.tui?.mouse !== false ? "\x1B[?1000h\x1B[?1006h" : "";
281792
- process.stdout.write(`\x1B7\x1B[?1049h${mouseMode}\x1B[?25l`);
281807
+ enterFullscreenTerminal(this.config?.tui?.mouse !== false);
281793
281808
  process.stdout.on("resize", this.onResize);
281794
281809
  if (this.config?.tui?.mouse !== false) {
281795
281810
  this.originalStdinEmit = process.stdin.emit.bind(process.stdin);
@@ -281834,9 +281849,7 @@ var FullscreenTui = class {
281834
281849
  if (!this.isActive) return;
281835
281850
  this.isActive = false;
281836
281851
  process.stdout.off("resize", this.onResize);
281837
- process.stdout.write(
281838
- "\x1B[?1006l\x1B[?1000l\x1B[?1049l\x1B8\x1B[0J\x1B[?25h"
281839
- );
281852
+ leaveFullscreenTerminal();
281840
281853
  this.hasWrittenStdoutSinceStop = false;
281841
281854
  if (this.renderTimeout) {
281842
281855
  clearTimeout(this.renderTimeout);
@@ -282505,7 +282518,7 @@ var FullscreenTui = class {
282505
282518
  if (this.ctrlCTimeout) clearTimeout(this.ctrlCTimeout);
282506
282519
  this.ctrlCTimeout = null;
282507
282520
  this.ctrlCPressedOnce = false;
282508
- cleanup();
282521
+ cleanup(false);
282509
282522
  process.stdout.write("\x1B[?25l");
282510
282523
  this.resolveInput = null;
282511
282524
  resolve38(null);
@@ -282521,6 +282534,11 @@ var FullscreenTui = class {
282521
282534
  }
282522
282535
  return;
282523
282536
  }
282537
+ if (this.ctrlCPressedOnce) {
282538
+ if (this.ctrlCTimeout) clearTimeout(this.ctrlCTimeout);
282539
+ this.ctrlCTimeout = null;
282540
+ this.ctrlCPressedOnce = false;
282541
+ }
282524
282542
  const vimEffect = this.handleVimKeypress(str, key);
282525
282543
  if (vimEffect === "handled") return;
282526
282544
  if (key && key.ctrl && key.name === "r") {
@@ -282543,22 +282561,30 @@ var FullscreenTui = class {
282543
282561
  return;
282544
282562
  }
282545
282563
  if (key && (key.name === "return" || key.name === "enter")) {
282546
- cleanup();
282547
- process.stdout.write("\x1B[?25l");
282548
282564
  const submitted = this.acceptActiveSlashSuggestion() || this.inputBuffer;
282549
282565
  this.historySearchQuery = null;
282566
+ if (!submitted.trim()) {
282567
+ this.activeCommandIndex = 0;
282568
+ this.hideAutocomplete = false;
282569
+ this.historyIndex = -1;
282570
+ this.tempBuffer = "";
282571
+ this.inputBuffer = "";
282572
+ this.cursorPosition = 0;
282573
+ this.render();
282574
+ return;
282575
+ }
282576
+ cleanup();
282577
+ process.stdout.write("\x1B[?25l");
282550
282578
  this.resolveInput = null;
282551
282579
  this.historyScrollOffset = 0;
282552
282580
  this.hasNewOutputWhileScrolled = false;
282553
- if (submitted.trim()) {
282554
- const echoSubmitted = typeof options.echoSubmitted === "function" ? options.echoSubmitted(submitted) : options.echoSubmitted !== false;
282555
- if (echoSubmitted) {
282556
- this.history.push({ role: "user", text: submitted });
282557
- }
282558
- if (this.inputHistory[this.inputHistory.length - 1] !== submitted) {
282559
- this.inputHistory.push(submitted);
282560
- this.saveInputHistory();
282561
- }
282581
+ const echoSubmitted = typeof options.echoSubmitted === "function" ? options.echoSubmitted(submitted) : options.echoSubmitted !== false;
282582
+ if (echoSubmitted) {
282583
+ this.history.push({ role: "user", text: submitted });
282584
+ }
282585
+ if (this.inputHistory[this.inputHistory.length - 1] !== submitted) {
282586
+ this.inputHistory.push(submitted);
282587
+ this.saveInputHistory();
282562
282588
  }
282563
282589
  this.historyIndex = -1;
282564
282590
  this.inputBuffer = "";
@@ -282805,9 +282831,9 @@ var FullscreenTui = class {
282805
282831
  }
282806
282832
  }
282807
282833
  };
282808
- const cleanup = () => {
282834
+ const cleanup = (restoreRawMode = true) => {
282809
282835
  process.stdin.removeListener("keypress", onKeypress);
282810
- if (process.stdin.setRawMode) {
282836
+ if (restoreRawMode && process.stdin.setRawMode) {
282811
282837
  process.stdin.setRawMode(wasRaw);
282812
282838
  }
282813
282839
  process.stdin.pause();
@@ -282921,6 +282947,7 @@ var FullscreenTui = class {
282921
282947
  }
282922
282948
  }
282923
282949
  render(forceFull = false) {
282950
+ if (!this.isActive) return;
282924
282951
  const columns = Math.max(40, process.stdout.columns || 80);
282925
282952
  const rows = Math.max(10, process.stdout.rows || 24);
282926
282953
  const morandi2 = this.theme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbit-build/cli",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Local-first AI coding agent CLI, TUI, Web UI, diagnostics, and LSP runtime",
6
6
  "keywords": [