nexrall-code 0.5.27 → 0.5.29

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 +151 -29
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -23210,22 +23210,6 @@ var icons = {
23210
23210
  thinking: "\u25C6",
23211
23211
  code: "{}"
23212
23212
  };
23213
- function banner() {
23214
- const version = "0.1.1";
23215
- console.log();
23216
- console.log(source_default.bold.blue(" \u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557"));
23217
- console.log(source_default.bold.blue(" \u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u255A\u2588\u2588\u2557\u2588\u2588\u2554\u255D"));
23218
- console.log(source_default.bold.blue(" \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u255A\u2588\u2588\u2588\u2554\u255D "));
23219
- console.log(source_default.bold.blue(" \u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2554\u2588\u2588\u2557 "));
23220
- console.log(source_default.bold.blue(" \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2554\u255D \u2588\u2588\u2557"));
23221
- console.log(source_default.bold.blue(" \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D"));
23222
- console.log();
23223
- console.log(
23224
- source_default.bold(" Nexrall Code") + source_default.dim(` v${version}`) + source_default.dim(" \xB7 ") + source_default.cyan("AI coding assistant")
23225
- );
23226
- console.log(source_default.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
23227
- console.log();
23228
- }
23229
23213
  function visibleLen(s2) {
23230
23214
  return s2.replace(/\x1b\[[0-9;]*m/g, "").length;
23231
23215
  }
@@ -24094,6 +24078,9 @@ function setAutoApprove(category) {
24094
24078
  function isAutoApproved(category) {
24095
24079
  return autoApproved.has("all") || autoApproved.has(category);
24096
24080
  }
24081
+ function isYoloMode() {
24082
+ return autoApproved.has("all");
24083
+ }
24097
24084
  var _replInterface = null;
24098
24085
  function setReadlineInterface(rl) {
24099
24086
  _replInterface = rl;
@@ -24556,7 +24543,118 @@ async function updateCommand(opts) {
24556
24543
  console.log();
24557
24544
  }
24558
24545
 
24546
+ // src/ui/screen.ts
24547
+ function enableAltScreen() {
24548
+ if (process.stdout.isTTY)
24549
+ process.stdout.write("\x1B[?1049h");
24550
+ }
24551
+ function disableAltScreen() {
24552
+ if (process.stdout.isTTY)
24553
+ process.stdout.write("\x1B[?1049l");
24554
+ }
24555
+ var NEX_LOGO = [
24556
+ "\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557",
24557
+ "\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u255A\u2588\u2588\u2557\u2588\u2588\u2554\u255D",
24558
+ "\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u255A\u2588\u2588\u2588\u2554\u255D ",
24559
+ "\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2554\u2588\u2588\u2557 ",
24560
+ "\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2554\u255D \u2588\u2588\u2557",
24561
+ "\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D"
24562
+ ];
24563
+ function center(s2, w) {
24564
+ const len = visibleLen(s2);
24565
+ if (len >= w)
24566
+ return s2;
24567
+ const left = Math.floor((w - len) / 2);
24568
+ return " ".repeat(left) + s2;
24569
+ }
24570
+ function renderBanner(info) {
24571
+ const LEFT_W = 38;
24572
+ const RIGHT_W = 44;
24573
+ const GAP = 2;
24574
+ const leftLines = [];
24575
+ leftLines.push(source_default.bold.hex("#d97757")(`Nexrall Code `) + source_default.dim(`v${info.version}`));
24576
+ leftLines.push("");
24577
+ leftLines.push(center(source_default.bold(`Welcome back ${info.userLabel}!`), LEFT_W));
24578
+ leftLines.push("");
24579
+ for (const l of NEX_LOGO)
24580
+ leftLines.push(center(source_default.hex("#d97757")(l), LEFT_W));
24581
+ leftLines.push("");
24582
+ leftLines.push(source_default.dim(info.modelLabel));
24583
+ leftLines.push(source_default.dim(info.workDir));
24584
+ if (info.nexrallMdLoaded)
24585
+ leftLines.push(source_default.dim("nexrall.md loaded"));
24586
+ const rightLines = [];
24587
+ rightLines.push(source_default.bold.yellow("Tips for getting started"));
24588
+ const tips = info.tips ?? [
24589
+ "Run /init to create a nexrall.md file with instructions for Nexrall Code.",
24590
+ "Use /help to see all slash commands."
24591
+ ];
24592
+ for (const t2 of tips)
24593
+ rightLines.push(...wrapText(t2, RIGHT_W));
24594
+ const whatsNew = info.whatsNew ?? [];
24595
+ if (whatsNew.length) {
24596
+ rightLines.push("");
24597
+ rightLines.push(source_default.bold.yellow("What's new"));
24598
+ for (const t2 of whatsNew)
24599
+ rightLines.push(...wrapText(t2, RIGHT_W));
24600
+ rightLines.push(source_default.dim.italic("/release-notes for more"));
24601
+ }
24602
+ const rowCount = Math.max(leftLines.length, rightLines.length);
24603
+ const border = source_default.hex("#d97757");
24604
+ const lines = [];
24605
+ lines.push(border("\u256D" + "\u2500".repeat(LEFT_W + GAP + RIGHT_W + 4) + "\u256E"));
24606
+ for (let i2 = 0; i2 < rowCount; i2++) {
24607
+ const l = padVis(leftLines[i2] ?? "", LEFT_W);
24608
+ const r2 = padVis(rightLines[i2] ?? "", RIGHT_W);
24609
+ lines.push(border("\u2502 ") + l + " ".repeat(GAP) + r2 + border(" \u2502"));
24610
+ }
24611
+ lines.push(border("\u2570" + "\u2500".repeat(LEFT_W + GAP + RIGHT_W + 4) + "\u256F"));
24612
+ return lines.join("\n");
24613
+ }
24614
+ function wrapText(text, width) {
24615
+ const words = text.split(" ");
24616
+ const out = [];
24617
+ let cur = "";
24618
+ for (const w of words) {
24619
+ const candidate = cur ? cur + " " + w : w;
24620
+ if (visibleLen(candidate) > width && cur) {
24621
+ out.push(cur);
24622
+ cur = w;
24623
+ } else {
24624
+ cur = candidate;
24625
+ }
24626
+ }
24627
+ if (cur)
24628
+ out.push(cur);
24629
+ return out;
24630
+ }
24631
+ var lastFooterText = "";
24632
+ function footerText(info) {
24633
+ const modeLabel = info.autoApprove ? "yolo mode on" : info.mode === "plan" ? "plan mode on" : info.mode === "edit" ? "edit mode on" : info.mode === "ask" ? "ask mode on" : "auto mode on";
24634
+ return `${modeLabel} \xB7 /help for shortcuts \xB7 /agents for agents`;
24635
+ }
24636
+ function drawStatusFooter(info) {
24637
+ if (!process.stdout.isTTY || !process.stdout.rows)
24638
+ return;
24639
+ const text = footerText(info);
24640
+ if (text === lastFooterText)
24641
+ return;
24642
+ lastFooterText = text;
24643
+ const row = process.stdout.rows;
24644
+ const out = `\x1B7\x1B[${row};1H\x1B[2K` + // clear the line
24645
+ source_default.dim(text) + "\x1B8";
24646
+ process.stdout.write(out);
24647
+ }
24648
+ function clearStatusFooter() {
24649
+ if (!process.stdout.isTTY || !process.stdout.rows)
24650
+ return;
24651
+ const row = process.stdout.rows;
24652
+ process.stdout.write(`\x1B7\x1B[${row};1H\x1B[2K\x1B8`);
24653
+ lastFooterText = "";
24654
+ }
24655
+
24559
24656
  // src/commands/chat.ts
24657
+ var CLI_VERSION = "0.5.29";
24560
24658
  var MODEL_LABELS = {
24561
24659
  turbo: "Nexrall Turbo",
24562
24660
  pro: "Nexrall Pro",
@@ -24589,6 +24687,14 @@ function printBalanceNotice(balance, zero) {
24589
24687
  console.log(" " + source_default.yellow(hyperlink("\u2192 Top up", BILLING_URL)) + source_default.dim(` (${BILLING_URL})`));
24590
24688
  console.log();
24591
24689
  }
24690
+ function currentUserLabel() {
24691
+ try {
24692
+ const u = os4.userInfo().username;
24693
+ return u ? u.charAt(0).toUpperCase() + u.slice(1) : "there";
24694
+ } catch {
24695
+ return "there";
24696
+ }
24697
+ }
24592
24698
  function collectEnv(workDir) {
24593
24699
  return {
24594
24700
  cwd: workDir,
@@ -25001,25 +25107,34 @@ function printSessions() {
25001
25107
  }
25002
25108
  async function startChatSession(options) {
25003
25109
  const headless = options.outputFormat === "json" || options.outputFormat === "stream-json";
25004
- if (options.showBanner !== false && !headless)
25005
- banner();
25006
25110
  const { workDir } = options;
25007
25111
  let modelAlias = options.model;
25008
25112
  const env2 = collectEnv(workDir);
25009
25113
  const nexrallMd = readNexrallMd(workDir);
25010
- if (!headless) {
25011
- console.log(source_default.dim(" model ") + source_default.cyan(resolveModelLabel(modelAlias)));
25012
- console.log(source_default.dim(" workdir ") + source_default.white(workDir));
25013
- console.log(source_default.dim(" mode ") + source_default.cyan("auto") + source_default.dim(" \xB7 effort ") + source_default.cyan("medium"));
25114
+ const interactive = !headless && !options.prompt && !options.stdinText;
25115
+ if (interactive) {
25116
+ enableAltScreen();
25117
+ process.on("exit", () => {
25118
+ clearStatusFooter();
25119
+ disableAltScreen();
25120
+ });
25121
+ }
25122
+ if (options.showBanner !== false && !headless) {
25014
25123
  const branch = tryExec("git branch --show-current", workDir);
25015
25124
  const gitStatus = tryExec("git status --short", workDir);
25125
+ const changedLines = gitStatus ? gitStatus.split("\n").filter(Boolean).length : 0;
25126
+ const tips = ["Run /init to create a nexrall.md file with instructions for Nexrall Code."];
25016
25127
  if (branch) {
25017
- const changedLines = gitStatus ? gitStatus.split("\n").filter(Boolean).length : 0;
25018
- const changed = changedLines > 0 ? source_default.dim(" \xB7 ") + source_default.yellow(`${changedLines} changed`) : "";
25019
- console.log(source_default.dim(" branch ") + source_default.dim(branch) + changed);
25020
- }
25021
- if (nexrallMd)
25022
- console.log(source_default.dim(" nexrall.md loaded"));
25128
+ tips.push(`On branch ${branch}${changedLines > 0 ? ` (${changedLines} changed)` : ""}.`);
25129
+ }
25130
+ console.log(renderBanner({
25131
+ version: CLI_VERSION,
25132
+ userLabel: currentUserLabel(),
25133
+ modelLabel: resolveModelLabel(modelAlias),
25134
+ workDir,
25135
+ nexrallMdLoaded: !!nexrallMd,
25136
+ tips
25137
+ }));
25023
25138
  console.log();
25024
25139
  }
25025
25140
  let messages = [];
@@ -25186,6 +25301,13 @@ ${text}` : "");
25186
25301
  enableBracketedPaste();
25187
25302
  process.on("exit", disableBracketedPaste);
25188
25303
  const uninstallPasteHandling = installPasteHandling(rl, process.stdin);
25304
+ const originalPrompt = rl.prompt.bind(rl);
25305
+ rl.prompt = (preserveCursor) => {
25306
+ if (interactive) {
25307
+ drawStatusFooter({ mode: agentMode, autoApprove: isYoloMode() });
25308
+ }
25309
+ return originalPrompt(preserveCursor);
25310
+ };
25189
25311
  rl.prompt();
25190
25312
  let inputBuffer = "";
25191
25313
  rl.on("line", async (rawLine) => {
@@ -25955,7 +26077,7 @@ function pluginListCommand() {
25955
26077
 
25956
26078
  // src/index.ts
25957
26079
  var program2 = new Command();
25958
- program2.name("nex").description("Nexrall Code \u2014 AI coding assistant (powered by Nexrall)").version("0.5.27");
26080
+ program2.name("nex").description("Nexrall Code \u2014 AI coding assistant (powered by Nexrall)").version("0.5.29");
25959
26081
  program2.command("auth").description("Login to your Nexrall account").action(authCommand);
25960
26082
  program2.command("logout").description("Log out of your Nexrall account").action(logoutCommand);
25961
26083
  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.27",
3
+ "version": "0.5.29",
4
4
  "description": "Nexrall Code — AI coding assistant for your terminal (headless agent for scripts, CI and automation)",
5
5
  "keywords": [
6
6
  "ai",