@kaynooo/cli-forgejo 0.16.0 → 0.17.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/dist/cli.js +191 -100
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -2,16 +2,34 @@
|
|
|
2
2
|
// @bun
|
|
3
3
|
|
|
4
4
|
// src/cli.ts
|
|
5
|
-
import
|
|
5
|
+
import process24 from "process";
|
|
6
6
|
// ../kit/src/args.ts
|
|
7
|
-
import
|
|
7
|
+
import process10 from "process";
|
|
8
8
|
import { parseArgs } from "util";
|
|
9
9
|
|
|
10
10
|
// ../kit/src/format.ts
|
|
11
|
-
import
|
|
11
|
+
import process7 from "process";
|
|
12
|
+
|
|
13
|
+
// ../kit/src/mode.ts
|
|
14
|
+
import process2 from "process";
|
|
15
|
+
var MODES = new Set(["terminal", "ci", "agent", "pipe"]);
|
|
16
|
+
var AGENT_VARIABLES = ["CLAUDECODE", "AI_AGENT"];
|
|
17
|
+
function isSet(value) {
|
|
18
|
+
return value !== undefined && value !== "" && value !== "0" && value.toLowerCase() !== "false";
|
|
19
|
+
}
|
|
20
|
+
function outputMode(stream = process2.stdout, env = process2.env) {
|
|
21
|
+
const chosen = env.KIT_MODE;
|
|
22
|
+
if (chosen !== undefined && MODES.has(chosen))
|
|
23
|
+
return chosen;
|
|
24
|
+
if (AGENT_VARIABLES.some((name) => isSet(env[name])))
|
|
25
|
+
return "agent";
|
|
26
|
+
if (stream.isTTY === true)
|
|
27
|
+
return "terminal";
|
|
28
|
+
return isSet(env.CI) ? "ci" : "pipe";
|
|
29
|
+
}
|
|
12
30
|
|
|
13
31
|
// ../kit/src/style.ts
|
|
14
|
-
import
|
|
32
|
+
import process6 from "process";
|
|
15
33
|
|
|
16
34
|
// ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-mtetydvc.js
|
|
17
35
|
function x(s) {
|
|
@@ -278,13 +296,13 @@ var t = le();
|
|
|
278
296
|
import { existsSync as existsSync3, readFileSync, statSync } from "fs";
|
|
279
297
|
import { homedir as homedir2 } from "os";
|
|
280
298
|
import { join as join3, resolve as resolve2 } from "path";
|
|
281
|
-
import
|
|
299
|
+
import process5 from "process";
|
|
282
300
|
|
|
283
301
|
// ../kit/src/config.ts
|
|
284
302
|
import { existsSync } from "fs";
|
|
285
303
|
import { dirname, join, resolve } from "path";
|
|
286
|
-
import
|
|
287
|
-
function findUp(names, from =
|
|
304
|
+
import process3 from "process";
|
|
305
|
+
function findUp(names, from = process3.cwd(), stop = () => false) {
|
|
288
306
|
const wanted = typeof names === "string" ? [names] : names;
|
|
289
307
|
for (let dir = resolve(from);; dir = dirname(dir)) {
|
|
290
308
|
const found = wanted.map((name) => join(dir, name)).find((path) => existsSync(path));
|
|
@@ -299,9 +317,9 @@ function findUp(names, from = process2.cwd(), stop = () => false) {
|
|
|
299
317
|
import { existsSync as existsSync2 } from "fs";
|
|
300
318
|
import { homedir } from "os";
|
|
301
319
|
import { join as join2 } from "path";
|
|
302
|
-
import
|
|
320
|
+
import process4 from "process";
|
|
303
321
|
function configBase(where = {}) {
|
|
304
|
-
const xdg = where.xdg ?? (where.home === undefined ?
|
|
322
|
+
const xdg = where.xdg ?? (where.home === undefined ? process4.env.XDG_CONFIG_HOME : undefined);
|
|
305
323
|
return xdg !== undefined && xdg !== "" ? xdg : join2(where.home ?? homedir(), ".config");
|
|
306
324
|
}
|
|
307
325
|
function userConfigPath(bin, where = {}) {
|
|
@@ -341,10 +359,30 @@ function isColorSpec(spec) {
|
|
|
341
359
|
return Number.isInteger(spec) && spec >= 0 && spec <= 255;
|
|
342
360
|
return typeof spec === "string" && spec.trim() !== "" && spec.trim().split(SPACES).every((token) => STYLES.has(token) || HEX.test(token));
|
|
343
361
|
}
|
|
344
|
-
|
|
362
|
+
var CUBE = [0, 95, 135, 175, 215, 255];
|
|
363
|
+
function cubeLevel(channel) {
|
|
364
|
+
return CUBE.reduce((best, value, level) => Math.abs(value - channel) < Math.abs(CUBE[best] - channel) ? level : best, 0);
|
|
365
|
+
}
|
|
366
|
+
function nearest256(hex) {
|
|
367
|
+
const rgb = [1, 3, 5].map((at) => Number.parseInt(hex.slice(at, at + 2), 16));
|
|
368
|
+
const levels = rgb.map(cubeLevel);
|
|
369
|
+
const cube = levels.map((level) => CUBE[level]);
|
|
370
|
+
const grey = Math.min(23, Math.max(0, Math.round((rgb.reduce((sum, channel) => sum + channel, 0) / 3 - 8) / 10)));
|
|
371
|
+
const greyValue = 8 + grey * 10;
|
|
372
|
+
const distance = (colour) => colour.reduce((sum, channel, at) => sum + (channel - rgb[at]) ** 2, 0);
|
|
373
|
+
return distance([greyValue, greyValue, greyValue]) < distance(cube) ? 232 + grey : 16 + 36 * levels[0] + 6 * levels[1] + levels[2];
|
|
374
|
+
}
|
|
375
|
+
function hasTrueColor(env) {
|
|
376
|
+
return env.COLORTERM === "truecolor" || env.COLORTERM === "24bit";
|
|
377
|
+
}
|
|
378
|
+
function tinted(colors, spec, env = process5.env) {
|
|
345
379
|
if (typeof spec === "number")
|
|
346
380
|
return colors.ansi256(spec);
|
|
347
|
-
return spec.trim().split(SPACES).reduce((chain, token) =>
|
|
381
|
+
return spec.trim().split(SPACES).reduce((chain, token) => {
|
|
382
|
+
if (HEX.test(token))
|
|
383
|
+
return hasTrueColor(env) ? chain.hex(token) : chain.ansi256(nearest256(token));
|
|
384
|
+
return chain[token] ?? chain;
|
|
385
|
+
}, colors);
|
|
348
386
|
}
|
|
349
387
|
function isRecord(value) {
|
|
350
388
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -428,7 +466,7 @@ function warnOnce(message) {
|
|
|
428
466
|
function isPath(chosen) {
|
|
429
467
|
return chosen.includes("/") || chosen.endsWith(".json");
|
|
430
468
|
}
|
|
431
|
-
function loadTheme({ env =
|
|
469
|
+
function loadTheme({ env = process5.env, from = process5.cwd(), home = homedir2(), warn = warnOnce } = {}) {
|
|
432
470
|
const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null) };
|
|
433
471
|
const sources = [];
|
|
434
472
|
const chosen = env.KIT_THEME ?? "";
|
|
@@ -458,7 +496,7 @@ function loadTheme({ env = process4.env, from = process4.cwd(), home = homedir2(
|
|
|
458
496
|
var current;
|
|
459
497
|
var currentKey = "";
|
|
460
498
|
function activeTheme() {
|
|
461
|
-
const key = `${
|
|
499
|
+
const key = `${process5.cwd()}\x00${process5.env.KIT_THEME ?? ""}\x00${process5.env.XDG_CONFIG_HOME ?? ""}`;
|
|
462
500
|
if (current === undefined || key !== currentKey) {
|
|
463
501
|
current = loadTheme();
|
|
464
502
|
currentKey = key;
|
|
@@ -468,35 +506,35 @@ function activeTheme() {
|
|
|
468
506
|
|
|
469
507
|
// ../kit/src/style.ts
|
|
470
508
|
var MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:" };
|
|
471
|
-
function takesControlCodes(stream, env =
|
|
472
|
-
return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb";
|
|
509
|
+
function takesControlCodes(stream, env = process6.env) {
|
|
510
|
+
return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb" && outputMode(stream, env) === "terminal";
|
|
473
511
|
}
|
|
474
|
-
function paint(stream, env =
|
|
512
|
+
function paint(stream, env = process6.env) {
|
|
475
513
|
return le({ stream: { isTTY: takesControlCodes(stream, env) }, env });
|
|
476
514
|
}
|
|
477
|
-
function marked(mark, text, stream, detail, env =
|
|
515
|
+
function marked(mark, text, stream, detail, env = process6.env) {
|
|
478
516
|
const colors = paint(stream, env);
|
|
479
517
|
let head = MARK_WORDS[mark];
|
|
480
518
|
if (takesControlCodes(stream, env)) {
|
|
481
519
|
const { theme } = activeTheme();
|
|
482
|
-
head = tinted(colors.bold, theme.colors[mark])(theme.glyphs[mark]);
|
|
520
|
+
head = tinted(colors.bold, theme.colors[mark], env)(theme.glyphs[mark]);
|
|
483
521
|
}
|
|
484
522
|
return `${head} ${text}${detail === undefined ? "" : ` ${colors.dim(detail)}`}`;
|
|
485
523
|
}
|
|
486
524
|
function note(text, detail) {
|
|
487
|
-
console.log(marked("note", text,
|
|
525
|
+
console.log(marked("note", text, process6.stdout, detail));
|
|
488
526
|
}
|
|
489
527
|
function warn(text, detail) {
|
|
490
|
-
console.error(marked("warn", text,
|
|
528
|
+
console.error(marked("warn", text, process6.stderr, detail));
|
|
491
529
|
}
|
|
492
|
-
function role(name, stream, env =
|
|
530
|
+
function role(name, stream, env = process6.env) {
|
|
493
531
|
const colors = paint(stream, env);
|
|
494
|
-
return takesControlCodes(stream, env) ? tinted(colors, activeTheme().theme.colors[name]) : colors;
|
|
532
|
+
return takesControlCodes(stream, env) ? tinted(colors, activeTheme().theme.colors[name], env) : colors;
|
|
495
533
|
}
|
|
496
534
|
var STATUS_WORDS = {
|
|
497
535
|
passed: ["passed", "success", "succeeded", "ok"],
|
|
498
536
|
failed: ["failed", "failure", "error", "errored"],
|
|
499
|
-
running: ["running", "in_progress", "started"],
|
|
537
|
+
running: ["running", "in_progress", "started", "holding"],
|
|
500
538
|
queued: ["queued", "waiting", "pending", "created", "blocked", "scheduled"],
|
|
501
539
|
skipped: ["skipped", "cancelled", "canceled", "manual"]
|
|
502
540
|
};
|
|
@@ -504,12 +542,12 @@ var STATUS_OF = new Map(Object.entries(STATUS_WORDS).flatMap(([status, words]) =
|
|
|
504
542
|
function statusOf(word) {
|
|
505
543
|
return STATUS_OF.get(word.toLowerCase());
|
|
506
544
|
}
|
|
507
|
-
function badge(word, stream, env =
|
|
545
|
+
function badge(word, stream, env = process6.env) {
|
|
508
546
|
const status = statusOf(word);
|
|
509
547
|
if (status === undefined || !takesControlCodes(stream, env))
|
|
510
548
|
return word;
|
|
511
549
|
const { theme } = activeTheme();
|
|
512
|
-
return tinted(paint(stream, env), theme.colors[status])(`${theme.glyphs[status]} ${word}`);
|
|
550
|
+
return tinted(paint(stream, env), theme.colors[status], env)(`${theme.glyphs[status]} ${word}`);
|
|
513
551
|
}
|
|
514
552
|
|
|
515
553
|
// ../kit/src/format.ts
|
|
@@ -552,8 +590,11 @@ var ESCAPE = String.fromCharCode(27);
|
|
|
552
590
|
function textWidth(text) {
|
|
553
591
|
return Bun.stringWidth(text);
|
|
554
592
|
}
|
|
555
|
-
function table(rows, { cellWidth, header = false, align = [], fit, stream =
|
|
593
|
+
function table(rows, { cellWidth, header = false, align = [], fit, stream = process7.stdout, env = process7.env } = {}) {
|
|
556
594
|
const cells = cellWidth === undefined ? rows : rows.map((row) => row.map((cell) => truncate(cell.replaceAll(LINE_BREAKS, " "), cellWidth)));
|
|
595
|
+
if (outputMode(stream, env) === "agent")
|
|
596
|
+
return cells.map((row) => row.map((cell) => Bun.stripANSI(cell).replaceAll(/[\t\r\n]+/g, " ")).join("\t")).join(`
|
|
597
|
+
`);
|
|
557
598
|
const widths = [];
|
|
558
599
|
for (const row of cells) {
|
|
559
600
|
for (const [index, cell] of row.entries())
|
|
@@ -588,32 +629,35 @@ function narrow(rows, widths, limit) {
|
|
|
588
629
|
}
|
|
589
630
|
return rows.map((row) => row.map((cell, index) => textWidth(cell) > (widths[index] ?? 0) ? truncate(cell, widths[index] ?? 0) : cell));
|
|
590
631
|
}
|
|
632
|
+
function jsonText(value, replacer, { stream = process7.stdout, env = process7.env } = {}) {
|
|
633
|
+
return JSON.stringify(value, replacer, outputMode(stream, env) === "agent" ? undefined : 2);
|
|
634
|
+
}
|
|
591
635
|
function printJson(value) {
|
|
592
|
-
console.log(
|
|
636
|
+
console.log(jsonText(value));
|
|
593
637
|
}
|
|
594
638
|
|
|
595
639
|
// ../kit/src/help.ts
|
|
596
|
-
import
|
|
640
|
+
import process8 from "process";
|
|
597
641
|
var OPTIONAL = /\[[^\]]+\]/g;
|
|
598
642
|
var USAGE_PREFIX = /^usage:\s*/i;
|
|
599
643
|
var FULL_STOP = /\.$/;
|
|
600
|
-
function usageLine(usage, colors = paint(
|
|
644
|
+
function usageLine(usage, colors = paint(process8.stdout)) {
|
|
601
645
|
return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
|
|
602
646
|
}
|
|
603
|
-
function helpText(usage, options, colors = paint(
|
|
647
|
+
function helpText(usage, options, colors = paint(process8.stdout), { examples = [], replaces, exits = [] } = {}) {
|
|
604
648
|
return [usageLine(usage, colors), ...replacesRows(replaces, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
|
|
605
649
|
`);
|
|
606
650
|
}
|
|
607
|
-
function exitRows(exits, colors = paint(
|
|
651
|
+
function exitRows(exits, colors = paint(process8.stdout)) {
|
|
608
652
|
if (exits.length === 0)
|
|
609
653
|
return [];
|
|
610
654
|
const width = Math.max(...exits.map(([code]) => String(code).length));
|
|
611
655
|
return ["", colors.bold("Exits:"), ...exits.map(([code, meaning]) => ` ${colors.cyan(String(code).padEnd(width))} ${meaning}`)];
|
|
612
656
|
}
|
|
613
|
-
function replacesRows(replaces, colors = paint(
|
|
614
|
-
return replaces === undefined ? [] : ["", `${colors.bold("Instead of:")} ${replaces}`];
|
|
657
|
+
function replacesRows(replaces, colors = paint(process8.stdout)) {
|
|
658
|
+
return replaces === undefined || outputMode() === "agent" ? [] : ["", `${colors.bold("Instead of:")} ${replaces}`];
|
|
615
659
|
}
|
|
616
|
-
function wantsHelpJson(env =
|
|
660
|
+
function wantsHelpJson(env = process8.env) {
|
|
617
661
|
return env.KIT_HELP === "json";
|
|
618
662
|
}
|
|
619
663
|
function description(usage, { examples = [], replaces, exits } = {}, options) {
|
|
@@ -632,12 +676,12 @@ function description(usage, { examples = [], replaces, exits } = {}, options) {
|
|
|
632
676
|
...options === undefined ? {} : { options: Object.entries(options).map(([name, { short, description }]) => ({ name, ...short === undefined ? {} : { short }, ...description === undefined ? {} : { description } })) }
|
|
633
677
|
};
|
|
634
678
|
}
|
|
635
|
-
function exampleRows(examples, colors = paint(
|
|
636
|
-
if (examples.length === 0)
|
|
679
|
+
function exampleRows(examples, colors = paint(process8.stdout)) {
|
|
680
|
+
if (examples.length === 0 || outputMode() === "agent")
|
|
637
681
|
return [];
|
|
638
682
|
return ["", colors.bold("Examples:"), ...examples.map((example) => typeof example === "string" ? ` ${example}` : ` ${example[0]} ${colors.dim(`# ${example[1]}`)}`)];
|
|
639
683
|
}
|
|
640
|
-
function optionRows(options, colors = paint(
|
|
684
|
+
function optionRows(options, colors = paint(process8.stdout)) {
|
|
641
685
|
const rows = Object.entries(options).map(([name, option]) => {
|
|
642
686
|
const short = option.short === undefined ? " " : `${colors.cyan(`-${option.short}`)}, `;
|
|
643
687
|
const named = option.choices === undefined ? "<value>" : `<${option.choices.join("|")}>`;
|
|
@@ -669,7 +713,7 @@ function closest(name, names) {
|
|
|
669
713
|
return best !== undefined && best.far <= (name.length < 4 ? 1 : 2) ? best.known : undefined;
|
|
670
714
|
}
|
|
671
715
|
// ../kit/src/input.ts
|
|
672
|
-
import
|
|
716
|
+
import process9 from "process";
|
|
673
717
|
var WHOLE = /^\d+$/;
|
|
674
718
|
function wholeNumber(value, name, fallback, min = 1) {
|
|
675
719
|
if (value === undefined)
|
|
@@ -692,7 +736,7 @@ function duration(value, name, fallback, unit = "s") {
|
|
|
692
736
|
}
|
|
693
737
|
async function readInput(path, { noStdin = "nothing is piped on stdin" } = {}) {
|
|
694
738
|
if (path === "-") {
|
|
695
|
-
if (
|
|
739
|
+
if (process9.stdin.isTTY)
|
|
696
740
|
fail(noStdin);
|
|
697
741
|
return Bun.stdin.text();
|
|
698
742
|
}
|
|
@@ -751,7 +795,7 @@ var OUTPUT_OPTIONS = {
|
|
|
751
795
|
color: { type: "string", description: "auto (on a terminal alone), always or never" },
|
|
752
796
|
plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
|
|
753
797
|
};
|
|
754
|
-
function applyOutput(color, plain, env =
|
|
798
|
+
function applyOutput(color, plain, env = process10.env) {
|
|
755
799
|
const when = plain === true ? "never" : color ?? "auto";
|
|
756
800
|
if (when === "auto")
|
|
757
801
|
return;
|
|
@@ -921,11 +965,11 @@ function nearestOption(message, options, allowNegative) {
|
|
|
921
965
|
return meant === undefined ? undefined : `did you mean ${known.find((flag) => flag.replace(DASHES, "") === meant)}?`;
|
|
922
966
|
}
|
|
923
967
|
// ../kit/src/progress.ts
|
|
924
|
-
import
|
|
968
|
+
import process12 from "process";
|
|
925
969
|
|
|
926
970
|
// ../kit/src/process.ts
|
|
927
971
|
import { constants } from "os";
|
|
928
|
-
import
|
|
972
|
+
import process11 from "process";
|
|
929
973
|
var KILL_GRACE_MS = 2000;
|
|
930
974
|
var SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
931
975
|
function exitCodeOf(code, signal) {
|
|
@@ -947,7 +991,7 @@ function holdSignals(cleanup) {
|
|
|
947
991
|
},
|
|
948
992
|
release: () => {
|
|
949
993
|
for (const signal of SIGNALS)
|
|
950
|
-
|
|
994
|
+
process11.off(signal, onSignal);
|
|
951
995
|
}
|
|
952
996
|
};
|
|
953
997
|
function onSignal(signal) {
|
|
@@ -960,10 +1004,10 @@ function holdSignals(cleanup) {
|
|
|
960
1004
|
return;
|
|
961
1005
|
held.release();
|
|
962
1006
|
cleanup(signal);
|
|
963
|
-
|
|
1007
|
+
process11.kill(process11.pid, signal);
|
|
964
1008
|
}
|
|
965
1009
|
for (const signal of SIGNALS)
|
|
966
|
-
|
|
1010
|
+
process11.on(signal, onSignal);
|
|
967
1011
|
return held;
|
|
968
1012
|
}
|
|
969
1013
|
async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal, maxBytes = Infinity, onChunk, onStart } = {}) {
|
|
@@ -977,7 +1021,7 @@ async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal,
|
|
|
977
1021
|
return;
|
|
978
1022
|
try {
|
|
979
1023
|
if (grouped)
|
|
980
|
-
|
|
1024
|
+
process11.kill(-proc.pid, killing);
|
|
981
1025
|
else
|
|
982
1026
|
proc.kill(killing);
|
|
983
1027
|
} catch {}
|
|
@@ -1056,7 +1100,7 @@ var RESET_STYLE = `${ESC}[0m`;
|
|
|
1056
1100
|
var CTRL_C = 3;
|
|
1057
1101
|
var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
|
|
1058
1102
|
var CONSOLE_METHODS = ["log", "info", "warn", "error", "debug", "dir", "dirxml", "table", "trace", "group", "groupCollapsed", "count", "timeEnd", "timeLog", "assert"];
|
|
1059
|
-
function liveRegion(render, stream =
|
|
1103
|
+
function liveRegion(render, stream = process12.stderr, env = process12.env) {
|
|
1060
1104
|
if (!takesControlCodes(stream, env))
|
|
1061
1105
|
return { redraw: () => {
|
|
1062
1106
|
return;
|
|
@@ -1097,11 +1141,11 @@ function liveRegion(render, stream = process11.stderr, env = process11.env) {
|
|
|
1097
1141
|
clear();
|
|
1098
1142
|
restore();
|
|
1099
1143
|
release();
|
|
1100
|
-
|
|
1144
|
+
process12.off("exit", onExit);
|
|
1101
1145
|
signals.release();
|
|
1102
1146
|
}
|
|
1103
1147
|
timer.unref();
|
|
1104
|
-
|
|
1148
|
+
process12.on("exit", onExit);
|
|
1105
1149
|
return {
|
|
1106
1150
|
redraw: draw,
|
|
1107
1151
|
print: (text) => {
|
|
@@ -1140,14 +1184,14 @@ function cutToWidth(line, width) {
|
|
|
1140
1184
|
return `${kept}${RESET_STYLE}${linked ? CLOSE_LINK : ""}`;
|
|
1141
1185
|
}
|
|
1142
1186
|
function swallowInput() {
|
|
1143
|
-
const input =
|
|
1187
|
+
const input = process12.stdin;
|
|
1144
1188
|
if (!input.isTTY)
|
|
1145
1189
|
return () => {
|
|
1146
1190
|
return;
|
|
1147
1191
|
};
|
|
1148
1192
|
const onData = (data) => {
|
|
1149
1193
|
if (data.includes(CTRL_C))
|
|
1150
|
-
|
|
1194
|
+
process12.kill(process12.pid, "SIGINT");
|
|
1151
1195
|
};
|
|
1152
1196
|
input.setRawMode(true);
|
|
1153
1197
|
input.on("data", onData);
|
|
@@ -1163,7 +1207,7 @@ function swallowInput() {
|
|
|
1163
1207
|
};
|
|
1164
1208
|
}
|
|
1165
1209
|
function interceptOutput(clear) {
|
|
1166
|
-
const targets = [...CONSOLE_METHODS.map((name) => [console, name]), [
|
|
1210
|
+
const targets = [...CONSOLE_METHODS.map((name) => [console, name]), [process12.stdout, "write"], [process12.stderr, "write"]];
|
|
1167
1211
|
const wrapped = targets.map(([target, name]) => {
|
|
1168
1212
|
const original = Reflect.get(target, name);
|
|
1169
1213
|
const wrapper = (...args) => {
|
|
@@ -1182,11 +1226,11 @@ function interceptOutput(clear) {
|
|
|
1182
1226
|
}
|
|
1183
1227
|
|
|
1184
1228
|
// ../kit/src/tool.ts
|
|
1185
|
-
import
|
|
1229
|
+
import process13 from "process";
|
|
1186
1230
|
var PERMANENT = /\bHTTP (?:401|403|404)\b|unauthorized|forbidden|not found|couldn't be found|token is required/i;
|
|
1187
1231
|
function cwdGone() {
|
|
1188
1232
|
try {
|
|
1189
|
-
|
|
1233
|
+
process13.cwd();
|
|
1190
1234
|
return false;
|
|
1191
1235
|
} catch {
|
|
1192
1236
|
return true;
|
|
@@ -1213,7 +1257,7 @@ function isPermanentFailure(error) {
|
|
|
1213
1257
|
async function runTool(label, argv, { timeoutMs, cwd, onStart } = {}) {
|
|
1214
1258
|
let ran;
|
|
1215
1259
|
try {
|
|
1216
|
-
ran = await runCommand(argv, { env:
|
|
1260
|
+
ran = await runCommand(argv, { env: process13.env, ...timeoutMs === undefined ? {} : { timeoutMs }, ...cwd === undefined ? {} : { cwd }, ...onStart === undefined ? {} : { onStart } });
|
|
1217
1261
|
} catch (error) {
|
|
1218
1262
|
throw spawnFailure(label, error);
|
|
1219
1263
|
}
|
|
@@ -1300,13 +1344,13 @@ async function waitForCi(wait) {
|
|
|
1300
1344
|
// ../kit/src/cli.ts
|
|
1301
1345
|
import { readFileSync as readFileSync2, realpathSync } from "fs";
|
|
1302
1346
|
import { dirname as dirname3, join as join5 } from "path";
|
|
1303
|
-
import
|
|
1347
|
+
import process15 from "process";
|
|
1304
1348
|
|
|
1305
1349
|
// ../kit/src/usage.ts
|
|
1306
1350
|
import { appendFileSync, mkdirSync } from "fs";
|
|
1307
1351
|
import { homedir as homedir3 } from "os";
|
|
1308
1352
|
import { dirname as dirname2, isAbsolute, join as join4 } from "path";
|
|
1309
|
-
import
|
|
1353
|
+
import process14 from "process";
|
|
1310
1354
|
|
|
1311
1355
|
// ../kit/src/logs.ts
|
|
1312
1356
|
var DAY_MS = 24 * 60 * 60 * 1000;
|
|
@@ -1320,14 +1364,14 @@ var usageError;
|
|
|
1320
1364
|
function noteUsageError(message) {
|
|
1321
1365
|
usageError = message;
|
|
1322
1366
|
}
|
|
1323
|
-
function stateHome(env =
|
|
1367
|
+
function stateHome(env = process14.env) {
|
|
1324
1368
|
const dir = env.XDG_STATE_HOME;
|
|
1325
1369
|
return dir !== undefined && isAbsolute(dir) ? dir : join4(homedir3(), ".local", "state");
|
|
1326
1370
|
}
|
|
1327
|
-
function usagePath(env =
|
|
1371
|
+
function usagePath(env = process14.env) {
|
|
1328
1372
|
return join4(stateHome(env), CLI_FOLDER, "usage.jsonl");
|
|
1329
1373
|
}
|
|
1330
|
-
function usageRecorded(env =
|
|
1374
|
+
function usageRecorded(env = process14.env) {
|
|
1331
1375
|
const off = env.KAYNOOO_CLI_NO_USAGE;
|
|
1332
1376
|
return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
|
|
1333
1377
|
}
|
|
@@ -1341,7 +1385,7 @@ function usageEntry(bin, command, argv, code, now = new Date) {
|
|
|
1341
1385
|
usageError = undefined;
|
|
1342
1386
|
return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
|
|
1343
1387
|
}
|
|
1344
|
-
function recordUsage(entry, env =
|
|
1388
|
+
function recordUsage(entry, env = process14.env) {
|
|
1345
1389
|
if (!usageRecorded(env))
|
|
1346
1390
|
return;
|
|
1347
1391
|
try {
|
|
@@ -1432,8 +1476,8 @@ async function help2({ path, header, summary: lazySummary, commands, defaultComm
|
|
|
1432
1476
|
`);
|
|
1433
1477
|
}
|
|
1434
1478
|
function printError(prefix, message, hint, cause) {
|
|
1435
|
-
const colors = paint(
|
|
1436
|
-
const styled = takesControlCodes(
|
|
1479
|
+
const colors = paint(process15.stderr);
|
|
1480
|
+
const styled = takesControlCodes(process15.stderr);
|
|
1437
1481
|
const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
|
|
1438
1482
|
const under = (label, text, tint) => text === undefined ? "" : `
|
|
1439
1483
|
${styled ? tint(label) : `${label}:`} ${text}`;
|
|
@@ -1443,8 +1487,8 @@ function runHint(command, effect) {
|
|
|
1443
1487
|
return `run \`${command}\`${effect === undefined ? "" : ` to ${effect}`}`;
|
|
1444
1488
|
}
|
|
1445
1489
|
function printHint(hint) {
|
|
1446
|
-
const colors = paint(
|
|
1447
|
-
console.error(` ${takesControlCodes(
|
|
1490
|
+
const colors = paint(process15.stderr);
|
|
1491
|
+
console.error(` ${takesControlCodes(process15.stderr) ? colors.yellow("hint") : "hint:"} ${hint}`);
|
|
1448
1492
|
}
|
|
1449
1493
|
function printJsonError(message, hint, cause) {
|
|
1450
1494
|
console.error(JSON.stringify({ error: message, ...hint === undefined ? {} : { hint }, ...cause === undefined ? {} : { cause } }));
|
|
@@ -1483,11 +1527,11 @@ async function dispatch(level, typed, { version, redact }) {
|
|
|
1483
1527
|
}
|
|
1484
1528
|
}
|
|
1485
1529
|
if (name === undefined && level.path.length > 1) {
|
|
1486
|
-
console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]),
|
|
1530
|
+
console.error(await help2(await expand(level, [...level.path.slice(1), ...argv]), process15.stderr));
|
|
1487
1531
|
return 2;
|
|
1488
1532
|
}
|
|
1489
1533
|
if (name === undefined || name === "help" || name === "--help" || name === "-h") {
|
|
1490
|
-
console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]),
|
|
1534
|
+
console.log(await help2(await expand(level, [...level.path.slice(1), ...argv]), process15.stdout));
|
|
1491
1535
|
return 0;
|
|
1492
1536
|
}
|
|
1493
1537
|
if (level.path.length === 1 && (name === "--version" || name === "-v")) {
|
|
@@ -1614,7 +1658,7 @@ function packageVersion(entry = Bun.main) {
|
|
|
1614
1658
|
return "0.0.0";
|
|
1615
1659
|
}
|
|
1616
1660
|
}
|
|
1617
|
-
async function runCli(cli, argv =
|
|
1661
|
+
async function runCli(cli, argv = process15.argv.slice(2)) {
|
|
1618
1662
|
const version = cli.version ?? packageVersion();
|
|
1619
1663
|
if (argv[0] === COMPLETE)
|
|
1620
1664
|
return printCandidates(candidates(scopeOf(cli.commands, cli.extraCommands, cli.aliases), cli.defaultCommand, argv.slice(1)));
|
|
@@ -1643,7 +1687,7 @@ function commandPath(scope, argv) {
|
|
|
1643
1687
|
}
|
|
1644
1688
|
// ../kit/src/git.ts
|
|
1645
1689
|
import { basename, dirname as dirname4 } from "path";
|
|
1646
|
-
import
|
|
1690
|
+
import process16 from "process";
|
|
1647
1691
|
var ORIGIN_PREFIX = /^origin\//;
|
|
1648
1692
|
var GIT_NETWORK_MS = 60000;
|
|
1649
1693
|
async function git(args, timeoutMs) {
|
|
@@ -1673,7 +1717,7 @@ async function defaultBranch() {
|
|
|
1673
1717
|
async function leaveWorktree() {
|
|
1674
1718
|
const common = await git(["rev-parse", "--path-format=absolute", "--git-common-dir"]);
|
|
1675
1719
|
if (basename(common) === ".git")
|
|
1676
|
-
|
|
1720
|
+
process16.chdir(dirname4(common));
|
|
1677
1721
|
}
|
|
1678
1722
|
// ../kit/src/limit.ts
|
|
1679
1723
|
function limitOptions(fallback) {
|
|
@@ -1696,20 +1740,33 @@ function capped(rows, limit) {
|
|
|
1696
1740
|
const more = rows.length - limit;
|
|
1697
1741
|
return more > 0 ? { shown: rows.slice(0, limit), footer: moreFooter(more) } : { shown: [...rows], footer: undefined };
|
|
1698
1742
|
}
|
|
1743
|
+
// ../kit/src/pool.ts
|
|
1744
|
+
async function pool(items, limit, task) {
|
|
1745
|
+
const results = Array.from({ length: items.length });
|
|
1746
|
+
let next = 0;
|
|
1747
|
+
async function worker() {
|
|
1748
|
+
while (next < items.length) {
|
|
1749
|
+
const index = next++;
|
|
1750
|
+
results[index] = await task(items[index]);
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));
|
|
1754
|
+
return results;
|
|
1755
|
+
}
|
|
1699
1756
|
// ../kit/src/secrets.ts
|
|
1700
1757
|
var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "session", "jwt", "ssn", "iban", "card", "cvv", "otp"]);
|
|
1701
1758
|
// ../kit/src/sessions.ts
|
|
1702
1759
|
import { homedir as homedir4 } from "os";
|
|
1703
1760
|
import { join as join6 } from "path";
|
|
1704
|
-
import
|
|
1761
|
+
import process17 from "process";
|
|
1705
1762
|
var {Glob } = globalThis.Bun;
|
|
1706
1763
|
var SESSION_FILES = new Glob("*.json");
|
|
1707
1764
|
var ACCOUNT_DIRS = new Glob("*/sessions");
|
|
1708
1765
|
async function sessionDirs() {
|
|
1709
1766
|
const home = homedir4();
|
|
1710
1767
|
const dirs = new Set([join6(home, ".claude", "sessions")]);
|
|
1711
|
-
if (
|
|
1712
|
-
dirs.add(join6(
|
|
1768
|
+
if (process17.env.CLAUDE_CONFIG_DIR !== undefined)
|
|
1769
|
+
dirs.add(join6(process17.env.CLAUDE_CONFIG_DIR, "sessions"));
|
|
1713
1770
|
try {
|
|
1714
1771
|
for await (const dir of ACCOUNT_DIRS.scan({ cwd: join6(home, ".claude-accounts"), onlyFiles: false, absolute: true }))
|
|
1715
1772
|
dirs.add(dir);
|
|
@@ -1755,7 +1812,7 @@ async function liveSessions() {
|
|
|
1755
1812
|
}
|
|
1756
1813
|
async function currentSession(sessions) {
|
|
1757
1814
|
const byPid = new Map(sessions.map((session) => [session.pid, session]));
|
|
1758
|
-
let pid =
|
|
1815
|
+
let pid = process17.ppid;
|
|
1759
1816
|
for (let depth = 0;depth < 32 && pid > 1; depth++) {
|
|
1760
1817
|
const session = byPid.get(pid);
|
|
1761
1818
|
if (session !== undefined)
|
|
@@ -1937,7 +1994,7 @@ function holderSession(holder, sessions) {
|
|
|
1937
1994
|
// src/forge.ts
|
|
1938
1995
|
import { homedir as homedir5 } from "os";
|
|
1939
1996
|
import { join as join7 } from "path";
|
|
1940
|
-
import
|
|
1997
|
+
import process19 from "process";
|
|
1941
1998
|
|
|
1942
1999
|
// src/remote.ts
|
|
1943
2000
|
var SCP_LIKE = /^(?:([^@/]+)@)?([^:/]+):(?!\/)(.+?)(?:\.git)?\/?$/;
|
|
@@ -1992,7 +2049,7 @@ function loginHosts(config) {
|
|
|
1992
2049
|
return hosts;
|
|
1993
2050
|
}
|
|
1994
2051
|
function teaConfigPath() {
|
|
1995
|
-
const base =
|
|
2052
|
+
const base = process19.env.XDG_CONFIG_HOME;
|
|
1996
2053
|
return join7(base !== undefined && base !== "" ? base : join7(homedir5(), ".config"), "tea", "config.yml");
|
|
1997
2054
|
}
|
|
1998
2055
|
async function readConfig() {
|
|
@@ -2111,14 +2168,9 @@ async function commentsOf(number, repo) {
|
|
|
2111
2168
|
return repoApi(`issues/${number}/comments`, repo);
|
|
2112
2169
|
}
|
|
2113
2170
|
async function commentsOfAll(issues, repo) {
|
|
2114
|
-
const
|
|
2115
|
-
const
|
|
2116
|
-
|
|
2117
|
-
for (let issue = queue.shift();issue !== undefined; issue = queue.shift())
|
|
2118
|
-
result.set(issue.number, await commentsOf(issue.number, repo));
|
|
2119
|
-
}
|
|
2120
|
-
await Promise.all(Array.from({ length: CONCURRENCY }, worker));
|
|
2121
|
-
return result;
|
|
2171
|
+
const commented = issues.filter((issue) => issue.comments > 0);
|
|
2172
|
+
const comments = await pool(commented, CONCURRENCY, async (issue) => commentsOf(issue.number, repo));
|
|
2173
|
+
return new Map(commented.map((issue, index) => [issue.number, comments[index]]));
|
|
2122
2174
|
}
|
|
2123
2175
|
async function editIssue(number, change, repo) {
|
|
2124
2176
|
const args = [String(number)];
|
|
@@ -2459,34 +2511,73 @@ async function take(args) {
|
|
|
2459
2511
|
console.log(`took #${number} as ${name}: ${found.title}`);
|
|
2460
2512
|
});
|
|
2461
2513
|
}
|
|
2462
|
-
var dropUsage = `ft drop <n>...
|
|
2514
|
+
var dropUsage = `ft drop <n>... [--stale] | --all-stale [--dry-run]
|
|
2463
2515
|
|
|
2464
2516
|
Gives each issue back with a "Released by session <name>." comment, when this session holds it.
|
|
2517
|
+
With --stale, a claim no session here answers to is released too, in the name of its holder, followed by a comment saying this session released it as stale; a claim a live session holds is still refused. --all-stale does that for every such claim on the board, and with --dry-run only lists them.
|
|
2465
2518
|
|
|
2466
|
-
Exits 0 when every issue is given back, 1 when one is not held by this session, 2 on a usage error.`;
|
|
2519
|
+
Exits 0 when every issue is given back, 1 when one is not held by this session or, with --stale, by a live one, 2 on a usage error.`;
|
|
2467
2520
|
var dropOptions = {
|
|
2468
2521
|
as: { type: "string", description: "the name it was taken as, instead of this session's" },
|
|
2522
|
+
stale: { type: "boolean", description: "also release a claim no live session here answers to" },
|
|
2523
|
+
"all-stale": { type: "boolean", description: "release every stale claim of the board, none needing a number" },
|
|
2524
|
+
"dry-run": { type: "boolean", description: "with --all-stale, list the claims without releasing them" },
|
|
2469
2525
|
...laneOption,
|
|
2470
2526
|
...repoOption
|
|
2471
2527
|
};
|
|
2528
|
+
async function releaseStale(number, me, author, sessions, repo) {
|
|
2529
|
+
const claim = latestClaim(await commentsOf(number, repo), author);
|
|
2530
|
+
if (claim === undefined)
|
|
2531
|
+
fail(`#${number} is not taken`, 1);
|
|
2532
|
+
const current = standing(claim, sessions);
|
|
2533
|
+
if (current.state === "taken")
|
|
2534
|
+
fail(`#${number} is taken by ${claim.holder}, which still runs (${current.session.status})`, 1);
|
|
2535
|
+
await comment(number, releasedComment(claim.holder), repo);
|
|
2536
|
+
await comment(number, `Claim of ${claim.holder} from ${formatAge(claim.at)}, which no live session answered to, released as stale by session ${me}.`, repo);
|
|
2537
|
+
console.log(`released #${number}, held by ${claim.holder}`);
|
|
2538
|
+
}
|
|
2472
2539
|
async function drop(args) {
|
|
2473
2540
|
const parsed = parse(args, dropUsage, dropOptions);
|
|
2474
2541
|
const { values, positionals } = parsed;
|
|
2475
|
-
const
|
|
2476
|
-
const nameFor = await claimant(values,
|
|
2542
|
+
const sessions = await liveSessions();
|
|
2543
|
+
const nameFor = await claimant(values, sessions);
|
|
2477
2544
|
const author = await sessionAuthor();
|
|
2545
|
+
if (values["dry-run"] === true && values["all-stale"] !== true)
|
|
2546
|
+
badUsage("--dry-run goes with --all-stale, which is the one that lists before releasing");
|
|
2547
|
+
if (values["all-stale"] === true) {
|
|
2548
|
+
if (positionals.length > 0)
|
|
2549
|
+
badUsage("--all-stale takes no issue number");
|
|
2550
|
+
const rows = await boardRows(await openIssues(undefined, values.repo), sessions, values.repo);
|
|
2551
|
+
const stale = rows.flatMap(({ issue, standing: now }) => now.state === "away" ? [{ issue, holder: now.claim.holder }] : []);
|
|
2552
|
+
if (stale.length === 0) {
|
|
2553
|
+
console.log("no stale claim");
|
|
2554
|
+
return 0;
|
|
2555
|
+
}
|
|
2556
|
+
for (const { issue, holder } of stale)
|
|
2557
|
+
console.log(`${values["dry-run"] === true ? "would release" : "releasing"} #${issue.number} held by ${holder}: ${issue.title}`);
|
|
2558
|
+
if (values["dry-run"] === true)
|
|
2559
|
+
return 0;
|
|
2560
|
+
return eachIssue("drop", stale.map(({ issue }) => issue.number), async (number) => {
|
|
2561
|
+
await releaseStale(number, nameFor(number), author, sessions, values.repo);
|
|
2562
|
+
});
|
|
2563
|
+
}
|
|
2564
|
+
const numbers = issueNumbers(positionals, dropUsage);
|
|
2478
2565
|
return eachIssue("drop", numbers, async (number) => {
|
|
2479
2566
|
const name = nameFor(number);
|
|
2480
2567
|
const claim = latestClaim(await commentsOf(number, values.repo), author);
|
|
2568
|
+
if (claim !== undefined && claim.holder !== name && values.stale === true) {
|
|
2569
|
+
await releaseStale(number, name, author, sessions, values.repo);
|
|
2570
|
+
return;
|
|
2571
|
+
}
|
|
2481
2572
|
if (claim?.holder !== name)
|
|
2482
|
-
fail(`#${number} is ${claim === undefined ? "not taken" : `taken by ${claim.holder}, not ${name}`}`, 1);
|
|
2573
|
+
fail(`#${number} is ${claim === undefined ? "not taken" : `taken by ${claim.holder}, not ${name}`}`, 1, claim === undefined ? undefined : runHint(`ft drop ${number} --stale`, "release it if no session answers to it"));
|
|
2483
2574
|
await comment(number, releasedComment(name), values.repo);
|
|
2484
2575
|
console.log(`released #${number}`);
|
|
2485
2576
|
});
|
|
2486
2577
|
}
|
|
2487
2578
|
|
|
2488
2579
|
// src/commands/ci.ts
|
|
2489
|
-
import
|
|
2580
|
+
import process20 from "process";
|
|
2490
2581
|
|
|
2491
2582
|
// src/git.ts
|
|
2492
2583
|
async function tagsAt(commit) {
|
|
@@ -2742,7 +2833,7 @@ async function ci2(args) {
|
|
|
2742
2833
|
return;
|
|
2743
2834
|
}
|
|
2744
2835
|
const json = values.json === true;
|
|
2745
|
-
const { dim } = paint(
|
|
2836
|
+
const { dim } = paint(process20.stderr);
|
|
2746
2837
|
const runs = await waitForCi({
|
|
2747
2838
|
tool: "ft ci",
|
|
2748
2839
|
short,
|
|
@@ -2767,7 +2858,7 @@ async function ci2(args) {
|
|
|
2767
2858
|
},
|
|
2768
2859
|
lines: (spinner, found, started) => [
|
|
2769
2860
|
`${spinner} CI on ${short} ${dim(formatElapsed(Date.now() - started))}`,
|
|
2770
|
-
...(found ?? []).map((run) => ` ${badge(run.status,
|
|
2861
|
+
...(found ?? []).map((run) => ` ${badge(run.status, process20.stderr)} ${run.workflow_id} ${dim(`run ${run.id}`)}`)
|
|
2771
2862
|
]
|
|
2772
2863
|
});
|
|
2773
2864
|
const status = overall(runs);
|
|
@@ -2797,7 +2888,7 @@ run ${run.id} failed${run.commit_sha === sha ? "" : `, testing every commit from
|
|
|
2797
2888
|
}
|
|
2798
2889
|
|
|
2799
2890
|
// src/commands/digest.ts
|
|
2800
|
-
import
|
|
2891
|
+
import process21 from "process";
|
|
2801
2892
|
var RUNS_SCANNED = 50;
|
|
2802
2893
|
var TITLE_WIDTH2 = 70;
|
|
2803
2894
|
var SHOWN = 8;
|
|
@@ -2847,7 +2938,7 @@ async function quietly(read) {
|
|
|
2847
2938
|
}
|
|
2848
2939
|
}
|
|
2849
2940
|
async function staleTodos() {
|
|
2850
|
-
const bin = Bun.which("todo-scan", { PATH:
|
|
2941
|
+
const bin = Bun.which("todo-scan", { PATH: process21.env.PATH ?? "" });
|
|
2851
2942
|
if (bin === null)
|
|
2852
2943
|
return [];
|
|
2853
2944
|
let found;
|
|
@@ -3691,7 +3782,7 @@ function report(plan, added, skipped) {
|
|
|
3691
3782
|
|
|
3692
3783
|
// src/commands/release.ts
|
|
3693
3784
|
import { basename as basename3, join as join11 } from "path";
|
|
3694
|
-
import
|
|
3785
|
+
import process23 from "process";
|
|
3695
3786
|
var {$: $2 } = globalThis.Bun;
|
|
3696
3787
|
|
|
3697
3788
|
// src/commands/watch.ts
|
|
@@ -3935,12 +4026,12 @@ async function publishable() {
|
|
|
3935
4026
|
|
|
3936
4027
|
// src/commands/release-plan.ts
|
|
3937
4028
|
import { basename as basename2, join as join9, relative } from "path";
|
|
3938
|
-
import
|
|
4029
|
+
import process22 from "process";
|
|
3939
4030
|
async function printPlan({ level, dir, prefix, branch, base, timeout, registry }) {
|
|
3940
4031
|
const file = Bun.file(join9(dir ?? ".", "package.json"));
|
|
3941
4032
|
const pkg = await file.exists() ? await file.json() : undefined;
|
|
3942
|
-
const name = pkg?.name ?? basename2(dir ??
|
|
3943
|
-
const where = dir === undefined ? "" : ` in ${relative(
|
|
4033
|
+
const name = pkg?.name ?? basename2(dir ?? process22.cwd());
|
|
4034
|
+
const where = dir === undefined ? "" : ` in ${relative(process22.cwd(), dir) || "."}`;
|
|
3944
4035
|
const sha = base.slice(0, 7);
|
|
3945
4036
|
let version;
|
|
3946
4037
|
let bump;
|
|
@@ -4199,7 +4290,7 @@ ${push.stderr.trim()}`, signal === undefined ? 1 : exitCodeOf(null, signal));
|
|
|
4199
4290
|
if (late !== undefined)
|
|
4200
4291
|
fail(`interrupted by ${late} after ${tag} was pushed: its runs are not waited for`, exitCodeOf(null, late));
|
|
4201
4292
|
say(`pushed ${branch} and ${tag}, waiting for their runs`);
|
|
4202
|
-
followed = await followRuns((runs) => runs.filter((run) => run.id > before && run.commit_sha === head), timeout, undefined, NO_RUN2, json ?
|
|
4293
|
+
followed = await followRuns((runs) => runs.filter((run) => run.id > before && run.commit_sha === head), timeout, undefined, NO_RUN2, json ? process23.stderr : process23.stdout, { json });
|
|
4203
4294
|
if (followed.code !== 0) {
|
|
4204
4295
|
outcome(false);
|
|
4205
4296
|
return followed.code;
|
|
@@ -4394,7 +4485,7 @@ async function runs(args) {
|
|
|
4394
4485
|
}
|
|
4395
4486
|
|
|
4396
4487
|
// src/cli.ts
|
|
4397
|
-
|
|
4488
|
+
process24.exitCode = await runCli({
|
|
4398
4489
|
name: "ft",
|
|
4399
4490
|
about: "Forgejo tools over tea, run from a repository whose origin is on Forgejo",
|
|
4400
4491
|
replaces: "tea api calls piped through jq, and sleep loops waiting on CI",
|
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.17.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",
|
|
@@ -28,6 +28,6 @@
|
|
|
28
28
|
"ft": "$npm_execpath src/cli.ts"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@kaynooo/cli-kit": "0.
|
|
31
|
+
"@kaynooo/cli-kit": "0.22.0"
|
|
32
32
|
}
|
|
33
33
|
}
|