recess-cli 3.52.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 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") {
@@ -54,6 +54,7 @@ export const FAMILY_REMOTE_READS = [
54
54
  "kid logins",
55
55
  "kid map-scores",
56
56
  "kid evidence",
57
+ "kid rooms",
57
58
  "kid screenshots",
58
59
  "kid send-screenshot",
59
60
  "kid moments",
@@ -313,6 +314,7 @@ const FAMILY_COMMANDS = new Set([
313
314
  "kid logins",
314
315
  "kid map-scores",
315
316
  "kid evidence",
317
+ "kid rooms",
316
318
  "kid screenshots",
317
319
  "kid send-screenshot",
318
320
  "kid moments",
@@ -865,13 +865,19 @@ export async function runFamilyCommand({ parsed, api, writeCommand, }) {
865
865
  const kid = hasFlag(parsed, "student")
866
866
  ? await resolveFamilyKid(api, parsed)
867
867
  : kids[0];
868
- const body = { text, ...(ask ? { ask } : {}), studentId: kid.id };
868
+ const eventId = flagUuid(parsed, "event");
869
+ const body = {
870
+ text,
871
+ ...(ask ? { ask } : {}),
872
+ studentId: kid.id,
873
+ ...(eventId ? { eventId } : {}),
874
+ };
869
875
  return writeCommand(parsed, {
870
- action: `message ${kidName(kid)}'s guide: "${text.slice(0, 120)}"`,
876
+ action: `message ${eventId ? `the teacher of ${kidName(kid)}'s class` : `${kidName(kid)}'s guide`}: "${text.slice(0, 120)}"`,
871
877
  target: { family: "@me", ...kidTarget(kid) },
872
878
  request: body,
873
879
  details: {
874
- consequence: "The guide gets a support ticket, plus a message on Slack and in your chat with them in the Recess app, and answers there. It can't be unsent.",
880
+ consequence: `${eventId ? "The class's teacher" : "The guide"} gets a support ticket, plus a message on Slack and in your chat with them in the Recess app, and answers there. It can't be unsent.`,
875
881
  },
876
882
  }, async () => unwrap(await api.client.POST("/parent-v2/message-guide/", { body })));
877
883
  }
@@ -1878,6 +1884,35 @@ export async function runKidCommand({ parsed, api, writeCommand, }) {
1878
1884
  },
1879
1885
  }));
1880
1886
  }
1887
+ if (verb === "rooms") {
1888
+ const sessionId = flagUuid(parsed, "session");
1889
+ const search = flagString(parsed, "search")?.trim();
1890
+ if (!sessionId) {
1891
+ if (hasFlag(parsed, "ask") || hasFlag(parsed, "page"))
1892
+ throw new CliError("invalid_arguments", "--ask and --page read one room: pass --session (ids from kid rooms).");
1893
+ const days = flagInteger(parsed, "days", { min: 1, max: 60 });
1894
+ return unwrap(await api.client.GET("/parent-v2/kid/{kidId}/rooms/", {
1895
+ params: {
1896
+ path: { kidId },
1897
+ query: { ...(days ? { days } : {}), ...(search ? { search } : {}) },
1898
+ },
1899
+ }));
1900
+ }
1901
+ const ask = flagString(parsed, "ask")?.trim();
1902
+ if (ask && search)
1903
+ throw new CliError("invalid_arguments", "Pass --ask or --search, not both.");
1904
+ const page = flagInteger(parsed, "page", { min: 1, max: 500 });
1905
+ return unwrap(await api.client.GET("/parent-v2/kid/{kidId}/rooms/{sessionId}/", {
1906
+ params: {
1907
+ path: { kidId, sessionId },
1908
+ query: {
1909
+ ...(page ? { page } : {}),
1910
+ ...(search ? { search } : {}),
1911
+ ...(ask ? { ask } : {}),
1912
+ },
1913
+ },
1914
+ }));
1915
+ }
1881
1916
  if (verb === "screenshots") {
1882
1917
  const todoId = flagUuid(parsed, "todo", { required: true });
1883
1918
  const frames = flagString(parsed, "frames")?.trim();
@@ -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
@@ -246,7 +246,8 @@ Usage:
246
246
  recess [--json] family memory rewrite --in family|me --text TEXT [--confirm]
247
247
  recess [--json] family memory forget --in journal|family|me --line TEXT
248
248
  [--date YYYY-MM-DD] [--confirm]
249
- recess [--json] family message-guide --text TEXT [--ask TEXT] [--student <kid>] [--confirm]
249
+ recess [--json] family message-guide --text TEXT [--ask TEXT] [--student <kid>] [--event <event-id>]
250
+ [--confirm]
250
251
  recess [--json] family report-bug --text TEXT [--summary TEXT] [--kind bug|request] [--student <kid>]
251
252
  [--todo <todo-id>] [--confirm]
252
253
  recess [--json] kid today --student <kid> [--date YYYY-MM-DD]
@@ -303,6 +304,8 @@ Usage:
303
304
  [--confirm]
304
305
  recess [--json] kid set-goal-coins --student <kid> --goal <goal-id> --value 0-20|default [--confirm]
305
306
  recess [--json] kid evidence --student <kid> --todo <todo-id> [--search TEXT]
307
+ recess [--json] kid rooms --student <kid> [--days 1-60] [--session <session-id>] [--page N]
308
+ [--search TEXT] [--ask TEXT]
306
309
  recess [--json] kid screenshots --student <kid> --todo <todo-id> [--frames 269,280]
307
310
  recess [--json] kid send-screenshot --student <kid> --todo <todo-id> --frames 269,280
308
311
  [--caption TEXT] [--confirm]
@@ -748,6 +751,16 @@ Usage:
748
751
  recess [--json] flags remove <key> [--user <id,...>] [--email <email,...>] [--role <ROLE,...>]
749
752
  [--confirm]
750
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]
751
764
  recess [--json] tutor-templates list [--q TEXT] [--subject TEXT] [--grade N]
752
765
  recess [--json] tutor-templates get <slug>
753
766
  recess [--json] tutor-templates assign <slug> [--student <kid-id>] [--confirm]
@@ -926,6 +939,16 @@ account — the confirmed write's own response is the record of what changed.
926
939
  without +country is read as US), rejects invalid or already-taken numbers, and
927
940
  marks the new number unverified until the user's next phone sign-in.
928
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
+
929
952
  "users birthday set" corrects any kid's birthday, e.g. a wrong-century year that
930
953
  makes "users get" show age 115 ("kid set-profile" reaches only your own kids).
931
954
  The preview shows the age before and after, and warns outside ages 3 to 21. The
@@ -1435,7 +1458,7 @@ export const COMMAND_SUMMARIES = {
1435
1458
  "family memory save": "Save one line to Rocky's family notes, with your name (at once).",
1436
1459
  "family memory rewrite": "Replace family.md or your own notes whole, tidied (at once).",
1437
1460
  "family memory forget": "Forget one exact line of the family notes (at once).",
1438
- "family message-guide": "Message your kid's guide (a support ticket; Rocky tells them in the app and on Slack); the person for anything. --text is the full note, kept on the ticket; --ask is what the guide is sent: who asked, what they want and the one fact the guide needs, in a line or two (200 characters). Always pass --ask.",
1461
+ "family message-guide": "Message your kid's guide (a support ticket; Rocky tells them in the app and on Slack); the person for anything. --text is the full note, kept on the ticket; --ask is what the guide is sent: who asked, what they want and the one fact the guide needs, in a line or two (200 characters). Always pass --ask. --event (a class session, from kid schedule, attendance or rooms) sends it to that class's teachers instead of the kid's guide: for a question about one class.",
1439
1462
  "family report-bug": "Report a bug, or a request (--kind request: something missing, or what you think of Rocky), to the Recess team (at once; not a change).",
1440
1463
  "family remind": "Have Rocky text you a reminder (applies at once).",
1441
1464
  "family reminders": "Your upcoming text-me reminders.",
@@ -1492,6 +1515,7 @@ export const COMMAND_SUMMARIES = {
1492
1515
  "kid set-challenge-order": "Set the order a kid's challenges run in; their to-dos follow it (at once).",
1493
1516
  "kid set-goal-coins": "Coins each of one challenge's to-dos pays, 0-20 or default, fixed (at once; tutors too).",
1494
1517
  "kid evidence": "What one to-do's session record shows: analysis, stretches, frame numbers.",
1518
+ "kid rooms": "The live rooms and classes a kid was in, and what was said: --session reads one's transcript a page at a time, --search the lines around a word, --ask an answer from the whole class.",
1495
1519
  "kid screenshots": "Links to up to five session screenshots of one to-do.",
1496
1520
  "kid send-screenshot": "Show a parent session screenshots: pictures on a Rocky text, links elsewhere.",
1497
1521
  "kid create-challenge": "A private fixed challenge: the same to-do on set days, optionally limited (at once; accounts that can create challenges).",
@@ -1756,6 +1780,12 @@ export const COMMAND_SUMMARIES = {
1756
1780
  "flags add": "Turn a flag on for more users, emails or roles.",
1757
1781
  "flags remove": "Stop targeting users, emails or roles with a flag.",
1758
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.",
1759
1789
  "tutor-templates list": "List tutor templates.",
1760
1790
  "tutor-templates get": "Read one tutor template.",
1761
1791
  "tutor-templates assign": "Assign a tutor template to a kid.",
@@ -1846,6 +1876,7 @@ export const NOUN_SUMMARIES = {
1846
1876
  memories: "Kid memory files and the context Rocky sees.",
1847
1877
  rocky: "A kid's Rocky personality settings; free Rocky grants and budgets.",
1848
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.",
1849
1880
  "tutor-templates": "Tutor templates and their assignment to kids.",
1850
1881
  "library-books": "Book library: search the web, add and delete books, read status, reader stages, tags.",
1851
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.52.0",
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/api-types": "0.0.0",
50
- "@tryrecess/typescript-config": "0.0.0"
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",