nexrall-code 0.5.32 → 0.5.34

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 +158 -15
  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");
@@ -24542,8 +24543,9 @@ async function updateCommand(opts) {
24542
24543
 
24543
24544
  // src/ui/screen.ts
24544
24545
  function enableAltScreen() {
24545
- if (process.stdout.isTTY)
24546
- process.stdout.write("\x1B[?1049h");
24546
+ if (!process.stdout.isTTY)
24547
+ return;
24548
+ process.stdout.write("\x1B[?1049h\x1B[2J\x1B[H");
24547
24549
  }
24548
24550
  function disableAltScreen() {
24549
24551
  if (process.stdout.isTTY)
@@ -24649,9 +24651,120 @@ function clearStatusFooter() {
24649
24651
  process.stdout.write(`\x1B7\x1B[${row};1H\x1B[2K\x1B8`);
24650
24652
  lastFooterText = "";
24651
24653
  }
24654
+ var splitScreenActive = false;
24655
+ var RESERVED_ROWS = 3;
24656
+ function contentBottomRow() {
24657
+ return Math.max(1, (process.stdout.rows || 24) - RESERVED_ROWS);
24658
+ }
24659
+ function separatorRow() {
24660
+ return Math.max(1, (process.stdout.rows || 24) - 2);
24661
+ }
24662
+ function inputRow() {
24663
+ return Math.max(1, (process.stdout.rows || 24) - 1);
24664
+ }
24665
+ function drawInputSeparator() {
24666
+ if (!process.stdout.isTTY || !process.stdout.rows)
24667
+ return;
24668
+ const row = separatorRow();
24669
+ const cols = process.stdout.columns || 80;
24670
+ process.stdout.write(
24671
+ `\x1B7\x1B[${row};1H\x1B[2K` + source_default.dim("\u2500".repeat(cols)) + "\x1B8"
24672
+ );
24673
+ }
24674
+ function enableSplitScreen() {
24675
+ if (!process.stdout.isTTY || !process.stdout.rows)
24676
+ return;
24677
+ splitScreenActive = true;
24678
+ const bottom = contentBottomRow();
24679
+ process.stdout.write(
24680
+ `\x1B[1;${bottom}r\x1B[${bottom};1H`
24681
+ // park cursor at the bottom of that region
24682
+ );
24683
+ drawInputSeparator();
24684
+ }
24685
+ function disableSplitScreen() {
24686
+ if (!process.stdout.isTTY)
24687
+ return;
24688
+ splitScreenActive = false;
24689
+ process.stdout.write("\x1B[r");
24690
+ }
24691
+ function resizeSplitScreen() {
24692
+ if (!splitScreenActive)
24693
+ return;
24694
+ enableSplitScreen();
24695
+ }
24696
+ function drawInputLine(promptText, line, cursorPos) {
24697
+ if (!process.stdout.isTTY || !process.stdout.rows)
24698
+ return;
24699
+ const row = inputRow();
24700
+ const cols = process.stdout.columns || 80;
24701
+ const promptLen = visibleLen(promptText);
24702
+ const availableForLine = Math.max(1, cols - promptLen - 1);
24703
+ let visibleLine = line;
24704
+ let caretIdx = cursorPos;
24705
+ if (line.length > availableForLine) {
24706
+ const shift = Math.max(0, Math.min(line.length - availableForLine, cursorPos));
24707
+ visibleLine = line.slice(shift, shift + availableForLine);
24708
+ caretIdx = cursorPos - shift;
24709
+ }
24710
+ let renderedLine;
24711
+ if (caretIdx >= 0 && caretIdx < visibleLine.length) {
24712
+ renderedLine = visibleLine.slice(0, caretIdx) + source_default.inverse(visibleLine[caretIdx]) + visibleLine.slice(caretIdx + 1);
24713
+ } else {
24714
+ renderedLine = visibleLine + source_default.inverse(" ");
24715
+ }
24716
+ const out = `\x1B7\x1B[${row};1H\x1B[2K` + // clear it
24717
+ promptText + renderedLine + "\x1B8";
24718
+ process.stdout.write(out);
24719
+ }
24720
+ function clearInputLine() {
24721
+ if (!process.stdout.isTTY || !process.stdout.rows)
24722
+ return;
24723
+ const row = inputRow();
24724
+ process.stdout.write(`\x1B7\x1B[${row};1H\x1B[2K\x1B8`);
24725
+ }
24726
+
24727
+ // src/ui/silentOutput.ts
24728
+ var import_events = require("events");
24729
+ var SilentTTYOutput = class extends import_events.EventEmitter {
24730
+ isTTY = true;
24731
+ get columns() {
24732
+ return process.stdout.columns || 80;
24733
+ }
24734
+ get rows() {
24735
+ return process.stdout.rows || 24;
24736
+ }
24737
+ write(_chunk, encOrCb, cb) {
24738
+ const done = typeof encOrCb === "function" ? encOrCb : cb;
24739
+ if (typeof done === "function")
24740
+ done();
24741
+ return true;
24742
+ }
24743
+ cursorTo() {
24744
+ return true;
24745
+ }
24746
+ moveCursor() {
24747
+ return true;
24748
+ }
24749
+ clearLine() {
24750
+ return true;
24751
+ }
24752
+ clearScreenDown() {
24753
+ return true;
24754
+ }
24755
+ getColorDepth() {
24756
+ return 1;
24757
+ }
24758
+ hasColors() {
24759
+ return false;
24760
+ }
24761
+ };
24762
+ function createSilentOutput() {
24763
+ return new SilentTTYOutput();
24764
+ }
24652
24765
 
24653
24766
  // src/commands/chat.ts
24654
- var CLI_VERSION = "0.5.32";
24767
+ var CLI_VERSION = "0.5.34";
24655
24768
  var MODEL_LABELS = {
24656
24769
  turbo: "Nexrall Turbo",
24657
24770
  pro: "Nexrall Pro",
@@ -25111,8 +25224,11 @@ async function startChatSession(options) {
25111
25224
  const interactive = !headless && !options.prompt && !options.stdinText;
25112
25225
  if (interactive) {
25113
25226
  enableAltScreen();
25227
+ enableSplitScreen();
25114
25228
  process.on("exit", () => {
25229
+ clearInputLine();
25115
25230
  clearStatusFooter();
25231
+ disableSplitScreen();
25116
25232
  disableAltScreen();
25117
25233
  });
25118
25234
  }
@@ -25288,29 +25404,56 @@ ${text}` : "");
25288
25404
  process.exit(0);
25289
25405
  }
25290
25406
  });
25407
+ const silentOutput = interactive ? createSilentOutput() : process.stdout;
25291
25408
  const rl = readline3.createInterface({
25292
25409
  input: process.stdin,
25293
- output: process.stdout,
25410
+ output: silentOutput,
25294
25411
  terminal: true,
25295
25412
  prompt: colors.primary.bold("> ")
25296
25413
  });
25297
25414
  setReadlineInterface(rl);
25415
+ const redrawInput = () => {
25416
+ if (!interactive)
25417
+ return;
25418
+ drawInputLine(colors.primary.bold("> "), rl.line, rl.cursor);
25419
+ };
25420
+ if (interactive) {
25421
+ process.stdin.on("keypress", redrawInput);
25422
+ process.stdout.on("resize", () => {
25423
+ resizeSplitScreen();
25424
+ drawStatusFooter({ mode: agentMode, autoApprove: isYoloMode() });
25425
+ redrawInput();
25426
+ });
25427
+ }
25298
25428
  enableBracketedPaste();
25299
25429
  process.on("exit", disableBracketedPaste);
25300
- const uninstallPasteHandling = installPasteHandling(rl, process.stdin);
25430
+ const uninstallPasteHandling = installPasteHandling(rl, process.stdin, redrawInput);
25301
25431
  const originalPrompt = rl.prompt.bind(rl);
25302
25432
  rl.prompt = (preserveCursor) => {
25303
25433
  if (interactive) {
25304
25434
  drawStatusFooter({ mode: agentMode, autoApprove: isYoloMode() });
25435
+ redrawInput();
25436
+ return;
25305
25437
  }
25306
- return originalPrompt(preserveCursor);
25438
+ originalPrompt(preserveCursor);
25439
+ };
25440
+ const originalPause = rl.pause.bind(rl);
25441
+ rl.pause = () => {
25442
+ if (interactive)
25443
+ clearInputLine();
25444
+ return originalPause();
25307
25445
  };
25308
25446
  rl.prompt();
25309
25447
  let inputBuffer = "";
25310
25448
  rl.on("line", async (rawLine) => {
25449
+ if (interactive) {
25450
+ clearInputLine();
25451
+ console.log(colors.primary.bold("> ") + rawLine);
25452
+ }
25311
25453
  if (rawLine.endsWith("\\")) {
25312
25454
  inputBuffer += rawLine.slice(0, -1) + "\n";
25313
- process.stdout.write(source_default.dim("\u2026 "));
25455
+ if (!interactive)
25456
+ process.stdout.write(source_default.dim("\u2026 "));
25314
25457
  return;
25315
25458
  }
25316
25459
  const userInput = (inputBuffer + rawLine).trim();
@@ -26074,7 +26217,7 @@ function pluginListCommand() {
26074
26217
 
26075
26218
  // src/index.ts
26076
26219
  var program2 = new Command();
26077
- program2.name("nex").description("Nexrall Code \u2014 AI coding assistant (powered by Nexrall)").version("0.5.32");
26220
+ program2.name("nex").description("Nexrall Code \u2014 AI coding assistant (powered by Nexrall)").version("0.5.34");
26078
26221
  program2.command("auth").description("Login to your Nexrall account").action(authCommand);
26079
26222
  program2.command("logout").description("Log out of your Nexrall account").action(logoutCommand);
26080
26223
  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.34",
4
4
  "description": "Nexrall Code — AI coding assistant for your terminal (headless agent for scripts, CI and automation)",
5
5
  "keywords": [
6
6
  "ai",