@v1nvn/statusline 0.30.3 → 0.30.5

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.
package/README.md CHANGED
@@ -22,7 +22,7 @@ offers the picker in chat, and writes the pick.
22
22
  In a terminal outside Claude Code — the wizard, the terminal guide:
23
23
 
24
24
  ```sh
25
- npx -y @v1nvn/statusline@0.30.3 configure
25
+ npx -y @v1nvn/statusline@0.30.5 configure
26
26
  ```
27
27
 
28
28
  Pass one stacks the five theme bars: `j/k` focus · `w` width · enter picks.
@@ -44,12 +44,12 @@ another home instead of `$HOME`.
44
44
  | `restore` | both keys back to their pre-lab values from `backup.json`, then deletes the lab data — `--dry-run` prints the plan; `--force` splices over a key changed after the takeover |
45
45
 
46
46
  ```sh
47
- npx -y @v1nvn/statusline@0.30.3 preview --theme rich --plain # chat-safe sketch, nothing written
48
- npx -y @v1nvn/statusline@0.30.3 configure --theme rich # the write — live on the next paint
49
- npx -y @v1nvn/statusline@0.30.3 configure --theme rich --bar percent # one swap on top of the theme
50
- npx -y @v1nvn/statusline@0.30.3 catalog --themes
51
- npx -y @v1nvn/statusline@0.30.3 status
52
- npx -y @v1nvn/statusline@0.30.3 restore
47
+ npx -y @v1nvn/statusline@0.30.5 preview --theme rich --plain # chat-safe sketch, nothing written
48
+ npx -y @v1nvn/statusline@0.30.5 configure --theme rich # the write — live on the next paint
49
+ npx -y @v1nvn/statusline@0.30.5 configure --theme rich --bar percent # one swap on top of the theme
50
+ npx -y @v1nvn/statusline@0.30.5 catalog --themes
51
+ npx -y @v1nvn/statusline@0.30.5 status
52
+ npx -y @v1nvn/statusline@0.30.5 restore
53
53
  ```
54
54
 
55
55
  ## Develop
package/dist/index.js CHANGED
@@ -503,6 +503,11 @@ function fmtFixed(x, d) {
503
503
  function pad2(n) {
504
504
  return String(n).padStart(2, "0");
505
505
  }
506
+ function fmtDuration(minutes) {
507
+ if (minutes < 60) return `${minutes}m`;
508
+ if (minutes < 1440) return `${Math.trunc(minutes / 60)}h${pad2(minutes % 60)}m`;
509
+ return `${Math.trunc(minutes / 1440)}d${pad2(Math.trunc(minutes / 60) % 24)}h`;
510
+ }
506
511
  function fmtK(n, d) {
507
512
  return `${fmtFixed(n / 1e3, d)}k`;
508
513
  }
@@ -719,6 +724,7 @@ function barFlatAt(input, w) {
719
724
  const pct = input.row.pct;
720
725
  let f = trunc(pct * w / 100);
721
726
  if (f > w) f = w;
727
+ if (pct > 0 && f === 0) f = 1;
722
728
  return `${pct >= 90 ? RED$1 : pct >= 70 ? YELLOW$1 : GREEN$1}${"█".repeat(f)}${"░".repeat(w - f)}${RESET$1}`;
723
729
  }
724
730
  function barFlat(input) {
@@ -813,11 +819,12 @@ function costBurn(input) {
813
819
  return out;
814
820
  }
815
821
  function durationClock({ row }) {
816
- return `${trunc(row.durationMs / 6e4)}m${pad2(trunc(row.durationMs % 6e4 / 1e3))}s`;
822
+ return fmtDuration(trunc(row.durationMs / 6e4));
817
823
  }
818
824
  function durationHours({ row }) {
819
825
  const m = trunc(row.durationMs / 6e4);
820
- return `${trunc(m / 60)}h${pad2(m % 60)}m`;
826
+ if (m < 1440) return `${trunc(m / 60)}h${pad2(m % 60)}m`;
827
+ return `${trunc(m / 1440)}d${pad2(trunc(m / 60) % 24)}h${pad2(m % 60)}m`;
821
828
  }
822
829
  function linesDiffstat({ row }) {
823
830
  if (row.la <= 0 && row.lr <= 0) return "";
@@ -1325,7 +1332,7 @@ function catalog(options) {
1325
1332
  //#region src/cli.ts
1326
1333
  var VERSION = {
1327
1334
  name: "@v1nvn/statusline",
1328
- version: "0.30.3",
1335
+ version: "0.30.5",
1329
1336
  description: "Browse statusline variants and configure the live status line and agent panel — the statusline CLI behind the statusline plugin.",
1330
1337
  type: "module",
1331
1338
  bin: "dist/index.js",
@@ -1933,7 +1940,7 @@ function duration(startText, now) {
1933
1940
  const seconds = start > MS_THRESHOLD ? Math.trunc(start / 1e3) : start;
1934
1941
  const elapsed = Math.trunc(now) - seconds;
1935
1942
  if (elapsed < 0) return "";
1936
- return `${Math.trunc(elapsed / 60)}m${pad2(Math.trunc(elapsed % 60))}s`;
1943
+ return fmtDuration(Math.trunc(elapsed / 60));
1937
1944
  }
1938
1945
  function rowFormats(fields, now) {
1939
1946
  const tokens = intValue(fields.tokens) ?? 0;