@kaynooo/cli-forgejo 0.29.0 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +80 -107
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -574,18 +574,14 @@ var FULL_STOP = /\.$/;
|
|
|
574
574
|
function usageLine(usage, colors = paint(process8.stdout)) {
|
|
575
575
|
return `${colors.bold("Usage:")} ${usage.replace(USAGE_PREFIX, "").replaceAll(OPTIONAL, (part) => colors.dim(part))}`;
|
|
576
576
|
}
|
|
577
|
-
function helpText(usage, options, colors = paint(process8.stdout), { examples = [],
|
|
578
|
-
return [usageLine(usage, colors),
|
|
577
|
+
function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [] } = {}) {
|
|
578
|
+
return [usageLine(usage, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
|
|
579
579
|
`);
|
|
580
580
|
}
|
|
581
581
|
function exitRows(exits, colors = paint(process8.stdout)) {
|
|
582
582
|
if (exits.length === 0)
|
|
583
583
|
return [];
|
|
584
|
-
|
|
585
|
-
return ["", colors.bold("Exits:"), ...exits.map(([code, meaning]) => ` ${colors.cyan(String(code).padEnd(width))} ${meaning}`)];
|
|
586
|
-
}
|
|
587
|
-
function replacesRows(replaces, colors = paint(process8.stdout)) {
|
|
588
|
-
return replaces === undefined || outputMode() === "agent" ? [] : ["", `${colors.bold("Instead of:")} ${replaces}`];
|
|
584
|
+
return ["", `${colors.bold("Exit codes:")} ${exits.map(([code, meaning]) => `${colors.cyan(String(code))} ${meaning}`).join(", ")}`];
|
|
589
585
|
}
|
|
590
586
|
function wantsHelpJson(env = process8.env) {
|
|
591
587
|
return env.KIT_HELP === "json";
|
|
@@ -1474,7 +1470,6 @@ async function help2({ path, header, summary: lazySummary, commands, defaultComm
|
|
|
1474
1470
|
header(colors, summary),
|
|
1475
1471
|
"",
|
|
1476
1472
|
usageLine(`${prefix} ${defaultCommand === undefined ? colors.cyan("<command>") : `[${colors.cyan("<command>")}]`} [options]`, colors),
|
|
1477
|
-
...replacesRows(replaces, colors),
|
|
1478
1473
|
"",
|
|
1479
1474
|
...await commandRows(commands, colors),
|
|
1480
1475
|
...own.length === 0 ? [] : ["", `${colors.bold(`Options of ${defaultCommand}:`)} ${colors.dim("the command run when none is named")}`, ...optionRows(Object.fromEntries(own), colors)],
|
|
@@ -2509,9 +2504,8 @@ var boardUsage = `ft board
|
|
|
2509
2504
|
|
|
2510
2505
|
Lists open issues, at most 30 of each kind (--full for all), as available, taken by a session running here, or claimed by a session no session here answers to, from their latest "Taken by session <name>." comment.
|
|
2511
2506
|
A claim shows its boxes left, and one no live session holds also the latest comment that is not a claim.
|
|
2512
|
-
A lane's claim (lane-<n>-<issue>) is held while the session whose name ends in -<n> runs
|
|
2513
|
-
|
|
2514
|
-
Exits 0 when it listed them, 1 when the issues cannot be read, 2 on a usage error.`;
|
|
2507
|
+
A lane's claim (lane-<n>-<issue>) is held while the session whose name ends in -<n> runs.`;
|
|
2508
|
+
var boardExits = [[0, "it listed them"], [1, "the issues cannot be read"], [2, "a usage error"]];
|
|
2515
2509
|
var BOARD_LIMIT = 30;
|
|
2516
2510
|
var boardOptions = {
|
|
2517
2511
|
labels: { type: "string", short: "L", description: "only issues with these labels, comma separated" },
|
|
@@ -2524,7 +2518,7 @@ var boardOptions = {
|
|
|
2524
2518
|
...repoOption
|
|
2525
2519
|
};
|
|
2526
2520
|
async function board(args) {
|
|
2527
|
-
const parsed = parse(args, boardUsage, boardOptions);
|
|
2521
|
+
const parsed = parse(args, boardUsage, boardOptions, { exits: boardExits });
|
|
2528
2522
|
const { values } = parsed;
|
|
2529
2523
|
if (values.watch !== undefined)
|
|
2530
2524
|
return watching(values.watch, async () => board(withoutWatch(args)));
|
|
@@ -2561,9 +2555,8 @@ async function me(as, sessions) {
|
|
|
2561
2555
|
var takeUsage = `ft take <n>...
|
|
2562
2556
|
|
|
2563
2557
|
Claims each issue for this Claude Code session with a "Taken by session <name>." comment.
|
|
2564
|
-
An issue another live session holds is refused, one this session or its lanes hold passes to the new name, and one claimed by a session no session here answers to needs --take-stale; a refusal leaves the other issues taken
|
|
2565
|
-
|
|
2566
|
-
Exits 0 when every issue is taken, 1 when one is refused, 2 on a usage error.`;
|
|
2558
|
+
An issue another live session holds is refused, one this session or its lanes hold passes to the new name, and one claimed by a session no session here answers to needs --take-stale; a refusal leaves the other issues taken.`;
|
|
2559
|
+
var takeExits = [[0, "every issue is taken"], [1, "one is refused"], [2, "a usage error"]];
|
|
2567
2560
|
var laneOption = {
|
|
2568
2561
|
lane: { type: "boolean", description: "claim each as lane-<s>-<n>, <s> ending this session's name, so the claim stays live while it runs" }
|
|
2569
2562
|
};
|
|
@@ -2599,7 +2592,7 @@ async function eachIssue(command, numbers, step) {
|
|
|
2599
2592
|
return code;
|
|
2600
2593
|
}
|
|
2601
2594
|
async function take(args) {
|
|
2602
|
-
const parsed = parse(args, takeUsage, takeOptions);
|
|
2595
|
+
const parsed = parse(args, takeUsage, takeOptions, { exits: takeExits });
|
|
2603
2596
|
const { values, positionals } = parsed;
|
|
2604
2597
|
const numbers = issueNumbers(positionals, takeUsage);
|
|
2605
2598
|
const sessions = await liveSessions();
|
|
@@ -2630,9 +2623,8 @@ async function take(args) {
|
|
|
2630
2623
|
var dropUsage = `ft drop <n>... [--stale] | --all-stale [--dry-run]
|
|
2631
2624
|
|
|
2632
2625
|
Gives each issue back with a "Released by session <name>." comment, when this session holds it.
|
|
2633
|
-
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
|
|
2634
|
-
|
|
2635
|
-
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.`;
|
|
2626
|
+
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.`;
|
|
2627
|
+
var dropExits = [[0, "every issue is given back"], [1, "one is not held by this session or, with --stale, by a live one"], [2, "a usage error"]];
|
|
2636
2628
|
var dropOptions = {
|
|
2637
2629
|
as: { type: "string", description: "the name it was taken as, instead of this session's" },
|
|
2638
2630
|
stale: { type: "boolean", description: "also release a claim no live session here answers to" },
|
|
@@ -2653,7 +2645,7 @@ async function releaseStale(number, me, author, sessions, repo) {
|
|
|
2653
2645
|
console.log(good(`released #${number}, held by ${claim.holder}`));
|
|
2654
2646
|
}
|
|
2655
2647
|
async function drop(args) {
|
|
2656
|
-
const parsed = parse(args, dropUsage, dropOptions);
|
|
2648
|
+
const parsed = parse(args, dropUsage, dropOptions, { exits: dropExits });
|
|
2657
2649
|
const { values, positionals } = parsed;
|
|
2658
2650
|
const sessions = await liveSessions();
|
|
2659
2651
|
const nameFor = await claimant(values, sessions);
|
|
@@ -2892,8 +2884,8 @@ var usage2 = `ft ci [ref]
|
|
|
2892
2884
|
|
|
2893
2885
|
Waits for the push runs covering a commit on the branch, by default origin's tip, and prints what each failed job's log says.
|
|
2894
2886
|
A push's run tests every commit since the previous push, so a commit whose own run was cancelled, or whose --job was skipped, is covered by the next commit's runs.
|
|
2895
|
-
--json prints {status, runs, failedJobs, url} on stdout, the progress going to stderr; --quiet prints only the announcement, the failures and the result
|
|
2896
|
-
|
|
2887
|
+
--json prints {status, runs, failedJobs, url} on stdout, the progress going to stderr; --quiet prints only the announcement, the failures and the result.`;
|
|
2888
|
+
var EXITS = [[0, "they pass"], [1, "one fails"], [2, "a timeout, a stalled queue or a commit not on the branch"]];
|
|
2897
2889
|
var options = {
|
|
2898
2890
|
branch: { type: "string", short: "b", description: "branch the commit is on, by default the one origin/HEAD names" },
|
|
2899
2891
|
workflow: { type: "string", short: "w", description: "only this workflow file, e.g. test.yml; by default every workflow a push starts" },
|
|
@@ -2923,7 +2915,7 @@ function settled(latest) {
|
|
|
2923
2915
|
return latest !== undefined && latest.every((run) => FINISHED.has(run.status)) && judge(latest, false, false).kind === "runs" ? latest : undefined;
|
|
2924
2916
|
}
|
|
2925
2917
|
async function ci2(args) {
|
|
2926
|
-
const parsed = parse(args, usage2, options);
|
|
2918
|
+
const parsed = parse(args, usage2, options, { exits: EXITS });
|
|
2927
2919
|
const { values, positionals } = parsed;
|
|
2928
2920
|
const branch = values.branch ?? await defaultBranch();
|
|
2929
2921
|
const giveUp = duration(values.timeout, "timeout", 30 * 60000, "m");
|
|
@@ -3121,16 +3113,15 @@ ${lines.join(`
|
|
|
3121
3113
|
var usage3 = `ft digest
|
|
3122
3114
|
|
|
3123
3115
|
Summarises the repository for a session starting cold: the issues this session holds with their boxes left, the claims no live session here answers to, red or running CI on the default branch, unpushed commits, dirty files and TODO comments naming a closed issue.
|
|
3124
|
-
A section with nothing in it is left out, and the stale TODO comments need todo-scan on the PATH
|
|
3125
|
-
|
|
3126
|
-
Exits 0 when it summarised the repository, 1 when Forgejo cannot be read, 2 on a usage error.`;
|
|
3116
|
+
A section with nothing in it is left out, and the stale TODO comments need todo-scan on the PATH.`;
|
|
3117
|
+
var EXITS2 = [[0, "it summarised the repository"], [1, "Forgejo cannot be read"], [2, "a usage error"]];
|
|
3127
3118
|
var options2 = {
|
|
3128
3119
|
json: jsonOption("held and away (number, title, holder, since, boxesLeft, boxesTotal), ci (id, status, workflow, started, title), unpushed, dirty (status, path) and stale (issue, comments: path, line)"),
|
|
3129
3120
|
watch: watchOption("the digest"),
|
|
3130
3121
|
...repoOption
|
|
3131
3122
|
};
|
|
3132
3123
|
async function digest(args) {
|
|
3133
|
-
const parsed = parse(args, usage3, options2);
|
|
3124
|
+
const parsed = parse(args, usage3, options2, { exits: EXITS2 });
|
|
3134
3125
|
const { values } = parsed;
|
|
3135
3126
|
if (values.watch !== undefined)
|
|
3136
3127
|
return watching(values.watch, async () => digest(withoutWatch(args)));
|
|
@@ -3199,9 +3190,8 @@ var tickUsage = `ft tick [<n>] <box>...
|
|
|
3199
3190
|
Ticks checklist boxes of issue <n>, each given by its number from \`ft issue\` or by text matching exactly one box, then posts the -m or -F comment.
|
|
3200
3191
|
With --closed, ticks instead every box opening with \`#<issue>\` whose issue is closed, as a release plan lists them.
|
|
3201
3192
|
|
|
3202
|
-
Without <n> (a first argument that is not a number) it takes the one open issue this session holds (\`ft take\`), and exits 2 when it holds none or several, saying which issue it used. A first argument that is a number is always the issue, so boxes named by number need it
|
|
3203
|
-
|
|
3204
|
-
Exits 0 when it ticked the boxes, 1 when Forgejo refuses, 2 on a usage error or a box matching none or several.`;
|
|
3193
|
+
Without <n> (a first argument that is not a number) it takes the one open issue this session holds (\`ft take\`), and exits 2 when it holds none or several, saying which issue it used. A first argument that is a number is always the issue, so boxes named by number need it.`;
|
|
3194
|
+
var tickExits = [[0, "it ticked the boxes"], [1, "Forgejo refuses"], [2, "a usage error or a box matching none or several"]];
|
|
3205
3195
|
var tickOptions = {
|
|
3206
3196
|
undo: { type: "boolean", short: "u", description: "untick them instead" },
|
|
3207
3197
|
closed: { type: "boolean", description: "tick the boxes listing a closed issue, no box to name" },
|
|
@@ -3216,7 +3206,7 @@ function tickedOrFail(number, run) {
|
|
|
3216
3206
|
}
|
|
3217
3207
|
}
|
|
3218
3208
|
async function tick(args) {
|
|
3219
|
-
const parsed = parse(args, tickUsage, tickOptions);
|
|
3209
|
+
const parsed = parse(args, tickUsage, tickOptions, { exits: tickExits });
|
|
3220
3210
|
const { values, positionals } = parsed;
|
|
3221
3211
|
const { number, rest: picks } = await targetIssue(positionals, values.repo, tickUsage);
|
|
3222
3212
|
if (values.closed === true && (picks.length > 0 || values.undo === true))
|
|
@@ -3253,9 +3243,8 @@ var fixedUsage = `ft fixed [<n>] [commit]...
|
|
|
3253
3243
|
|
|
3254
3244
|
Comments "Fixed in <sha>: <message>" on issue <n> and closes it, naming each commit given as "Fixed in <a>, <b> and <c>".
|
|
3255
3245
|
Without a commit it takes those on origin's default branch whose message names #<n>, and says which, or HEAD when none does.
|
|
3256
|
-
Without <n> it takes the one open issue this session holds (\`ft take\`). The message defaults to the subject of the first commit. Every open issue listing \`- [ ] #<n>\` in its checklist gets that line ticked. An issue with boxes left is refused, as a partly done issue stays open, unless --tick ticks them first
|
|
3257
|
-
|
|
3258
|
-
Exits 0 when it closed the issue, 1 when the issue is already closed, has boxes left or Forgejo refuses, 2 on a usage error.`;
|
|
3246
|
+
Without <n> it takes the one open issue this session holds (\`ft take\`). The message defaults to the subject of the first commit. Every open issue listing \`- [ ] #<n>\` in its checklist gets that line ticked. An issue with boxes left is refused, as a partly done issue stays open, unless --tick ticks them first.`;
|
|
3247
|
+
var fixedExits = [[0, "it closed the issue"], [1, "the issue is already closed, has boxes left or Forgejo refuses"], [2, "a usage error"]];
|
|
3259
3248
|
var fixedOptions = {
|
|
3260
3249
|
message: { type: "string", short: "m", description: 'the line after "Fixed in <sha>:"' },
|
|
3261
3250
|
tick: { type: "boolean", description: "tick the boxes left before closing" },
|
|
@@ -3296,7 +3285,7 @@ async function tickListings(closed, repo) {
|
|
|
3296
3285
|
}
|
|
3297
3286
|
}
|
|
3298
3287
|
async function fixed(args) {
|
|
3299
|
-
const parsed = parse(args, fixedUsage, fixedOptions);
|
|
3288
|
+
const parsed = parse(args, fixedUsage, fixedOptions, { exits: fixedExits });
|
|
3300
3289
|
const { values, positionals } = parsed;
|
|
3301
3290
|
const { number, rest } = await targetIssue(positionals, values.repo, fixedUsage);
|
|
3302
3291
|
const commits = await fixingCommits(number, rest);
|
|
@@ -3334,8 +3323,8 @@ var stateOptions = {
|
|
|
3334
3323
|
message: { type: "string", short: "m", description: "a comment posted first, saying why" },
|
|
3335
3324
|
...repoOption
|
|
3336
3325
|
};
|
|
3337
|
-
async function setState(args, usage, wanted) {
|
|
3338
|
-
const parsed = parse(args, usage, stateOptions);
|
|
3326
|
+
async function setState(args, usage, exits, wanted) {
|
|
3327
|
+
const parsed = parse(args, usage, stateOptions, { exits });
|
|
3339
3328
|
const { values, positionals } = parsed;
|
|
3340
3329
|
for (const number of issueNumbers(positionals, usage)) {
|
|
3341
3330
|
if ((await getIssue(number, values.repo)).state === wanted) {
|
|
@@ -3354,19 +3343,17 @@ async function setState(args, usage, wanted) {
|
|
|
3354
3343
|
}
|
|
3355
3344
|
var closeUsage = `ft close <n>... [-m <reason>]
|
|
3356
3345
|
|
|
3357
|
-
Closes issues without a fix, a duplicate or one dropped, posting the -m reason first. \`ft fixed\` closes one a commit fixed
|
|
3358
|
-
|
|
3359
|
-
Exits 0 when every issue is closed, 1 when Forgejo refuses, 2 on a usage error.`;
|
|
3346
|
+
Closes issues without a fix, a duplicate or one dropped, posting the -m reason first. \`ft fixed\` closes one a commit fixed.`;
|
|
3347
|
+
var closeExits = [[0, "every issue is closed"], [1, "Forgejo refuses"], [2, "a usage error"]];
|
|
3360
3348
|
async function closeIssues(args) {
|
|
3361
|
-
return setState(args, closeUsage, "closed");
|
|
3349
|
+
return setState(args, closeUsage, closeExits, "closed");
|
|
3362
3350
|
}
|
|
3363
3351
|
var reopenUsage = `ft reopen <n>... [-m <reason>]
|
|
3364
3352
|
|
|
3365
|
-
Reopens closed issues, posting the -m reason first
|
|
3366
|
-
|
|
3367
|
-
Exits 0 when every issue is open, 1 when Forgejo refuses, 2 on a usage error.`;
|
|
3353
|
+
Reopens closed issues, posting the -m reason first.`;
|
|
3354
|
+
var reopenExits = [[0, "every issue is open"], [1, "Forgejo refuses"], [2, "a usage error"]];
|
|
3368
3355
|
async function reopenIssues(args) {
|
|
3369
|
-
return setState(args, reopenUsage, "open");
|
|
3356
|
+
return setState(args, reopenUsage, reopenExits, "open");
|
|
3370
3357
|
}
|
|
3371
3358
|
var LABEL_FLAGS = new Set(["-h", "--help"]);
|
|
3372
3359
|
var REPO_FLAGS = new Set(["-r", "--repo"]);
|
|
@@ -3389,12 +3376,11 @@ function labelChanges(args) {
|
|
|
3389
3376
|
}
|
|
3390
3377
|
var labelUsage = `ft label <n> [+]<label>... -<label>...
|
|
3391
3378
|
|
|
3392
|
-
Adds the labels named bare or with +, removes those named with -, then prints the issue's labels. A label the repository lacks is refused
|
|
3393
|
-
|
|
3394
|
-
Exits 0 when it changed the labels, 1 when Forgejo refuses, 2 on a usage error or a label the repository lacks.`;
|
|
3379
|
+
Adds the labels named bare or with +, removes those named with -, then prints the issue's labels. A label the repository lacks is refused.`;
|
|
3380
|
+
var labelExits = [[0, "it changed the labels"], [1, "Forgejo refuses"], [2, "a usage error or a label the repository lacks"]];
|
|
3395
3381
|
async function label(args) {
|
|
3396
3382
|
const changes = labelChanges(args);
|
|
3397
|
-
const parsed = parse(changes.rest, labelUsage, repoOption);
|
|
3383
|
+
const parsed = parse(changes.rest, labelUsage, repoOption, { exits: labelExits });
|
|
3398
3384
|
const { values, positionals } = parsed;
|
|
3399
3385
|
const number = issueNumber(positionals[0], labelUsage);
|
|
3400
3386
|
const add = [...positionals.slice(1), ...changes.add];
|
|
@@ -3416,9 +3402,8 @@ ${labelUsage}`);
|
|
|
3416
3402
|
// src/commands/issue-write.ts
|
|
3417
3403
|
var newUsage = `ft new -t <title> [-F <file>] [-L a,b] [-m <milestone>]
|
|
3418
3404
|
|
|
3419
|
-
Creates an issue and prints its number and url. The description is read from -F <file>, or from stdin with -F -, and is empty without it. A label or milestone the repository lacks is refused before anything is created
|
|
3420
|
-
|
|
3421
|
-
Exits 0 when it created the issue, 1 when Forgejo refuses, 2 on a usage error or a label or milestone the repository lacks.`;
|
|
3405
|
+
Creates an issue and prints its number and url. The description is read from -F <file>, or from stdin with -F -, and is empty without it. A label or milestone the repository lacks is refused before anything is created.`;
|
|
3406
|
+
var newExits = [[0, "it created the issue"], [1, "Forgejo refuses"], [2, "a usage error or a label or milestone the repository lacks"]];
|
|
3422
3407
|
var newOptions = {
|
|
3423
3408
|
title: { type: "string", short: "t", description: "the issue title" },
|
|
3424
3409
|
file: { type: "string", short: "F", description: "the description: a file, - for stdin" },
|
|
@@ -3432,7 +3417,7 @@ async function milestoneTitle(reference, repo) {
|
|
|
3432
3417
|
return reference.trim() === "" ? "" : (await findMilestone(reference.trim(), repo)).title;
|
|
3433
3418
|
}
|
|
3434
3419
|
async function newIssue(args) {
|
|
3435
|
-
const parsed = parse(args, newUsage, newOptions);
|
|
3420
|
+
const parsed = parse(args, newUsage, newOptions, { exits: newExits });
|
|
3436
3421
|
const { values } = parsed;
|
|
3437
3422
|
if (values.title === undefined || values.title.trim() === "")
|
|
3438
3423
|
fail(`give the issue a title with -t
|
|
@@ -3450,9 +3435,8 @@ var editUsage = `ft edit <n> [-t <title>] [-F <file> [--append]] [--add-box <tex
|
|
|
3450
3435
|
Replaces the title and/or the description of issue <n>, the description from -F <file> or from stdin with -F -.
|
|
3451
3436
|
-m moves it to a milestone given by title or id, and \`-m ''\` takes it out of its milestone.
|
|
3452
3437
|
--append adds the -F text after the description instead, and each --add-box an unticked box after the last one, the rest of the description untouched.
|
|
3453
|
-
\`ft issue <n> --body\` prints the description to edit
|
|
3454
|
-
|
|
3455
|
-
Exits 0 when it edited the issue, 1 when Forgejo refuses, 2 on a usage error.`;
|
|
3438
|
+
\`ft issue <n> --body\` prints the description to edit.`;
|
|
3439
|
+
var editExits = [[0, "it edited the issue"], [1, "Forgejo refuses"], [2, "a usage error"]];
|
|
3456
3440
|
var editOptions = {
|
|
3457
3441
|
title: { type: "string", short: "t", description: "the new title" },
|
|
3458
3442
|
file: { type: "string", short: "F", description: "the new description: a file, - for stdin" },
|
|
@@ -3462,7 +3446,7 @@ var editOptions = {
|
|
|
3462
3446
|
...repoOption
|
|
3463
3447
|
};
|
|
3464
3448
|
async function edit(args) {
|
|
3465
|
-
const parsed = parse(args, editUsage, editOptions);
|
|
3449
|
+
const parsed = parse(args, editUsage, editOptions, { exits: editExits });
|
|
3466
3450
|
const { values, positionals } = parsed;
|
|
3467
3451
|
const number = issueNumber(positionals[0], editUsage);
|
|
3468
3452
|
const text = await noteText({ file: values.file });
|
|
@@ -3500,15 +3484,14 @@ ${text}` : body;
|
|
|
3500
3484
|
var commentUsage = `ft comment [<n>] [text]
|
|
3501
3485
|
|
|
3502
3486
|
Posts a comment on issue <n>: the text given, -F <file>, or stdin when neither is, so a heredoc needs no escaping.
|
|
3503
|
-
Without <n> (a first argument that is not a number) it takes the one open issue this session holds (\`ft take\`), and exits 2 when it holds none or several, saying which issue it used. A first argument that is a number is always the issue, so boxes named by number need it
|
|
3504
|
-
|
|
3505
|
-
Exits 0 when it posted the comment, 1 when Forgejo refuses, 2 on a usage error.`;
|
|
3487
|
+
Without <n> (a first argument that is not a number) it takes the one open issue this session holds (\`ft take\`), and exits 2 when it holds none or several, saying which issue it used. A first argument that is a number is always the issue, so boxes named by number need it.`;
|
|
3488
|
+
var commentExits = [[0, "it posted the comment"], [1, "Forgejo refuses"], [2, "a usage error"]];
|
|
3506
3489
|
var commentOptions = {
|
|
3507
3490
|
file: noteOptions.file,
|
|
3508
3491
|
...repoOption
|
|
3509
3492
|
};
|
|
3510
3493
|
async function commentOn(args) {
|
|
3511
|
-
const parsed = parse(args, commentUsage, commentOptions);
|
|
3494
|
+
const parsed = parse(args, commentUsage, commentOptions, { exits: commentExits });
|
|
3512
3495
|
const { values, positionals } = parsed;
|
|
3513
3496
|
const { number, rest } = await targetIssue(positionals, values.repo, commentUsage);
|
|
3514
3497
|
const given = rest.join(" ") || undefined;
|
|
@@ -3527,9 +3510,8 @@ var issueUsage = `ft issue [<n>...]
|
|
|
3527
3510
|
|
|
3528
3511
|
Prints each issue: its title, state, boxes left and claim, then its description with each checklist box numbered as \`ft tick\` takes it. --open also opens each in the browser.
|
|
3529
3512
|
With --body, prints only the raw description, to edit and give back to \`ft edit -F\`.
|
|
3530
|
-
With no number, prints the open issues this session holds (\`ft take\`), and exits 2 when it holds none
|
|
3531
|
-
|
|
3532
|
-
Exits 0 when it printed them, 1 when an issue cannot be read, 2 on a usage error.`;
|
|
3513
|
+
With no number, prints the open issues this session holds (\`ft take\`), and exits 2 when it holds none.`;
|
|
3514
|
+
var issueExits = [[0, "it printed them"], [1, "an issue cannot be read"], [2, "a usage error"]];
|
|
3533
3515
|
var issueOptions = {
|
|
3534
3516
|
todo: { type: "boolean", short: "t", description: "only the header and the boxes left to tick" },
|
|
3535
3517
|
comments: { type: "boolean", short: "c", description: "add the comments, each with its author and age" },
|
|
@@ -3582,7 +3564,7 @@ function issueJson(found, comments, author) {
|
|
|
3582
3564
|
};
|
|
3583
3565
|
}
|
|
3584
3566
|
async function issue(args) {
|
|
3585
|
-
const parsed = parse(args, issueUsage, issueOptions);
|
|
3567
|
+
const parsed = parse(args, issueUsage, issueOptions, { exits: issueExits });
|
|
3586
3568
|
const { values, positionals } = parsed;
|
|
3587
3569
|
const held = positionals.length === 0 ? await heldIssues(values.repo) : [];
|
|
3588
3570
|
const numbers = held.length === 0 ? issueNumbers(positionals, issueUsage) : held;
|
|
@@ -3628,9 +3610,8 @@ async function issue(args) {
|
|
|
3628
3610
|
var usage4 = `ft logs <run id>
|
|
3629
3611
|
|
|
3630
3612
|
Prints what the failed jobs of a run say went wrong: each failed bun test's output and the end of each failed step.
|
|
3631
|
-
With no failed job it prints every job's last lines; --full prints whole logs
|
|
3632
|
-
|
|
3633
|
-
Exits 0 when it printed the logs, 1 when Forgejo cannot be read, 2 on a usage error or a job the run lacks.`;
|
|
3613
|
+
With no failed job it prints every job's last lines; --full prints whole logs.`;
|
|
3614
|
+
var EXITS3 = [[0, "it printed the logs"], [1, "Forgejo cannot be read"], [2, "a usage error or a job the run lacks"]];
|
|
3634
3615
|
var options3 = {
|
|
3635
3616
|
job: { type: "string", short: "j", description: "only this job, by name or id" },
|
|
3636
3617
|
full: { type: "boolean", short: "f", description: "the whole log, timestamps stripped" },
|
|
@@ -3644,7 +3625,7 @@ function pickJobs(jobs, wanted) {
|
|
|
3644
3625
|
return failed.length > 0 ? failed : jobs;
|
|
3645
3626
|
}
|
|
3646
3627
|
async function logs2(args) {
|
|
3647
|
-
const parsed = parse(args, usage4, options3);
|
|
3628
|
+
const parsed = parse(args, usage4, options3, { exits: EXITS3 });
|
|
3648
3629
|
const { values, positionals } = parsed;
|
|
3649
3630
|
if (positionals[0] === undefined)
|
|
3650
3631
|
fail("a run id is needed", 2, runHint("ft runs", "list them"));
|
|
@@ -3712,9 +3693,8 @@ async function printWithIssues(list, repo) {
|
|
|
3712
3693
|
}
|
|
3713
3694
|
var listUsage = `ft milestones
|
|
3714
3695
|
|
|
3715
|
-
Lists the repository's milestones, the open ones unless --state says otherwise, with the issues open and closed in each, the progress and the due date; on a terminal the progress is a bar, and --issues lists the title of every issue under its milestone
|
|
3716
|
-
|
|
3717
|
-
Exits 0 when it listed them, 1 when Forgejo refuses, 2 on a usage error.`;
|
|
3696
|
+
Lists the repository's milestones, the open ones unless --state says otherwise, with the issues open and closed in each, the progress and the due date; on a terminal the progress is a bar, and --issues lists the title of every issue under its milestone.`;
|
|
3697
|
+
var listExits = [[0, "it listed them"], [1, "Forgejo refuses"], [2, "a usage error"]];
|
|
3718
3698
|
var listOptions = {
|
|
3719
3699
|
state: { type: "string", description: "open (the default), closed or all" },
|
|
3720
3700
|
issues: { type: "boolean", short: "i", description: "list the open and closed issues of each milestone by title" },
|
|
@@ -3723,7 +3703,7 @@ var listOptions = {
|
|
|
3723
3703
|
...repoOption
|
|
3724
3704
|
};
|
|
3725
3705
|
async function milestones(args) {
|
|
3726
|
-
const parsed = parse(args, listUsage, listOptions);
|
|
3706
|
+
const parsed = parse(args, listUsage, listOptions, { exits: listExits });
|
|
3727
3707
|
const { values } = parsed;
|
|
3728
3708
|
const state = values.state ?? "open";
|
|
3729
3709
|
if (state !== "open" && state !== "closed" && state !== "all")
|
|
@@ -3751,16 +3731,15 @@ async function milestones(args) {
|
|
|
3751
3731
|
}
|
|
3752
3732
|
var newUsage2 = `ft milestone new <title> [-d <text>] [--due <YYYY-MM-DD>]
|
|
3753
3733
|
|
|
3754
|
-
Creates a milestone through the API and prints its id. Without --due it has no due date
|
|
3755
|
-
|
|
3756
|
-
Exits 0 when it created the milestone, 1 when Forgejo refuses, 2 on a usage error.`;
|
|
3734
|
+
Creates a milestone through the API and prints its id. Without --due it has no due date.`;
|
|
3735
|
+
var newExits2 = [[0, "it created the milestone"], [1, "Forgejo refuses"], [2, "a usage error"]];
|
|
3757
3736
|
var newOptions2 = {
|
|
3758
3737
|
description: { type: "string", short: "d", description: "the milestone description" },
|
|
3759
3738
|
due: { type: "string", description: "the due date, YYYY-MM-DD" },
|
|
3760
3739
|
...repoOption
|
|
3761
3740
|
};
|
|
3762
3741
|
async function create(args) {
|
|
3763
|
-
const parsed = parse(args, newUsage2, newOptions2);
|
|
3742
|
+
const parsed = parse(args, newUsage2, newOptions2, { exits: newExits2 });
|
|
3764
3743
|
const { values, positionals } = parsed;
|
|
3765
3744
|
const title = positionals.join(" ").trim();
|
|
3766
3745
|
if (title === "")
|
|
@@ -3774,15 +3753,14 @@ ${newUsage2}`);
|
|
|
3774
3753
|
}
|
|
3775
3754
|
var closeUsage2 = `ft milestone close <title|id> [--force]
|
|
3776
3755
|
|
|
3777
|
-
Closes a milestone, refused while issues are open in it, which it names. --force closes it with them left
|
|
3778
|
-
|
|
3779
|
-
Exits 0 when it closed the milestone, 1 when issues are open in it or Forgejo refuses, 2 on a usage error.`;
|
|
3756
|
+
Closes a milestone, refused while issues are open in it, which it names. --force closes it with them left.`;
|
|
3757
|
+
var closeExits2 = [[0, "it closed the milestone"], [1, "issues are open in it or Forgejo refuses"], [2, "a usage error"]];
|
|
3780
3758
|
var closeOptions = {
|
|
3781
3759
|
force: { type: "boolean", description: "close it with issues left open" },
|
|
3782
3760
|
...repoOption
|
|
3783
3761
|
};
|
|
3784
3762
|
async function closeOne(args) {
|
|
3785
|
-
const parsed = parse(args, closeUsage2, closeOptions);
|
|
3763
|
+
const parsed = parse(args, closeUsage2, closeOptions, { exits: closeExits2 });
|
|
3786
3764
|
const { values, positionals } = parsed;
|
|
3787
3765
|
const reference = positionals.join(" ").trim();
|
|
3788
3766
|
if (reference === "")
|
|
@@ -3808,16 +3786,15 @@ ft milestone new <title> [-d <text>] [--due <YYYY-MM-DD>]
|
|
|
3808
3786
|
ft milestone close <title|id> [--force]
|
|
3809
3787
|
|
|
3810
3788
|
Shows a milestone with its open issues as \`ft board\` does: available, taken by a session running here, or claimed by one gone, each with its boxes left, at most 30 of each kind (--full for all).
|
|
3811
|
-
\`ft milestone new\` and \`ft milestone close\` have their own --help; a milestone titled new or close is named by its id
|
|
3812
|
-
|
|
3813
|
-
Exits 0 when it showed the milestone, 1 when it cannot be read, 2 on a usage error or an unknown milestone.`;
|
|
3789
|
+
\`ft milestone new\` and \`ft milestone close\` have their own --help; a milestone titled new or close is named by its id.`;
|
|
3790
|
+
var showExits = [[0, "it showed the milestone"], [1, "it cannot be read"], [2, "a usage error or an unknown milestone"]];
|
|
3814
3791
|
var showOptions = {
|
|
3815
3792
|
...limitOptions(LIST_LIMIT),
|
|
3816
3793
|
json: jsonOption("the milestone (id, title, state, description, open, closed, due) and its open issues as `ft board --json` lists them"),
|
|
3817
3794
|
...repoOption
|
|
3818
3795
|
};
|
|
3819
3796
|
async function show(args) {
|
|
3820
|
-
const parsed = parse(args, showUsage, showOptions);
|
|
3797
|
+
const parsed = parse(args, showUsage, showOptions, { exits: showExits });
|
|
3821
3798
|
const { values, positionals } = parsed;
|
|
3822
3799
|
const reference = positionals.join(" ").trim();
|
|
3823
3800
|
if (reference === "")
|
|
@@ -3904,16 +3881,14 @@ var addUsage = `ft plan add <plan> <n>... [--section "Bugs:"]
|
|
|
3904
3881
|
|
|
3905
3882
|
Lists each issue <n> as \`- [ ] #<n> <title>\` in the checklist of issue <plan>, skipping those already listed.
|
|
3906
3883
|
Lines go under --section, created at the end of the body when missing, or else after the checklist's last box.
|
|
3907
|
-
The body is read again just before it is written, so an edit made meanwhile is kept
|
|
3908
|
-
|
|
3909
|
-
Exits 0 when it listed the issues, 1 when Forgejo refuses, 2 on a usage error.`;
|
|
3884
|
+
The body is read again just before it is written, so an edit made meanwhile is kept.`;
|
|
3885
|
+
var addExits = [[0, "it listed the issues"], [1, "Forgejo refuses"], [2, "a usage error"]];
|
|
3910
3886
|
var carryUsage = `ft plan carry <from> <to> [--section "Carried from 1.71.0:"]
|
|
3911
3887
|
|
|
3912
3888
|
Copies the unticked \`#<n>\` lines of issue <from> into issue <to>, skipping those <to> already lists.
|
|
3913
3889
|
Lines go under --section, created at the end of the body when missing, or else after the checklist's last box.
|
|
3914
|
-
The body is read again just before it is written, so an edit made meanwhile is kept
|
|
3915
|
-
|
|
3916
|
-
Exits 0 when it copied the lines, 1 when Forgejo refuses, 2 on a usage error.`;
|
|
3890
|
+
The body is read again just before it is written, so an edit made meanwhile is kept.`;
|
|
3891
|
+
var carryExits = [[0, "it copied the lines"], [1, "Forgejo refuses"], [2, "a usage error"]];
|
|
3917
3892
|
var options4 = {
|
|
3918
3893
|
section: { type: "string", short: "s", description: 'the heading the lines go under, e.g. "Bugs:"' },
|
|
3919
3894
|
...repoOption
|
|
@@ -3926,7 +3901,7 @@ var plan = {
|
|
|
3926
3901
|
}
|
|
3927
3902
|
};
|
|
3928
3903
|
async function add(args) {
|
|
3929
|
-
const parsed = parse(args, addUsage, options4);
|
|
3904
|
+
const parsed = parse(args, addUsage, options4, { exits: addExits });
|
|
3930
3905
|
const { section, repo } = parsed.values;
|
|
3931
3906
|
const [target, ...listed] = parsed.positionals;
|
|
3932
3907
|
const planNumber = issueNumber(target, addUsage);
|
|
@@ -3947,7 +3922,7 @@ ${addUsage}`);
|
|
|
3947
3922
|
return 0;
|
|
3948
3923
|
}
|
|
3949
3924
|
async function carry(args) {
|
|
3950
|
-
const parsed = parse(args, carryUsage, options4);
|
|
3925
|
+
const parsed = parse(args, carryUsage, options4, { exits: carryExits });
|
|
3951
3926
|
const { section, repo } = parsed.values;
|
|
3952
3927
|
const from = issueNumber(parsed.positionals[0], carryUsage);
|
|
3953
3928
|
const to = issueNumber(parsed.positionals[1], carryUsage);
|
|
@@ -3976,8 +3951,8 @@ var {$: $2 } = globalThis.Bun;
|
|
|
3976
3951
|
var usage5 = `ft watch [--after <id>]
|
|
3977
3952
|
|
|
3978
3953
|
Waits for runs to finish: those newer than run <id>, or else the ones in progress now.
|
|
3979
|
-
Prints nothing but failures and each run's final status with --quiet, and a JSON result with --json
|
|
3980
|
-
|
|
3954
|
+
Prints nothing but failures and each run's final status with --quiet, and a JSON result with --json.`;
|
|
3955
|
+
var EXITS4 = [[0, "every one passed or was skipped"], [1, "one failed or was cancelled"], [2, "a timeout or a stalled queue"]];
|
|
3981
3956
|
var options5 = {
|
|
3982
3957
|
after: { type: "string", short: "a", description: "watch the runs newer than this run id, as `ft runs --json` gives it" },
|
|
3983
3958
|
timeout: { type: "string", short: "t", description: "how long before giving up (15m), a bare number in minutes" },
|
|
@@ -4081,7 +4056,7 @@ ${run.html_url}`);
|
|
|
4081
4056
|
}
|
|
4082
4057
|
}
|
|
4083
4058
|
async function watch2(args) {
|
|
4084
|
-
const parsed = parse(args, usage5, options5);
|
|
4059
|
+
const parsed = parse(args, usage5, options5, { exits: EXITS4 });
|
|
4085
4060
|
const { values } = parsed;
|
|
4086
4061
|
const timeout = duration(values.timeout, "timeout", 15 * 60000, "m");
|
|
4087
4062
|
const json = values.json === true;
|
|
@@ -4342,8 +4317,8 @@ Cuts a release from the default branch: first the commit it sits on is pushed an
|
|
|
4342
4317
|
A refused or interrupted push drops the bump commits and their tags, so a retry starts clean; with --tagged the commit and tag are yours and stay.
|
|
4343
4318
|
Once released, an open milestone titled like the version (\`1.2.0\`, \`v1.2.0\` or the tag) has its closed issues listed and is closed; a failure there only warns.
|
|
4344
4319
|
--dry-run checks the same and prints the plan: the version bump, the tag, the pushes and the runs and registry it would wait for, changing nothing.
|
|
4345
|
-
--json prints {released, tag, package, version, status, runs, failedJobs, url} on stdout and the progress on stderr, an array of them with --package a,b or --all; it does not take --dry-run
|
|
4346
|
-
|
|
4320
|
+
--json prints {released, tag, package, version, status, runs, failedJobs, url} on stdout and the progress on stderr, an array of them with --package a,b or --all; it does not take --dry-run.`;
|
|
4321
|
+
var EXITS5 = [[0, "released or planned"], [1, "a run fails, origin refuses a push or the registry never serves the version"], [2, "a timeout, a stalled queue, a refusal before anything ran (another branch, uncommitted changes, origin ahead) or a usage error"]];
|
|
4347
4322
|
var options6 = {
|
|
4348
4323
|
tagged: { type: "boolean", description: "push the version commit and tag already at HEAD instead of bumping" },
|
|
4349
4324
|
package: { type: "string", short: "p", description: "workspace folder to release, a path or a name under packages/, several separated by commas" },
|
|
@@ -4354,7 +4329,7 @@ var options6 = {
|
|
|
4354
4329
|
json: jsonOption("what was released and how its runs ended")
|
|
4355
4330
|
};
|
|
4356
4331
|
async function release(args) {
|
|
4357
|
-
const parsed = parse(args, usage6, options6);
|
|
4332
|
+
const parsed = parse(args, usage6, options6, { exits: EXITS5 });
|
|
4358
4333
|
const { values, positionals } = parsed;
|
|
4359
4334
|
const json = values.json === true;
|
|
4360
4335
|
const say = json ? console.error : console.log;
|
|
@@ -4492,9 +4467,8 @@ var usage7 = `ft remote [--fix]
|
|
|
4492
4467
|
|
|
4493
4468
|
Checks that origin's URLs name the Forgejo host itself: tea only finds the repository when origin's host is the login's ssh_host, never through an ssh alias such as \`forgejo\` or \`gitea\`.
|
|
4494
4469
|
--fix switches every alias URL to \`git@<host>:<owner>/<repo>.git\` and proves it with \`git ls-remote\`.
|
|
4495
|
-
The host comes from --host, else \`remoteHost\` in ~/.config/kaynooo-cli/ft.json; with neither, it checks nothing
|
|
4496
|
-
|
|
4497
|
-
Exits 0 when origin names the Forgejo host (or was switched) or no host is set, 1 when it does not or a switch is still to run, 2 on a usage error.`;
|
|
4470
|
+
The host comes from --host, else \`remoteHost\` in ~/.config/kaynooo-cli/ft.json; with neither, it checks nothing.`;
|
|
4471
|
+
var EXITS6 = [[0, "origin names the Forgejo host (or was switched) or no host is set"], [1, "it does not or a switch is still to run"], [2, "a usage error"]];
|
|
4498
4472
|
var options7 = {
|
|
4499
4473
|
host: { type: "string", description: "the Forgejo ssh host, instead of remoteHost in ~/.config/kaynooo-cli/ft.json" },
|
|
4500
4474
|
fix: { type: "boolean", description: "rewrite the alias URLs" }
|
|
@@ -4528,7 +4502,7 @@ function originHost2(url) {
|
|
|
4528
4502
|
return parseSshRemote(url)?.host ?? (URL.canParse(url) ? new URL(url).hostname : undefined);
|
|
4529
4503
|
}
|
|
4530
4504
|
async function remote(args, home) {
|
|
4531
|
-
const { values } = parse(args, usage7, options7);
|
|
4505
|
+
const { values } = parse(args, usage7, options7, { exits: EXITS6 });
|
|
4532
4506
|
const host = values.host ?? (await loadSettings(home)).remoteHost;
|
|
4533
4507
|
if (host === undefined) {
|
|
4534
4508
|
note(`no Forgejo host to check origin against: pass --host, or set "remoteHost" in ${settingsPath(home)}`);
|
|
@@ -4588,9 +4562,8 @@ var usage8 = `ft runs [--sha <ref>]
|
|
|
4588
4562
|
|
|
4589
4563
|
Lists recent runs with what tea's own listing leaves empty: workflow, ref, duration and age, ten by default with the count of the rest (--full for all of them; --json is never cut unless --limit is given).
|
|
4590
4564
|
|
|
4591
|
-
--open also opens the newest run listed in the browser
|
|
4592
|
-
|
|
4593
|
-
Exits 0 when it listed them, 1 when Forgejo or git cannot be read, 2 on a usage error.`;
|
|
4565
|
+
--open also opens the newest run listed in the browser.`;
|
|
4566
|
+
var EXITS7 = [[0, "it listed them"], [1, "Forgejo or git cannot be read"], [2, "a usage error"]];
|
|
4594
4567
|
var DEFAULT_LIMIT = 10;
|
|
4595
4568
|
var options8 = {
|
|
4596
4569
|
...limitOptions(DEFAULT_LIMIT),
|
|
@@ -4606,7 +4579,7 @@ async function onCommit(sha, repo) {
|
|
|
4606
4579
|
return { runs: found, total: found.length };
|
|
4607
4580
|
}
|
|
4608
4581
|
async function runs(args) {
|
|
4609
|
-
const parsed = parse(args, usage8, options8);
|
|
4582
|
+
const parsed = parse(args, usage8, options8, { exits: EXITS7 });
|
|
4610
4583
|
const { values } = parsed;
|
|
4611
4584
|
const limit = limitOf(values, DEFAULT_LIMIT);
|
|
4612
4585
|
const { runs: found, total } = values.sha === undefined ? await runsListing(limit, values.repo, values.workflow) : await onCommit(values.sha, values.repo);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-forgejo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.29.
|
|
4
|
+
"version": "0.29.1",
|
|
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",
|