@kaynooo/cli-forgejo 0.30.4 → 0.30.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/cli.js +48 -22
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -23,9 +23,9 @@ Needs [tea](https://gitea.com/gitea/tea) logged in to the Forgejo instance (`tea
|
|
|
23
23
|
| `ft issue [<n>...]` | an issue's state, claim and description, its checklist boxes numbered in place, the issues this session holds when no number is given (`-c` comments, `-t` only the boxes left, `-b` only the raw description to edit, `--json`) |
|
|
24
24
|
| `ft new -t <title>` | creates an issue and prints its number and url; `-F <file>` (`-F -` for stdin) is the description, `-L a,b` the labels and `-m <milestone>` the milestone, refused before anything is created when the repository lacks one |
|
|
25
25
|
| `ft edit <n>` | replaces the title (`-t`) and/or the description (`-F <file>`, `-F -` for stdin); `--append` adds the `-F` text after the description instead, `--add-box <text>` (repeatable) an unticked box after the last one, `-m <milestone>` moves it to a milestone and `-m ''` takes it out |
|
|
26
|
-
| `ft tick [<n>] <box>...` | ticks boxes by number or text, `--undo` unticks, `-m <text>` or `-F <file>` comments too; `--closed` ticks instead every `- [ ] #<n>` line of a release plan whose issue is closed |
|
|
26
|
+
| `ft tick [<n>] <box>...` | ticks boxes by number or text (a text must match exactly one box, else exit 2), without `<n>` the one open issue this session holds (exit 2 when it holds none or several, saying which it used; a first argument that is a number is always the issue), `--undo` unticks, `-m <text>` or `-F <file>` comments too; `--closed` ticks instead every `- [ ] #<n>` line of a release plan whose issue is closed |
|
|
27
27
|
| `ft comment [<n>] [text]` | comments on an issue, from `-F <file>` or stdin when no text is given, so a heredoc needs no escaping |
|
|
28
|
-
| `ft fixed [<n>] [sha]...` | comments `Fixed in <a>, <b> and <c>: <subject>` and closes; with no sha it takes the commits on origin's default branch naming `#<n>` and says which; refuses while boxes are left unless `--tick` ticks them first; then ticks its `- [ ] #<n>` line in every open issue listing it, and names those |
|
|
28
|
+
| `ft fixed [<n>] [sha]...` | comments `Fixed in <a>, <b> and <c>: <subject>` and closes; with no sha it takes the commits on origin's default branch naming `#<n>` and says which; refuses while boxes are left, as a partly done issue stays open, unless `--tick` ticks them first; without `<n>` it takes the one open issue this session holds, the message defaults to the first commit's subject and falls back to HEAD when no commit names the issue; then ticks its `- [ ] #<n>` line in every open issue listing it, and names those |
|
|
29
29
|
| `ft close <n>... [-m reason]` | closes issues no commit fixed (a duplicate, one dropped), posting the reason first; `ft reopen` reopens them the same way |
|
|
30
30
|
| `ft label <n> [+]a -b` | adds the labels named bare or with `+`, removes those named with `-`, refusing one the repository lacks, and prints the issue's labels |
|
|
31
31
|
| `ft plan add <plan> <n>...` / `ft plan carry <from> <to>` | adds `- [ ] #<n> <title>` lines to a release plan's checklist, or copies one plan's unticked `#<n>` lines into the next, both under `--section "Bugs:"` (created when missing) and skipping issues already listed |
|
|
@@ -55,7 +55,7 @@ With an admin login, a queued run is checked against the runners: a job whose `r
|
|
|
55
55
|
|
|
56
56
|
## Releases
|
|
57
57
|
|
|
58
|
-
`ft release patch|minor|major` releases from the default branch. It first pushes any commits origin lacks and waits for their runs, so failing tests stop it before a tag exists that would never publish; a push starting no run within 3 minutes lets it go on. A refused push drops the bump commit and tag. A repo with its own bump script runs it, then `ft release --tagged
|
|
58
|
+
`ft release patch|minor|major` releases from the default branch. It first pushes any commits origin lacks and waits for their runs, so failing tests stop it before a tag exists that would never publish; a push starting no run within 3 minutes lets it go on. A refused push drops the bump commit and tag. A repo with its own bump script runs it, then `ft release --tagged`, which releases the version commit already tagged at HEAD; the runs waited for first are then those of the commit below it, and the commit and tag stay yours when a push is refused. In a monorepo, `ft release patch -p ft` bumps `packages/ft` alone, refreshes `bun.lock`, and commits and tags it `ft-v<version>`, so each package releases on its own. `-p` takes several folders separated by commas, each optionally with its own level after a colon (`-p ft:minor,db` bumps ft by minor and db by the level given), and `--all` every published package of the workspace: each gets its own bump commit and tag, one atomic push sends the branch with every tag, so the tests run once for all of them, and the registry is then waited for package by package, stopping at the first one it does not serve. `--dry-run` makes the same checks, then prints the bump (`1.0.0 -> 1.1.0`), the tag, whether HEAD is pushed first, the pushes and the runs and registry it would wait for, and changes nothing. With `--json` the result goes on stdout and the progress on stderr, and `--dry-run` is refused. 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.
|
|
59
59
|
|
|
60
60
|
## Issue claims
|
|
61
61
|
|
package/dist/cli.js
CHANGED
|
@@ -608,7 +608,27 @@ var init_format = __esm(() => {
|
|
|
608
608
|
// ../kit/src/help.ts
|
|
609
609
|
import process8 from "process";
|
|
610
610
|
function usageLine(usage, colors = paint(process8.stdout)) {
|
|
611
|
-
|
|
611
|
+
const lines = usage.replace(USAGE_PREFIX, "").split(`
|
|
612
|
+
`);
|
|
613
|
+
const blank = lines.indexOf("");
|
|
614
|
+
const synopses = blank === -1 ? lines : lines.slice(0, blank);
|
|
615
|
+
const details = blank === -1 ? [] : lines.slice(blank + 1);
|
|
616
|
+
const colon = synopses[0].indexOf(": ");
|
|
617
|
+
const inline = synopses[0].slice(colon + 2);
|
|
618
|
+
const summary = colon === -1 ? details.shift() : `${inline.charAt(0).toUpperCase()}${inline.slice(1)}`;
|
|
619
|
+
if (colon !== -1)
|
|
620
|
+
synopses[0] = synopses[0].slice(0, colon);
|
|
621
|
+
const head = `${colors.bold("Usage:")} ${synopses.map((line) => line.replaceAll(OPTIONAL, (part) => colors.dim(part))).join(`
|
|
622
|
+
`)}`;
|
|
623
|
+
const lead = summary === undefined ? [] : ["", colors.bold(prose(summary, colors))];
|
|
624
|
+
const rest = details.length === 0 ? [] : ["", ...details.map((line) => prose(line, colors))];
|
|
625
|
+
return [head, ...lead, ...rest].join(`
|
|
626
|
+
`);
|
|
627
|
+
}
|
|
628
|
+
function prose(line, colors) {
|
|
629
|
+
if (colors.cyan("x") === "x")
|
|
630
|
+
return line;
|
|
631
|
+
return line.replaceAll(PROSE_MARKS, (match, code, flag) => code === undefined ? colors.cyan(flag ?? match) : colors.bold(code));
|
|
612
632
|
}
|
|
613
633
|
function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [] } = {}) {
|
|
614
634
|
return [usageLine(usage, colors), "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
|
|
@@ -657,13 +677,14 @@ function optionRows(options, colors = paint(process8.stdout)) {
|
|
|
657
677
|
const width = Math.max(0, ...rows.map((row) => row.width));
|
|
658
678
|
return rows.map((row) => row.description === "" ? ` ${row.flag}` : ` ${row.flag}${" ".repeat(width - row.width)} ${colors.dim(row.description)}`);
|
|
659
679
|
}
|
|
660
|
-
var OPTIONAL, USAGE_PREFIX, FULL_STOP, MAX_INLINE_CHOICES = 24;
|
|
680
|
+
var OPTIONAL, USAGE_PREFIX, FULL_STOP, PROSE_MARKS, MAX_INLINE_CHOICES = 24;
|
|
661
681
|
var init_help = __esm(() => {
|
|
662
682
|
init_mode();
|
|
663
683
|
init_style();
|
|
664
684
|
OPTIONAL = /(?<!\x1B)\[[^\]]+\]/g;
|
|
665
685
|
USAGE_PREFIX = /^usage:\s*/i;
|
|
666
686
|
FULL_STOP = /\.$/;
|
|
687
|
+
PROSE_MARKS = /`([^`\n]+)`|(?<![\w-])(--[a-z][\w-]*|-[a-z](?![\w-]))/gi;
|
|
667
688
|
});
|
|
668
689
|
|
|
669
690
|
// ../kit/src/text.ts
|
|
@@ -932,7 +953,7 @@ function nearestOption(message, options, allowNegative) {
|
|
|
932
953
|
const meant = closest(word, known.map((flag) => flag.replace(DASHES, "")));
|
|
933
954
|
return meant === undefined ? undefined : `did you mean ${known.find((flag) => flag.replace(DASHES, "") === meant)}?`;
|
|
934
955
|
}
|
|
935
|
-
var DASHES, Exit, UsageError, HelpShown, completion, OUTPUT_OPTIONS, UNKNOWN_OPTION;
|
|
956
|
+
var DASHES, EXIT, Exit, UsageError, HelpShown, completion, OUTPUT_OPTIONS, UNKNOWN_OPTION;
|
|
936
957
|
var init_args = __esm(() => {
|
|
937
958
|
init_format();
|
|
938
959
|
init_help();
|
|
@@ -940,14 +961,21 @@ var init_args = __esm(() => {
|
|
|
940
961
|
init_help();
|
|
941
962
|
init_input();
|
|
942
963
|
DASHES = /^-+/;
|
|
964
|
+
EXIT = Symbol.for("@kaynooo/cli-kit/Exit");
|
|
943
965
|
Exit = class Exit extends Error {
|
|
944
966
|
code;
|
|
945
967
|
hint;
|
|
968
|
+
[EXIT] = true;
|
|
946
969
|
constructor(message, code, hint) {
|
|
947
970
|
super(message);
|
|
948
971
|
this.code = code;
|
|
949
972
|
this.hint = hint;
|
|
950
973
|
}
|
|
974
|
+
static [Symbol.hasInstance](value) {
|
|
975
|
+
if (this !== Exit)
|
|
976
|
+
return Function.prototype[Symbol.hasInstance].call(this, value);
|
|
977
|
+
return typeof value === "object" && value !== null && value[EXIT] === true;
|
|
978
|
+
}
|
|
951
979
|
};
|
|
952
980
|
UsageError = class UsageError extends Exit {
|
|
953
981
|
constructor(message, hint) {
|
|
@@ -1536,10 +1564,10 @@ async function pipeInto(argv, text) {
|
|
|
1536
1564
|
return false;
|
|
1537
1565
|
}
|
|
1538
1566
|
}
|
|
1539
|
-
async function runCommand(argv, { cwd, env, stdin = "ignore", timeoutMs, signal, maxBytes = Infinity, onChunk, onStart } = {}) {
|
|
1567
|
+
async function runCommand(argv, { cwd, env, stdin = "ignore", input, timeoutMs, signal, maxBytes = Infinity, onChunk, onStart } = {}) {
|
|
1540
1568
|
const chunks = [];
|
|
1541
1569
|
const grouped = timeoutMs !== undefined || signal !== undefined || onStart !== undefined || onChunk !== undefined;
|
|
1542
|
-
const proc = Bun.spawn(argv, { ...cwd === undefined ? {} : { cwd }, ...env === undefined ? {} : { env }, stdin, stdout: "pipe", stderr: "pipe", ...grouped ? { detached: true } : {} });
|
|
1570
|
+
const proc = Bun.spawn(argv, { ...cwd === undefined ? {} : { cwd }, ...env === undefined ? {} : { env }, stdin: input === undefined ? stdin : new TextEncoder().encode(input), stdout: "pipe", stderr: "pipe", ...grouped ? { detached: true } : {} });
|
|
1543
1571
|
const state = { kept: 0, truncated: false, timedOut: false, failure: undefined, done: false };
|
|
1544
1572
|
const timers = [];
|
|
1545
1573
|
const killGroup = (killing) => {
|
|
@@ -2150,10 +2178,10 @@ function flagNames(argv) {
|
|
|
2150
2178
|
const names = (end === -1 ? argv : argv.slice(0, end)).filter((word) => word.startsWith("-") && word !== "-").map((word) => word.includes("=") ? word.slice(0, word.indexOf("=")) : word);
|
|
2151
2179
|
return [...new Set(names)].filter((name) => name.length <= LONGEST_NAME && FLAG_NAME.test(name));
|
|
2152
2180
|
}
|
|
2153
|
-
function usageEntry(bin, command, argv, code, now = new Date) {
|
|
2181
|
+
function usageEntry(bin, command, argv, code, { ms, now = new Date } = {}) {
|
|
2154
2182
|
const unknown = code === 2 && usageError !== undefined ? UNKNOWN_OPTION2.exec(usageError)?.[1] : undefined;
|
|
2155
2183
|
usageError = undefined;
|
|
2156
|
-
return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown } };
|
|
2184
|
+
return { at: now.toISOString(), bin, ...command === undefined ? {} : { command }, flags: flagNames(argv), code, ...unknown === undefined ? {} : { unknown }, ...ms === undefined ? {} : { ms: Math.round(ms) } };
|
|
2157
2185
|
}
|
|
2158
2186
|
function recordUsage(entry, env = process21.env) {
|
|
2159
2187
|
if (!usageRecorded(env))
|
|
@@ -2463,7 +2491,7 @@ async function runCli(cli, argv = scriptArgs()) {
|
|
|
2463
2491
|
notifyEnd(command === undefined ? cli.name : `${cli.name} ${command}`, code, performance.now() - started);
|
|
2464
2492
|
if (cli.usage !== false) {
|
|
2465
2493
|
try {
|
|
2466
|
-
recordUsage(usageEntry(cli.name, command, argv, code));
|
|
2494
|
+
recordUsage(usageEntry(cli.name, command, argv, code, { ms: performance.now() - started }));
|
|
2467
2495
|
} catch {}
|
|
2468
2496
|
}
|
|
2469
2497
|
return code;
|
|
@@ -2674,13 +2702,15 @@ function capped(rows, limit) {
|
|
|
2674
2702
|
init_mode();
|
|
2675
2703
|
|
|
2676
2704
|
// ../kit/src/pool.ts
|
|
2677
|
-
async function pool(items, limit, task) {
|
|
2705
|
+
async function pool(items, limit, task, onDone) {
|
|
2678
2706
|
const results = Array.from({ length: items.length });
|
|
2679
2707
|
let next = 0;
|
|
2708
|
+
let done = 0;
|
|
2680
2709
|
async function worker() {
|
|
2681
2710
|
while (next < items.length) {
|
|
2682
2711
|
const index = next++;
|
|
2683
2712
|
results[index] = await task(items[index]);
|
|
2713
|
+
onDone?.(++done, items.length);
|
|
2684
2714
|
}
|
|
2685
2715
|
}
|
|
2686
2716
|
await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));
|
|
@@ -4232,7 +4262,7 @@ var tickUsage = `ft tick [<n>] <box>...
|
|
|
4232
4262
|
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.
|
|
4233
4263
|
With --closed, ticks instead every box opening with \`#<issue>\` whose issue is closed, as a release plan lists them.
|
|
4234
4264
|
|
|
4235
|
-
Without <n>
|
|
4265
|
+
Without <n> it takes the one open issue this session holds (\`ft take\`); a first argument that is a number is always the issue.`;
|
|
4236
4266
|
var tickExits = [[0, "it ticked the boxes"], [1, "Forgejo refuses"], [2, "a usage error or a box matching none or several"]];
|
|
4237
4267
|
var tickOptions = {
|
|
4238
4268
|
undo: { type: "boolean", short: "u", description: "untick them instead" },
|
|
@@ -4283,9 +4313,9 @@ ${tickUsage}`);
|
|
|
4283
4313
|
}
|
|
4284
4314
|
var fixedUsage = `ft fixed [<n>] [commit]...
|
|
4285
4315
|
|
|
4286
|
-
Comments "Fixed in <
|
|
4287
|
-
Without a commit it takes those on origin's default branch
|
|
4288
|
-
|
|
4316
|
+
Comments "Fixed in <a>, <b> and <c>: <subject>" on issue <n> and closes it.
|
|
4317
|
+
Without a commit it takes those on origin's default branch naming #<n> in their message, or HEAD when none does, and says which; without <n> it takes the one open issue this session holds (\`ft take\`).
|
|
4318
|
+
An issue with boxes left is refused unless --tick ticks them first, and every open issue listing \`- [ ] #<n>\` gets that line ticked.`;
|
|
4289
4319
|
var fixedExits = [[0, "it closed the issue"], [1, "the issue is already closed, has boxes left or Forgejo refuses"], [2, "a usage error"]];
|
|
4290
4320
|
var fixedOptions = {
|
|
4291
4321
|
message: { type: "string", short: "m", description: 'the line after "Fixed in <sha>:"' },
|
|
@@ -5360,14 +5390,10 @@ ft release <level> -p <a,b:minor,...>
|
|
|
5360
5390
|
ft release <level> --all
|
|
5361
5391
|
ft release --tagged
|
|
5362
5392
|
|
|
5363
|
-
Cuts a release from the default branch:
|
|
5364
|
-
|
|
5365
|
-
--package releases
|
|
5366
|
-
|
|
5367
|
-
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.
|
|
5368
|
-
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.
|
|
5369
|
-
--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.
|
|
5370
|
-
--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.`;
|
|
5393
|
+
Cuts a release from the default branch: waits for the runs on HEAD, bumps and tags with \`bun pm version\`, pushes, then waits for the runs and the registry.
|
|
5394
|
+
Failing tests stop it before anything is bumped or tagged, and a refused or interrupted push drops the bump commits and their tags; with --tagged the commit and tag are yours and stay.
|
|
5395
|
+
--package releases workspace packages tagged \`<folder>-v<version>\`, each with an optional level of its own (\`-p ft:minor,db\`), --all every published one, in one atomic push.
|
|
5396
|
+
Once released, an open milestone titled like the version has its closed issues listed and is closed; a failure there only warns.`;
|
|
5371
5397
|
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"]];
|
|
5372
5398
|
var options6 = {
|
|
5373
5399
|
tagged: { type: "boolean", description: "push the version commit and tag already at HEAD instead of bumping" },
|
|
@@ -5376,7 +5402,7 @@ var options6 = {
|
|
|
5376
5402
|
"no-registry": { type: "boolean", description: "do not wait for the registry to serve the new version" },
|
|
5377
5403
|
"dry-run": { type: "boolean", description: "print what the release would do, changing nothing" },
|
|
5378
5404
|
timeout: { type: "string", short: "t", description: "how long to wait for the runs (15m), a bare number in minutes" },
|
|
5379
|
-
json: jsonOption("
|
|
5405
|
+
json: jsonOption("{released, tag, package, version, status, runs, failedJobs, url} on stdout and the progress on stderr, an array with several packages; not with --dry-run")
|
|
5380
5406
|
};
|
|
5381
5407
|
async function release(args) {
|
|
5382
5408
|
const parsed = parse(args, usage6, options6, { exits: EXITS5 });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-forgejo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.30.
|
|
4
|
+
"version": "0.30.5",
|
|
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",
|
|
@@ -31,6 +31,6 @@
|
|
|
31
31
|
"@kaynooo/utils": "3.1.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@kaynooo/cli-kit": "0.
|
|
34
|
+
"@kaynooo/cli-kit": "0.45.1"
|
|
35
35
|
}
|
|
36
36
|
}
|