recess-cli 3.53.0 → 3.54.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/dist/cli.js +4 -0
- package/dist/commands/issues.js +169 -0
- package/dist/help.js +27 -0
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -33,6 +33,7 @@ import { runOnboardingCommand } from "./commands/onboarding.js";
|
|
|
33
33
|
import { runScheduleCommand, runMemoryFilesCommand, } from "./commands/safe-staff-operations.js";
|
|
34
34
|
import { runPlacementCommand } from "./commands/placement.js";
|
|
35
35
|
import { runFlagsCommand } from "./commands/flags.js";
|
|
36
|
+
import { runIssuesCommand } from "./commands/issues.js";
|
|
36
37
|
import { runRockyFreeCommand } from "./commands/rocky-free.js";
|
|
37
38
|
import { runSchoolCommand } from "./commands/school.js";
|
|
38
39
|
import { runVillageEventsCommand } from "./commands/village-events.js";
|
|
@@ -7340,6 +7341,9 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
7340
7341
|
if (noun === "flags") {
|
|
7341
7342
|
return runFlagsCommand({ parsed, api, writeCommand });
|
|
7342
7343
|
}
|
|
7344
|
+
if (noun === "issues") {
|
|
7345
|
+
return runIssuesCommand({ parsed, api, writeCommand });
|
|
7346
|
+
}
|
|
7343
7347
|
if (noun === "rocky") {
|
|
7344
7348
|
const studentId = flagString(parsed, "student", { required: true });
|
|
7345
7349
|
if (verb === "get") {
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { fs } from "../in-app.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { unwrap } from "../api.js";
|
|
4
|
+
import { flagString } from "../args.js";
|
|
5
|
+
import { CliError } from "../errors.js";
|
|
6
|
+
import { assertChoice, flagInteger, positional, } from "./shared.js";
|
|
7
|
+
const TYPES = ["bug", "feature", "request", "task"];
|
|
8
|
+
const SEVERITIES = ["minor", "major", "blocking"];
|
|
9
|
+
const STATUSES = ["open", "in_progress", "done", "wont_do"];
|
|
10
|
+
const SEARCH_STATUSES = ["active", "all", "archived", ...STATUSES];
|
|
11
|
+
/** R-1691, r-1691 or 1691 → "1691" (the route takes either). */
|
|
12
|
+
function issueNumber(context) {
|
|
13
|
+
const raw = positional(context.parsed, 2, "issue number (R-####)");
|
|
14
|
+
if (!/^(R-)?\d+$/i.test(raw)) {
|
|
15
|
+
throw new CliError("invalid_arguments", `${raw} is not an issue number: pass R-1691 or 1691.`);
|
|
16
|
+
}
|
|
17
|
+
return raw.replace(/^R-/i, "");
|
|
18
|
+
}
|
|
19
|
+
/** --body TEXT or --body-file <path>; undefined when neither is passed. */
|
|
20
|
+
async function bodyFlag(context) {
|
|
21
|
+
const text = flagString(context.parsed, "body");
|
|
22
|
+
const file = flagString(context.parsed, "body-file");
|
|
23
|
+
if (text !== undefined && file !== undefined) {
|
|
24
|
+
throw new CliError("invalid_arguments", "Pass --body or --body-file, not both.");
|
|
25
|
+
}
|
|
26
|
+
if (file === undefined)
|
|
27
|
+
return text;
|
|
28
|
+
const absolutePath = path.resolve(file);
|
|
29
|
+
const contents = await fs.readFile(absolutePath, "utf8").catch(() => null);
|
|
30
|
+
if (contents === null) {
|
|
31
|
+
throw new CliError("invalid_arguments", `--body-file is not readable: ${absolutePath}`);
|
|
32
|
+
}
|
|
33
|
+
return contents;
|
|
34
|
+
}
|
|
35
|
+
function choice(context, name, values) {
|
|
36
|
+
const raw = flagString(context.parsed, name);
|
|
37
|
+
return raw === undefined ? undefined : assertChoice(raw, values, `--${name}`);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* `recess issues` — Recess Issues (issues.recess.gg), the team tracker, for admins: search, read,
|
|
41
|
+
* create, edit, set status, archive. Writes land as you, through the tracker's own actions, so a
|
|
42
|
+
* group's children follow its status and the issue's history names you.
|
|
43
|
+
*/
|
|
44
|
+
export async function runIssuesCommand(context) {
|
|
45
|
+
const { parsed, api, writeCommand } = context;
|
|
46
|
+
const verb = parsed.positionals[1];
|
|
47
|
+
if (verb === "search") {
|
|
48
|
+
const q = parsed.positionals.slice(2).join(" ").trim() || undefined;
|
|
49
|
+
return unwrap(await api.client.GET("/admin/issues/", {
|
|
50
|
+
params: {
|
|
51
|
+
query: {
|
|
52
|
+
q,
|
|
53
|
+
status: choice(context, "status", SEARCH_STATUSES) ?? "active",
|
|
54
|
+
type: choice(context, "type", TYPES),
|
|
55
|
+
limit: flagInteger(parsed, "limit") ?? 25,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
if (verb === "get") {
|
|
61
|
+
return unwrap(await api.client.GET("/admin/issues/{number}", {
|
|
62
|
+
params: { path: { number: issueNumber(context) } },
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
if (verb === "create") {
|
|
66
|
+
const title = flagString(parsed, "title", { required: true }).trim();
|
|
67
|
+
const body = (await bodyFlag(context)) ?? "";
|
|
68
|
+
const type = choice(context, "type", TYPES) ?? "bug";
|
|
69
|
+
const severity = choice(context, "severity", SEVERITIES) ?? null;
|
|
70
|
+
const request = { title, body, type, severity };
|
|
71
|
+
// The person decides whether it's new: show what already looks like it.
|
|
72
|
+
const { issues: similar } = unwrap(await api.client.GET("/admin/issues/", {
|
|
73
|
+
params: { query: { q: `${title}\n${body}`, status: "all", limit: 5 } },
|
|
74
|
+
}));
|
|
75
|
+
return writeCommand(parsed, {
|
|
76
|
+
action: `create ${type} "${title}" in the Recess Issues Backlog, as you`,
|
|
77
|
+
target: { tracker: "issues.recess.gg" },
|
|
78
|
+
request,
|
|
79
|
+
details: {
|
|
80
|
+
similar: similar.map((i) => `${i.key} [${i.archived ? "archived" : i.status}] ${i.title}`),
|
|
81
|
+
consequences: [
|
|
82
|
+
similar.length > 0
|
|
83
|
+
? "Check `similar`: if one is the same thing, update it instead of creating a duplicate."
|
|
84
|
+
: "Nothing similar found.",
|
|
85
|
+
],
|
|
86
|
+
reverse: "`issues archive <R-number>`",
|
|
87
|
+
},
|
|
88
|
+
}, async () => unwrap(await api.client.POST("/admin/issues/", { body: request })));
|
|
89
|
+
}
|
|
90
|
+
if (verb === "update" || verb === "archive" || verb === "unarchive") {
|
|
91
|
+
const number = issueNumber(context);
|
|
92
|
+
const { issue: before, children } = unwrap(await api.client.GET("/admin/issues/{number}", {
|
|
93
|
+
params: { path: { number } },
|
|
94
|
+
}));
|
|
95
|
+
const patch = {};
|
|
96
|
+
if (verb === "update") {
|
|
97
|
+
const title = flagString(parsed, "title")?.trim();
|
|
98
|
+
if (title)
|
|
99
|
+
patch.title = title;
|
|
100
|
+
const body = await bodyFlag(context);
|
|
101
|
+
if (body !== undefined)
|
|
102
|
+
patch.body = body;
|
|
103
|
+
const type = choice(context, "type", TYPES);
|
|
104
|
+
if (type)
|
|
105
|
+
patch.type = type;
|
|
106
|
+
const severity = choice(context, "severity", [...SEVERITIES, "none"]);
|
|
107
|
+
if (severity)
|
|
108
|
+
patch.severity = severity === "none" ? null : severity;
|
|
109
|
+
const status = choice(context, "status", STATUSES);
|
|
110
|
+
if (status)
|
|
111
|
+
patch.status = status;
|
|
112
|
+
if (Object.keys(patch).length === 0) {
|
|
113
|
+
throw new CliError("invalid_arguments", "Pass at least one of --title, --body, --body-file, --type, --severity, --status.");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else if (verb === "archive") {
|
|
117
|
+
if (before.archived)
|
|
118
|
+
return { issue: before, status: "unchanged" };
|
|
119
|
+
patch.status = "archived";
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
if (!before.archived)
|
|
123
|
+
return { issue: before, status: "unchanged" };
|
|
124
|
+
// Picking its own status again brings an archived issue back.
|
|
125
|
+
patch.status = before.status;
|
|
126
|
+
}
|
|
127
|
+
const group = !!patch.status && before.status !== patch.status && children.length > 0;
|
|
128
|
+
const consequences = [
|
|
129
|
+
...(patch.status === "archived"
|
|
130
|
+
? ["Hidden from every list; a new matching report brings it back."]
|
|
131
|
+
: []),
|
|
132
|
+
...(patch.status === "done"
|
|
133
|
+
? [
|
|
134
|
+
"Done: kids who reported a fixed bug (or posted a built idea) are paid coins on Friday, unless it's archived first.",
|
|
135
|
+
]
|
|
136
|
+
: []),
|
|
137
|
+
...(group
|
|
138
|
+
? [
|
|
139
|
+
"This is a group: its children (except safety reports) get the same status.",
|
|
140
|
+
]
|
|
141
|
+
: []),
|
|
142
|
+
];
|
|
143
|
+
return writeCommand(parsed, {
|
|
144
|
+
action: verb === "archive"
|
|
145
|
+
? `archive ${before.key}, as you`
|
|
146
|
+
: verb === "unarchive"
|
|
147
|
+
? `bring ${before.key} back from the archive, as you`
|
|
148
|
+
: `update ${before.key}, as you`,
|
|
149
|
+
target: { issue: before.key, url: before.url },
|
|
150
|
+
request: patch,
|
|
151
|
+
details: {
|
|
152
|
+
current: {
|
|
153
|
+
title: before.title,
|
|
154
|
+
type: before.type,
|
|
155
|
+
status: before.status,
|
|
156
|
+
severity: before.severity,
|
|
157
|
+
archived: before.archived,
|
|
158
|
+
...(patch.body !== undefined ? { body: before.body } : {}),
|
|
159
|
+
},
|
|
160
|
+
...(consequences.length > 0 ? { consequences } : {}),
|
|
161
|
+
},
|
|
162
|
+
}, async () => unwrap(await api.client.PATCH("/admin/issues/{number}", {
|
|
163
|
+
params: { path: { number } },
|
|
164
|
+
body: patch,
|
|
165
|
+
})));
|
|
166
|
+
}
|
|
167
|
+
throw new CliError("invalid_arguments", "Use issues search|get|create|update|archive|unarchive.");
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=issues.js.map
|
package/dist/help.js
CHANGED
|
@@ -751,6 +751,16 @@ Usage:
|
|
|
751
751
|
recess [--json] flags remove <key> [--user <id,...>] [--email <email,...>] [--role <ROLE,...>]
|
|
752
752
|
[--confirm]
|
|
753
753
|
recess [--json] flags delete <key> [--confirm]
|
|
754
|
+
recess [--json] issues search [<text>...] [--status active|all|archived|open|in_progress|done|wont_do]
|
|
755
|
+
[--type bug|feature|request|task] [--limit N]
|
|
756
|
+
recess [--json] issues get <R-number>
|
|
757
|
+
recess [--json] issues create --title TEXT [--body TEXT] [--body-file <path.md>]
|
|
758
|
+
[--type bug|feature|request|task] [--severity minor|major|blocking] [--confirm]
|
|
759
|
+
recess [--json] issues update <R-number> [--title TEXT] [--body TEXT] [--body-file <path.md>]
|
|
760
|
+
[--type bug|feature|request|task] [--severity minor|major|blocking|none]
|
|
761
|
+
[--status open|in_progress|done|wont_do] [--confirm]
|
|
762
|
+
recess [--json] issues archive <R-number> [--confirm]
|
|
763
|
+
recess [--json] issues unarchive <R-number> [--confirm]
|
|
754
764
|
recess [--json] tutor-templates list [--q TEXT] [--subject TEXT] [--grade N]
|
|
755
765
|
recess [--json] tutor-templates get <slug>
|
|
756
766
|
recess [--json] tutor-templates assign <slug> [--student <kid-id>] [--confirm]
|
|
@@ -929,6 +939,16 @@ account — the confirmed write's own response is the record of what changed.
|
|
|
929
939
|
without +country is read as US), rejects invalid or already-taken numbers, and
|
|
930
940
|
marks the new number unverified until the user's next phone sign-in.
|
|
931
941
|
|
|
942
|
+
Recess Issues (issues.recess.gg), admins only: "issues search" matches keywords
|
|
943
|
+
and meaning (no text lists the newest open and in-progress issues); --status
|
|
944
|
+
active is the default. "issues get" adds reports, the latest comments and
|
|
945
|
+
changes, and a group's children. Writes land as you, through the tracker's own
|
|
946
|
+
actions: "create" goes to the Backlog and never merges (its preview lists
|
|
947
|
+
similar issues, so update one instead of filing a duplicate); "update --status"
|
|
948
|
+
on a group moves its children too (never safety reports); done pays reporting
|
|
949
|
+
kids coins on Friday; "archive" hides it from every list until a new matching
|
|
950
|
+
report brings it back.
|
|
951
|
+
|
|
932
952
|
"users birthday set" corrects any kid's birthday, e.g. a wrong-century year that
|
|
933
953
|
makes "users get" show age 115 ("kid set-profile" reaches only your own kids).
|
|
934
954
|
The preview shows the age before and after, and warns outside ages 3 to 21. The
|
|
@@ -1760,6 +1780,12 @@ export const COMMAND_SUMMARIES = {
|
|
|
1760
1780
|
"flags add": "Turn a flag on for more users, emails or roles.",
|
|
1761
1781
|
"flags remove": "Stop targeting users, emails or roles with a flag.",
|
|
1762
1782
|
"flags delete": "Delete a feature flag.",
|
|
1783
|
+
"issues search": "Search or list Recess Issues (issues.recess.gg).",
|
|
1784
|
+
"issues get": "Read one issue: reports, comments, changes, children.",
|
|
1785
|
+
"issues create": "File an issue in the Backlog, as you.",
|
|
1786
|
+
"issues update": "Edit an issue or set its status, as you.",
|
|
1787
|
+
"issues archive": "Archive an issue (hidden from every list).",
|
|
1788
|
+
"issues unarchive": "Bring an archived issue back.",
|
|
1763
1789
|
"tutor-templates list": "List tutor templates.",
|
|
1764
1790
|
"tutor-templates get": "Read one tutor template.",
|
|
1765
1791
|
"tutor-templates assign": "Assign a tutor template to a kid.",
|
|
@@ -1850,6 +1876,7 @@ export const NOUN_SUMMARIES = {
|
|
|
1850
1876
|
memories: "Kid memory files and the context Rocky sees.",
|
|
1851
1877
|
rocky: "A kid's Rocky personality settings; free Rocky grants and budgets.",
|
|
1852
1878
|
flags: "Feature flags: on/off, everyone, and who they target by user, email or role.",
|
|
1879
|
+
issues: "Recess Issues (issues.recess.gg): search, get, create, update, archive.",
|
|
1853
1880
|
"tutor-templates": "Tutor templates and their assignment to kids.",
|
|
1854
1881
|
"library-books": "Book library: search the web, add and delete books, read status, reader stages, tags.",
|
|
1855
1882
|
"math-curricula": "Math curricula and the goals a math review assigns (ADMIN, GUIDE).",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "recess-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.54.0",
|
|
4
4
|
"description": "Safe Recess administration and family AI tools from the command line.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"oxlint-tsgolint": "^0.6.0",
|
|
47
47
|
"typescript": "^5.9.2",
|
|
48
48
|
"vitest": "^1.6.0",
|
|
49
|
-
"@tryrecess/
|
|
50
|
-
"@tryrecess/
|
|
49
|
+
"@tryrecess/typescript-config": "0.0.0",
|
|
50
|
+
"@tryrecess/api-types": "0.0.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "node node_modules/@tryrecess/typescript-config/bin/tsc-fast.mjs",
|