nexrall-code 0.5.32 → 0.5.33

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 +143 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -972,7 +972,7 @@ var require_suggestSimilar = __commonJS({
972
972
  // ../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/command.js
973
973
  var require_command = __commonJS({
974
974
  "../../node_modules/.pnpm/commander@12.1.0/node_modules/commander/lib/command.js"(exports2) {
975
- var EventEmitter = require("node:events").EventEmitter;
975
+ var EventEmitter2 = require("node:events").EventEmitter;
976
976
  var childProcess = require("node:child_process");
977
977
  var path5 = require("node:path");
978
978
  var fs6 = require("node:fs");
@@ -982,7 +982,7 @@ var require_command = __commonJS({
982
982
  var { Help: Help2 } = require_help();
983
983
  var { Option: Option2, DualOptions } = require_option();
984
984
  var { suggestSimilar } = require_suggestSimilar();
985
- var Command2 = class _Command extends EventEmitter {
985
+ var Command2 = class _Command extends EventEmitter2 {
986
986
  /**
987
987
  * Initialize a new `Command`.
988
988
  *
@@ -17949,12 +17949,12 @@ var require_prompt = __commonJS({
17949
17949
  var readline4 = require("readline");
17950
17950
  var _require = require_util();
17951
17951
  var action = _require.action;
17952
- var EventEmitter = require("events");
17952
+ var EventEmitter2 = require("events");
17953
17953
  var _require2 = require_src();
17954
17954
  var beep = _require2.beep;
17955
17955
  var cursor = _require2.cursor;
17956
17956
  var color = require_kleur();
17957
- var Prompt = class extends EventEmitter {
17957
+ var Prompt = class extends EventEmitter2 {
17958
17958
  constructor(opts = {}) {
17959
17959
  super();
17960
17960
  this.firstRender = true;
@@ -20522,10 +20522,10 @@ var require_prompt2 = __commonJS({
20522
20522
  "use strict";
20523
20523
  var readline4 = require("readline");
20524
20524
  var { action } = require_util2();
20525
- var EventEmitter = require("events");
20525
+ var EventEmitter2 = require("events");
20526
20526
  var { beep, cursor } = require_src();
20527
20527
  var color = require_kleur();
20528
- var Prompt = class extends EventEmitter {
20528
+ var Prompt = class extends EventEmitter2 {
20529
20529
  constructor(opts = {}) {
20530
20530
  super();
20531
20531
  this.firstRender = true;
@@ -23461,7 +23461,7 @@ function disableBracketedPaste() {
23461
23461
  if (process.stdout.isTTY)
23462
23462
  process.stdout.write("\x1B[?2004l");
23463
23463
  }
23464
- function installPasteHandling(rl, stdin) {
23464
+ function installPasteHandling(rl, stdin, onInsert) {
23465
23465
  const originalListeners = stdin.listeners("data");
23466
23466
  for (const l of originalListeners)
23467
23467
  stdin.removeListener("data", l);
@@ -23483,6 +23483,7 @@ function installPasteHandling(rl, stdin) {
23483
23483
  } else {
23484
23484
  rl.write(flattened);
23485
23485
  }
23486
+ onInsert?.();
23486
23487
  };
23487
23488
  const onData = (chunk) => {
23488
23489
  let text = chunk.toString("utf-8");
@@ -24649,9 +24650,108 @@ function clearStatusFooter() {
24649
24650
  process.stdout.write(`\x1B7\x1B[${row};1H\x1B[2K\x1B8`);
24650
24651
  lastFooterText = "";
24651
24652
  }
24653
+ var splitScreenActive = false;
24654
+ var RESERVED_ROWS = 2;
24655
+ function contentBottomRow() {
24656
+ return Math.max(1, (process.stdout.rows || 24) - RESERVED_ROWS);
24657
+ }
24658
+ function inputRow() {
24659
+ return Math.max(1, (process.stdout.rows || 24) - 1);
24660
+ }
24661
+ function enableSplitScreen() {
24662
+ if (!process.stdout.isTTY || !process.stdout.rows)
24663
+ return;
24664
+ splitScreenActive = true;
24665
+ const bottom = contentBottomRow();
24666
+ process.stdout.write(
24667
+ `\x1B[1;${bottom}r\x1B[${bottom};1H`
24668
+ // park cursor at the bottom of that region
24669
+ );
24670
+ }
24671
+ function disableSplitScreen() {
24672
+ if (!process.stdout.isTTY)
24673
+ return;
24674
+ splitScreenActive = false;
24675
+ process.stdout.write("\x1B[r");
24676
+ }
24677
+ function resizeSplitScreen() {
24678
+ if (!splitScreenActive)
24679
+ return;
24680
+ enableSplitScreen();
24681
+ }
24682
+ function drawInputLine(promptText, line, cursorPos) {
24683
+ if (!process.stdout.isTTY || !process.stdout.rows)
24684
+ return;
24685
+ const row = inputRow();
24686
+ const cols = process.stdout.columns || 80;
24687
+ const full = promptText + line;
24688
+ const promptLen = visibleLen(promptText);
24689
+ let caretIdx = promptLen + cursorPos;
24690
+ let display = full;
24691
+ if (visibleLen(full) >= cols) {
24692
+ const overflow = visibleLen(full) - cols + 1;
24693
+ const shift = Math.max(0, Math.min(overflow, caretIdx));
24694
+ display = full.slice(shift);
24695
+ caretIdx -= shift;
24696
+ }
24697
+ let rendered;
24698
+ if (caretIdx >= 0 && caretIdx < display.length) {
24699
+ rendered = display.slice(0, caretIdx) + source_default.inverse(display[caretIdx]) + display.slice(caretIdx + 1);
24700
+ } else {
24701
+ rendered = display + source_default.inverse(" ");
24702
+ }
24703
+ const out = `\x1B7\x1B[${row};1H\x1B[2K` + // clear it
24704
+ rendered + "\x1B8";
24705
+ process.stdout.write(out);
24706
+ }
24707
+ function clearInputLine() {
24708
+ if (!process.stdout.isTTY || !process.stdout.rows)
24709
+ return;
24710
+ const row = inputRow();
24711
+ process.stdout.write(`\x1B7\x1B[${row};1H\x1B[2K\x1B8`);
24712
+ }
24713
+
24714
+ // src/ui/silentOutput.ts
24715
+ var import_events = require("events");
24716
+ var SilentTTYOutput = class extends import_events.EventEmitter {
24717
+ isTTY = true;
24718
+ get columns() {
24719
+ return process.stdout.columns || 80;
24720
+ }
24721
+ get rows() {
24722
+ return process.stdout.rows || 24;
24723
+ }
24724
+ write(_chunk, encOrCb, cb) {
24725
+ const done = typeof encOrCb === "function" ? encOrCb : cb;
24726
+ if (typeof done === "function")
24727
+ done();
24728
+ return true;
24729
+ }
24730
+ cursorTo() {
24731
+ return true;
24732
+ }
24733
+ moveCursor() {
24734
+ return true;
24735
+ }
24736
+ clearLine() {
24737
+ return true;
24738
+ }
24739
+ clearScreenDown() {
24740
+ return true;
24741
+ }
24742
+ getColorDepth() {
24743
+ return 1;
24744
+ }
24745
+ hasColors() {
24746
+ return false;
24747
+ }
24748
+ };
24749
+ function createSilentOutput() {
24750
+ return new SilentTTYOutput();
24751
+ }
24652
24752
 
24653
24753
  // src/commands/chat.ts
24654
- var CLI_VERSION = "0.5.32";
24754
+ var CLI_VERSION = "0.5.33";
24655
24755
  var MODEL_LABELS = {
24656
24756
  turbo: "Nexrall Turbo",
24657
24757
  pro: "Nexrall Pro",
@@ -25111,8 +25211,11 @@ async function startChatSession(options) {
25111
25211
  const interactive = !headless && !options.prompt && !options.stdinText;
25112
25212
  if (interactive) {
25113
25213
  enableAltScreen();
25214
+ enableSplitScreen();
25114
25215
  process.on("exit", () => {
25216
+ clearInputLine();
25115
25217
  clearStatusFooter();
25218
+ disableSplitScreen();
25116
25219
  disableAltScreen();
25117
25220
  });
25118
25221
  }
@@ -25288,29 +25391,56 @@ ${text}` : "");
25288
25391
  process.exit(0);
25289
25392
  }
25290
25393
  });
25394
+ const silentOutput = interactive ? createSilentOutput() : process.stdout;
25291
25395
  const rl = readline3.createInterface({
25292
25396
  input: process.stdin,
25293
- output: process.stdout,
25397
+ output: silentOutput,
25294
25398
  terminal: true,
25295
25399
  prompt: colors.primary.bold("> ")
25296
25400
  });
25297
25401
  setReadlineInterface(rl);
25402
+ const redrawInput = () => {
25403
+ if (!interactive)
25404
+ return;
25405
+ drawInputLine(colors.primary.bold("> "), rl.line, rl.cursor);
25406
+ };
25407
+ if (interactive) {
25408
+ process.stdin.on("keypress", redrawInput);
25409
+ process.stdout.on("resize", () => {
25410
+ resizeSplitScreen();
25411
+ drawStatusFooter({ mode: agentMode, autoApprove: isYoloMode() });
25412
+ redrawInput();
25413
+ });
25414
+ }
25298
25415
  enableBracketedPaste();
25299
25416
  process.on("exit", disableBracketedPaste);
25300
- const uninstallPasteHandling = installPasteHandling(rl, process.stdin);
25417
+ const uninstallPasteHandling = installPasteHandling(rl, process.stdin, redrawInput);
25301
25418
  const originalPrompt = rl.prompt.bind(rl);
25302
25419
  rl.prompt = (preserveCursor) => {
25303
25420
  if (interactive) {
25304
25421
  drawStatusFooter({ mode: agentMode, autoApprove: isYoloMode() });
25422
+ redrawInput();
25423
+ return;
25305
25424
  }
25306
- return originalPrompt(preserveCursor);
25425
+ originalPrompt(preserveCursor);
25426
+ };
25427
+ const originalPause = rl.pause.bind(rl);
25428
+ rl.pause = () => {
25429
+ if (interactive)
25430
+ clearInputLine();
25431
+ return originalPause();
25307
25432
  };
25308
25433
  rl.prompt();
25309
25434
  let inputBuffer = "";
25310
25435
  rl.on("line", async (rawLine) => {
25436
+ if (interactive) {
25437
+ clearInputLine();
25438
+ console.log(colors.primary.bold("> ") + rawLine);
25439
+ }
25311
25440
  if (rawLine.endsWith("\\")) {
25312
25441
  inputBuffer += rawLine.slice(0, -1) + "\n";
25313
- process.stdout.write(source_default.dim("\u2026 "));
25442
+ if (!interactive)
25443
+ process.stdout.write(source_default.dim("\u2026 "));
25314
25444
  return;
25315
25445
  }
25316
25446
  const userInput = (inputBuffer + rawLine).trim();
@@ -26074,7 +26204,7 @@ function pluginListCommand() {
26074
26204
 
26075
26205
  // src/index.ts
26076
26206
  var program2 = new Command();
26077
- program2.name("nex").description("Nexrall Code \u2014 AI coding assistant (powered by Nexrall)").version("0.5.32");
26207
+ program2.name("nex").description("Nexrall Code \u2014 AI coding assistant (powered by Nexrall)").version("0.5.33");
26078
26208
  program2.command("auth").description("Login to your Nexrall account").action(authCommand);
26079
26209
  program2.command("logout").description("Log out of your Nexrall account").action(logoutCommand);
26080
26210
  program2.command("update").description("Update nex to the latest version").option("-c, --check", "Check for updates without installing").option("-y, --yes", "Skip confirmation prompt").action(async (opts) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexrall-code",
3
- "version": "0.5.32",
3
+ "version": "0.5.33",
4
4
  "description": "Nexrall Code — AI coding assistant for your terminal (headless agent for scripts, CI and automation)",
5
5
  "keywords": [
6
6
  "ai",