@retasc/cli 1.24.0 → 1.25.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/CHANGELOG.md +11 -0
- package/dist/commands/invite.js +76 -7
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,17 @@ release commits and the issues they reference.
|
|
|
6
6
|
|
|
7
7
|
Dates are the npm publish date. Each entry names the RTSC issue behind it.
|
|
8
8
|
|
|
9
|
+
## 1.25.0 (2026-08-19)
|
|
10
|
+
|
|
11
|
+
- **RTSC-669** — the invite project picker takes several projects. 1.24.0 shipped it
|
|
12
|
+
single-select, which left "two of these four" expressible nowhere: the workaround —
|
|
13
|
+
repeating `--project-id` — needs ids that nothing in the CLI lists, which is the gap
|
|
14
|
+
the picker existed to close. Answer `2,4` (or `2 4`) and the invite grants exactly
|
|
15
|
+
those. Naming every project collapses to all projects, so the grant follows the org as
|
|
16
|
+
it grows rather than freezing today's list. `1) All projects` can't be combined with
|
|
17
|
+
individual ones: that's a contradiction about the widest grant there is, so it re-asks
|
|
18
|
+
instead of guessing which half you meant.
|
|
19
|
+
|
|
9
20
|
## 1.24.0 (2026-08-19)
|
|
10
21
|
|
|
11
22
|
- **RTSC-667** — `retasc members invite` asks instead of demanding ids. It used to
|
package/dist/commands/invite.js
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
import { cliError } from "../api.js";
|
|
2
2
|
import { pickExisting, isInteractive, ask } from "./bind.js";
|
|
3
3
|
import { clean } from "../lib/text.js";
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Parse an answer to the multi-select prompt into 1-based positions (RTSC-669).
|
|
6
|
+
*
|
|
7
|
+
* Exported for its tests: this is the whole of the input rule, and the rule is the part
|
|
8
|
+
* that goes wrong. Returns null for anything that isn't a clean selection, so every
|
|
9
|
+
* rejection re-prompts rather than resolving to a subset of what was typed — picking
|
|
10
|
+
* SOME of the projects somebody listed is worse than picking none, because they would
|
|
11
|
+
* never see which ones went missing.
|
|
12
|
+
*
|
|
13
|
+
* `max` is the highest offerable position.
|
|
14
|
+
*/
|
|
15
|
+
export function parseSelection(answer, max) {
|
|
16
|
+
const tokens = answer.split(/[\s,]+/).filter(Boolean);
|
|
17
|
+
if (!tokens.length)
|
|
18
|
+
return null;
|
|
19
|
+
const out = [];
|
|
20
|
+
for (const t of tokens) {
|
|
21
|
+
// Digits ONLY. `Number()` alone accepts "0x4", "4e0", "+4" and "4.0", and RTSC-269
|
|
22
|
+
// is the record of what happens when a non-canonical spelling reaches a branch it
|
|
23
|
+
// was never meant to: a typo picked the destructive option instead of re-asking.
|
|
24
|
+
if (!/^\d+$/.test(t))
|
|
25
|
+
return null;
|
|
26
|
+
const n = Number(t);
|
|
27
|
+
if (n < 1 || n > max)
|
|
28
|
+
return null;
|
|
29
|
+
if (!out.includes(n))
|
|
30
|
+
out.push(n); // "2,2" is a typo, not a double selection
|
|
31
|
+
}
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
7
34
|
/**
|
|
8
35
|
* Which org is this invite for?
|
|
9
36
|
*
|
|
@@ -31,9 +58,22 @@ export async function chooseInviteOrg(orgs, opts = {}) {
|
|
|
31
58
|
/**
|
|
32
59
|
* Which projects may the invitee reach? `undefined` ⇒ every project.
|
|
33
60
|
*
|
|
61
|
+
* MULTI-select (RTSC-669), because the data model always was: `projectIds` is an array
|
|
62
|
+
* and the Dash modal has picked any combination since RTSC-665. Shipping a single-select
|
|
63
|
+
* picker here left "two of these four" expressible nowhere — the documented workaround,
|
|
64
|
+
* repeating `--project-id`, needs ids that nothing in the CLI lists, which is the very
|
|
65
|
+
* gap the picker was added to close.
|
|
66
|
+
*
|
|
67
|
+
* Hand-rolled rather than widened out of `choose`/`pickExisting`: those are single-select
|
|
68
|
+
* by contract and `bind`, `join` and the identity prompt all rely on it. Teaching them to
|
|
69
|
+
* return "one or many" would put that ambiguity into every picker in the product to serve
|
|
70
|
+
* one caller.
|
|
71
|
+
*
|
|
34
72
|
* The menu's FIRST entry is "All projects" — an explicit option, never the thing you
|
|
35
|
-
* get by not answering
|
|
36
|
-
*
|
|
73
|
+
* get by not answering, and never combinable with the others (that is a contradiction
|
|
74
|
+
* about the widest grant there is, so it re-prompts rather than resolving). Handing
|
|
75
|
+
* someone the whole org should be a choice somebody made; that is the same call the
|
|
76
|
+
* Dash's invite form makes, for the same reason.
|
|
37
77
|
*
|
|
38
78
|
* Two cases skip the question and mean "every project", which is what this command has
|
|
39
79
|
* always done when no project was named:
|
|
@@ -47,6 +87,35 @@ export async function chooseInviteProjects(projects, opts = {}) {
|
|
|
47
87
|
const interactive = opts.interactive ?? isInteractive();
|
|
48
88
|
if (!interactive)
|
|
49
89
|
return undefined;
|
|
50
|
-
const
|
|
51
|
-
|
|
90
|
+
const askFn = opts.askFn ?? ask;
|
|
91
|
+
console.log("\nWhich projects can they see:");
|
|
92
|
+
console.log(" 1) All projects");
|
|
93
|
+
projects.forEach((p, i) => console.log(` ${i + 2}) ${clean(p.name)}`));
|
|
94
|
+
const max = projects.length + 1;
|
|
95
|
+
// Three attempts then abort, the cap `choose` uses: an EOF stdin returns "" forever,
|
|
96
|
+
// and a prompt that re-asks forever is a hang rather than a failure.
|
|
97
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
98
|
+
const picked = parseSelection(await askFn("Choose a number, or several (e.g. 2,4): "), max);
|
|
99
|
+
if (!picked) {
|
|
100
|
+
console.log(`Please enter numbers between 1 and ${max}, separated by commas.`);
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const wantsAll = picked.includes(1);
|
|
104
|
+
if (wantsAll && picked.length > 1) {
|
|
105
|
+
// Not resolvable either way, so it must not be resolved. "All projects AND
|
|
106
|
+
// Marketing" is a contradiction about the widest grant in the product, and
|
|
107
|
+
// guessing which half they meant is how someone hands over an org by accident.
|
|
108
|
+
console.log("1) All projects can't be combined with individual projects. Pick one or the other.");
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (wantsAll)
|
|
112
|
+
return undefined;
|
|
113
|
+
const chosen = picked.map((n) => projects[n - 2]);
|
|
114
|
+
// Naming every project IS "all projects", and storing it as a list would freeze the
|
|
115
|
+
// grant at today's set — a project added next month would be missing from a scope
|
|
116
|
+
// its author chose as everything. `normalizeInviteScope` collapses this server-side
|
|
117
|
+
// too; doing it here as well keeps the confirmation honest about what was granted.
|
|
118
|
+
return chosen.length === projects.length ? undefined : chosen.map((p) => p.id);
|
|
119
|
+
}
|
|
120
|
+
throw new Error("no valid choice — aborting");
|
|
52
121
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retasc/cli",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Retasc CLI
|
|
3
|
+
"version": "1.25.0",
|
|
4
|
+
"description": "Retasc CLI \u2014 the issue tracker AI agents pull work from. Sign in with GitHub or Google, create projects, mint agent API keys, and wire your agent to the Retasc MCP server in one command.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"retasc": "dist/index.js"
|