@modelstatus/cli 0.1.51 → 0.1.52

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/package.json +1 -1
  2. package/src/tui/app.js +25 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelstatus/cli",
3
- "version": "0.1.51",
3
+ "version": "0.1.52",
4
4
  "description": "Track which AI models you use, where, and never get surprised by a retirement. Free offline model-health for any repo (mm status), browser sign-in for cloud inventory + alerts.",
5
5
  "keywords": [
6
6
  "llm",
package/src/tui/app.js CHANGED
@@ -40,37 +40,39 @@ const GATE_KEYS = [{ k: "1-8", label: "switch" }, { k: "7", label: "sign in" }];
40
40
  // toast, status, keybar, bottomRule) — the body fills whatever rows remain.
41
41
  const CHROME_ROWS = 10;
42
42
 
43
+ // Rows to reserve below the frame (termRows = rows - reserve). POSITIVE shrinks
44
+ // the frame, NEGATIVE grows it past the reported height.
45
+ // - 1 everywhere: a full-height ink frame write+newlines its bottom line and
46
+ // scrolls the buffer up 1/render; the 1-row reserve keeps the last line blank.
47
+ // - -7 in Warp: empirically (the user dialing it live in their Warp), the frame
48
+ // must be GROWN ~7 rows past stdout.rows or the top clips — Warp's block model
49
+ // reports/handles the alt-screen height such that a flush-height frame rides too
50
+ // high. So in Warp we render TALLER, which pushes the window down into view.
51
+ // Gated on Warp (a negative reserve elsewhere would over-grow + clip the top of
52
+ // a normal full-screen terminal).
53
+ const WARP_RESERVE = -7;
54
+
55
+ /** True when running under Warp (TERM_PROGRAM=WarpTerminal, or any WARP_* env, or
56
+ * TERM_PROGRAM merely containing "warp" — broad so detection doesn't silently
57
+ * miss a build/config that doesn't set the canonical value). */
58
+ function isWarp(env) {
59
+ if (String(env.TERM_PROGRAM || "").toLowerCase().includes("warp")) return true;
60
+ for (const k in env) if (k.startsWith("WARP_")) return true;
61
+ return false;
62
+ }
63
+
43
64
  /**
44
- * How many rows to leave UN-rendered below the frame so the window never clips.
45
- *
46
- * - 1 row everywhere: a frame that fills the full height makes ink write+newline
47
- * the bottom line, which scrolls the buffer up by 1 each render; reserving the
48
- * last row keeps it blank so nothing ever scrolls.
49
- * - 6 rows in Warp: Warp keeps ~5 rows of block chrome (sticky command header +
50
- * pinned input) drawn OVER the alternate screen and over-reports stdout.rows by
51
- * that much, so the TOP clips unless we also subtract them (1 guard + 5 chrome;
52
- * measured against the user's Warp build — see Warp issues #6428/#2373, the
53
- * chrome area can't be reclaimed via alt_screen_padding). Gated on TERM_PROGRAM
54
- * so non-Warp terminals keep the plain 1-row reserve (an extra reserve elsewhere
55
- * would leave a blank band).
56
- *
57
- * MM_TUI_RESERVE_ROWS (integer ≥ 0) overrides the whole reserve so a user on a
58
- * different Warp version / input position / timing-line setting can self-tune
59
- * (e.g. =5 or =7) without waiting for a release; 0 opts out entirely.
65
+ * MM_TUI_RESERVE_ROWS (any integer, may be negative) overrides the reserve so a
66
+ * user on a different terminal/version can self-tune in either direction without
67
+ * a release; blank/non-integer falls back to the gated default.
60
68
  */
61
69
  export function rowsReserve(env = process.env) {
62
- // Any non-blank INTEGER string overrides (so `MM_TUI_RESERVE_ROWS=` or stray
63
- // whitespace falls back to the default rather than being read as 0 —
64
- // `Number("")` is 0). The override may be NEGATIVE: a negative reserve GROWS the
65
- // frame past the terminal height (termRows = rows - reserve), so the knob goes
66
- // both ways — positive shrinks the frame, negative grows it — letting a user
67
- // find the exact offset their terminal (e.g. Warp) needs in either direction.
68
70
  const raw = env.MM_TUI_RESERVE_ROWS;
69
71
  if (typeof raw === "string" && raw.trim() !== "") {
70
72
  const n = Number(raw);
71
73
  if (Number.isInteger(n)) return n;
72
74
  }
73
- return env.TERM_PROGRAM === "WarpTerminal" ? 6 : 1;
75
+ return isWarp(env) ? WARP_RESERVE : 1;
74
76
  }
75
77
 
76
78
  /** Frame height for a terminal of `rows` rows: reserve rows, then clamp to a