nexrall-code 0.5.87 → 0.5.89

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 +56 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -142752,14 +142752,19 @@ function rowsOccupied(text, columns = process.stdout.columns || 80) {
142752
142752
  }
142753
142753
  return rows;
142754
142754
  }
142755
- function padToBottom(rowsAlreadyPrinted, footerText2 = "") {
142756
- const rows = process.stdout.rows;
142757
- if (!process.stdout.isTTY || !rows)
142758
- return false;
142759
- const chromeRows = bottomChromeRows({ footerText: footerText2, columns: process.stdout.columns ?? 80 });
142755
+ function fillerRowCount(rowsAlreadyPrinted, footerTextValue = "", columns = process.stdout.columns ?? 80, rows = process.stdout.rows) {
142756
+ if (!rows)
142757
+ return 0;
142758
+ const chromeRows = bottomChromeRows({ footerText: footerTextValue, columns });
142760
142759
  const filler = rows - rowsAlreadyPrinted - chromeRows - 2;
142761
142760
  const MIN_WORTHWHILE_FILLER = 3;
142762
- if (filler < MIN_WORTHWHILE_FILLER)
142761
+ return filler < MIN_WORTHWHILE_FILLER ? 0 : filler;
142762
+ }
142763
+ function padToBottom(rowsAlreadyPrinted, footerText2 = "") {
142764
+ if (!process.stdout.isTTY)
142765
+ return false;
142766
+ const filler = fillerRowCount(rowsAlreadyPrinted, footerText2);
142767
+ if (filler <= 0)
142763
142768
  return false;
142764
142769
  console.log("\n".repeat(filler - 1));
142765
142770
  return true;
@@ -151780,6 +151785,13 @@ function footerText(info) {
151780
151785
  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";
151781
151786
  return `${modeLabel} \xB7 /help for shortcuts \xB7 /agents for agents`;
151782
151787
  }
151788
+ function fillerContent(rows) {
151789
+ if (rows <= 0)
151790
+ return "";
151791
+ if (rows === 1)
151792
+ return " ";
151793
+ return "\n".repeat(rows - 1);
151794
+ }
151783
151795
  var IntlWithSegmenter = Intl;
151784
151796
  var graphemeSegmenter = typeof IntlWithSegmenter.Segmenter === "function" ? new IntlWithSegmenter.Segmenter(void 0, { granularity: "grapheme" }) : null;
151785
151797
  function graphemeBoundaries(text) {
@@ -151905,7 +151917,11 @@ var App2 = ({ onReady }) => {
151905
151917
  const setBannerRegenerator = (0, import_react35.useCallback)((fn) => {
151906
151918
  bannerRegeneratorRef.current = fn;
151907
151919
  }, []);
151908
- const setFooter = (0, import_react35.useCallback)((info) => setFooterState(info), []);
151920
+ const footerRef = (0, import_react35.useRef)({ mode: "auto", autoApprove: false });
151921
+ const setFooter = (0, import_react35.useCallback)((info) => {
151922
+ footerRef.current = info;
151923
+ setFooterState(info);
151924
+ }, []);
151909
151925
  const setLive = (0, import_react35.useCallback)((text) => setLiveState(text), []);
151910
151926
  const setBusy = (0, import_react35.useCallback)((value) => {
151911
151927
  busyRef.current = value;
@@ -152038,6 +152054,21 @@ var App2 = ({ onReady }) => {
152038
152054
  return s2.slice(0, pos) + char + s2.slice(pos);
152039
152055
  });
152040
152056
  });
152057
+ const repadBottomChrome = (0, import_react35.useCallback)(() => {
152058
+ if (!process.stdout.isTTY)
152059
+ return;
152060
+ setItems((prev) => {
152061
+ const withoutOldFiller = prev.filter((it) => !it.isFiller);
152062
+ const printedRows = withoutOldFiller.reduce(
152063
+ (sum, it) => sum + rowsOccupied(it.content, process.stdout.columns || 80),
152064
+ 0
152065
+ );
152066
+ const filler = fillerRowCount(printedRows, footerRef.current ? footerText(footerRef.current) : "");
152067
+ if (filler <= 0)
152068
+ return withoutOldFiller;
152069
+ return [...withoutOldFiller, { id: idCounter++, content: fillerContent(filler), isFiller: true }];
152070
+ });
152071
+ }, []);
152041
152072
  const forceFullRedraw = (0, import_react35.useCallback)(() => {
152042
152073
  process.stdout.write("\x1B[2J\x1B[H");
152043
152074
  const regen = bannerRegeneratorRef.current;
@@ -152047,8 +152078,9 @@ var App2 = ({ onReady }) => {
152047
152078
  (it) => it.isBanner ? { ...it, content: regen(columns) } : it
152048
152079
  ));
152049
152080
  }
152081
+ repadBottomChrome();
152050
152082
  setStaticKey((k) => k + 1);
152051
- }, []);
152083
+ }, [repadBottomChrome]);
152052
152084
  import_react35.default.useEffect(() => {
152053
152085
  forceFullRedrawRef = forceFullRedraw;
152054
152086
  return () => {
@@ -152058,8 +152090,23 @@ var App2 = ({ onReady }) => {
152058
152090
  const collapseStartupPadding = (0, import_react35.useCallback)(async () => {
152059
152091
  await inkInstance?.waitUntilRenderFlush();
152060
152092
  process.stdout.write("\x1B[2J\x1B[H");
152093
+ repadBottomChrome();
152061
152094
  setStaticKey((k) => k + 1);
152062
- }, []);
152095
+ }, [repadBottomChrome]);
152096
+ import_react35.default.useEffect(() => {
152097
+ const inkPatchedLog = console.log;
152098
+ const inkPatchedError = console.error;
152099
+ console.log = (...args) => {
152100
+ print(args.length === 0 ? " " : args.map(String).join(" "));
152101
+ };
152102
+ console.error = (...args) => {
152103
+ print(args.length === 0 ? " " : args.map(String).join(" "));
152104
+ };
152105
+ return () => {
152106
+ console.log = inkPatchedLog;
152107
+ console.error = inkPatchedError;
152108
+ };
152109
+ }, [print]);
152063
152110
  import_react35.default.useEffect(() => {
152064
152111
  onReady({
152065
152112
  print,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexrall-code",
3
- "version": "0.5.87",
3
+ "version": "0.5.89",
4
4
  "description": "Nexrall Code — AI coding assistant for your terminal (headless agent for scripts, CI and automation)",
5
5
  "keywords": [
6
6
  "ai",