@kaynooo/cli-forgejo 0.11.0 → 0.12.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/README.md +3 -3
- package/dist/cli.js +24 -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.0";
|
|
1460
1460
|
|
|
1461
1461
|
// src/args.ts
|
|
1462
1462
|
var repoOption = {
|
|
@@ -2669,6 +2669,17 @@ async function issue(args) {
|
|
|
2669
2669
|
`));
|
|
2670
2670
|
return 0;
|
|
2671
2671
|
}
|
|
2672
|
+
var ISSUE_REFERENCE = /^#?\d+$/;
|
|
2673
|
+
async function targetIssue(positionals, repo, usage) {
|
|
2674
|
+
if (positionals[0] !== undefined && ISSUE_REFERENCE.test(positionals[0]))
|
|
2675
|
+
return { number: issueNumber(positionals[0], usage), rest: positionals.slice(1) };
|
|
2676
|
+
const [only, ...others] = await heldIssues(repo);
|
|
2677
|
+
if (only === undefined || others.length > 0)
|
|
2678
|
+
fail(`${only === undefined ? "an issue number is needed, this session holds none" : "an issue number is needed, this session holds several"}
|
|
2679
|
+
|
|
2680
|
+
${usage}`);
|
|
2681
|
+
return { number: only, rest: positionals };
|
|
2682
|
+
}
|
|
2672
2683
|
var noteOptions = {
|
|
2673
2684
|
message: { type: "string", short: "m", description: "comment this text on the issue" },
|
|
2674
2685
|
file: { type: "string", short: "F", description: "comment the text of this file, - for stdin" }
|
|
@@ -2777,11 +2788,13 @@ ${text}` : body;
|
|
|
2777
2788
|
console.log(`edited #${number}`);
|
|
2778
2789
|
return 0;
|
|
2779
2790
|
}
|
|
2780
|
-
var tickUsage = `ft tick <n> <box>...
|
|
2791
|
+
var tickUsage = `ft tick [<n>] <box>...
|
|
2781
2792
|
|
|
2782
2793
|
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
2794
|
With --closed, ticks instead every box opening with \`#<issue>\` whose issue is closed, as a release plan lists them.
|
|
2784
2795
|
|
|
2796
|
+
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.
|
|
2797
|
+
|
|
2785
2798
|
Exits 0 when it ticked the boxes, 1 when Forgejo refuses, 2 on a usage error or a box matching none or several.`;
|
|
2786
2799
|
var tickOptions = {
|
|
2787
2800
|
undo: { type: "boolean", short: "u", description: "untick them instead" },
|
|
@@ -2799,8 +2812,7 @@ function tickedOrFail(number, run) {
|
|
|
2799
2812
|
async function tick(args) {
|
|
2800
2813
|
const parsed = parse(args, tickUsage, tickOptions);
|
|
2801
2814
|
const { values, positionals } = parsed;
|
|
2802
|
-
const number =
|
|
2803
|
-
const picks = positionals.slice(1);
|
|
2815
|
+
const { number, rest: picks } = await targetIssue(positionals, values.repo, tickUsage);
|
|
2804
2816
|
if (values.closed === true && (picks.length > 0 || values.undo === true))
|
|
2805
2817
|
fail(`--closed takes no boxes and no --undo
|
|
2806
2818
|
|
|
@@ -2831,9 +2843,10 @@ ${tickUsage}`);
|
|
|
2831
2843
|
}
|
|
2832
2844
|
return 0;
|
|
2833
2845
|
}
|
|
2834
|
-
var commentUsage = `ft comment <n> [text]
|
|
2846
|
+
var commentUsage = `ft comment [<n>] [text]
|
|
2835
2847
|
|
|
2836
2848
|
Posts a comment on issue <n>: the text given, -F <file>, or stdin when neither is, so a heredoc needs no escaping.
|
|
2849
|
+
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.
|
|
2837
2850
|
|
|
2838
2851
|
Exits 0 when it posted the comment, 1 when Forgejo refuses, 2 on a usage error.`;
|
|
2839
2852
|
var commentOptions = {
|
|
@@ -2843,8 +2856,8 @@ var commentOptions = {
|
|
|
2843
2856
|
async function commentOn(args) {
|
|
2844
2857
|
const parsed = parse(args, commentUsage, commentOptions);
|
|
2845
2858
|
const { values, positionals } = parsed;
|
|
2846
|
-
const number =
|
|
2847
|
-
const given =
|
|
2859
|
+
const { number, rest } = await targetIssue(positionals, values.repo, commentUsage);
|
|
2860
|
+
const given = rest.join(" ") || undefined;
|
|
2848
2861
|
const text = await noteText({ message: given, file: values.file ?? (given === undefined ? "-" : undefined) });
|
|
2849
2862
|
if (text === undefined)
|
|
2850
2863
|
fail(`nothing to comment
|
|
@@ -2854,11 +2867,11 @@ ${commentUsage}`);
|
|
|
2854
2867
|
console.log(`commented on #${number}`);
|
|
2855
2868
|
return 0;
|
|
2856
2869
|
}
|
|
2857
|
-
var fixedUsage = `ft fixed <n> [commit]...
|
|
2870
|
+
var fixedUsage = `ft fixed [<n>] [commit]...
|
|
2858
2871
|
|
|
2859
2872
|
Comments "Fixed in <sha>: <message>" on issue <n> and closes it, naming each commit given as "Fixed in <a>, <b> and <c>".
|
|
2860
2873
|
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.
|
|
2874
|
+
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
2875
|
|
|
2863
2876
|
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
2877
|
var fixedOptions = {
|
|
@@ -2903,8 +2916,8 @@ async function tickListings(closed, repo) {
|
|
|
2903
2916
|
async function fixed(args) {
|
|
2904
2917
|
const parsed = parse(args, fixedUsage, fixedOptions);
|
|
2905
2918
|
const { values, positionals } = parsed;
|
|
2906
|
-
const number =
|
|
2907
|
-
const commits = await fixingCommits(number,
|
|
2919
|
+
const { number, rest } = await targetIssue(positionals, values.repo, fixedUsage);
|
|
2920
|
+
const commits = await fixingCommits(number, rest);
|
|
2908
2921
|
const found = await getIssue(number, values.repo);
|
|
2909
2922
|
if (found.state === "closed")
|
|
2910
2923
|
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.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",
|