@kaynooo/cli-forgejo 0.26.0 → 0.28.0
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 +1 -1
- package/dist/cli.js +121 -282
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Needs [tea](https://gitea.com/gitea/tea) logged in to the Forgejo instance (`tea
|
|
|
17
17
|
| `ft watch` | waits for the runs in progress, or `--after <id>` those newer than a run; `--json` and `--quiet` as `ft ci` |
|
|
18
18
|
| `ft logs <run>` | what the failed jobs of a run say went wrong, `-j <name or id>` picks a job, `--full` for whole logs, `--json` for the run, its jobs and the failed ones with their excerpts |
|
|
19
19
|
| `ft release <level>` | waits for the runs on HEAD, pushing it first when origin lacks it, then `bun pm version`, one atomic push of branch and tag, and waits for the runs and the registry; `-p <folder>` releases one workspace package as `<folder>-v<version>`, `-p a,b` or `--all` several in one push and one test run; `--json` prints `{released, tag, package, version, status, runs, failedJobs, url}` (an array with several packages) |
|
|
20
|
-
| `ft board` | open issues: available, taken by a live session, or claimed with no live session here, each claim with its boxes left and a stale one with its latest note (
|
|
20
|
+
| `ft board` | open issues: available, taken by a live session, or claimed with no live session here, each claim with its boxes left and a stale one with its latest note (`--query <regex>` on titles, `--state available\|taken\|away`, `-L`, `-m <milestone>`, `--json`) |
|
|
21
21
|
| `ft digest` | one screen for a session starting cold: the issues this session holds with their boxes left, claims no live session answers to, red or running CI on the default branch, unpushed commits, dirty files and TODO comments naming a closed issue (needs `todo-scan` on the PATH; empty sections left out, `--json`) |
|
|
22
22
|
| `ft take <n>...` / `ft drop <n>...` | claims or gives back issues for the calling Claude Code session, `--lane` as `lane-<s>-<n>` |
|
|
23
23
|
| `ft issue [<n>...]` | an issue's state, claim and description, its checklist boxes numbered in place, the issues this session holds when no number is given (`-c` comments, `-t` only the boxes left, `-b` only the raw description to edit, `--json`) |
|
package/dist/cli.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/cli.ts
|
|
@@ -9,7 +9,42 @@ import { parseArgs } from "util";
|
|
|
9
9
|
|
|
10
10
|
// ../kit/src/format.ts
|
|
11
11
|
import process7 from "process";
|
|
12
|
-
|
|
12
|
+
// ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-rxztfxgv.js
|
|
13
|
+
var ct = /[aeiou]y$/;
|
|
14
|
+
var N = new Map;
|
|
15
|
+
var Ot = /(?:leaf|loaf|thief|wolf|half|calf|elf|sheaf|scarf|dwarf|hoof|wharf)$/;
|
|
16
|
+
var Gt = /(?:knife|life|wife)$/;
|
|
17
|
+
function K(t, e, { plural: r, zero: n = "singular" } = {}) {
|
|
18
|
+
if (e === 1 || e === 0 && n === "singular")
|
|
19
|
+
return t;
|
|
20
|
+
if (r !== undefined)
|
|
21
|
+
return r;
|
|
22
|
+
if (t.endsWith("y") && !ct.test(t))
|
|
23
|
+
return `${t.slice(0, -1)}ies`;
|
|
24
|
+
if (t.endsWith("s") || t.endsWith("x") || t.endsWith("z") || t.endsWith("ch") || t.endsWith("sh"))
|
|
25
|
+
return `${t}es`;
|
|
26
|
+
if (Ot.test(t))
|
|
27
|
+
return `${t.slice(0, -1)}ves`;
|
|
28
|
+
return Gt.test(t) ? `${t.slice(0, -2)}ves` : `${t}s`;
|
|
29
|
+
}
|
|
30
|
+
function go(t, e, { zero: r = "plural", ...n } = {}) {
|
|
31
|
+
return `${t} ${K(e, t, { ...n, zero: r })}`;
|
|
32
|
+
}
|
|
33
|
+
var Nt = /\s+\S*$/;
|
|
34
|
+
var Y = /\s/;
|
|
35
|
+
function ko(t, e, r = "...") {
|
|
36
|
+
let { suffix: n = "...", includeSuffix: s = false, wordBoundary: o = false } = typeof r === "string" ? { suffix: r } : r;
|
|
37
|
+
if (t.length <= e)
|
|
38
|
+
return t;
|
|
39
|
+
let l = Math.max(0, e), c = t.substring(0, Math.max(0, s ? l - n.length : l));
|
|
40
|
+
if (o && !Y.test(t[c.length] ?? " "))
|
|
41
|
+
c = c.replace(Nt, "") || c;
|
|
42
|
+
if (o)
|
|
43
|
+
c = c.trimEnd();
|
|
44
|
+
return s ? (c + n).slice(0, l) : c + n;
|
|
45
|
+
}
|
|
46
|
+
var be = new Map(["\u20AC", "", "\u201A", "\u0192", "\u201E", "\u2026", "\u2020", "\u2021", "\u02C6", "\u2030", "\u0160", "\u2039", "\u0152", "", "\u017D", "", "", "\u2018", "\u2019", "\u201C", "\u201D", "\u2022", "\u2013", "\u2014", "\u02DC", "\u2122", "\u0161", "\u203A", "\u0153", "", "\u017E", "\u0178"].map((t, e) => [t, 128 + e]).filter(([t]) => t));
|
|
47
|
+
var z = new Map;
|
|
13
48
|
// ../kit/src/mode.ts
|
|
14
49
|
import process2 from "process";
|
|
15
50
|
var MODES = new Set(["terminal", "ci", "agent", "pipe"]);
|
|
@@ -31,266 +66,60 @@ function outputMode(stream = process2.stdout, env = process2.env) {
|
|
|
31
66
|
// ../kit/src/style.ts
|
|
32
67
|
import process6 from "process";
|
|
33
68
|
|
|
34
|
-
// ../../node_modules/.bun/@kaynooo+utils@
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
69
|
+
// ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-x450vn3m.js
|
|
70
|
+
var G2 = /^[a-f0-9]+$/i;
|
|
71
|
+
function b(r) {
|
|
72
|
+
let e = r.startsWith("#") ? r.slice(1) : r;
|
|
73
|
+
if (!G2.test(e))
|
|
38
74
|
return [0, 0, 0];
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
let
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (
|
|
54
|
-
return `#${(r << 24 | t << 16 | n << 8 | Math.round((a ?? 1) * 255)).toString(16).padStart(8, "0").toUpperCase()}`;
|
|
55
|
-
return `#${(r << 16 | t << 8 | n).toString(16).padStart(6, "0").toUpperCase()}`;
|
|
56
|
-
}
|
|
57
|
-
function R(s, r, t) {
|
|
58
|
-
s = (s % 360 + 360) % 360, t /= 100;
|
|
59
|
-
let n = r * Math.min(t, 1 - t) / 100, a = (b) => {
|
|
60
|
-
let o = (b + s / 30) % 12, y = t - n * Math.max(Math.min(o - 3, 9 - o, 1), -1);
|
|
61
|
-
return Math.round(255 * y);
|
|
62
|
-
};
|
|
63
|
-
return [a(0), a(8), a(4)];
|
|
64
|
-
}
|
|
65
|
-
function k(s) {
|
|
66
|
-
let [r, t, n] = s;
|
|
67
|
-
r /= 255, t /= 255, n /= 255;
|
|
68
|
-
let a = Math.max(r, t, n), b = Math.min(r, t, n), o = 0, y = 0, c = (a + b) / 2;
|
|
69
|
-
if (a !== b) {
|
|
70
|
-
let u = a - b;
|
|
71
|
-
if (y = c > 0 && c < 1 ? u / (1 - Math.abs(2 * c - 1)) : 0, a === r)
|
|
72
|
-
o = (t - n) / u + (t < n ? 6 : 0);
|
|
73
|
-
else if (a === t)
|
|
74
|
-
o = (n - r) / u + 2;
|
|
75
|
-
else
|
|
76
|
-
o = (r - t) / u + 4;
|
|
77
|
-
o /= 6;
|
|
78
|
-
}
|
|
79
|
-
return [Math.round(o * 360), Math.round(y * 100), Math.round(c * 100)];
|
|
80
|
-
}
|
|
81
|
-
function H(s, r, t) {
|
|
82
|
-
s = (s % 360 + 360) % 360, r /= 100, t /= 100;
|
|
83
|
-
let n = (a) => {
|
|
84
|
-
let b = (a + s / 60) % 6, o = t - t * r * Math.max(Math.min(b, 4 - b, 1), 0);
|
|
85
|
-
return Math.round(255 * o);
|
|
86
|
-
};
|
|
87
|
-
return [n(5), n(3), n(1)];
|
|
88
|
-
}
|
|
89
|
-
function f(s) {
|
|
90
|
-
let [r, t, n] = s;
|
|
91
|
-
r /= 255, t /= 255, n /= 255;
|
|
92
|
-
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;
|
|
93
|
-
if (o !== 0) {
|
|
94
|
-
if (a === r)
|
|
95
|
-
y = (t - n) / o + (t < n ? 6 : 0);
|
|
96
|
-
else if (a === t)
|
|
97
|
-
y = (n - r) / o + 2;
|
|
98
|
-
else
|
|
99
|
-
y = (r - t) / o + 4;
|
|
100
|
-
y /= 6;
|
|
101
|
-
}
|
|
102
|
-
return [Math.round(y * 360), Math.round(c * 100), Math.round(u * 100)];
|
|
103
|
-
}
|
|
104
|
-
function O(s) {
|
|
105
|
-
let r = s[0] / 255, t = s[1] / 255, n = s[2] / 255, a = 1 - Math.max(r, t, n);
|
|
106
|
-
if (a === 1)
|
|
107
|
-
return [0, 0, 0, 100];
|
|
108
|
-
let b = (1 - r - a) / (1 - a), o = (1 - t - a) / (1 - a), y = (1 - n - a) / (1 - a);
|
|
109
|
-
return [Math.round(b * 100), Math.round(o * 100), Math.round(y * 100), Math.round(a * 100)];
|
|
110
|
-
}
|
|
111
|
-
function v(s, r, t, n) {
|
|
112
|
-
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))];
|
|
113
|
-
}
|
|
114
|
-
var m = (s) => s <= 0.04045 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
|
115
|
-
var p = (s) => s <= 0.0031308 ? 12.92 * s : 1.055 * s ** 0.4166666666666667 - 0.055;
|
|
116
|
-
var i = (s, r) => Math.round(s * 10 ** r) / 10 ** r;
|
|
117
|
-
function T(s) {
|
|
118
|
-
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);
|
|
119
|
-
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)];
|
|
120
|
-
}
|
|
121
|
-
function M(s, r, t) {
|
|
122
|
-
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)));
|
|
123
|
-
return [u(o), u(y), u(c)];
|
|
124
|
-
}
|
|
125
|
-
function d(s) {
|
|
126
|
-
let [r, t, n] = T(s), a = Math.sqrt(t * t + n * n), b = (Math.atan2(n, t) * 180 / Math.PI + 360) % 360;
|
|
127
|
-
return [i(r, 4), i(a, 4), i(b, 2)];
|
|
128
|
-
}
|
|
129
|
-
function C(s, r, t) {
|
|
130
|
-
let n = t * Math.PI / 180;
|
|
131
|
-
return M(s, r * Math.cos(n), r * Math.sin(n));
|
|
132
|
-
}
|
|
133
|
-
function l(s) {
|
|
134
|
-
let r = s / 255;
|
|
135
|
-
return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
class e {
|
|
139
|
-
r;
|
|
140
|
-
g;
|
|
141
|
-
b;
|
|
142
|
-
a;
|
|
143
|
-
constructor(s, r, t, n = 1) {
|
|
144
|
-
this.r = s, this.g = r, this.b = t, this.a = n;
|
|
145
|
-
}
|
|
146
|
-
static from(s, r) {
|
|
147
|
-
if (s === "hex") {
|
|
148
|
-
let [t, n, a, b] = x(r);
|
|
149
|
-
return new e(t, n, a, b);
|
|
150
|
-
}
|
|
151
|
-
if (s === "rgb") {
|
|
152
|
-
if (Array.isArray(r)) {
|
|
153
|
-
let [o, y, c, u] = r;
|
|
154
|
-
return new e(o, y, c, u);
|
|
155
|
-
}
|
|
156
|
-
let { r: t, g: n, b: a, a: b } = r;
|
|
157
|
-
return new e(t, n, a, b);
|
|
158
|
-
}
|
|
159
|
-
if (s === "hsl") {
|
|
160
|
-
let t, n, a, b;
|
|
161
|
-
if (Array.isArray(r))
|
|
162
|
-
[t, n, a, b] = r;
|
|
163
|
-
else
|
|
164
|
-
({ h: t, s: n, l: a, a: b } = r);
|
|
165
|
-
let [o, y, c] = R(t, n, a);
|
|
166
|
-
return new e(o, y, c, b);
|
|
167
|
-
}
|
|
168
|
-
if (s === "hsv") {
|
|
169
|
-
let t, n, a, b;
|
|
170
|
-
if (Array.isArray(r))
|
|
171
|
-
[t, n, a, b] = r;
|
|
172
|
-
else
|
|
173
|
-
({ h: t, s: n, v: a, a: b } = r);
|
|
174
|
-
let [o, y, c] = H(t, n, a);
|
|
175
|
-
return new e(o, y, c, b);
|
|
176
|
-
}
|
|
177
|
-
if (s === "cmyk") {
|
|
178
|
-
let t, n, a, b, o;
|
|
179
|
-
if (Array.isArray(r))
|
|
180
|
-
[t, n, a, b, o] = r;
|
|
181
|
-
else
|
|
182
|
-
({ c: t, m: n, y: a, k: b, a: o } = r);
|
|
183
|
-
let [y, c, u] = v(t, n, a, b);
|
|
184
|
-
return new e(y, c, u, o);
|
|
185
|
-
}
|
|
186
|
-
if (s === "oklch") {
|
|
187
|
-
let t, n, a, b;
|
|
188
|
-
if (Array.isArray(r))
|
|
189
|
-
[t, n, a, b] = r;
|
|
190
|
-
else
|
|
191
|
-
({ l: t, c: n, h: a, a: b } = r);
|
|
192
|
-
let [o, y, c] = C(t, n, a);
|
|
193
|
-
return new e(o, y, c, b);
|
|
194
|
-
}
|
|
195
|
-
if (s === "oklab") {
|
|
196
|
-
let t, n, a, b;
|
|
197
|
-
if (Array.isArray(r))
|
|
198
|
-
[t, n, a, b] = r;
|
|
199
|
-
else
|
|
200
|
-
({ l: t, a: n, b: a, alpha: b } = r);
|
|
201
|
-
let [o, y, c] = M(t, n, a);
|
|
202
|
-
return new e(o, y, c, b);
|
|
203
|
-
}
|
|
204
|
-
throw Error("Invalid input");
|
|
205
|
-
}
|
|
206
|
-
to(s) {
|
|
207
|
-
switch (s) {
|
|
208
|
-
case "rgb":
|
|
209
|
-
return [this.r, this.g, this.b];
|
|
210
|
-
case "rgba":
|
|
211
|
-
return [this.r, this.g, this.b, this.a];
|
|
212
|
-
case "hex":
|
|
213
|
-
return A([this.r, this.g, this.b]);
|
|
214
|
-
case "hexa":
|
|
215
|
-
return A([this.r, this.g, this.b, this.a]);
|
|
216
|
-
case "hsl":
|
|
217
|
-
return k([this.r, this.g, this.b]);
|
|
218
|
-
case "hsla":
|
|
219
|
-
return [...k([this.r, this.g, this.b]), this.a];
|
|
220
|
-
case "hsv":
|
|
221
|
-
return f([this.r, this.g, this.b]);
|
|
222
|
-
case "hsva":
|
|
223
|
-
return [...f([this.r, this.g, this.b]), this.a];
|
|
224
|
-
case "cmyk":
|
|
225
|
-
return O([this.r, this.g, this.b]);
|
|
226
|
-
case "cmyka":
|
|
227
|
-
return [...O([this.r, this.g, this.b]), this.a];
|
|
228
|
-
case "oklch":
|
|
229
|
-
return d([this.r, this.g, this.b]);
|
|
230
|
-
case "oklcha":
|
|
231
|
-
return [...d([this.r, this.g, this.b]), this.a];
|
|
232
|
-
case "oklab":
|
|
233
|
-
return T([this.r, this.g, this.b]);
|
|
234
|
-
case "oklaba":
|
|
235
|
-
return [...T([this.r, this.g, this.b]), this.a];
|
|
236
|
-
default:
|
|
237
|
-
return [this.r, this.g, this.b];
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
getLuminance() {
|
|
241
|
-
let s = l(this.r), r = l(this.g), t = l(this.b);
|
|
242
|
-
return 0.2126 * s + 0.7152 * r + 0.0722 * t;
|
|
243
|
-
}
|
|
244
|
-
contrastRatio(s) {
|
|
245
|
-
let r = this.getLuminance(), t = s.getLuminance(), [n, a] = r >= t ? [r, t] : [t, r];
|
|
246
|
-
return (n + 0.05) / (a + 0.05);
|
|
247
|
-
}
|
|
248
|
-
bestContrastForeground() {
|
|
249
|
-
let s = new e(255, 255, 255, 1), r = new e(0, 0, 0, 1), t = this.contrastRatio(s), n = this.contrastRatio(r);
|
|
250
|
-
return t >= n ? s : r;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-y1msbssb.js
|
|
255
|
-
var r = 39;
|
|
256
|
-
var o = 49;
|
|
257
|
-
var f2 = "\x1B[";
|
|
258
|
-
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") => {
|
|
259
|
-
let [a, l, s] = e.from("hex", i).to("rgb");
|
|
260
|
-
return [`${n === "fg" ? 38 : 48};2;${a};${l};${s}`, n === "fg" ? r : o];
|
|
261
|
-
}, ansi256: (i, n = "fg") => [`${n === "fg" ? 38 : 48};5;${i}`, n === "fg" ? r : o] };
|
|
262
|
-
var b = new Set(["", "1", "2", "3", "true"]);
|
|
263
|
-
function h(i, n = globalThis.process?.env ?? {}) {
|
|
264
|
-
if (n.FORCE_COLOR !== undefined)
|
|
265
|
-
return b.has(n.FORCE_COLOR);
|
|
266
|
-
if (n.NO_COLOR !== undefined || n.NODE_DISABLE_COLORS !== undefined || n.TERM === "dumb")
|
|
75
|
+
if (e.length === 3 || e.length === 4)
|
|
76
|
+
return [Number.parseInt(e[0] + e[0], 16), Number.parseInt(e[1] + e[1], 16), Number.parseInt(e[2] + e[2], 16)];
|
|
77
|
+
if (e.length !== 6 && e.length !== 8)
|
|
78
|
+
throw Error(`Invalid hex color length: ${e.length}`);
|
|
79
|
+
return [Number.parseInt(e.slice(0, 2), 16), Number.parseInt(e.slice(2, 4), 16), Number.parseInt(e.slice(4, 6), 16)];
|
|
80
|
+
}
|
|
81
|
+
var B2 = { 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") => {
|
|
82
|
+
let [l, n, c] = b(r);
|
|
83
|
+
return [`${e === "fg" ? 38 : 48};2;${l};${n};${c}`, e === "fg" ? 39 : 49];
|
|
84
|
+
}, ansi256: (r, e = "fg") => [`${e === "fg" ? 38 : 48};5;${r}`, e === "fg" ? 39 : 49] };
|
|
85
|
+
var h = new Set(["", "1", "2", "3", "true"]);
|
|
86
|
+
function C(r, e = globalThis.process?.env ?? {}) {
|
|
87
|
+
if (e.FORCE_COLOR !== undefined)
|
|
88
|
+
return h.has(e.FORCE_COLOR);
|
|
89
|
+
if (e.NO_COLOR !== undefined || e.NODE_DISABLE_COLORS !== undefined || e.TERM === "dumb")
|
|
267
90
|
return false;
|
|
268
|
-
return
|
|
269
|
-
}
|
|
270
|
-
function
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
if (
|
|
284
|
-
return
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
91
|
+
return r?.isTTY === true;
|
|
92
|
+
}
|
|
93
|
+
function f2(r, e = []) {
|
|
94
|
+
let l = "", n = "";
|
|
95
|
+
for (let t = 0, i = e.length;t < i; t++)
|
|
96
|
+
l += `\x1B[${e[t][0]}m`, n = `\x1B[${e[t][1]}m${n}`;
|
|
97
|
+
let c = (t) => C(r.stream ?? globalThis.process?.stdout, r.env) ? l + t + n : t, g = new Map;
|
|
98
|
+
return new Proxy(c, { get(t, i) {
|
|
99
|
+
let a = B2[i];
|
|
100
|
+
if (Array.isArray(a)) {
|
|
101
|
+
let s = g.get(i);
|
|
102
|
+
if (s === undefined)
|
|
103
|
+
s = f2(r, [...e, a]), g.set(i, s);
|
|
104
|
+
return s;
|
|
105
|
+
}
|
|
106
|
+
if (typeof a === "function")
|
|
107
|
+
return (...s) => {
|
|
108
|
+
let y = `${i}:${s.join(",")}`, u = g.get(y);
|
|
109
|
+
if (u === undefined) {
|
|
110
|
+
if (g.size >= 64)
|
|
111
|
+
g.clear();
|
|
112
|
+
u = f2(r, [...e, a(...s)]), g.set(y, u);
|
|
113
|
+
}
|
|
114
|
+
return u;
|
|
115
|
+
};
|
|
116
|
+
throw Error(`Unknown style: ${String(i)}`);
|
|
288
117
|
} });
|
|
289
118
|
}
|
|
290
|
-
function
|
|
291
|
-
return
|
|
119
|
+
function Fe2(r = {}) {
|
|
120
|
+
return f2(r);
|
|
292
121
|
}
|
|
293
|
-
var
|
|
122
|
+
var o2 = Fe2();
|
|
294
123
|
|
|
295
124
|
// ../kit/src/theme.ts
|
|
296
125
|
import { existsSync as existsSync3, readFileSync, statSync } from "fs";
|
|
@@ -368,15 +197,15 @@ function gradientAt(theme, ratio) {
|
|
|
368
197
|
return fromOklab(from.map((start, index) => start + (to[index] - start) * at));
|
|
369
198
|
}
|
|
370
199
|
var DEFAULT = {
|
|
371
|
-
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" },
|
|
372
|
-
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D", open: "\u2022", leaf: "\xB7", guide: "\u2502" },
|
|
200
|
+
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" },
|
|
201
|
+
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" },
|
|
373
202
|
accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
|
|
374
203
|
bins: {},
|
|
375
204
|
gradient: ["#c084fc", "#67e8f9"]
|
|
376
205
|
};
|
|
377
|
-
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" };
|
|
378
|
-
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" };
|
|
379
|
-
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+", open: "*", leaf: "-", guide: "|" };
|
|
206
|
+
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" };
|
|
207
|
+
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" };
|
|
208
|
+
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", plan: "?", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+", open: "*", leaf: "-", guide: "|" };
|
|
380
209
|
var PRESETS = {
|
|
381
210
|
default: {},
|
|
382
211
|
"high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"], gradient: ["#d8b4fe", "#a5f3fc"] },
|
|
@@ -550,12 +379,12 @@ function activeTheme() {
|
|
|
550
379
|
}
|
|
551
380
|
|
|
552
381
|
// ../kit/src/style.ts
|
|
553
|
-
var MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:" };
|
|
382
|
+
var MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:", plan: "would:" };
|
|
554
383
|
function takesControlCodes(stream, env = process6.env) {
|
|
555
384
|
return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb" && outputMode(stream, env) === "terminal";
|
|
556
385
|
}
|
|
557
386
|
function paint(stream, env = process6.env) {
|
|
558
|
-
return
|
|
387
|
+
return Fe2({ stream: { isTTY: takesControlCodes(stream, env) }, env });
|
|
559
388
|
}
|
|
560
389
|
function marked(mark, text, stream, detail, env = process6.env) {
|
|
561
390
|
const colors = paint(stream, env);
|
|
@@ -625,7 +454,7 @@ function section(title, count, stream = process6.stdout, env = process6.env, ton
|
|
|
625
454
|
return tone === undefined ? paint(stream, env).dim(rule) : tinted(paint(stream, env), activeTheme().theme.colors[tone], env)(rule);
|
|
626
455
|
}
|
|
627
456
|
function hyperlink(text, url, stream, env = process6.env) {
|
|
628
|
-
return takesControlCodes(stream, env) ? link(text, url, stream, env) : text;
|
|
457
|
+
return takesControlCodes(stream, env) ? paint(stream, env).underline(link(text, url, stream, env)) : text;
|
|
629
458
|
}
|
|
630
459
|
|
|
631
460
|
// ../kit/src/format.ts
|
|
@@ -661,7 +490,7 @@ function formatAge(date, now = Date.now()) {
|
|
|
661
490
|
return seconds < 60 ? "just now" : `${upTo(formatSeconds(seconds), " ")} ago`;
|
|
662
491
|
}
|
|
663
492
|
function truncate(text, width) {
|
|
664
|
-
return text
|
|
493
|
+
return ko(text, width, { suffix: "\u2026", includeSuffix: true });
|
|
665
494
|
}
|
|
666
495
|
var LINE_BREAKS = /\s*\n\s*/g;
|
|
667
496
|
var ESCAPE = String.fromCharCode(27);
|
|
@@ -2609,7 +2438,7 @@ var BOARD_LIMIT = 30;
|
|
|
2609
2438
|
var boardOptions = {
|
|
2610
2439
|
labels: { type: "string", short: "L", description: "only issues with these labels, comma separated" },
|
|
2611
2440
|
milestone: { type: "string", short: "m", description: "only issues of this milestone, a title or an id" },
|
|
2612
|
-
query: { type: "string",
|
|
2441
|
+
query: { type: "string", description: "only issues whose title matches this, a case-insensitive regex such as dom|eager" },
|
|
2613
2442
|
state: { type: "string", description: "only issues in this state: available, taken or away (claimed, no live session here)" },
|
|
2614
2443
|
...limitOptions(BOARD_LIMIT),
|
|
2615
2444
|
json: jsonOption("number, title, labels, state, holder, since, session, boxesTotal, boxesLeft and note (author, at, body of the latest comment that is not a claim)"),
|
|
@@ -2643,7 +2472,7 @@ async function board(args) {
|
|
|
2643
2472
|
console.log(rows.length === 0 && (query !== undefined || state !== undefined) ? "no open issue matches" : renderBoard(rows, Date.now(), limit));
|
|
2644
2473
|
return 0;
|
|
2645
2474
|
}
|
|
2646
|
-
async function
|
|
2475
|
+
async function me2(as, sessions) {
|
|
2647
2476
|
if (as !== undefined)
|
|
2648
2477
|
return as;
|
|
2649
2478
|
const session = await currentSession(sessions);
|
|
@@ -2667,7 +2496,7 @@ var takeOptions = {
|
|
|
2667
2496
|
...repoOption
|
|
2668
2497
|
};
|
|
2669
2498
|
async function claimant(values, sessions) {
|
|
2670
|
-
const name = await
|
|
2499
|
+
const name = await me2(values.as, sessions);
|
|
2671
2500
|
if (values.lane !== true)
|
|
2672
2501
|
return () => name;
|
|
2673
2502
|
const suffix = laneSuffix(name);
|
|
@@ -2864,8 +2693,8 @@ function elapsed(run, seen) {
|
|
|
2864
2693
|
const seconds = Math.floor((Date.now() - (startedAt(run) ?? seen)) / 1000);
|
|
2865
2694
|
return seconds > 0 ? `for ${formatSeconds(seconds)}` : undefined;
|
|
2866
2695
|
}
|
|
2867
|
-
function runLine(run, out, seen = Date.now()) {
|
|
2868
|
-
return ciLine(run.status, run.workflow_id, [`run ${run.id}`, `on ${
|
|
2696
|
+
function runLine(run, out, seen = Date.now(), ref = run.prettyref) {
|
|
2697
|
+
return ciLine(run.status, run.workflow_id, [`run ${hyperlink(String(run.id), run.html_url, out)}`, `on ${ref}`, elapsed(run, seen)], out);
|
|
2869
2698
|
}
|
|
2870
2699
|
function startedAge(run, now = Date.now()) {
|
|
2871
2700
|
return startedAt(run) === undefined ? "-" : formatAge(run.started, now);
|
|
@@ -2965,8 +2794,9 @@ async function failedJobsOf(run, repo) {
|
|
|
2965
2794
|
}
|
|
2966
2795
|
return failed;
|
|
2967
2796
|
}
|
|
2968
|
-
function failureText(failed) {
|
|
2969
|
-
|
|
2797
|
+
function failureText(failed, out = process.stderr) {
|
|
2798
|
+
const problem = role("failed", out);
|
|
2799
|
+
return failed.map((job) => `${problem(`job ${job.name} of ${job.workflow} failed`)}:
|
|
2970
2800
|
${job.excerpt}`).join(`
|
|
2971
2801
|
|
|
2972
2802
|
`);
|
|
@@ -3014,7 +2844,7 @@ function commitsToAsk(commits, passedOver, max = MAX_LOOKUPS) {
|
|
|
3014
2844
|
function settled(latest) {
|
|
3015
2845
|
return latest !== undefined && latest.every((run) => FINISHED.has(run.status)) && judge(latest, false, false).kind === "runs" ? latest : undefined;
|
|
3016
2846
|
}
|
|
3017
|
-
async function
|
|
2847
|
+
async function ci3(args) {
|
|
3018
2848
|
const parsed = parse(args, usage2, options);
|
|
3019
2849
|
const { values, positionals } = parsed;
|
|
3020
2850
|
const branch = values.branch ?? await defaultBranch();
|
|
@@ -3051,6 +2881,7 @@ async function ci2(args) {
|
|
|
3051
2881
|
return;
|
|
3052
2882
|
}
|
|
3053
2883
|
const json = values.json === true;
|
|
2884
|
+
const live = takesControlCodes(process23.stderr) && takesControlCodes(process23.stdout) && !json && values.quiet !== true;
|
|
3054
2885
|
const runs = await waitForCi({
|
|
3055
2886
|
tool: "ft ci",
|
|
3056
2887
|
short,
|
|
@@ -3063,6 +2894,8 @@ async function ci2(args) {
|
|
|
3063
2894
|
finished: (found) => found.every((run) => FINISHED.has(run.status)),
|
|
3064
2895
|
key: (found) => found.map((run) => run.id).join(","),
|
|
3065
2896
|
announce: (found) => {
|
|
2897
|
+
if (live)
|
|
2898
|
+
return;
|
|
3066
2899
|
const say = json ? console.error : console.log;
|
|
3067
2900
|
for (const run of found)
|
|
3068
2901
|
say(`following ${run.workflow_id} run ${run.id} on ${run.commit_sha.slice(0, 7)}${run.commit_sha === sha ? "" : `, which covers ${short}`}: ${run.html_url}`);
|
|
@@ -3075,7 +2908,7 @@ async function ci2(args) {
|
|
|
3075
2908
|
},
|
|
3076
2909
|
lines: (spinner, found, started) => [
|
|
3077
2910
|
ciHeader(spinner, `CI on ${short}`, started, process23.stderr),
|
|
3078
|
-
...(found ?? []).map((run) => ` ${runLine(run, process23.stderr)}`)
|
|
2911
|
+
...(found ?? []).map((run) => ` ${runLine(run, process23.stderr, undefined, run.commit_sha.slice(0, 7))}`)
|
|
3079
2912
|
]
|
|
3080
2913
|
});
|
|
3081
2914
|
const status = overall(runs);
|
|
@@ -3090,7 +2923,13 @@ async function ci2(args) {
|
|
|
3090
2923
|
printJson(ciJson(runs, failed));
|
|
3091
2924
|
return status === "failure" ? 1 : 0;
|
|
3092
2925
|
}
|
|
2926
|
+
if (live) {
|
|
2927
|
+
for (const run of runs)
|
|
2928
|
+
console.log(runLine(run, process23.stdout, undefined, run.commit_sha.slice(0, 7)));
|
|
2929
|
+
}
|
|
3093
2930
|
if (status !== "failure") {
|
|
2931
|
+
if (live)
|
|
2932
|
+
return 0;
|
|
3094
2933
|
console.log(good(`CI ${status === "success" ? "passed" : "skipped its tests, a release tag's workflow testing them"} on ${short}`));
|
|
3095
2934
|
return 0;
|
|
3096
2935
|
}
|
|
@@ -3879,7 +3718,7 @@ ${closeUsage2}`);
|
|
|
3879
3718
|
}
|
|
3880
3719
|
const open = await openIssues(undefined, values.repo, found.id);
|
|
3881
3720
|
if (open.length > 0 && values.force !== true)
|
|
3882
|
-
fail(`milestone ${found.title} has ${open.length
|
|
3721
|
+
fail(`milestone ${found.title} has ${go(open.length, "open issue")}:
|
|
3883
3722
|
${open.map((issue) => ` #${issue.number} ${truncate(issue.title, TITLE_WIDTH3)}`).join(`
|
|
3884
3723
|
`)}`, 1, `${runHint(`ft milestone close ${found.title} --force`, "close it with them open")}, or move them with \`ft edit <n> -m <milestone>\``);
|
|
3885
3724
|
await closeMilestone(found.id, values.repo);
|
|
@@ -4026,7 +3865,7 @@ ${addUsage}`);
|
|
|
4026
3865
|
added = fresh.map(({ number, title }) => `- [ ] #${number} ${title}`);
|
|
4027
3866
|
return addLines(body, added, section);
|
|
4028
3867
|
}, repo);
|
|
4029
|
-
|
|
3868
|
+
report2(planNumber, added, titled.length - added.length);
|
|
4030
3869
|
return 0;
|
|
4031
3870
|
}
|
|
4032
3871
|
async function carry(args) {
|
|
@@ -4041,10 +3880,10 @@ async function carry(args) {
|
|
|
4041
3880
|
added = source.filter(({ issue }) => !known.has(issue)).map(({ line }) => line);
|
|
4042
3881
|
return addLines(body, added, section);
|
|
4043
3882
|
}, repo);
|
|
4044
|
-
|
|
3883
|
+
report2(to, added, source.length - added.length);
|
|
4045
3884
|
return 0;
|
|
4046
3885
|
}
|
|
4047
|
-
function
|
|
3886
|
+
function report2(plan, added, skipped) {
|
|
4048
3887
|
for (const line of added)
|
|
4049
3888
|
console.log(`#${plan}: ${line}`);
|
|
4050
3889
|
console.log(good(`#${plan}: ${added.length} added${skipped === 0 ? "" : `, ${skipped} already listed`}`));
|
|
@@ -4148,7 +3987,7 @@ ${run.html_url}`);
|
|
|
4148
3987
|
if (isPermanentFailure(error))
|
|
4149
3988
|
fail(message);
|
|
4150
3989
|
if (!quiet)
|
|
4151
|
-
|
|
3990
|
+
warn(`ft watch: ${message}, polling again`);
|
|
4152
3991
|
}
|
|
4153
3992
|
}
|
|
4154
3993
|
}
|
|
@@ -4399,7 +4238,7 @@ async function settleMilestone(version, tag, say = console.log) {
|
|
|
4399
4238
|
if (found === undefined)
|
|
4400
4239
|
return;
|
|
4401
4240
|
const [done, left] = await Promise.all([closedIssues(found.id), openIssues(undefined, undefined, found.id)]);
|
|
4402
|
-
say(`milestone ${found.title}: ${done.length
|
|
4241
|
+
say(`milestone ${found.title}: ${go(done.length, "closed issue")}${done.length === 0 ? "" : `
|
|
4403
4242
|
${done.map((issue) => ` #${issue.number} ${issue.title}`).join(`
|
|
4404
4243
|
`)}`}`);
|
|
4405
4244
|
if (left.length > 0)
|
|
@@ -4752,7 +4591,7 @@ process28.exitCode = await runCli({
|
|
|
4752
4591
|
examples: [["ft ci", "wait for the runs of origin's tip, failures printed"], ["ft issue 12 -c", "an issue with its boxes numbered and its comments"]],
|
|
4753
4592
|
commands: {
|
|
4754
4593
|
runs: { run: runs, summary: "recent runs with workflow, ref, duration and age", group: "CI and release" },
|
|
4755
|
-
ci: { run:
|
|
4594
|
+
ci: { run: ci3, summary: "wait for the runs covering a commit, printing what failed", group: "CI and release" },
|
|
4756
4595
|
watch: { run: watch2, summary: "wait for runs newer than an id, or those in progress", group: "CI and release" },
|
|
4757
4596
|
logs: { run: logs2, summary: "what the failed jobs of a run say went wrong", group: "CI and release" },
|
|
4758
4597
|
release: { run: release, summary: "bump, push branch and tag atomically, wait for runs and registry", group: "CI and release" },
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-forgejo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.28.0",
|
|
5
5
|
"description": "ft: Forgejo CI runs, logs, releases and issue checklists from the terminal, through tea.",
|
|
6
6
|
"author": "Kaynooo <contact@kaynooo.fr>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -27,7 +27,10 @@
|
|
|
27
27
|
"build": "$npm_execpath build src/cli.ts --target bun --outdir dist",
|
|
28
28
|
"ft": "$npm_execpath src/cli.ts"
|
|
29
29
|
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@kaynooo/utils": "3.0.0"
|
|
32
|
+
},
|
|
30
33
|
"devDependencies": {
|
|
31
|
-
"@kaynooo/cli-kit": "0.
|
|
34
|
+
"@kaynooo/cli-kit": "0.35.0"
|
|
32
35
|
}
|
|
33
36
|
}
|