@kaynooo/cli-forgejo 0.15.2 → 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 +432 -162
- 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
12
|
|
|
13
|
-
// ../kit/src/
|
|
13
|
+
// ../kit/src/mode.ts
|
|
14
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
|
+
}
|
|
30
|
+
|
|
31
|
+
// ../kit/src/style.ts
|
|
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) {
|
|
@@ -274,48 +292,262 @@ function le(i = {}) {
|
|
|
274
292
|
}
|
|
275
293
|
var t = le();
|
|
276
294
|
|
|
277
|
-
// ../kit/src/
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
295
|
+
// ../kit/src/theme.ts
|
|
296
|
+
import { existsSync as existsSync3, readFileSync, statSync } from "fs";
|
|
297
|
+
import { homedir as homedir2 } from "os";
|
|
298
|
+
import { join as join3, resolve as resolve2 } from "path";
|
|
299
|
+
import process5 from "process";
|
|
300
|
+
|
|
301
|
+
// ../kit/src/config.ts
|
|
302
|
+
import { existsSync } from "fs";
|
|
303
|
+
import { dirname, join, resolve } from "path";
|
|
304
|
+
import process3 from "process";
|
|
305
|
+
function findUp(names, from = process3.cwd(), stop = () => false) {
|
|
306
|
+
const wanted = typeof names === "string" ? [names] : names;
|
|
307
|
+
for (let dir = resolve(from);; dir = dirname(dir)) {
|
|
308
|
+
const found = wanted.map((name) => join(dir, name)).find((path) => existsSync(path));
|
|
309
|
+
if (found !== undefined)
|
|
310
|
+
return found;
|
|
311
|
+
if (stop(dir) || dirname(dir) === dir)
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// ../kit/src/user-config.ts
|
|
317
|
+
import { existsSync as existsSync2 } from "fs";
|
|
318
|
+
import { homedir } from "os";
|
|
319
|
+
import { join as join2 } from "path";
|
|
320
|
+
import process4 from "process";
|
|
321
|
+
function configBase(where = {}) {
|
|
322
|
+
const xdg = where.xdg ?? (where.home === undefined ? process4.env.XDG_CONFIG_HOME : undefined);
|
|
323
|
+
return xdg !== undefined && xdg !== "" ? xdg : join2(where.home ?? homedir(), ".config");
|
|
324
|
+
}
|
|
325
|
+
function userConfigPath(bin, where = {}) {
|
|
326
|
+
return join2(configBase(where), "kaynooo-cli", `${bin}.json`);
|
|
327
|
+
}
|
|
328
|
+
function userConfigReadPath(bin, legacy = [], where = {}) {
|
|
329
|
+
const current = userConfigPath(bin, where);
|
|
330
|
+
if (existsSync2(current))
|
|
331
|
+
return current;
|
|
332
|
+
const base = configBase(where);
|
|
333
|
+
return legacy.map((parts) => join2(base, ...parts)).find((path) => existsSync2(path)) ?? current;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// ../kit/src/theme.ts
|
|
337
|
+
var DEFAULT = {
|
|
338
|
+
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" },
|
|
339
|
+
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501" },
|
|
340
|
+
accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
|
|
341
|
+
bins: {}
|
|
342
|
+
};
|
|
343
|
+
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" };
|
|
344
|
+
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" };
|
|
345
|
+
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#" };
|
|
346
|
+
var PRESETS = {
|
|
347
|
+
default: {},
|
|
348
|
+
"high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"] },
|
|
349
|
+
mono: { colors: MONO, accents: ["bold"] },
|
|
350
|
+
ascii: { glyphs: ASCII }
|
|
283
351
|
};
|
|
284
|
-
|
|
285
|
-
|
|
352
|
+
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"]);
|
|
353
|
+
var HEX = /^#[0-9a-f]{6}$/i;
|
|
354
|
+
var CONTROL = /\p{Cc}/u;
|
|
355
|
+
var MAX_FILE_BYTES = 64 * 1024;
|
|
356
|
+
var SPACES = /\s+/;
|
|
357
|
+
function isColorSpec(spec) {
|
|
358
|
+
if (typeof spec === "number")
|
|
359
|
+
return Number.isInteger(spec) && spec >= 0 && spec <= 255;
|
|
360
|
+
return typeof spec === "string" && spec.trim() !== "" && spec.trim().split(SPACES).every((token) => STYLES.has(token) || HEX.test(token));
|
|
361
|
+
}
|
|
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) {
|
|
379
|
+
if (typeof spec === "number")
|
|
380
|
+
return colors.ansi256(spec);
|
|
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);
|
|
386
|
+
}
|
|
387
|
+
function isRecord(value) {
|
|
388
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
389
|
+
}
|
|
390
|
+
function readThemeFile(path, warn) {
|
|
391
|
+
try {
|
|
392
|
+
const stat = statSync(path, { throwIfNoEntry: false });
|
|
393
|
+
if (stat === undefined)
|
|
394
|
+
return;
|
|
395
|
+
if (!stat.isFile() || stat.size > MAX_FILE_BYTES) {
|
|
396
|
+
warn(`${path} is not a regular file under ${MAX_FILE_BYTES / 1024} KiB, theme ignored`);
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
400
|
+
if (isRecord(parsed))
|
|
401
|
+
return parsed;
|
|
402
|
+
warn(`${path} is not a JSON object, theme ignored`);
|
|
403
|
+
} catch (error) {
|
|
404
|
+
warn(`${path} does not parse (${error instanceof Error ? error.message : String(error)}), theme ignored`);
|
|
405
|
+
}
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
function applyPreset(theme, name, warn, where) {
|
|
409
|
+
if (name === undefined)
|
|
410
|
+
return;
|
|
411
|
+
if (typeof name !== "string" || !Object.hasOwn(PRESETS, name)) {
|
|
412
|
+
warn(`${where}: no preset ${String(name)}, one of ${Object.keys(PRESETS).join(", ")}`);
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
const preset = PRESETS[name];
|
|
416
|
+
Object.assign(theme.colors, preset.colors);
|
|
417
|
+
Object.assign(theme.glyphs, preset.glyphs);
|
|
418
|
+
if (preset.accents !== undefined)
|
|
419
|
+
theme.accents = [...preset.accents];
|
|
420
|
+
return name;
|
|
421
|
+
}
|
|
422
|
+
function applyFile(theme, file, where, warn) {
|
|
423
|
+
if (isRecord(file.colors)) {
|
|
424
|
+
for (const [key, value] of Object.entries(file.colors)) {
|
|
425
|
+
if (!Object.hasOwn(DEFAULT.colors, key))
|
|
426
|
+
warn(`${where}: no colour ${key}, one of ${Object.keys(DEFAULT.colors).join(", ")}`);
|
|
427
|
+
else if (!isColorSpec(value))
|
|
428
|
+
warn(`${where}: colour ${key} is not an ANSI name, \`#rrggbb\` or a number up to 255`);
|
|
429
|
+
else
|
|
430
|
+
theme.colors[key] = value;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
if (isRecord(file.glyphs)) {
|
|
434
|
+
for (const [key, value] of Object.entries(file.glyphs)) {
|
|
435
|
+
if (!Object.hasOwn(DEFAULT.glyphs, key))
|
|
436
|
+
warn(`${where}: no glyph ${key}, one of ${Object.keys(DEFAULT.glyphs).join(", ")}`);
|
|
437
|
+
else if (typeof value !== "string" || CONTROL.test(value) || Bun.stringWidth(value) !== 1)
|
|
438
|
+
warn(`${where}: glyph ${key} must be one visible character wide, with no control character`);
|
|
439
|
+
else
|
|
440
|
+
theme.glyphs[key] = value;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
if (Array.isArray(file.accents) && file.accents.length > 0 && file.accents.every(isColorSpec))
|
|
444
|
+
theme.accents = [...file.accents];
|
|
445
|
+
else if (file.accents !== undefined)
|
|
446
|
+
warn(`${where}: accents must be a non-empty list of colours`);
|
|
447
|
+
if (isRecord(file.bins)) {
|
|
448
|
+
for (const [bin, value] of Object.entries(file.bins)) {
|
|
449
|
+
if (isColorSpec(value))
|
|
450
|
+
theme.bins[bin] = value;
|
|
451
|
+
else
|
|
452
|
+
warn(`${where}: bin ${bin} has no valid colour`);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
function endsWalk(home) {
|
|
457
|
+
return (dir) => dir === resolve2(home) || existsSync3(join3(dir, ".git"));
|
|
458
|
+
}
|
|
459
|
+
var warned = new Set;
|
|
460
|
+
function warnOnce(message) {
|
|
461
|
+
if (warned.has(message))
|
|
462
|
+
return;
|
|
463
|
+
warned.add(message);
|
|
464
|
+
console.error(`warning: theme ${message}`);
|
|
465
|
+
}
|
|
466
|
+
function isPath(chosen) {
|
|
467
|
+
return chosen.includes("/") || chosen.endsWith(".json");
|
|
468
|
+
}
|
|
469
|
+
function loadTheme({ env = process5.env, from = process5.cwd(), home = homedir2(), warn = warnOnce } = {}) {
|
|
470
|
+
const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null) };
|
|
471
|
+
const sources = [];
|
|
472
|
+
const chosen = env.KIT_THEME ?? "";
|
|
473
|
+
const wanted = chosen === "" ? [userConfigPath("theme", { home, xdg: env.XDG_CONFIG_HOME }), findUp(join3(".kaynooo", "theme.json"), from, endsWalk(home))] : [];
|
|
474
|
+
if (isPath(chosen))
|
|
475
|
+
wanted.push(resolve2(from, chosen));
|
|
476
|
+
const files = [];
|
|
477
|
+
for (const path of wanted) {
|
|
478
|
+
const file = path === undefined ? undefined : readThemeFile(path, warn);
|
|
479
|
+
if (path !== undefined && file !== undefined)
|
|
480
|
+
files.push({ path, file });
|
|
481
|
+
}
|
|
482
|
+
let preset = "default";
|
|
483
|
+
if (chosen !== "" && !isPath(chosen)) {
|
|
484
|
+
preset = applyPreset(theme, chosen, warn, "KIT_THEME") ?? preset;
|
|
485
|
+
} else {
|
|
486
|
+
const named = files.findLast(({ file }) => file.preset !== undefined);
|
|
487
|
+
if (named !== undefined)
|
|
488
|
+
preset = applyPreset(theme, named.file.preset, warn, named.path) ?? preset;
|
|
489
|
+
}
|
|
490
|
+
for (const { path, file } of files) {
|
|
491
|
+
applyFile(theme, file, path, warn);
|
|
492
|
+
sources.push(path);
|
|
493
|
+
}
|
|
494
|
+
return { theme, sources, preset };
|
|
286
495
|
}
|
|
287
|
-
|
|
496
|
+
var current;
|
|
497
|
+
var currentKey = "";
|
|
498
|
+
function activeTheme() {
|
|
499
|
+
const key = `${process5.cwd()}\x00${process5.env.KIT_THEME ?? ""}\x00${process5.env.XDG_CONFIG_HOME ?? ""}`;
|
|
500
|
+
if (current === undefined || key !== currentKey) {
|
|
501
|
+
current = loadTheme();
|
|
502
|
+
currentKey = key;
|
|
503
|
+
}
|
|
504
|
+
return current;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// ../kit/src/style.ts
|
|
508
|
+
var MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:" };
|
|
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";
|
|
511
|
+
}
|
|
512
|
+
function paint(stream, env = process6.env) {
|
|
288
513
|
return le({ stream: { isTTY: takesControlCodes(stream, env) }, env });
|
|
289
514
|
}
|
|
290
|
-
function marked(mark, text, stream, detail, env =
|
|
515
|
+
function marked(mark, text, stream, detail, env = process6.env) {
|
|
291
516
|
const colors = paint(stream, env);
|
|
292
|
-
|
|
293
|
-
|
|
517
|
+
let head = MARK_WORDS[mark];
|
|
518
|
+
if (takesControlCodes(stream, env)) {
|
|
519
|
+
const { theme } = activeTheme();
|
|
520
|
+
head = tinted(colors.bold, theme.colors[mark], env)(theme.glyphs[mark]);
|
|
521
|
+
}
|
|
294
522
|
return `${head} ${text}${detail === undefined ? "" : ` ${colors.dim(detail)}`}`;
|
|
295
523
|
}
|
|
296
524
|
function note(text, detail) {
|
|
297
|
-
console.log(marked("note", text,
|
|
525
|
+
console.log(marked("note", text, process6.stdout, detail));
|
|
298
526
|
}
|
|
299
527
|
function warn(text, detail) {
|
|
300
|
-
console.error(marked("warn", text,
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
528
|
+
console.error(marked("warn", text, process6.stderr, detail));
|
|
529
|
+
}
|
|
530
|
+
function role(name, stream, env = process6.env) {
|
|
531
|
+
const colors = paint(stream, env);
|
|
532
|
+
return takesControlCodes(stream, env) ? tinted(colors, activeTheme().theme.colors[name], env) : colors;
|
|
533
|
+
}
|
|
534
|
+
var STATUS_WORDS = {
|
|
535
|
+
passed: ["passed", "success", "succeeded", "ok"],
|
|
536
|
+
failed: ["failed", "failure", "error", "errored"],
|
|
537
|
+
running: ["running", "in_progress", "started", "holding"],
|
|
538
|
+
queued: ["queued", "waiting", "pending", "created", "blocked", "scheduled"],
|
|
539
|
+
skipped: ["skipped", "cancelled", "canceled", "manual"]
|
|
308
540
|
};
|
|
309
|
-
var STATUS_OF = new Map(Object.entries(
|
|
541
|
+
var STATUS_OF = new Map(Object.entries(STATUS_WORDS).flatMap(([status, words]) => words.map((word) => [word, status])));
|
|
310
542
|
function statusOf(word) {
|
|
311
543
|
return STATUS_OF.get(word.toLowerCase());
|
|
312
544
|
}
|
|
313
|
-
function badge(word, stream, env =
|
|
545
|
+
function badge(word, stream, env = process6.env) {
|
|
314
546
|
const status = statusOf(word);
|
|
315
547
|
if (status === undefined || !takesControlCodes(stream, env))
|
|
316
548
|
return word;
|
|
317
|
-
const {
|
|
318
|
-
return
|
|
549
|
+
const { theme } = activeTheme();
|
|
550
|
+
return tinted(paint(stream, env), theme.colors[status], env)(`${theme.glyphs[status]} ${word}`);
|
|
319
551
|
}
|
|
320
552
|
|
|
321
553
|
// ../kit/src/format.ts
|
|
@@ -358,15 +590,18 @@ var ESCAPE = String.fromCharCode(27);
|
|
|
358
590
|
function textWidth(text) {
|
|
359
591
|
return Bun.stringWidth(text);
|
|
360
592
|
}
|
|
361
|
-
function table(rows, { cellWidth, header = false, align = [], fit } = {}) {
|
|
593
|
+
function table(rows, { cellWidth, header = false, align = [], fit, stream = process7.stdout, env = process7.env } = {}) {
|
|
362
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
|
+
`);
|
|
363
598
|
const widths = [];
|
|
364
599
|
for (const row of cells) {
|
|
365
600
|
for (const [index, cell] of row.entries())
|
|
366
601
|
widths[index] = Math.max(widths[index] ?? 0, textWidth(cell));
|
|
367
602
|
}
|
|
368
603
|
const shown = fit === undefined ? cells : narrow(cells, widths, fit);
|
|
369
|
-
const colors = paint(
|
|
604
|
+
const colors = paint(stream);
|
|
370
605
|
const lines = shown.map((row) => row.map((cell, index) => {
|
|
371
606
|
const width = widths[index] ?? 0;
|
|
372
607
|
const gap = " ".repeat(Math.max(0, width - textWidth(cell)));
|
|
@@ -374,7 +609,8 @@ function table(rows, { cellWidth, header = false, align = [], fit } = {}) {
|
|
|
374
609
|
return `${gap}${cell}`;
|
|
375
610
|
return index === row.length - 1 ? cell : `${cell}${gap}`;
|
|
376
611
|
}).join(" ").trimEnd());
|
|
377
|
-
|
|
612
|
+
const rule = header && takesControlCodes(stream) && lines.length > 1 ? [colors.dim("\u2500".repeat(Math.max(...lines.map(textWidth))))] : [];
|
|
613
|
+
return lines.flatMap((line, index) => header && index === 0 ? [colors.bold(line), ...rule] : [line]).join(`
|
|
378
614
|
`);
|
|
379
615
|
}
|
|
380
616
|
function narrow(rows, widths, limit) {
|
|
@@ -393,32 +629,35 @@ function narrow(rows, widths, limit) {
|
|
|
393
629
|
}
|
|
394
630
|
return rows.map((row) => row.map((cell, index) => textWidth(cell) > (widths[index] ?? 0) ? truncate(cell, widths[index] ?? 0) : cell));
|
|
395
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
|
+
}
|
|
396
635
|
function printJson(value) {
|
|
397
|
-
console.log(
|
|
636
|
+
console.log(jsonText(value));
|
|
398
637
|
}
|
|
399
638
|
|
|
400
639
|
// ../kit/src/help.ts
|
|
401
|
-
import
|
|
640
|
+
import process8 from "process";
|
|
402
641
|
var OPTIONAL = /\[[^\]]+\]/g;
|
|
403
642
|
var USAGE_PREFIX = /^usage:\s*/i;
|
|
404
643
|
var FULL_STOP = /\.$/;
|
|
405
|
-
function usageLine(usage, colors = paint(
|
|
644
|
+
function usageLine(usage, colors = paint(process8.stdout)) {
|
|
406
645
|
return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
|
|
407
646
|
}
|
|
408
|
-
function helpText(usage, options, colors = paint(
|
|
647
|
+
function helpText(usage, options, colors = paint(process8.stdout), { examples = [], replaces, exits = [] } = {}) {
|
|
409
648
|
return [usageLine(usage, colors), ...replacesRows(replaces, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
|
|
410
649
|
`);
|
|
411
650
|
}
|
|
412
|
-
function exitRows(exits, colors = paint(
|
|
651
|
+
function exitRows(exits, colors = paint(process8.stdout)) {
|
|
413
652
|
if (exits.length === 0)
|
|
414
653
|
return [];
|
|
415
654
|
const width = Math.max(...exits.map(([code]) => String(code).length));
|
|
416
655
|
return ["", colors.bold("Exits:"), ...exits.map(([code, meaning]) => ` ${colors.cyan(String(code).padEnd(width))} ${meaning}`)];
|
|
417
656
|
}
|
|
418
|
-
function replacesRows(replaces, colors = paint(
|
|
419
|
-
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}`];
|
|
420
659
|
}
|
|
421
|
-
function wantsHelpJson(env =
|
|
660
|
+
function wantsHelpJson(env = process8.env) {
|
|
422
661
|
return env.KIT_HELP === "json";
|
|
423
662
|
}
|
|
424
663
|
function description(usage, { examples = [], replaces, exits } = {}, options) {
|
|
@@ -437,12 +676,12 @@ function description(usage, { examples = [], replaces, exits } = {}, options) {
|
|
|
437
676
|
...options === undefined ? {} : { options: Object.entries(options).map(([name, { short, description }]) => ({ name, ...short === undefined ? {} : { short }, ...description === undefined ? {} : { description } })) }
|
|
438
677
|
};
|
|
439
678
|
}
|
|
440
|
-
function exampleRows(examples, colors = paint(
|
|
441
|
-
if (examples.length === 0)
|
|
679
|
+
function exampleRows(examples, colors = paint(process8.stdout)) {
|
|
680
|
+
if (examples.length === 0 || outputMode() === "agent")
|
|
442
681
|
return [];
|
|
443
682
|
return ["", colors.bold("Examples:"), ...examples.map((example) => typeof example === "string" ? ` ${example}` : ` ${example[0]} ${colors.dim(`# ${example[1]}`)}`)];
|
|
444
683
|
}
|
|
445
|
-
function optionRows(options, colors = paint(
|
|
684
|
+
function optionRows(options, colors = paint(process8.stdout)) {
|
|
446
685
|
const rows = Object.entries(options).map(([name, option]) => {
|
|
447
686
|
const short = option.short === undefined ? " " : `${colors.cyan(`-${option.short}`)}, `;
|
|
448
687
|
const named = option.choices === undefined ? "<value>" : `<${option.choices.join("|")}>`;
|
|
@@ -474,7 +713,7 @@ function closest(name, names) {
|
|
|
474
713
|
return best !== undefined && best.far <= (name.length < 4 ? 1 : 2) ? best.known : undefined;
|
|
475
714
|
}
|
|
476
715
|
// ../kit/src/input.ts
|
|
477
|
-
import
|
|
716
|
+
import process9 from "process";
|
|
478
717
|
var WHOLE = /^\d+$/;
|
|
479
718
|
function wholeNumber(value, name, fallback, min = 1) {
|
|
480
719
|
if (value === undefined)
|
|
@@ -497,7 +736,7 @@ function duration(value, name, fallback, unit = "s") {
|
|
|
497
736
|
}
|
|
498
737
|
async function readInput(path, { noStdin = "nothing is piped on stdin" } = {}) {
|
|
499
738
|
if (path === "-") {
|
|
500
|
-
if (
|
|
739
|
+
if (process9.stdin.isTTY)
|
|
501
740
|
fail(noStdin);
|
|
502
741
|
return Bun.stdin.text();
|
|
503
742
|
}
|
|
@@ -556,7 +795,7 @@ var OUTPUT_OPTIONS = {
|
|
|
556
795
|
color: { type: "string", description: "auto (on a terminal alone), always or never" },
|
|
557
796
|
plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
|
|
558
797
|
};
|
|
559
|
-
function applyOutput(color, plain, env =
|
|
798
|
+
function applyOutput(color, plain, env = process10.env) {
|
|
560
799
|
const when = plain === true ? "never" : color ?? "auto";
|
|
561
800
|
if (when === "auto")
|
|
562
801
|
return;
|
|
@@ -726,11 +965,11 @@ function nearestOption(message, options, allowNegative) {
|
|
|
726
965
|
return meant === undefined ? undefined : `did you mean ${known.find((flag) => flag.replace(DASHES, "") === meant)}?`;
|
|
727
966
|
}
|
|
728
967
|
// ../kit/src/progress.ts
|
|
729
|
-
import
|
|
968
|
+
import process12 from "process";
|
|
730
969
|
|
|
731
970
|
// ../kit/src/process.ts
|
|
732
971
|
import { constants } from "os";
|
|
733
|
-
import
|
|
972
|
+
import process11 from "process";
|
|
734
973
|
var KILL_GRACE_MS = 2000;
|
|
735
974
|
var SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
736
975
|
function exitCodeOf(code, signal) {
|
|
@@ -752,7 +991,7 @@ function holdSignals(cleanup) {
|
|
|
752
991
|
},
|
|
753
992
|
release: () => {
|
|
754
993
|
for (const signal of SIGNALS)
|
|
755
|
-
|
|
994
|
+
process11.off(signal, onSignal);
|
|
756
995
|
}
|
|
757
996
|
};
|
|
758
997
|
function onSignal(signal) {
|
|
@@ -765,10 +1004,10 @@ function holdSignals(cleanup) {
|
|
|
765
1004
|
return;
|
|
766
1005
|
held.release();
|
|
767
1006
|
cleanup(signal);
|
|
768
|
-
|
|
1007
|
+
process11.kill(process11.pid, signal);
|
|
769
1008
|
}
|
|
770
1009
|
for (const signal of SIGNALS)
|
|
771
|
-
|
|
1010
|
+
process11.on(signal, onSignal);
|
|
772
1011
|
return held;
|
|
773
1012
|
}
|
|
774
1013
|
async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal, maxBytes = Infinity, onChunk, onStart } = {}) {
|
|
@@ -782,7 +1021,7 @@ async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal,
|
|
|
782
1021
|
return;
|
|
783
1022
|
try {
|
|
784
1023
|
if (grouped)
|
|
785
|
-
|
|
1024
|
+
process11.kill(-proc.pid, killing);
|
|
786
1025
|
else
|
|
787
1026
|
proc.kill(killing);
|
|
788
1027
|
} catch {}
|
|
@@ -861,7 +1100,7 @@ var RESET_STYLE = `${ESC}[0m`;
|
|
|
861
1100
|
var CTRL_C = 3;
|
|
862
1101
|
var CLOSE_LINK = `${ESC}]8;;${ESC}\\`;
|
|
863
1102
|
var CONSOLE_METHODS = ["log", "info", "warn", "error", "debug", "dir", "dirxml", "table", "trace", "group", "groupCollapsed", "count", "timeEnd", "timeLog", "assert"];
|
|
864
|
-
function liveRegion(render, stream =
|
|
1103
|
+
function liveRegion(render, stream = process12.stderr, env = process12.env) {
|
|
865
1104
|
if (!takesControlCodes(stream, env))
|
|
866
1105
|
return { redraw: () => {
|
|
867
1106
|
return;
|
|
@@ -902,11 +1141,11 @@ function liveRegion(render, stream = process8.stderr, env = process8.env) {
|
|
|
902
1141
|
clear();
|
|
903
1142
|
restore();
|
|
904
1143
|
release();
|
|
905
|
-
|
|
1144
|
+
process12.off("exit", onExit);
|
|
906
1145
|
signals.release();
|
|
907
1146
|
}
|
|
908
1147
|
timer.unref();
|
|
909
|
-
|
|
1148
|
+
process12.on("exit", onExit);
|
|
910
1149
|
return {
|
|
911
1150
|
redraw: draw,
|
|
912
1151
|
print: (text) => {
|
|
@@ -945,14 +1184,14 @@ function cutToWidth(line, width) {
|
|
|
945
1184
|
return `${kept}${RESET_STYLE}${linked ? CLOSE_LINK : ""}`;
|
|
946
1185
|
}
|
|
947
1186
|
function swallowInput() {
|
|
948
|
-
const input =
|
|
1187
|
+
const input = process12.stdin;
|
|
949
1188
|
if (!input.isTTY)
|
|
950
1189
|
return () => {
|
|
951
1190
|
return;
|
|
952
1191
|
};
|
|
953
1192
|
const onData = (data) => {
|
|
954
1193
|
if (data.includes(CTRL_C))
|
|
955
|
-
|
|
1194
|
+
process12.kill(process12.pid, "SIGINT");
|
|
956
1195
|
};
|
|
957
1196
|
input.setRawMode(true);
|
|
958
1197
|
input.on("data", onData);
|
|
@@ -968,7 +1207,7 @@ function swallowInput() {
|
|
|
968
1207
|
};
|
|
969
1208
|
}
|
|
970
1209
|
function interceptOutput(clear) {
|
|
971
|
-
const targets = [...CONSOLE_METHODS.map((name) => [console, name]), [
|
|
1210
|
+
const targets = [...CONSOLE_METHODS.map((name) => [console, name]), [process12.stdout, "write"], [process12.stderr, "write"]];
|
|
972
1211
|
const wrapped = targets.map(([target, name]) => {
|
|
973
1212
|
const original = Reflect.get(target, name);
|
|
974
1213
|
const wrapper = (...args) => {
|
|
@@ -987,11 +1226,11 @@ function interceptOutput(clear) {
|
|
|
987
1226
|
}
|
|
988
1227
|
|
|
989
1228
|
// ../kit/src/tool.ts
|
|
990
|
-
import
|
|
1229
|
+
import process13 from "process";
|
|
991
1230
|
var PERMANENT = /\bHTTP (?:401|403|404)\b|unauthorized|forbidden|not found|couldn't be found|token is required/i;
|
|
992
1231
|
function cwdGone() {
|
|
993
1232
|
try {
|
|
994
|
-
|
|
1233
|
+
process13.cwd();
|
|
995
1234
|
return false;
|
|
996
1235
|
} catch {
|
|
997
1236
|
return true;
|
|
@@ -1018,7 +1257,7 @@ function isPermanentFailure(error) {
|
|
|
1018
1257
|
async function runTool(label, argv, { timeoutMs, cwd, onStart } = {}) {
|
|
1019
1258
|
let ran;
|
|
1020
1259
|
try {
|
|
1021
|
-
ran = await runCommand(argv, { env:
|
|
1260
|
+
ran = await runCommand(argv, { env: process13.env, ...timeoutMs === undefined ? {} : { timeoutMs }, ...cwd === undefined ? {} : { cwd }, ...onStart === undefined ? {} : { onStart } });
|
|
1022
1261
|
} catch (error) {
|
|
1023
1262
|
throw spawnFailure(label, error);
|
|
1024
1263
|
}
|
|
@@ -1103,15 +1342,15 @@ async function waitForCi(wait) {
|
|
|
1103
1342
|
}
|
|
1104
1343
|
}
|
|
1105
1344
|
// ../kit/src/cli.ts
|
|
1106
|
-
import { readFileSync, realpathSync } from "fs";
|
|
1107
|
-
import { dirname as
|
|
1108
|
-
import
|
|
1345
|
+
import { readFileSync as readFileSync2, realpathSync } from "fs";
|
|
1346
|
+
import { dirname as dirname3, join as join5 } from "path";
|
|
1347
|
+
import process15 from "process";
|
|
1109
1348
|
|
|
1110
1349
|
// ../kit/src/usage.ts
|
|
1111
1350
|
import { appendFileSync, mkdirSync } from "fs";
|
|
1112
|
-
import { homedir } from "os";
|
|
1113
|
-
import { dirname, isAbsolute, join } from "path";
|
|
1114
|
-
import
|
|
1351
|
+
import { homedir as homedir3 } from "os";
|
|
1352
|
+
import { dirname as dirname2, isAbsolute, join as join4 } from "path";
|
|
1353
|
+
import process14 from "process";
|
|
1115
1354
|
|
|
1116
1355
|
// ../kit/src/logs.ts
|
|
1117
1356
|
var DAY_MS = 24 * 60 * 60 * 1000;
|
|
@@ -1125,14 +1364,14 @@ var usageError;
|
|
|
1125
1364
|
function noteUsageError(message) {
|
|
1126
1365
|
usageError = message;
|
|
1127
1366
|
}
|
|
1128
|
-
function stateHome(env =
|
|
1367
|
+
function stateHome(env = process14.env) {
|
|
1129
1368
|
const dir = env.XDG_STATE_HOME;
|
|
1130
|
-
return dir !== undefined && isAbsolute(dir) ? dir :
|
|
1369
|
+
return dir !== undefined && isAbsolute(dir) ? dir : join4(homedir3(), ".local", "state");
|
|
1131
1370
|
}
|
|
1132
|
-
function usagePath(env =
|
|
1133
|
-
return
|
|
1371
|
+
function usagePath(env = process14.env) {
|
|
1372
|
+
return join4(stateHome(env), CLI_FOLDER, "usage.jsonl");
|
|
1134
1373
|
}
|
|
1135
|
-
function usageRecorded(env =
|
|
1374
|
+
function usageRecorded(env = process14.env) {
|
|
1136
1375
|
const off = env.KAYNOOO_CLI_NO_USAGE;
|
|
1137
1376
|
return env.NODE_ENV !== "test" && (off === undefined || off === "" || off === "0");
|
|
1138
1377
|
}
|
|
@@ -1146,12 +1385,12 @@ function usageEntry(bin, command, argv, code, now = new Date) {
|
|
|
1146
1385
|
usageError = undefined;
|
|
1147
1386
|
return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
|
|
1148
1387
|
}
|
|
1149
|
-
function recordUsage(entry, env =
|
|
1388
|
+
function recordUsage(entry, env = process14.env) {
|
|
1150
1389
|
if (!usageRecorded(env))
|
|
1151
1390
|
return;
|
|
1152
1391
|
try {
|
|
1153
1392
|
const path = usagePath(env);
|
|
1154
|
-
mkdirSync(
|
|
1393
|
+
mkdirSync(dirname2(path), { recursive: true, mode: 448 });
|
|
1155
1394
|
appendFileSync(path, `${JSON.stringify(entry)}
|
|
1156
1395
|
`, { mode: 384 });
|
|
1157
1396
|
} catch {}
|
|
@@ -1237,8 +1476,8 @@ async function help2({ path, header, summary: lazySummary, commands, defaultComm
|
|
|
1237
1476
|
`);
|
|
1238
1477
|
}
|
|
1239
1478
|
function printError(prefix, message, hint, cause) {
|
|
1240
|
-
const colors = paint(
|
|
1241
|
-
const styled = takesControlCodes(
|
|
1479
|
+
const colors = paint(process15.stderr);
|
|
1480
|
+
const styled = takesControlCodes(process15.stderr);
|
|
1242
1481
|
const head = styled ? `${colors.red.bold("error")} ${colors.dim(`${prefix}:`)}` : `error: ${prefix}:`;
|
|
1243
1482
|
const under = (label, text, tint) => text === undefined ? "" : `
|
|
1244
1483
|
${styled ? tint(label) : `${label}:`} ${text}`;
|
|
@@ -1248,8 +1487,8 @@ function runHint(command, effect) {
|
|
|
1248
1487
|
return `run \`${command}\`${effect === undefined ? "" : ` to ${effect}`}`;
|
|
1249
1488
|
}
|
|
1250
1489
|
function printHint(hint) {
|
|
1251
|
-
const colors = paint(
|
|
1252
|
-
console.error(` ${takesControlCodes(
|
|
1490
|
+
const colors = paint(process15.stderr);
|
|
1491
|
+
console.error(` ${takesControlCodes(process15.stderr) ? colors.yellow("hint") : "hint:"} ${hint}`);
|
|
1253
1492
|
}
|
|
1254
1493
|
function printJsonError(message, hint, cause) {
|
|
1255
1494
|
console.error(JSON.stringify({ error: message, ...hint === undefined ? {} : { hint }, ...cause === undefined ? {} : { cause } }));
|
|
@@ -1288,11 +1527,11 @@ async function dispatch(level, typed, { version, redact }) {
|
|
|
1288
1527
|
}
|
|
1289
1528
|
}
|
|
1290
1529
|
if (name === undefined && level.path.length > 1) {
|
|
1291
|
-
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));
|
|
1292
1531
|
return 2;
|
|
1293
1532
|
}
|
|
1294
1533
|
if (name === undefined || name === "help" || name === "--help" || name === "-h") {
|
|
1295
|
-
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));
|
|
1296
1535
|
return 0;
|
|
1297
1536
|
}
|
|
1298
1537
|
if (level.path.length === 1 && (name === "--version" || name === "-v")) {
|
|
@@ -1409,17 +1648,17 @@ async function printCandidates(found) {
|
|
|
1409
1648
|
return 0;
|
|
1410
1649
|
}
|
|
1411
1650
|
function packageVersion(entry = Bun.main) {
|
|
1412
|
-
for (let dir =
|
|
1651
|
+
for (let dir = dirname3(realpathSync(entry));; dir = dirname3(dir)) {
|
|
1413
1652
|
try {
|
|
1414
|
-
const { version } = JSON.parse(
|
|
1653
|
+
const { version } = JSON.parse(readFileSync2(join5(dir, "package.json"), "utf8"));
|
|
1415
1654
|
if (typeof version === "string")
|
|
1416
1655
|
return version;
|
|
1417
1656
|
} catch {}
|
|
1418
|
-
if (
|
|
1657
|
+
if (dirname3(dir) === dir)
|
|
1419
1658
|
return "0.0.0";
|
|
1420
1659
|
}
|
|
1421
1660
|
}
|
|
1422
|
-
async function runCli(cli, argv =
|
|
1661
|
+
async function runCli(cli, argv = process15.argv.slice(2)) {
|
|
1423
1662
|
const version = cli.version ?? packageVersion();
|
|
1424
1663
|
if (argv[0] === COMPLETE)
|
|
1425
1664
|
return printCandidates(candidates(scopeOf(cli.commands, cli.extraCommands, cli.aliases), cli.defaultCommand, argv.slice(1)));
|
|
@@ -1447,8 +1686,8 @@ function commandPath(scope, argv) {
|
|
|
1447
1686
|
return path.length === 0 ? undefined : path.join(" ");
|
|
1448
1687
|
}
|
|
1449
1688
|
// ../kit/src/git.ts
|
|
1450
|
-
import { basename, dirname as
|
|
1451
|
-
import
|
|
1689
|
+
import { basename, dirname as dirname4 } from "path";
|
|
1690
|
+
import process16 from "process";
|
|
1452
1691
|
var ORIGIN_PREFIX = /^origin\//;
|
|
1453
1692
|
var GIT_NETWORK_MS = 60000;
|
|
1454
1693
|
async function git(args, timeoutMs) {
|
|
@@ -1478,7 +1717,7 @@ async function defaultBranch() {
|
|
|
1478
1717
|
async function leaveWorktree() {
|
|
1479
1718
|
const common = await git(["rev-parse", "--path-format=absolute", "--git-common-dir"]);
|
|
1480
1719
|
if (basename(common) === ".git")
|
|
1481
|
-
|
|
1720
|
+
process16.chdir(dirname4(common));
|
|
1482
1721
|
}
|
|
1483
1722
|
// ../kit/src/limit.ts
|
|
1484
1723
|
function limitOptions(fallback) {
|
|
@@ -1501,22 +1740,35 @@ function capped(rows, limit) {
|
|
|
1501
1740
|
const more = rows.length - limit;
|
|
1502
1741
|
return more > 0 ? { shown: rows.slice(0, limit), footer: moreFooter(more) } : { shown: [...rows], footer: undefined };
|
|
1503
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
|
+
}
|
|
1504
1756
|
// ../kit/src/secrets.ts
|
|
1505
1757
|
var SECRET_WORDS = new Set(["key", "pass", "pwd", "auth", "salt", "cookie", "session", "jwt", "ssn", "iban", "card", "cvv", "otp"]);
|
|
1506
1758
|
// ../kit/src/sessions.ts
|
|
1507
|
-
import { homedir as
|
|
1508
|
-
import { join as
|
|
1509
|
-
import
|
|
1759
|
+
import { homedir as homedir4 } from "os";
|
|
1760
|
+
import { join as join6 } from "path";
|
|
1761
|
+
import process17 from "process";
|
|
1510
1762
|
var {Glob } = globalThis.Bun;
|
|
1511
1763
|
var SESSION_FILES = new Glob("*.json");
|
|
1512
1764
|
var ACCOUNT_DIRS = new Glob("*/sessions");
|
|
1513
1765
|
async function sessionDirs() {
|
|
1514
|
-
const home =
|
|
1515
|
-
const dirs = new Set([
|
|
1516
|
-
if (
|
|
1517
|
-
dirs.add(
|
|
1766
|
+
const home = homedir4();
|
|
1767
|
+
const dirs = new Set([join6(home, ".claude", "sessions")]);
|
|
1768
|
+
if (process17.env.CLAUDE_CONFIG_DIR !== undefined)
|
|
1769
|
+
dirs.add(join6(process17.env.CLAUDE_CONFIG_DIR, "sessions"));
|
|
1518
1770
|
try {
|
|
1519
|
-
for await (const dir of ACCOUNT_DIRS.scan({ cwd:
|
|
1771
|
+
for await (const dir of ACCOUNT_DIRS.scan({ cwd: join6(home, ".claude-accounts"), onlyFiles: false, absolute: true }))
|
|
1520
1772
|
dirs.add(dir);
|
|
1521
1773
|
} catch {}
|
|
1522
1774
|
return [...dirs];
|
|
@@ -1560,7 +1812,7 @@ async function liveSessions() {
|
|
|
1560
1812
|
}
|
|
1561
1813
|
async function currentSession(sessions) {
|
|
1562
1814
|
const byPid = new Map(sessions.map((session) => [session.pid, session]));
|
|
1563
|
-
let pid =
|
|
1815
|
+
let pid = process17.ppid;
|
|
1564
1816
|
for (let depth = 0;depth < 32 && pid > 1; depth++) {
|
|
1565
1817
|
const session = byPid.get(pid);
|
|
1566
1818
|
if (session !== undefined)
|
|
@@ -1572,25 +1824,6 @@ async function currentSession(sessions) {
|
|
|
1572
1824
|
}
|
|
1573
1825
|
return;
|
|
1574
1826
|
}
|
|
1575
|
-
// ../kit/src/user-config.ts
|
|
1576
|
-
import { existsSync } from "fs";
|
|
1577
|
-
import { homedir as homedir3 } from "os";
|
|
1578
|
-
import { join as join4 } from "path";
|
|
1579
|
-
import process14 from "process";
|
|
1580
|
-
function configBase(where = {}) {
|
|
1581
|
-
const xdg = where.xdg ?? (where.home === undefined ? process14.env.XDG_CONFIG_HOME : undefined);
|
|
1582
|
-
return xdg !== undefined && xdg !== "" ? xdg : join4(where.home ?? homedir3(), ".config");
|
|
1583
|
-
}
|
|
1584
|
-
function userConfigPath(bin, where = {}) {
|
|
1585
|
-
return join4(configBase(where), "kaynooo-cli", `${bin}.json`);
|
|
1586
|
-
}
|
|
1587
|
-
function userConfigReadPath(bin, legacy = [], where = {}) {
|
|
1588
|
-
const current = userConfigPath(bin, where);
|
|
1589
|
-
if (existsSync(current))
|
|
1590
|
-
return current;
|
|
1591
|
-
const base = configBase(where);
|
|
1592
|
-
return legacy.map((parts) => join4(base, ...parts)).find((path) => existsSync(path)) ?? current;
|
|
1593
|
-
}
|
|
1594
1827
|
// src/args.ts
|
|
1595
1828
|
var repoOption = {
|
|
1596
1829
|
repo: { type: "string", short: "r", description: "owner/name of the repository, instead of the one origin points at" }
|
|
@@ -1759,9 +1992,9 @@ function holderSession(holder, sessions) {
|
|
|
1759
1992
|
}
|
|
1760
1993
|
|
|
1761
1994
|
// src/forge.ts
|
|
1762
|
-
import { homedir as
|
|
1763
|
-
import { join as
|
|
1764
|
-
import
|
|
1995
|
+
import { homedir as homedir5 } from "os";
|
|
1996
|
+
import { join as join7 } from "path";
|
|
1997
|
+
import process19 from "process";
|
|
1765
1998
|
|
|
1766
1999
|
// src/remote.ts
|
|
1767
2000
|
var SCP_LIKE = /^(?:([^@/]+)@)?([^:/]+):(?!\/)(.+?)(?:\.git)?\/?$/;
|
|
@@ -1816,8 +2049,8 @@ function loginHosts(config) {
|
|
|
1816
2049
|
return hosts;
|
|
1817
2050
|
}
|
|
1818
2051
|
function teaConfigPath() {
|
|
1819
|
-
const base =
|
|
1820
|
-
return
|
|
2052
|
+
const base = process19.env.XDG_CONFIG_HOME;
|
|
2053
|
+
return join7(base !== undefined && base !== "" ? base : join7(homedir5(), ".config"), "tea", "config.yml");
|
|
1821
2054
|
}
|
|
1822
2055
|
async function readConfig() {
|
|
1823
2056
|
try {
|
|
@@ -1935,14 +2168,9 @@ async function commentsOf(number, repo) {
|
|
|
1935
2168
|
return repoApi(`issues/${number}/comments`, repo);
|
|
1936
2169
|
}
|
|
1937
2170
|
async function commentsOfAll(issues, repo) {
|
|
1938
|
-
const
|
|
1939
|
-
const
|
|
1940
|
-
|
|
1941
|
-
for (let issue = queue.shift();issue !== undefined; issue = queue.shift())
|
|
1942
|
-
result.set(issue.number, await commentsOf(issue.number, repo));
|
|
1943
|
-
}
|
|
1944
|
-
await Promise.all(Array.from({ length: CONCURRENCY }, worker));
|
|
1945
|
-
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]]));
|
|
1946
2174
|
}
|
|
1947
2175
|
async function editIssue(number, change, repo) {
|
|
1948
2176
|
const args = [String(number)];
|
|
@@ -2092,6 +2320,9 @@ function standing(claim, sessions) {
|
|
|
2092
2320
|
}
|
|
2093
2321
|
var NOTE_WIDTH = 100;
|
|
2094
2322
|
var STATES = new Set(["available", "taken", "away"]);
|
|
2323
|
+
function dimmed(text) {
|
|
2324
|
+
return text === "" ? "" : paint(process.stdout).dim(text);
|
|
2325
|
+
}
|
|
2095
2326
|
function boxesLeft(issue) {
|
|
2096
2327
|
const list = boxes(issue.body);
|
|
2097
2328
|
return list.length === 0 ? "" : `${list.filter((box) => !box.done).length}/${list.length} left`;
|
|
@@ -2099,7 +2330,7 @@ function boxesLeft(issue) {
|
|
|
2099
2330
|
function claimRow(issue, row, now) {
|
|
2100
2331
|
const holder = row.state === "taken" && row.session.name !== row.claim.holder ? `${row.claim.holder} via ${row.session.name}` : row.claim.holder;
|
|
2101
2332
|
const status = row.state === "taken" ? ` (${row.session.status})` : "";
|
|
2102
|
-
return [`#${issue.number}
|
|
2333
|
+
return [role("id", process.stdout)(`#${issue.number}`), `${holder}${status}`, paint(process.stdout).dim(formatAge(row.claim.at, now)), boxesLeft(issue), truncate(issue.title, TITLE_WIDTH)];
|
|
2103
2334
|
}
|
|
2104
2335
|
function noteLine(comments, now) {
|
|
2105
2336
|
const note = latestNote(comments);
|
|
@@ -2118,11 +2349,11 @@ function renderBoard(rows, now = Date.now(), limit = Number.POSITIVE_INFINITY) {
|
|
|
2118
2349
|
const taken = claimed("taken");
|
|
2119
2350
|
const away = claimed("away");
|
|
2120
2351
|
const sections = [
|
|
2121
|
-
{ heading: "available", count: available.length, ...within(available, limit, ({ issue }) => [`#${issue.number}
|
|
2352
|
+
{ heading: "available", count: available.length, ...within(available, limit, ({ issue }) => [role("id", process.stdout)(`#${issue.number}`), truncate(issue.title, TITLE_WIDTH), dimmed(issue.labels.map((label) => label.name).join(", "))]) },
|
|
2122
2353
|
{ heading: "taken", count: taken.length, ...within(taken, limit, ({ issue, row }) => claimRow(issue, row, now)) },
|
|
2123
2354
|
{ heading: "claimed, no live session here", count: away.length, ...within(away, limit, ({ issue, row }) => claimRow(issue, row, now), (line, index) => [line, ...noteLine(away[index]?.comments ?? [], now)]) }
|
|
2124
2355
|
].filter((section) => section.count > 0);
|
|
2125
|
-
return sections.length === 0 ? "no open issue" : sections.map(({ heading, count, lines }) => `${heading} (${count})
|
|
2356
|
+
return sections.length === 0 ? "no open issue" : sections.map(({ heading, count, lines }) => `${paint(process.stdout).bold(`${heading} (${count})`)}
|
|
2126
2357
|
${lines.join(`
|
|
2127
2358
|
`).replace(LINE_START, " ")}`).join(`
|
|
2128
2359
|
|
|
@@ -2280,34 +2511,73 @@ async function take(args) {
|
|
|
2280
2511
|
console.log(`took #${number} as ${name}: ${found.title}`);
|
|
2281
2512
|
});
|
|
2282
2513
|
}
|
|
2283
|
-
var dropUsage = `ft drop <n>...
|
|
2514
|
+
var dropUsage = `ft drop <n>... [--stale] | --all-stale [--dry-run]
|
|
2284
2515
|
|
|
2285
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.
|
|
2286
2518
|
|
|
2287
|
-
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.`;
|
|
2288
2520
|
var dropOptions = {
|
|
2289
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" },
|
|
2290
2525
|
...laneOption,
|
|
2291
2526
|
...repoOption
|
|
2292
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
|
+
}
|
|
2293
2539
|
async function drop(args) {
|
|
2294
2540
|
const parsed = parse(args, dropUsage, dropOptions);
|
|
2295
2541
|
const { values, positionals } = parsed;
|
|
2296
|
-
const
|
|
2297
|
-
const nameFor = await claimant(values,
|
|
2542
|
+
const sessions = await liveSessions();
|
|
2543
|
+
const nameFor = await claimant(values, sessions);
|
|
2298
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);
|
|
2299
2565
|
return eachIssue("drop", numbers, async (number) => {
|
|
2300
2566
|
const name = nameFor(number);
|
|
2301
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
|
+
}
|
|
2302
2572
|
if (claim?.holder !== name)
|
|
2303
|
-
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"));
|
|
2304
2574
|
await comment(number, releasedComment(name), values.repo);
|
|
2305
2575
|
console.log(`released #${number}`);
|
|
2306
2576
|
});
|
|
2307
2577
|
}
|
|
2308
2578
|
|
|
2309
2579
|
// src/commands/ci.ts
|
|
2310
|
-
import
|
|
2580
|
+
import process20 from "process";
|
|
2311
2581
|
|
|
2312
2582
|
// src/git.ts
|
|
2313
2583
|
async function tagsAt(commit) {
|
|
@@ -2563,7 +2833,7 @@ async function ci2(args) {
|
|
|
2563
2833
|
return;
|
|
2564
2834
|
}
|
|
2565
2835
|
const json = values.json === true;
|
|
2566
|
-
const { dim } = paint(
|
|
2836
|
+
const { dim } = paint(process20.stderr);
|
|
2567
2837
|
const runs = await waitForCi({
|
|
2568
2838
|
tool: "ft ci",
|
|
2569
2839
|
short,
|
|
@@ -2588,7 +2858,7 @@ async function ci2(args) {
|
|
|
2588
2858
|
},
|
|
2589
2859
|
lines: (spinner, found, started) => [
|
|
2590
2860
|
`${spinner} CI on ${short} ${dim(formatElapsed(Date.now() - started))}`,
|
|
2591
|
-
...(found ?? []).map((run) => ` ${badge(run.status,
|
|
2861
|
+
...(found ?? []).map((run) => ` ${badge(run.status, process20.stderr)} ${run.workflow_id} ${dim(`run ${run.id}`)}`)
|
|
2592
2862
|
]
|
|
2593
2863
|
});
|
|
2594
2864
|
const status = overall(runs);
|
|
@@ -2618,7 +2888,7 @@ run ${run.id} failed${run.commit_sha === sha ? "" : `, testing every commit from
|
|
|
2618
2888
|
}
|
|
2619
2889
|
|
|
2620
2890
|
// src/commands/digest.ts
|
|
2621
|
-
import
|
|
2891
|
+
import process21 from "process";
|
|
2622
2892
|
var RUNS_SCANNED = 50;
|
|
2623
2893
|
var TITLE_WIDTH2 = 70;
|
|
2624
2894
|
var SHOWN = 8;
|
|
@@ -2668,7 +2938,7 @@ async function quietly(read) {
|
|
|
2668
2938
|
}
|
|
2669
2939
|
}
|
|
2670
2940
|
async function staleTodos() {
|
|
2671
|
-
const bin = Bun.which("todo-scan", { PATH:
|
|
2941
|
+
const bin = Bun.which("todo-scan", { PATH: process21.env.PATH ?? "" });
|
|
2672
2942
|
if (bin === null)
|
|
2673
2943
|
return [];
|
|
2674
2944
|
let found;
|
|
@@ -3511,8 +3781,8 @@ function report(plan, added, skipped) {
|
|
|
3511
3781
|
}
|
|
3512
3782
|
|
|
3513
3783
|
// src/commands/release.ts
|
|
3514
|
-
import { basename as basename3, join as
|
|
3515
|
-
import
|
|
3784
|
+
import { basename as basename3, join as join11 } from "path";
|
|
3785
|
+
import process23 from "process";
|
|
3516
3786
|
var {$: $2 } = globalThis.Bun;
|
|
3517
3787
|
|
|
3518
3788
|
// src/commands/watch.ts
|
|
@@ -3694,7 +3964,7 @@ ${push.stderr.trim()}`, 1);
|
|
|
3694
3964
|
|
|
3695
3965
|
// src/commands/release-many.ts
|
|
3696
3966
|
import { readdir } from "fs/promises";
|
|
3697
|
-
import { join as
|
|
3967
|
+
import { join as join8 } from "path";
|
|
3698
3968
|
|
|
3699
3969
|
// src/commands/release-version.ts
|
|
3700
3970
|
var LEVELS = new Set(["patch", "minor", "major", "prepatch", "preminor", "premajor", "prerelease"]);
|
|
@@ -3743,11 +4013,11 @@ function parseTargets(spec, level) {
|
|
|
3743
4013
|
});
|
|
3744
4014
|
}
|
|
3745
4015
|
async function publishable() {
|
|
3746
|
-
const root =
|
|
4016
|
+
const root = join8(await git(["rev-parse", "--show-toplevel"]), "packages");
|
|
3747
4017
|
const folders = (await readdir(root, { withFileTypes: true })).filter((entry) => entry.isDirectory()).map((entry) => entry.name).toSorted();
|
|
3748
4018
|
const found = [];
|
|
3749
4019
|
for (const folder of folders) {
|
|
3750
|
-
const file = Bun.file(
|
|
4020
|
+
const file = Bun.file(join8(root, folder, "package.json"));
|
|
3751
4021
|
if (await file.exists() && (await file.json()).private !== true)
|
|
3752
4022
|
found.push(folder);
|
|
3753
4023
|
}
|
|
@@ -3755,13 +4025,13 @@ async function publishable() {
|
|
|
3755
4025
|
}
|
|
3756
4026
|
|
|
3757
4027
|
// src/commands/release-plan.ts
|
|
3758
|
-
import { basename as basename2, join as
|
|
3759
|
-
import
|
|
4028
|
+
import { basename as basename2, join as join9, relative } from "path";
|
|
4029
|
+
import process22 from "process";
|
|
3760
4030
|
async function printPlan({ level, dir, prefix, branch, base, timeout, registry }) {
|
|
3761
|
-
const file = Bun.file(
|
|
4031
|
+
const file = Bun.file(join9(dir ?? ".", "package.json"));
|
|
3762
4032
|
const pkg = await file.exists() ? await file.json() : undefined;
|
|
3763
|
-
const name = pkg?.name ?? basename2(dir ??
|
|
3764
|
-
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) || "."}`;
|
|
3765
4035
|
const sha = base.slice(0, 7);
|
|
3766
4036
|
let version;
|
|
3767
4037
|
let bump;
|
|
@@ -3774,7 +4044,7 @@ async function printPlan({ level, dir, prefix, branch, base, timeout, registry }
|
|
|
3774
4044
|
console.log(`would release ${name} ${version}, tagged ${tag}`);
|
|
3775
4045
|
} else {
|
|
3776
4046
|
if (pkg?.version === undefined)
|
|
3777
|
-
fail(`no version in ${
|
|
4047
|
+
fail(`no version in ${join9(dir ?? ".", "package.json")}`);
|
|
3778
4048
|
version = nextVersion(pkg.version, level);
|
|
3779
4049
|
bump = dir === undefined ? `bun pm version ${level}, which commits and tags ${prefix}${version}` : `bun pm version ${level} --no-git-tag-version${where}, then commit it with bun.lock refreshed and tag ${prefix}${version}`;
|
|
3780
4050
|
console.log(`would release ${name} ${pkg.version} -> ${version}, tagged ${prefix}${version}`);
|
|
@@ -3794,25 +4064,25 @@ async function printPlan({ level, dir, prefix, branch, base, timeout, registry }
|
|
|
3794
4064
|
}
|
|
3795
4065
|
|
|
3796
4066
|
// src/commands/release-steps.ts
|
|
3797
|
-
import { join as
|
|
4067
|
+
import { join as join10, relative as relative2, resolve as resolve3 } from "path";
|
|
3798
4068
|
var {$ } = globalThis.Bun;
|
|
3799
4069
|
var registryWait = { tries: 12, poll: 5000 };
|
|
3800
4070
|
var REGISTRY_INFO_MS = 30000;
|
|
3801
4071
|
async function packageDir(value) {
|
|
3802
|
-
for (const dir of [
|
|
3803
|
-
if (await Bun.file(
|
|
4072
|
+
for (const dir of [resolve3(value), join10(await git(["rev-parse", "--show-toplevel"]), "packages", value)]) {
|
|
4073
|
+
if (await Bun.file(join10(dir, "package.json")).exists())
|
|
3804
4074
|
return dir;
|
|
3805
4075
|
}
|
|
3806
4076
|
fail(`no package.json in ${value} nor in packages/${value}`);
|
|
3807
4077
|
}
|
|
3808
4078
|
async function commitPackageBump(dir, prefix) {
|
|
3809
|
-
const { version } = await Bun.file(
|
|
4079
|
+
const { version } = await Bun.file(join10(dir, "package.json")).json();
|
|
3810
4080
|
const root = await git(["rev-parse", "--show-toplevel"]);
|
|
3811
4081
|
const tag = `${prefix}${version}`;
|
|
3812
4082
|
const lock = await $`bun install --lockfile-only`.cwd(root).quiet().nothrow();
|
|
3813
4083
|
if (lock.exitCode !== 0)
|
|
3814
4084
|
fail(`bun install --lockfile-only after the bump: ${lock.stderr.toString().trim()}`);
|
|
3815
|
-
await git(["add",
|
|
4085
|
+
await git(["add", join10(dir, "package.json"), join10(root, "bun.lock")]);
|
|
3816
4086
|
await git(["commit", "-q", "-m", tag]);
|
|
3817
4087
|
await git(["tag", "-a", tag, "-m", tag]);
|
|
3818
4088
|
}
|
|
@@ -3841,11 +4111,11 @@ async function rollBack(preBump, tagsBefore, dir) {
|
|
|
3841
4111
|
await git(["reset", "--keep", preBump]);
|
|
3842
4112
|
if (dir !== undefined) {
|
|
3843
4113
|
const root = await git(["rev-parse", "--show-toplevel"]);
|
|
3844
|
-
const paths = [
|
|
4114
|
+
const paths = [join10(dir, "package.json"), join10(root, "bun.lock")].map((path) => relative2(root, path));
|
|
3845
4115
|
const tracked = (await git(["ls-tree", "-r", "--full-tree", "--name-only", preBump, "--", ...paths])).split(`
|
|
3846
4116
|
`).filter((path) => path !== "");
|
|
3847
4117
|
if (tracked.length > 0)
|
|
3848
|
-
await git(["restore", `--source=${preBump}`, "--staged", "--worktree", "--", ...tracked.map((path) =>
|
|
4118
|
+
await git(["restore", `--source=${preBump}`, "--staged", "--worktree", "--", ...tracked.map((path) => join10(root, path))]);
|
|
3849
4119
|
}
|
|
3850
4120
|
} catch (error) {
|
|
3851
4121
|
warn(`could not undo the bump, back to ${preBump.slice(0, 7)} by hand`, error instanceof Error ? error.message : String(error));
|
|
@@ -4002,7 +4272,7 @@ ${push.stderr.trim()}`, signal === undefined ? 1 : exitCodeOf(null, signal));
|
|
|
4002
4272
|
if (!pushed && !isPushUnknown && level !== undefined)
|
|
4003
4273
|
await rollBack(preBump, tagsBefore, dir);
|
|
4004
4274
|
}
|
|
4005
|
-
const file = Bun.file(
|
|
4275
|
+
const file = Bun.file(join11(dir ?? ".", "package.json"));
|
|
4006
4276
|
const pkg = await file.exists() ? await file.json() : undefined;
|
|
4007
4277
|
const version = tag.slice(prefix.length);
|
|
4008
4278
|
let followed = { code: 0, runs: [], failedJobs: [] };
|
|
@@ -4020,7 +4290,7 @@ ${push.stderr.trim()}`, signal === undefined ? 1 : exitCodeOf(null, signal));
|
|
|
4020
4290
|
if (late !== undefined)
|
|
4021
4291
|
fail(`interrupted by ${late} after ${tag} was pushed: its runs are not waited for`, exitCodeOf(null, late));
|
|
4022
4292
|
say(`pushed ${branch} and ${tag}, waiting for their runs`);
|
|
4023
|
-
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 });
|
|
4024
4294
|
if (followed.code !== 0) {
|
|
4025
4295
|
outcome(false);
|
|
4026
4296
|
return followed.code;
|
|
@@ -4215,7 +4485,7 @@ async function runs(args) {
|
|
|
4215
4485
|
}
|
|
4216
4486
|
|
|
4217
4487
|
// src/cli.ts
|
|
4218
|
-
|
|
4488
|
+
process24.exitCode = await runCli({
|
|
4219
4489
|
name: "ft",
|
|
4220
4490
|
about: "Forgejo tools over tea, run from a repository whose origin is on Forgejo",
|
|
4221
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
|
}
|