@kaynooo/cli-forgejo 0.11.0 → 0.12.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/README.md +3 -3
- package/dist/cli.js +30 -11
- package/package.json +1 -1
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
package/dist/cli.js
CHANGED
|
@@ -1456,7 +1456,7 @@ async function currentSession(sessions) {
|
|
|
1456
1456
|
return;
|
|
1457
1457
|
}
|
|
1458
1458
|
// package.json
|
|
1459
|
-
var version = "0.
|
|
1459
|
+
var version = "0.12.1";
|
|
1460
1460
|
|
|
1461
1461
|
// src/args.ts
|
|
1462
1462
|
var repoOption = {
|
|
@@ -2669,6 +2669,23 @@ async function issue(args) {
|
|
|
2669
2669
|
`));
|
|
2670
2670
|
return 0;
|
|
2671
2671
|
}
|
|
2672
|
+
var ISSUE_REFERENCE = /^#?\d+$/;
|
|
2673
|
+
async function chooseTarget(positionals, held, usage) {
|
|
2674
|
+
if (positionals[0] !== undefined && ISSUE_REFERENCE.test(positionals[0]))
|
|
2675
|
+
return { number: issueNumber(positionals[0], usage), rest: positionals.slice(1), defaulted: false };
|
|
2676
|
+
const [only, ...others] = await held();
|
|
2677
|
+
if (only === undefined || others.length > 0)
|
|
2678
|
+
fail(`an issue number is needed, this session holds ${only === undefined ? "none" : "several"}
|
|
2679
|
+
|
|
2680
|
+
${usage}`);
|
|
2681
|
+
return { number: only, rest: positionals, defaulted: true };
|
|
2682
|
+
}
|
|
2683
|
+
async function targetIssue(positionals, repo, usage) {
|
|
2684
|
+
const { number, rest, defaulted } = await chooseTarget(positionals, async () => heldIssues(repo), usage);
|
|
2685
|
+
if (defaulted)
|
|
2686
|
+
warn(`using #${number}, the issue this session holds`);
|
|
2687
|
+
return { number, rest };
|
|
2688
|
+
}
|
|
2672
2689
|
var noteOptions = {
|
|
2673
2690
|
message: { type: "string", short: "m", description: "comment this text on the issue" },
|
|
2674
2691
|
file: { type: "string", short: "F", description: "comment the text of this file, - for stdin" }
|
|
@@ -2777,11 +2794,13 @@ ${text}` : body;
|
|
|
2777
2794
|
console.log(`edited #${number}`);
|
|
2778
2795
|
return 0;
|
|
2779
2796
|
}
|
|
2780
|
-
var tickUsage = `ft tick <n> <box>...
|
|
2797
|
+
var tickUsage = `ft tick [<n>] <box>...
|
|
2781
2798
|
|
|
2782
2799
|
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.
|
|
2783
2800
|
With --closed, ticks instead every box opening with \`#<issue>\` whose issue is closed, as a release plan lists them.
|
|
2784
2801
|
|
|
2802
|
+
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.
|
|
2803
|
+
|
|
2785
2804
|
Exits 0 when it ticked the boxes, 1 when Forgejo refuses, 2 on a usage error or a box matching none or several.`;
|
|
2786
2805
|
var tickOptions = {
|
|
2787
2806
|
undo: { type: "boolean", short: "u", description: "untick them instead" },
|
|
@@ -2799,8 +2818,7 @@ function tickedOrFail(number, run) {
|
|
|
2799
2818
|
async function tick(args) {
|
|
2800
2819
|
const parsed = parse(args, tickUsage, tickOptions);
|
|
2801
2820
|
const { values, positionals } = parsed;
|
|
2802
|
-
const number =
|
|
2803
|
-
const picks = positionals.slice(1);
|
|
2821
|
+
const { number, rest: picks } = await targetIssue(positionals, values.repo, tickUsage);
|
|
2804
2822
|
if (values.closed === true && (picks.length > 0 || values.undo === true))
|
|
2805
2823
|
fail(`--closed takes no boxes and no --undo
|
|
2806
2824
|
|
|
@@ -2831,9 +2849,10 @@ ${tickUsage}`);
|
|
|
2831
2849
|
}
|
|
2832
2850
|
return 0;
|
|
2833
2851
|
}
|
|
2834
|
-
var commentUsage = `ft comment <n> [text]
|
|
2852
|
+
var commentUsage = `ft comment [<n>] [text]
|
|
2835
2853
|
|
|
2836
2854
|
Posts a comment on issue <n>: the text given, -F <file>, or stdin when neither is, so a heredoc needs no escaping.
|
|
2855
|
+
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.
|
|
2837
2856
|
|
|
2838
2857
|
Exits 0 when it posted the comment, 1 when Forgejo refuses, 2 on a usage error.`;
|
|
2839
2858
|
var commentOptions = {
|
|
@@ -2843,8 +2862,8 @@ var commentOptions = {
|
|
|
2843
2862
|
async function commentOn(args) {
|
|
2844
2863
|
const parsed = parse(args, commentUsage, commentOptions);
|
|
2845
2864
|
const { values, positionals } = parsed;
|
|
2846
|
-
const number =
|
|
2847
|
-
const given =
|
|
2865
|
+
const { number, rest } = await targetIssue(positionals, values.repo, commentUsage);
|
|
2866
|
+
const given = rest.join(" ") || undefined;
|
|
2848
2867
|
const text = await noteText({ message: given, file: values.file ?? (given === undefined ? "-" : undefined) });
|
|
2849
2868
|
if (text === undefined)
|
|
2850
2869
|
fail(`nothing to comment
|
|
@@ -2854,11 +2873,11 @@ ${commentUsage}`);
|
|
|
2854
2873
|
console.log(`commented on #${number}`);
|
|
2855
2874
|
return 0;
|
|
2856
2875
|
}
|
|
2857
|
-
var fixedUsage = `ft fixed <n> [commit]...
|
|
2876
|
+
var fixedUsage = `ft fixed [<n>] [commit]...
|
|
2858
2877
|
|
|
2859
2878
|
Comments "Fixed in <sha>: <message>" on issue <n> and closes it, naming each commit given as "Fixed in <a>, <b> and <c>".
|
|
2860
2879
|
Without a commit it takes those on origin's default branch whose message names #<n>, and says which, or HEAD when none does.
|
|
2861
|
-
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.
|
|
2880
|
+
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.
|
|
2862
2881
|
|
|
2863
2882
|
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.`;
|
|
2864
2883
|
var fixedOptions = {
|
|
@@ -2903,8 +2922,8 @@ async function tickListings(closed, repo) {
|
|
|
2903
2922
|
async function fixed(args) {
|
|
2904
2923
|
const parsed = parse(args, fixedUsage, fixedOptions);
|
|
2905
2924
|
const { values, positionals } = parsed;
|
|
2906
|
-
const number =
|
|
2907
|
-
const commits = await fixingCommits(number,
|
|
2925
|
+
const { number, rest } = await targetIssue(positionals, values.repo, fixedUsage);
|
|
2926
|
+
const commits = await fixingCommits(number, rest);
|
|
2908
2927
|
const found = await getIssue(number, values.repo);
|
|
2909
2928
|
if (found.state === "closed")
|
|
2910
2929
|
fail(`#${number} is already closed`, 1, runHint(`ft reopen ${number}`, "reopen it"));
|
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.12.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",
|