@tiens.nguyen/gu-cli 1.0.786 → 1.0.787

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/gu-repl.mjs +27 -0
  2. package/package.json +1 -1
package/gu-repl.mjs CHANGED
@@ -3649,6 +3649,33 @@ function jumpToBottom() {
3649
3649
  paintLiveTail();
3650
3650
  }
3651
3651
  /** Paint the tail, put the output position on it, and let the bar drop the jump affordance. */
3652
+ /**
3653
+ * DIAGNOSTIC — `GU_SCREEN_DUMP=<file> gu` writes, a few times a second, what gu BELIEVES the
3654
+ * scrolling area shows (#324, #326). A display bug in this terminal is always the same thing: the
3655
+ * screen and gu's record of it disagree, and from then on text is drawn over its neighbour. With
3656
+ * this file beside a terminal emulator's own screen the first step where they part is found by
3657
+ * comparing, not by reading a paste. Off unless the variable is set; never written otherwise.
3658
+ */
3659
+ if (process.env.GU_SCREEN_DUMP) {
3660
+ setInterval(() => {
3661
+ try {
3662
+ const rows = displayRows(transcript.lines(), Math.max(20, process.stdout.columns || 80) - 1).length;
3663
+ writeFileSync(
3664
+ process.env.GU_SCREEN_DUMP,
3665
+ JSON.stringify({
3666
+ at: Date.now(),
3667
+ pad: currentPad(rows),
3668
+ height: viewportHeight(),
3669
+ reserved: barReserved,
3670
+ scrolledBack: scrolledBack(),
3671
+ view: viewportSlice(screenRows(), scrollOffset, viewportHeight()).rows.map((r) => r.replace(/\x1b\[[0-9;?]*[A-Za-z]/g, "")),
3672
+ })
3673
+ );
3674
+ } catch {
3675
+ /* a diagnostic must never be the thing that breaks */
3676
+ }
3677
+ }, 150).unref();
3678
+ }
3652
3679
  function paintLiveTail() {
3653
3680
  scrollOffset = 0;
3654
3681
  const width = Math.max(20, process.stdout.columns || 80);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gu-cli",
3
- "version": "1.0.786",
3
+ "version": "1.0.787",
4
4
  "description": "Gu CLI — the gu terminal plus the local worker that runs agent / OCR / PDF / embedding jobs on your Mac (Ollama / MLX / OpenAI-compatible).",
5
5
  "type": "module",
6
6
  "license": "MIT",