@kaynooo/cli-git 0.12.0 → 0.13.1

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
@@ -4,17 +4,17 @@ Git for Claude Code, where a session would otherwise chain `git status --short`
4
4
 
5
5
  ```sh
6
6
  bun install -g @kaynooo/cli-git
7
- gst --log 3
7
+ gst -n 3
8
8
  gc 'fix(band): keep it visible' -m 'The band stays above a long prompt.' --ticket '#5 - deliver every pointer' -- src/band.ts tests/band.test.ts
9
9
  ```
10
10
 
11
11
  ## gst
12
12
 
13
- Prints one line with the branch, its upstream and how far ahead and behind it is as of the last fetch, the counts of changed, untracked and conflicted files and HEAD, then the paths grouped as `staged`, `unstaged`, `untracked` and `conflicted`, each with git's letter (`M`, `A`, `D`, `R old -> new`). `--log N` adds the last N commits as `<sha7> <title>`. `--json` prints the same as `{branch, oid, upstream, ahead, behind, head, staged, unstaged, untracked, conflicted, commits}`, a change as `{status, path, from?}`. It takes no index lock, so it runs beside another git command. Exit codes: 0, 2 outside a repository or a usage error.
13
+ Prints one line with the branch, its upstream and how far ahead and behind it is as of the last fetch, the counts of changed, untracked and conflicted files and HEAD, then the paths grouped as `staged`, `unstaged`, `untracked` and `conflicted`, each with git's letter (`M`, `A`, `D`, `R old -> new`). `-n N` (`--limit`, and the former `--log` and `-l`) adds the last N commits as `<sha7> <title>`. `--json` prints the same as `{branch, oid, upstream, ahead, behind, head, staged, unstaged, untracked, conflicted, commits}`, a change as `{status, path, from?}`. It takes no index lock, so it runs beside another git command. Exit codes: 0, 2 outside a repository or a usage error.
14
14
 
15
15
  ## gc
16
16
 
17
- `gc <title> [-m <line>]... [--ticket <line>]... -- <path>...` commits exactly the paths given and prints `<sha7> <title>` then each file committed with its letter; `--json` prints `{sha, subject, files: [{status, path, from?}]}`.
17
+ `gc <title> [-m <line>]... [--ticket <line>]... -- <path>...` commits exactly the paths given and prints `<sha7> <title>` then each file committed with its letter, nothing with `-q`/`--quiet`; `--json` prints `{sha, subject, files: [{status, path, from?}]}`.
18
18
 
19
19
  - The message is the title, then the `-m` lines, then the `--ticket` lines, each block after a blank line; ticket lines are copied verbatim and read `#<n> - <title>`.
20
20
  - Before anything is staged it refuses, exit 1, saying which rule broke: a title that is no Conventional Commit, a title over one line, more than two description lines, a bullet list, a hard-wrapped sentence, any trailer (`Co-Authored-By`, `Signed-off-by`, "Generated with"). A breaking change (`feat!:` or a `BREAKING CHANGE:` line) may give full details.
package/dist/gb.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env -S bun --no-env-file
1
+ #!/usr/bin/env -S bun --no-env-file --config=/dev/null
2
2
  // @bun
3
3
 
4
4
  // src/gb.ts
@@ -34,266 +34,60 @@ function isInteractive(streams = process2) {
34
34
  // ../kit/src/style.ts
35
35
  import process6 from "process";
36
36
 
37
- // ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-mtetydvc.js
38
- function x(s) {
39
- let r = s.startsWith("#") ? s.slice(1).toLowerCase() : s.toLowerCase();
40
- if (!/^[a-f0-9]+$/.test(r))
37
+ // ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-x450vn3m.js
38
+ var G = /^[a-f0-9]+$/i;
39
+ function b(r) {
40
+ let e = r.startsWith("#") ? r.slice(1) : r;
41
+ if (!G.test(e))
41
42
  return [0, 0, 0];
42
- let t = r.length, n = (c) => Number.parseInt(c, 16);
43
- if (t === 3 || t === 4) {
44
- let c = n(r[0] + r[0]), u = n(r[1] + r[1]), h = n(r[2] + r[2]), g = t === 4 ? n(r[3] + r[3]) : undefined;
45
- return g !== undefined ? [c, u, h, g] : [c, u, h];
46
- }
47
- if (t !== 6 && t !== 8)
48
- throw Error(`Invalid hex color length: ${t}`);
49
- let a = n(r.slice(0, 2)), b = n(r.slice(2, 4)), o = n(r.slice(4, 6)), y = t === 8 ? n(r.slice(6, 8)) : undefined;
50
- if ([a, b, o].some(Number.isNaN) || y !== undefined && Number.isNaN(y))
51
- throw Error(`Invalid hex color value: ${s}`);
52
- return y !== undefined ? [a, b, o, y] : [a, b, o];
53
- }
54
- function A(s) {
55
- let [r, t, n, a] = s;
56
- if (a)
57
- return `#${(r << 24 | t << 16 | n << 8 | Math.round((a ?? 1) * 255)).toString(16).padStart(8, "0").toUpperCase()}`;
58
- return `#${(r << 16 | t << 8 | n).toString(16).padStart(6, "0").toUpperCase()}`;
59
- }
60
- function R(s, r, t) {
61
- s = (s % 360 + 360) % 360, t /= 100;
62
- let n = r * Math.min(t, 1 - t) / 100, a = (b) => {
63
- let o = (b + s / 30) % 12, y = t - n * Math.max(Math.min(o - 3, 9 - o, 1), -1);
64
- return Math.round(255 * y);
65
- };
66
- return [a(0), a(8), a(4)];
67
- }
68
- function k(s) {
69
- let [r, t, n] = s;
70
- r /= 255, t /= 255, n /= 255;
71
- let a = Math.max(r, t, n), b = Math.min(r, t, n), o = 0, y = 0, c = (a + b) / 2;
72
- if (a !== b) {
73
- let u = a - b;
74
- if (y = c > 0 && c < 1 ? u / (1 - Math.abs(2 * c - 1)) : 0, a === r)
75
- o = (t - n) / u + (t < n ? 6 : 0);
76
- else if (a === t)
77
- o = (n - r) / u + 2;
78
- else
79
- o = (r - t) / u + 4;
80
- o /= 6;
81
- }
82
- return [Math.round(o * 360), Math.round(y * 100), Math.round(c * 100)];
83
- }
84
- function H(s, r, t) {
85
- s = (s % 360 + 360) % 360, r /= 100, t /= 100;
86
- let n = (a) => {
87
- let b = (a + s / 60) % 6, o = t - t * r * Math.max(Math.min(b, 4 - b, 1), 0);
88
- return Math.round(255 * o);
89
- };
90
- return [n(5), n(3), n(1)];
91
- }
92
- function f(s) {
93
- let [r, t, n] = s;
94
- r /= 255, t /= 255, n /= 255;
95
- let a = Math.max(r, t, n), b = Math.min(r, t, n), o = a - b, y = 0, c = a === 0 ? 0 : o / a, u = a;
96
- if (o !== 0) {
97
- if (a === r)
98
- y = (t - n) / o + (t < n ? 6 : 0);
99
- else if (a === t)
100
- y = (n - r) / o + 2;
101
- else
102
- y = (r - t) / o + 4;
103
- y /= 6;
104
- }
105
- return [Math.round(y * 360), Math.round(c * 100), Math.round(u * 100)];
106
- }
107
- function O(s) {
108
- let r = s[0] / 255, t = s[1] / 255, n = s[2] / 255, a = 1 - Math.max(r, t, n);
109
- if (a === 1)
110
- return [0, 0, 0, 100];
111
- let b = (1 - r - a) / (1 - a), o = (1 - t - a) / (1 - a), y = (1 - n - a) / (1 - a);
112
- return [Math.round(b * 100), Math.round(o * 100), Math.round(y * 100), Math.round(a * 100)];
113
- }
114
- function v(s, r, t, n) {
115
- return s /= 100, r /= 100, t /= 100, n /= 100, [Math.round(255 * (1 - s) * (1 - n)), Math.round(255 * (1 - r) * (1 - n)), Math.round(255 * (1 - t) * (1 - n))];
116
- }
117
- var m = (s) => s <= 0.04045 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
118
- var p = (s) => s <= 0.0031308 ? 12.92 * s : 1.055 * s ** 0.4166666666666667 - 0.055;
119
- var i = (s, r) => Math.round(s * 10 ** r) / 10 ** r;
120
- function T(s) {
121
- let r = m(s[0] / 255), t = m(s[1] / 255), n = m(s[2] / 255), a = Math.cbrt(0.4122214708 * r + 0.5363325363 * t + 0.0514459929 * n), b = Math.cbrt(0.2119034982 * r + 0.6806995451 * t + 0.1073969566 * n), o = Math.cbrt(0.0883024619 * r + 0.2817188376 * t + 0.6299787005 * n);
122
- return [i(0.2104542553 * a + 0.793617785 * b - 0.0040720468 * o, 4), i(1.9779984951 * a - 2.428592205 * b + 0.4505937099 * o, 4), i(0.0259040371 * a + 0.7827717662 * b - 0.808675766 * o, 4)];
123
- }
124
- function M(s, r, t) {
125
- let n = (s + 0.3963377774 * r + 0.2158037573 * t) ** 3, a = (s - 0.1055613458 * r - 0.0638541728 * t) ** 3, b = (s - 0.0894841775 * r - 1.291485548 * t) ** 3, o = p(4.0767416621 * n - 3.3077115913 * a + 0.2309699292 * b), y = p(-1.2684380046 * n + 2.6097574011 * a - 0.3413193965 * b), c = p(-0.0041960863 * n - 0.7034186147 * a + 1.707614701 * b), u = (h) => Math.min(255, Math.max(0, Math.round(h * 255)));
126
- return [u(o), u(y), u(c)];
127
- }
128
- function d(s) {
129
- let [r, t, n] = T(s), a = Math.sqrt(t * t + n * n), b = (Math.atan2(n, t) * 180 / Math.PI + 360) % 360;
130
- return [i(r, 4), i(a, 4), i(b, 2)];
131
- }
132
- function C(s, r, t) {
133
- let n = t * Math.PI / 180;
134
- return M(s, r * Math.cos(n), r * Math.sin(n));
135
- }
136
- function l(s) {
137
- let r = s / 255;
138
- return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
139
- }
140
-
141
- class e {
142
- r;
143
- g;
144
- b;
145
- a;
146
- constructor(s, r, t, n = 1) {
147
- this.r = s, this.g = r, this.b = t, this.a = n;
148
- }
149
- static from(s, r) {
150
- if (s === "hex") {
151
- let [t, n, a, b] = x(r);
152
- return new e(t, n, a, b);
153
- }
154
- if (s === "rgb") {
155
- if (Array.isArray(r)) {
156
- let [o, y, c, u] = r;
157
- return new e(o, y, c, u);
158
- }
159
- let { r: t, g: n, b: a, a: b } = r;
160
- return new e(t, n, a, b);
161
- }
162
- if (s === "hsl") {
163
- let t, n, a, b;
164
- if (Array.isArray(r))
165
- [t, n, a, b] = r;
166
- else
167
- ({ h: t, s: n, l: a, a: b } = r);
168
- let [o, y, c] = R(t, n, a);
169
- return new e(o, y, c, b);
170
- }
171
- if (s === "hsv") {
172
- let t, n, a, b;
173
- if (Array.isArray(r))
174
- [t, n, a, b] = r;
175
- else
176
- ({ h: t, s: n, v: a, a: b } = r);
177
- let [o, y, c] = H(t, n, a);
178
- return new e(o, y, c, b);
179
- }
180
- if (s === "cmyk") {
181
- let t, n, a, b, o;
182
- if (Array.isArray(r))
183
- [t, n, a, b, o] = r;
184
- else
185
- ({ c: t, m: n, y: a, k: b, a: o } = r);
186
- let [y, c, u] = v(t, n, a, b);
187
- return new e(y, c, u, o);
188
- }
189
- if (s === "oklch") {
190
- let t, n, a, b;
191
- if (Array.isArray(r))
192
- [t, n, a, b] = r;
193
- else
194
- ({ l: t, c: n, h: a, a: b } = r);
195
- let [o, y, c] = C(t, n, a);
196
- return new e(o, y, c, b);
197
- }
198
- if (s === "oklab") {
199
- let t, n, a, b;
200
- if (Array.isArray(r))
201
- [t, n, a, b] = r;
202
- else
203
- ({ l: t, a: n, b: a, alpha: b } = r);
204
- let [o, y, c] = M(t, n, a);
205
- return new e(o, y, c, b);
206
- }
207
- throw Error("Invalid input");
208
- }
209
- to(s) {
210
- switch (s) {
211
- case "rgb":
212
- return [this.r, this.g, this.b];
213
- case "rgba":
214
- return [this.r, this.g, this.b, this.a];
215
- case "hex":
216
- return A([this.r, this.g, this.b]);
217
- case "hexa":
218
- return A([this.r, this.g, this.b, this.a]);
219
- case "hsl":
220
- return k([this.r, this.g, this.b]);
221
- case "hsla":
222
- return [...k([this.r, this.g, this.b]), this.a];
223
- case "hsv":
224
- return f([this.r, this.g, this.b]);
225
- case "hsva":
226
- return [...f([this.r, this.g, this.b]), this.a];
227
- case "cmyk":
228
- return O([this.r, this.g, this.b]);
229
- case "cmyka":
230
- return [...O([this.r, this.g, this.b]), this.a];
231
- case "oklch":
232
- return d([this.r, this.g, this.b]);
233
- case "oklcha":
234
- return [...d([this.r, this.g, this.b]), this.a];
235
- case "oklab":
236
- return T([this.r, this.g, this.b]);
237
- case "oklaba":
238
- return [...T([this.r, this.g, this.b]), this.a];
239
- default:
240
- return [this.r, this.g, this.b];
241
- }
242
- }
243
- getLuminance() {
244
- let s = l(this.r), r = l(this.g), t = l(this.b);
245
- return 0.2126 * s + 0.7152 * r + 0.0722 * t;
246
- }
247
- contrastRatio(s) {
248
- let r = this.getLuminance(), t = s.getLuminance(), [n, a] = r >= t ? [r, t] : [t, r];
249
- return (n + 0.05) / (a + 0.05);
250
- }
251
- bestContrastForeground() {
252
- let s = new e(255, 255, 255, 1), r = new e(0, 0, 0, 1), t = this.contrastRatio(s), n = this.contrastRatio(r);
253
- return t >= n ? s : r;
254
- }
255
- }
256
-
257
- // ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-y1msbssb.js
258
- var r = 39;
259
- var o = 49;
260
- var f2 = "\x1B[";
261
- var C2 = { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29], black: [30, r], red: [31, r], green: [32, r], yellow: [33, r], blue: [34, r], magenta: [35, r], cyan: [36, r], white: [37, r], gray: [90, r], grey: [90, r], blackBright: [90, r], redBright: [91, r], greenBright: [92, r], yellowBright: [93, r], blueBright: [94, r], magentaBright: [95, r], cyanBright: [96, r], whiteBright: [97, r], bgBlack: [40, o], bgRed: [41, o], bgGreen: [42, o], bgYellow: [43, o], bgBlue: [44, o], bgMagenta: [45, o], bgCyan: [46, o], bgWhite: [47, o], bgBlackBright: [100, o], bgRedBright: [101, o], bgGreenBright: [102, o], bgYellowBright: [103, o], bgBlueBright: [104, o], bgMagentaBright: [105, o], bgCyanBright: [106, o], bgWhiteBright: [107, o], rgb: (i, n, a, l = "fg") => [`${l === "fg" ? 38 : 48};2;${i};${n};${a}`, l === "fg" ? r : o], hex: (i, n = "fg") => {
262
- let [a, l, s] = e.from("hex", i).to("rgb");
263
- return [`${n === "fg" ? 38 : 48};2;${a};${l};${s}`, n === "fg" ? r : o];
264
- }, ansi256: (i, n = "fg") => [`${n === "fg" ? 38 : 48};5;${i}`, n === "fg" ? r : o] };
265
- var b = new Set(["", "1", "2", "3", "true"]);
266
- function h(i, n = globalThis.process?.env ?? {}) {
267
- if (n.FORCE_COLOR !== undefined)
268
- return b.has(n.FORCE_COLOR);
269
- if (n.NO_COLOR !== undefined || n.NODE_DISABLE_COLORS !== undefined || n.TERM === "dumb")
43
+ if (e.length === 3 || e.length === 4)
44
+ return [Number.parseInt(e[0] + e[0], 16), Number.parseInt(e[1] + e[1], 16), Number.parseInt(e[2] + e[2], 16)];
45
+ if (e.length !== 6 && e.length !== 8)
46
+ throw Error(`Invalid hex color length: ${e.length}`);
47
+ return [Number.parseInt(e.slice(0, 2), 16), Number.parseInt(e.slice(2, 4), 16), Number.parseInt(e.slice(4, 6), 16)];
48
+ }
49
+ var B = { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29], black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], gray: [90, 39], grey: [90, 39], blackBright: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39], bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49], rgb: (r, e, l, n = "fg") => [`${n === "fg" ? 38 : 48};2;${r};${e};${l}`, n === "fg" ? 39 : 49], hex: (r, e = "fg") => {
50
+ let [l, n, c] = b(r);
51
+ return [`${e === "fg" ? 38 : 48};2;${l};${n};${c}`, e === "fg" ? 39 : 49];
52
+ }, ansi256: (r, e = "fg") => [`${e === "fg" ? 38 : 48};5;${r}`, e === "fg" ? 39 : 49] };
53
+ var h = new Set(["", "1", "2", "3", "true"]);
54
+ function C(r, e = globalThis.process?.env ?? {}) {
55
+ if (e.FORCE_COLOR !== undefined)
56
+ return h.has(e.FORCE_COLOR);
57
+ if (e.NO_COLOR !== undefined || e.NODE_DISABLE_COLORS !== undefined || e.TERM === "dumb")
270
58
  return false;
271
- return i?.isTTY === true;
272
- }
273
- function d2(i, n, a) {
274
- if (!h(a.stream ?? globalThis.process?.stdout, a.env))
275
- return n;
276
- let l = "", s = "";
277
- for (let g = 0, y = i.length;g < y; g++) {
278
- let [c, p] = i[g];
279
- l += `${f2}${c}m`, s = `${f2}${p}m${s}`;
280
- }
281
- return l + n + s;
282
- }
283
- function u(i, n = []) {
284
- return new Proxy((l) => d2(n, l, i), { get(l, s) {
285
- let g = C2[s];
286
- if (Array.isArray(g))
287
- return u(i, [...n, g]);
288
- if (typeof g === "function")
289
- return (...y) => u(i, [...n, g(...y)]);
290
- throw Error(`Unknown style: ${String(s)}`);
59
+ return r?.isTTY === true;
60
+ }
61
+ function f(r, e = []) {
62
+ let l = "", n = "";
63
+ for (let t = 0, i = e.length;t < i; t++)
64
+ l += `\x1B[${e[t][0]}m`, n = `\x1B[${e[t][1]}m${n}`;
65
+ let c = (t) => C(r.stream ?? globalThis.process?.stdout, r.env) ? l + t + n : t, g = new Map;
66
+ return new Proxy(c, { get(t, i) {
67
+ let a = B[i];
68
+ if (Array.isArray(a)) {
69
+ let s = g.get(i);
70
+ if (s === undefined)
71
+ s = f(r, [...e, a]), g.set(i, s);
72
+ return s;
73
+ }
74
+ if (typeof a === "function")
75
+ return (...s) => {
76
+ let y = `${i}:${s.join(",")}`, u = g.get(y);
77
+ if (u === undefined) {
78
+ if (g.size >= 64)
79
+ g.clear();
80
+ u = f(r, [...e, a(...s)]), g.set(y, u);
81
+ }
82
+ return u;
83
+ };
84
+ throw Error(`Unknown style: ${String(i)}`);
291
85
  } });
292
86
  }
293
- function le(i = {}) {
294
- return u(i);
87
+ function Fe(r = {}) {
88
+ return f(r);
295
89
  }
296
- var t = le();
90
+ var o = Fe();
297
91
 
298
92
  // ../kit/src/theme.ts
299
93
  import { existsSync as existsSync2, readFileSync, statSync } from "fs";
@@ -329,19 +123,21 @@ function userConfigPath(bin, where = {}) {
329
123
  }
330
124
 
331
125
  // ../kit/src/theme.ts
126
+ var ENDS = new Map;
332
127
  var DEFAULT = {
333
- colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
334
- glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D" },
128
+ colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", plan: "magenta", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
129
+ glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", plan: "\u25C7", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D", open: "\u2022", leaf: "\xB7", guide: "\u2502" },
335
130
  accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
336
- bins: {}
131
+ bins: {},
132
+ gradient: ["#c084fc", "#67e8f9"]
337
133
  };
338
- var BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
339
- var MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
340
- var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+" };
134
+ var BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", plan: "magentaBright", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
135
+ var MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", plan: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
136
+ var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", plan: "?", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+", open: "*", leaf: "-", guide: "|" };
341
137
  var PRESETS = {
342
138
  default: {},
343
- "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"] },
344
- mono: { colors: MONO, accents: ["bold"] },
139
+ "high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"], gradient: ["#d8b4fe", "#a5f3fc"] },
140
+ mono: { colors: MONO, accents: ["bold"], gradient: undefined },
345
141
  ascii: { glyphs: ASCII }
346
142
  };
347
143
  var STYLES = new Set(["bold", "dim", "italic", "underline", "inverse", "strikethrough", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "gray", "grey", "blackBright", "redBright", "greenBright", "yellowBright", "blueBright", "magentaBright", "cyanBright", "whiteBright"]);
@@ -412,6 +208,8 @@ function applyPreset(theme, name, warn, where) {
412
208
  Object.assign(theme.glyphs, preset.glyphs);
413
209
  if (preset.accents !== undefined)
414
210
  theme.accents = [...preset.accents];
211
+ if (Object.hasOwn(preset, "gradient"))
212
+ theme.gradient = preset.gradient;
415
213
  return name;
416
214
  }
417
215
  function applyFile(theme, file, where, warn) {
@@ -439,6 +237,12 @@ function applyFile(theme, file, where, warn) {
439
237
  theme.accents = [...file.accents];
440
238
  else if (file.accents !== undefined)
441
239
  warn(`${where}: accents must be a non-empty list of colours`);
240
+ if (file.gradient === null)
241
+ theme.gradient = undefined;
242
+ else if (Array.isArray(file.gradient) && file.gradient.length === 2 && file.gradient.every((end) => typeof end === "string" && HEX.test(end)))
243
+ theme.gradient = [file.gradient[0], file.gradient[1]];
244
+ else if (file.gradient !== undefined)
245
+ warn(`${where}: gradient must be two \`#rrggbb\` colours, or null for none`);
442
246
  if (isRecord(file.bins)) {
443
247
  for (const [bin, value] of Object.entries(file.bins)) {
444
248
  if (isColorSpec(value))
@@ -462,7 +266,7 @@ function isPath(chosen) {
462
266
  return chosen.includes("/") || chosen.endsWith(".json");
463
267
  }
464
268
  function loadTheme({ env = process5.env, from = process5.cwd(), home = homedir2(), warn = warnOnce } = {}) {
465
- const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null) };
269
+ const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null), gradient: DEFAULT.gradient };
466
270
  const sources = [];
467
271
  const chosen = env.KIT_THEME ?? "";
468
272
  const wanted = chosen === "" ? [userConfigPath("theme", { home, xdg: env.XDG_CONFIG_HOME }), findUp(join3(".kaynooo", "theme.json"), from, endsWalk(home))] : [];
@@ -504,7 +308,7 @@ function takesControlCodes(stream, env = process6.env) {
504
308
  return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb" && outputMode(stream, env) === "terminal";
505
309
  }
506
310
  function paint(stream, env = process6.env) {
507
- return le({ stream: { isTTY: takesControlCodes(stream, env) }, env });
311
+ return Fe({ stream: { isTTY: takesControlCodes(stream, env) }, env });
508
312
  }
509
313
  function role(name, stream, env = process6.env) {
510
314
  const colors = paint(stream, env);
@@ -520,10 +324,31 @@ var STATUS_WORDS = {
520
324
  var STATUS_OF = new Map(Object.entries(STATUS_WORDS).flatMap(([status, words]) => words.map((word) => [word, status])));
521
325
 
522
326
  // ../kit/src/format.ts
327
+ var UNITS = [["d", 86400], ["h", 3600], ["m", 60], ["s", 1]];
328
+ function formatSeconds(total) {
329
+ let rest = Math.max(0, Math.round(total));
330
+ const amounts = UNITS.map(([unit, size]) => {
331
+ const amount = Math.floor(rest / size);
332
+ rest -= amount * size;
333
+ return `${amount}${unit}`;
334
+ });
335
+ const first = amounts.findIndex((amount) => !amount.startsWith("0"));
336
+ if (first === -1)
337
+ return "0s";
338
+ const next = amounts[first + 1];
339
+ return next === undefined || next.startsWith("0") ? amounts[first] ?? "0s" : `${amounts[first]} ${next}`;
340
+ }
523
341
  function upTo(text, separator) {
524
342
  const end = text.indexOf(separator);
525
343
  return end === -1 ? text : text.slice(0, end);
526
344
  }
345
+ function formatAge(date, now = Date.now()) {
346
+ const at = typeof date === "number" ? date : Date.parse(date);
347
+ if (Number.isNaN(at))
348
+ return "-";
349
+ const seconds = (now - at) / 1000;
350
+ return seconds < 60 ? "just now" : `${upTo(formatSeconds(seconds), " ")} ago`;
351
+ }
527
352
  var ESCAPE = String.fromCharCode(27);
528
353
  function jsonText(value, replacer, { stream = process7.stdout, env = process7.env } = {}) {
529
354
  return JSON.stringify(value, replacer, outputMode(stream, env) === "agent" ? undefined : 2);
@@ -1310,7 +1135,9 @@ var COLUMN_GAP = 2;
1310
1135
  var PASTE_START = "\x1B[200~";
1311
1136
  var PASTE_END = "\x1B[201~";
1312
1137
  var LAST_WORD = /\S*\s*$/;
1313
- var KEY_SEQUENCES = /\x1B\[[0-9;]*[A-Z~]|\x1BO[A-Z]|\x1B[\s\S]|[\s\S]/gu;
1138
+ var KEY_SEQUENCES = /\x1B\[<[0-9;]*[A-Za-z]|\x1B\[[0-9;]*[A-Z~]|\x1BO[A-Z]|\x1B[\s\S]|[\s\S]/gu;
1139
+ var MOUSE = /^\x1B\[<(\d+);\d+;\d+[a-z]$/i;
1140
+ var WHEEL_LINES = 3;
1314
1141
  var KEYS = {
1315
1142
  "\x1B[A": "up",
1316
1143
  "\x1BOA": "up",
@@ -1392,6 +1219,9 @@ function lay(rows, searched) {
1392
1219
  function parseKeys(input, paste = { active: false }, ctrls = []) {
1393
1220
  const codes = new Map(ctrls.map((name) => [String.fromCharCode(name.codePointAt(name.length - 1) - 96), name]));
1394
1221
  return (input.match(KEY_SEQUENCES) ?? []).flatMap((sequence) => {
1222
+ const wheel = MOUSE.exec(sequence)?.[1];
1223
+ if (wheel !== undefined)
1224
+ return repeat(wheel === "64" ? "up" : "down", wheel === "64" || wheel === "65" ? WHEEL_LINES : 0);
1395
1225
  const named = codes.get(sequence);
1396
1226
  const key = named === undefined ? KEYS[sequence] : { ctrl: named };
1397
1227
  if (sequence === PASTE_START || sequence === PASTE_END) {
@@ -1634,7 +1464,7 @@ function caretColumn(state, layout) {
1634
1464
  }
1635
1465
  function helpLines(state, layout, theme) {
1636
1466
  const lines = [
1637
- "type to filter, up, down, ctrl-p, ctrl-n, pgup, pgdn, home, end move",
1467
+ "type to filter, up, down, ctrl-p, ctrl-n, pgup, pgdn, home, end, the wheel move",
1638
1468
  `enter picks${state.multi ? ", tab marks" : ""}, ctrl-u clears the query, ctrl-w a word, esc or ctrl-c cancels`,
1639
1469
  ...state.expect.length > 0 ? [`${state.expect.join(", ")} end the pick as this command asks`] : []
1640
1470
  ];
@@ -1684,8 +1514,11 @@ var ESCAPE_WAIT_MS = 30;
1684
1514
  var OPEN = { ctrl: "open" };
1685
1515
  var HIDE_CURSOR = "\x1B[?25l";
1686
1516
  var SHOW_CURSOR = "\x1B[?25h";
1517
+ var CARET = "\x1B[7m \x1B[27m";
1687
1518
  var PASTE_ON = "\x1B[?2004h";
1688
1519
  var PASTE_OFF = "\x1B[?2004l";
1520
+ var MOUSE_ON = "\x1B[?1000h\x1B[?1006h";
1521
+ var MOUSE_OFF = "\x1B[?1006l\x1B[?1000l";
1689
1522
  var CLEAR_BELOW = "\r\x1B[J";
1690
1523
  var SIGNALS2 = ["SIGINT", "SIGTERM", "SIGHUP"];
1691
1524
  function up(lines) {
@@ -1748,21 +1581,18 @@ async function select(rows, settings, terminal = openTerminal()) {
1748
1581
  let finish;
1749
1582
  let restored = false;
1750
1583
  let escape;
1751
- let caret;
1752
1584
  function draw(clear = false) {
1753
1585
  if (restored)
1754
1586
  return;
1755
1587
  const layout = layoutFor({ columns: terminal.columns, rows: terminal.rows }, settings.height, settings.preview !== undefined, settings.previewPosition);
1756
1588
  let frame = HIDE_CURSOR;
1757
1589
  if (reserved !== layout.height || clear) {
1758
- frame += clear && caret !== undefined ? up(Math.floor((caret - 1) / terminal.columns)) : "";
1759
1590
  frame += CLEAR_BELOW + `
1760
1591
  `.repeat(layout.height - 1) + up(layout.height - 1);
1761
1592
  reserved = layout.height;
1762
1593
  }
1763
- caret = caretColumn(state, layout);
1764
1594
  frame += `\r${render(state, layout, theme, preview).map((line) => `\x1B[2K${line}`).join(`
1765
- `)}${up(layout.height - 1)}\r\x1B[${caret}G${SHOW_CURSOR}`;
1595
+ `)}${up(layout.height - 1)}\r\x1B[${caretColumn(state, layout)}G${CARET}\r`;
1766
1596
  terminal.write(frame);
1767
1597
  }
1768
1598
  function pageSize() {
@@ -1801,7 +1631,7 @@ async function select(rows, settings, terminal = openTerminal()) {
1801
1631
  clearTimeout(previewTimer);
1802
1632
  clearTimeout(escape);
1803
1633
  previewing.abort();
1804
- terminal.write(`${CLEAR_BELOW}${PASTE_OFF}${SHOW_CURSOR}`);
1634
+ terminal.write(`${CLEAR_BELOW}${MOUSE_OFF}${PASTE_OFF}${SHOW_CURSOR}`);
1805
1635
  terminal.close();
1806
1636
  }
1807
1637
  const stop = () => {
@@ -1880,7 +1710,7 @@ async function select(rows, settings, terminal = openTerminal()) {
1880
1710
  for (const signal of SIGNALS2)
1881
1711
  process16.once(signal, stop);
1882
1712
  try {
1883
- terminal.write(PASTE_ON);
1713
+ terminal.write(`${PASTE_ON}${MOUSE_ON}`);
1884
1714
  terminal.listen(onChunk, () => draw(true));
1885
1715
  refreshPreview();
1886
1716
  draw(true);
@@ -1953,7 +1783,7 @@ var options = {
1953
1783
  delete: { type: "boolean", short: "d", description: "delete the local branch with git branch -d" },
1954
1784
  json: jsonOption("[{ name, remote, worktree, when, subject, date, upstream, track, merged }]")
1955
1785
  };
1956
- var FIELDS = ["%(refname)", "%(refname:short)", "%(committerdate:unix)", "%(committerdate:relative)", "%(subject)", "%(worktreepath)", "%(upstream:short)", "%(upstream:track,nobracket)"];
1786
+ var FIELDS = ["%(refname)", "%(refname:short)", "%(committerdate:unix)", "%(subject)", "%(worktreepath)", "%(upstream:short)", "%(upstream:track,nobracket)"];
1957
1787
  var CHECKOUT = /^checkout: moving from (\S+) to (\S+)$/;
1958
1788
  var KEYS2 = "enter go, ctrl-n new from query, ctrl-d delete if merged, ctrl-r fetch";
1959
1789
  var TRACK_TINTS = { ahead: "green", behind: "red", gone: "yellow" };
@@ -1996,13 +1826,13 @@ function branches(against) {
1996
1826
  `).filter(Boolean);
1997
1827
  const merged = new Set(against !== undefined ? read(["branch", "--merged", against, "--format=%(refname:short)"]).split(`
1998
1828
  `) : []);
1999
- return lines.map((line) => line.split("\x00")).filter(([ref = ""]) => !ref.endsWith("/HEAD")).map(([ref = "", name = "", date = "0", when = "", subject = "", worktree = "", upstream = "", track = ""]) => {
1829
+ return lines.map((line) => line.split("\x00")).filter(([ref = ""]) => !ref.endsWith("/HEAD")).map(([ref = "", name = "", date = "0", subject = "", worktree = "", upstream = "", track = ""]) => {
2000
1830
  const remote = ref.startsWith("refs/remotes/");
2001
1831
  return {
2002
1832
  name,
2003
1833
  remote,
2004
1834
  worktree: worktree === here ? "" : worktree,
2005
- when,
1835
+ when: formatAge(Number(date) * 1000),
2006
1836
  subject,
2007
1837
  date: Number(date),
2008
1838
  upstream,