recess-cli 3.27.0 → 3.29.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 +12 -0
- package/dist/command-schema.js +7 -0
- package/dist/commands/flags.js +185 -0
- package/dist/commands/library-books.js +49 -3
- package/dist/commands/math-curricula.js +42 -0
- package/dist/commands/reading-checks.js +63 -0
- package/dist/help.js +35 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -13,6 +13,8 @@ import { runAppsCommand } from "./commands/apps.js";
|
|
|
13
13
|
import { runChannelsCommand } from "./commands/channels.js";
|
|
14
14
|
import { runChatLogsCommand } from "./commands/chat-logs.js";
|
|
15
15
|
import { runLibraryBooksCommand } from "./commands/library-books.js";
|
|
16
|
+
import { runMathCurriculaCommand } from "./commands/math-curricula.js";
|
|
17
|
+
import { runReadingChecksCommand } from "./commands/reading-checks.js";
|
|
16
18
|
import { runChallengeOfTheWeekCommand } from "./commands/challenge-of-the-week.js";
|
|
17
19
|
import { runDbCommand } from "./commands/db.js";
|
|
18
20
|
import { runRoomsCommand } from "./commands/rooms.js";
|
|
@@ -28,6 +30,7 @@ import { runMasteryCommand } from "./commands/mastery.js";
|
|
|
28
30
|
import { runOnboardingCommand } from "./commands/onboarding.js";
|
|
29
31
|
import { runScheduleCommand, runMemoryFilesCommand, } from "./commands/safe-staff-operations.js";
|
|
30
32
|
import { runPlacementCommand } from "./commands/placement.js";
|
|
33
|
+
import { runFlagsCommand } from "./commands/flags.js";
|
|
31
34
|
import { runRockyFreeCommand } from "./commands/rocky-free.js";
|
|
32
35
|
import { runSchoolCommand } from "./commands/school.js";
|
|
33
36
|
import { runVillageEventsCommand } from "./commands/village-events.js";
|
|
@@ -6048,6 +6051,12 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
6048
6051
|
if (noun === "library-books") {
|
|
6049
6052
|
return runLibraryBooksCommand({ parsed, api, writeCommand });
|
|
6050
6053
|
}
|
|
6054
|
+
if (noun === "math-curricula") {
|
|
6055
|
+
return runMathCurriculaCommand({ parsed, api, writeCommand });
|
|
6056
|
+
}
|
|
6057
|
+
if (noun === "reading-checks") {
|
|
6058
|
+
return runReadingChecksCommand({ parsed, api, writeCommand });
|
|
6059
|
+
}
|
|
6051
6060
|
if (noun === "challenge-of-the-week") {
|
|
6052
6061
|
return runChallengeOfTheWeekCommand({ parsed, api, writeCommand });
|
|
6053
6062
|
}
|
|
@@ -6596,6 +6605,9 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
6596
6605
|
if (noun === "rocky" && verb === "free") {
|
|
6597
6606
|
return runRockyFreeCommand({ parsed, api, writeCommand });
|
|
6598
6607
|
}
|
|
6608
|
+
if (noun === "flags") {
|
|
6609
|
+
return runFlagsCommand({ parsed, api, writeCommand });
|
|
6610
|
+
}
|
|
6599
6611
|
if (noun === "rocky") {
|
|
6600
6612
|
const studentId = flagString(parsed, "student", { required: true });
|
|
6601
6613
|
if (verb === "get") {
|
package/dist/command-schema.js
CHANGED
|
@@ -313,6 +313,13 @@ const STAFF_COMMANDS = new Set([
|
|
|
313
313
|
"challenge-of-the-week queue",
|
|
314
314
|
"challenge-of-the-week show",
|
|
315
315
|
"challenge-of-the-week swap",
|
|
316
|
+
"library-books set-stage",
|
|
317
|
+
"library-books tag",
|
|
318
|
+
"math-curricula link",
|
|
319
|
+
"math-curricula list",
|
|
320
|
+
"math-curricula unlink",
|
|
321
|
+
"reading-checks passages list",
|
|
322
|
+
"reading-checks passages set-text",
|
|
316
323
|
"students mastery",
|
|
317
324
|
"apps link",
|
|
318
325
|
"apps links",
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { unwrap } from "../api.js";
|
|
2
|
+
import { flagString } from "../args.js";
|
|
3
|
+
import { CliError } from "../errors.js";
|
|
4
|
+
import { positional, readJsonFile } from "./shared.js";
|
|
5
|
+
const ROLES = [
|
|
6
|
+
"KID",
|
|
7
|
+
"GUARDIAN",
|
|
8
|
+
"GUIDE",
|
|
9
|
+
"MODERATOR",
|
|
10
|
+
"ADMIN",
|
|
11
|
+
"DISABLED",
|
|
12
|
+
"PROGRAM",
|
|
13
|
+
"GUEST",
|
|
14
|
+
];
|
|
15
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
16
|
+
const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
17
|
+
function list(context, name) {
|
|
18
|
+
const raw = flagString(context.parsed, name);
|
|
19
|
+
return raw
|
|
20
|
+
? raw
|
|
21
|
+
.split(",")
|
|
22
|
+
.map((value) => value.trim())
|
|
23
|
+
.filter(Boolean)
|
|
24
|
+
: [];
|
|
25
|
+
}
|
|
26
|
+
function onOff(context, name) {
|
|
27
|
+
const raw = flagString(context.parsed, name);
|
|
28
|
+
if (raw === undefined)
|
|
29
|
+
return undefined;
|
|
30
|
+
if (raw === "on")
|
|
31
|
+
return true;
|
|
32
|
+
if (raw === "off")
|
|
33
|
+
return false;
|
|
34
|
+
throw new CliError("invalid_arguments", `--${name} takes on or off.`);
|
|
35
|
+
}
|
|
36
|
+
function targets(context) {
|
|
37
|
+
const userIds = list(context, "user");
|
|
38
|
+
const emails = list(context, "email").map((email) => email.toLowerCase());
|
|
39
|
+
const roles = list(context, "role").map((role) => role.toUpperCase());
|
|
40
|
+
const badId = userIds.find((id) => !UUID.test(id));
|
|
41
|
+
if (badId) {
|
|
42
|
+
throw new CliError("invalid_arguments", `--user ${badId} is not a user id.`);
|
|
43
|
+
}
|
|
44
|
+
const badEmail = emails.find((email) => !EMAIL.test(email));
|
|
45
|
+
if (badEmail) {
|
|
46
|
+
throw new CliError("invalid_arguments", `--email ${badEmail} is not an email.`);
|
|
47
|
+
}
|
|
48
|
+
const badRole = roles.find((role) => !ROLES.includes(role));
|
|
49
|
+
if (badRole) {
|
|
50
|
+
throw new CliError("invalid_arguments", `--role ${badRole} is not one of ${ROLES.join(", ")}.`);
|
|
51
|
+
}
|
|
52
|
+
if (!userIds.length && !emails.length && !roles.length) {
|
|
53
|
+
throw new CliError("invalid_arguments", "Pass at least one of --user <id,...>, --email <email,...>, --role <ROLE,...>.");
|
|
54
|
+
}
|
|
55
|
+
return { userIds, emails, roles: roles };
|
|
56
|
+
}
|
|
57
|
+
function current(flag) {
|
|
58
|
+
return {
|
|
59
|
+
enabled: flag.enabled,
|
|
60
|
+
everyone: flag.everyone,
|
|
61
|
+
roles: flag.roles,
|
|
62
|
+
emails: flag.emails,
|
|
63
|
+
users: flag.users.map((user) => `${[user.firstName, user.lastName].filter(Boolean).join(" ") || user.email || user.id} (${user.role})`),
|
|
64
|
+
payload: flag.payload,
|
|
65
|
+
updatedAt: flag.updatedAt,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export async function runFlagsCommand(context) {
|
|
69
|
+
const { parsed, api, writeCommand } = context;
|
|
70
|
+
const verb = parsed.positionals[1];
|
|
71
|
+
if (verb === "list") {
|
|
72
|
+
return unwrap(await api.client.GET("/admin/feature-flags/"));
|
|
73
|
+
}
|
|
74
|
+
const verbs = ["get", "create", "set", "add", "remove", "delete"];
|
|
75
|
+
if (!verb || !verbs.includes(verb)) {
|
|
76
|
+
throw new CliError("invalid_arguments", "Use flags list|get|create|set|add|remove|delete.");
|
|
77
|
+
}
|
|
78
|
+
const key = positional(parsed, 2, "flag key");
|
|
79
|
+
if (verb === "create") {
|
|
80
|
+
const description = flagString(parsed, "description") ?? null;
|
|
81
|
+
const name = flagString(parsed, "name")?.trim() || undefined;
|
|
82
|
+
return writeCommand(parsed, {
|
|
83
|
+
action: "create a feature flag (off, targeting no one)",
|
|
84
|
+
target: { key },
|
|
85
|
+
request: { key, name, description },
|
|
86
|
+
details: {
|
|
87
|
+
consequences: [
|
|
88
|
+
"The flag starts disabled; code reading it sees it off until `flags set --enabled on` and a target.",
|
|
89
|
+
],
|
|
90
|
+
reverse: `\`flags delete ${key}\``,
|
|
91
|
+
},
|
|
92
|
+
}, async () => unwrap(await api.client.POST("/admin/feature-flags/", {
|
|
93
|
+
body: { key, name, description },
|
|
94
|
+
})));
|
|
95
|
+
}
|
|
96
|
+
const flag = unwrap(await api.client.GET("/admin/feature-flags/{key}", {
|
|
97
|
+
params: { path: { key } },
|
|
98
|
+
}));
|
|
99
|
+
if (verb === "get")
|
|
100
|
+
return flag;
|
|
101
|
+
const patch = (body) => async () => unwrap(await api.client.PATCH("/admin/feature-flags/{key}", {
|
|
102
|
+
params: { path: { key } },
|
|
103
|
+
body: { ...body, expectedUpdatedAt: flag.updatedAt },
|
|
104
|
+
}));
|
|
105
|
+
if (verb === "set") {
|
|
106
|
+
const body = {};
|
|
107
|
+
const enabled = onOff(context, "enabled");
|
|
108
|
+
const everyone = onOff(context, "everyone");
|
|
109
|
+
const name = flagString(parsed, "name")?.trim();
|
|
110
|
+
const description = flagString(parsed, "description");
|
|
111
|
+
const payloadFile = flagString(parsed, "payload-file");
|
|
112
|
+
if (name)
|
|
113
|
+
body.name = name;
|
|
114
|
+
if (enabled !== undefined)
|
|
115
|
+
body.enabled = enabled;
|
|
116
|
+
if (everyone !== undefined)
|
|
117
|
+
body.everyone = everyone;
|
|
118
|
+
if (description !== undefined)
|
|
119
|
+
body.description = description || null;
|
|
120
|
+
if (payloadFile !== undefined) {
|
|
121
|
+
body.payload =
|
|
122
|
+
payloadFile === "none"
|
|
123
|
+
? null
|
|
124
|
+
: await readJsonFile(payloadFile, "--payload-file");
|
|
125
|
+
}
|
|
126
|
+
if (!Object.keys(body).length) {
|
|
127
|
+
throw new CliError("invalid_arguments", "Pass at least one of --enabled, --everyone, --name, --description, --payload-file.");
|
|
128
|
+
}
|
|
129
|
+
const turningOnForEveryone = (body.everyone ?? flag.everyone) && (body.enabled ?? flag.enabled);
|
|
130
|
+
return writeCommand(parsed, {
|
|
131
|
+
action: "change a feature flag",
|
|
132
|
+
target: { key },
|
|
133
|
+
request: body,
|
|
134
|
+
details: {
|
|
135
|
+
current: current(flag),
|
|
136
|
+
consequences: [
|
|
137
|
+
turningOnForEveryone
|
|
138
|
+
? "On for EVERY user (and signed-out visitors) within ~15 seconds."
|
|
139
|
+
: "Takes effect for matching users within ~15 seconds.",
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
}, patch(body));
|
|
143
|
+
}
|
|
144
|
+
if (verb === "add" || verb === "remove") {
|
|
145
|
+
const { userIds, emails, roles } = targets(context);
|
|
146
|
+
const body = verb === "add"
|
|
147
|
+
? { addUserIds: userIds, addEmails: emails, addRoles: roles }
|
|
148
|
+
: { removeUserIds: userIds, removeEmails: emails, removeRoles: roles };
|
|
149
|
+
return writeCommand(parsed, {
|
|
150
|
+
action: verb === "add"
|
|
151
|
+
? "turn a feature flag on for these users, emails or roles"
|
|
152
|
+
: "stop targeting these users, emails or roles with a feature flag",
|
|
153
|
+
target: { key },
|
|
154
|
+
request: body,
|
|
155
|
+
details: {
|
|
156
|
+
current: current(flag),
|
|
157
|
+
consequences: [
|
|
158
|
+
flag.enabled
|
|
159
|
+
? "The flag is enabled, so this takes effect within ~15 seconds."
|
|
160
|
+
: "The flag is disabled: nothing changes for anyone until `flags set --enabled on`.",
|
|
161
|
+
...(flag.everyone
|
|
162
|
+
? [
|
|
163
|
+
"The flag is on for everyone, so targeting lists don't matter while it stays that way.",
|
|
164
|
+
]
|
|
165
|
+
: []),
|
|
166
|
+
],
|
|
167
|
+
reverse: `\`flags ${verb === "add" ? "remove" : "add"} ${key} …\` with the same targets`,
|
|
168
|
+
},
|
|
169
|
+
}, patch(body));
|
|
170
|
+
}
|
|
171
|
+
return writeCommand(parsed, {
|
|
172
|
+
action: "delete a feature flag",
|
|
173
|
+
target: { key },
|
|
174
|
+
request: {},
|
|
175
|
+
details: {
|
|
176
|
+
current: current(flag),
|
|
177
|
+
consequences: [
|
|
178
|
+
"Code reading this key sees it as unknown (off) everywhere; the targeting lists are gone.",
|
|
179
|
+
],
|
|
180
|
+
},
|
|
181
|
+
}, async () => unwrap(await api.client.DELETE("/admin/feature-flags/{key}", {
|
|
182
|
+
params: { path: { key } },
|
|
183
|
+
})));
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=flags.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { unwrap } from "../api.js";
|
|
2
2
|
import { flagNumber, flagString } from "../args.js";
|
|
3
3
|
import { CliError } from "../errors.js";
|
|
4
|
-
import { assertChoice, positional } from "./shared.js";
|
|
4
|
+
import { assertChoice, flagIdList, flagInteger, positional, } from "./shared.js";
|
|
5
5
|
const MD5 = /^[0-9a-f]{32}$/i;
|
|
6
6
|
async function resolveAddBody({ parsed, api }) {
|
|
7
7
|
const fromSearch = flagNumber(parsed, "from-search");
|
|
@@ -73,10 +73,56 @@ export async function runLibraryBooksCommand(context) {
|
|
|
73
73
|
}
|
|
74
74
|
if (verb === "list") {
|
|
75
75
|
const q = flagString(parsed, "q");
|
|
76
|
+
const stage = flagInteger(parsed, "stage", { min: 1, max: 5 });
|
|
77
|
+
const tag = flagString(parsed, "tag");
|
|
76
78
|
return unwrap(await api.client.GET("/library-books/", {
|
|
77
|
-
params: {
|
|
79
|
+
params: {
|
|
80
|
+
query: {
|
|
81
|
+
...(q === undefined ? {} : { q }),
|
|
82
|
+
...(stage === undefined ? {} : { stage }),
|
|
83
|
+
...(tag === undefined ? {} : { tag }),
|
|
84
|
+
},
|
|
85
|
+
},
|
|
78
86
|
}));
|
|
79
87
|
}
|
|
88
|
+
if (verb === "set-stage") {
|
|
89
|
+
const id = positional(parsed, 2, "library book ID");
|
|
90
|
+
const raw = positional(parsed, 3, "stage (1-5 or none)");
|
|
91
|
+
const readingStage = raw === "none"
|
|
92
|
+
? null
|
|
93
|
+
: Number(assertChoice(raw, ["1", "2", "3", "4", "5"], "stage"));
|
|
94
|
+
const body = { readingStage };
|
|
95
|
+
return writeCommand(parsed, {
|
|
96
|
+
action: "set a library book's reader stage",
|
|
97
|
+
target: { id },
|
|
98
|
+
request: body,
|
|
99
|
+
details: {
|
|
100
|
+
consequence: readingStage === null
|
|
101
|
+
? "The book leaves the reading plan."
|
|
102
|
+
: `The book shows on the stage ${readingStage} reading plan.`,
|
|
103
|
+
},
|
|
104
|
+
}, async () => unwrap(await api.client.PATCH("/library-books/{id}", {
|
|
105
|
+
params: { path: { id } },
|
|
106
|
+
body,
|
|
107
|
+
})));
|
|
108
|
+
}
|
|
109
|
+
if (verb === "tag") {
|
|
110
|
+
const id = positional(parsed, 2, "library book ID");
|
|
111
|
+
const tags = parsed.flags.has("clear") ? [] : flagIdList(parsed, "tags");
|
|
112
|
+
if (tags.length === 0 && !parsed.flags.has("clear")) {
|
|
113
|
+
throw new CliError("invalid_arguments", "Pass --tags a,b or --clear.");
|
|
114
|
+
}
|
|
115
|
+
const body = { tags };
|
|
116
|
+
return writeCommand(parsed, {
|
|
117
|
+
action: "replace a library book's tags",
|
|
118
|
+
target: { id },
|
|
119
|
+
request: body,
|
|
120
|
+
details: { consequence: "Replaces every tag on the book." },
|
|
121
|
+
}, async () => unwrap(await api.client.PATCH("/library-books/{id}", {
|
|
122
|
+
params: { path: { id } },
|
|
123
|
+
body,
|
|
124
|
+
})));
|
|
125
|
+
}
|
|
80
126
|
if (verb === "get") {
|
|
81
127
|
const id = positional(parsed, 2, "library book ID");
|
|
82
128
|
const book = unwrap(await api.client.GET("/library-books/{id}", {
|
|
@@ -118,6 +164,6 @@ export async function runLibraryBooksCommand(context) {
|
|
|
118
164
|
params: { path: { id: book.id } },
|
|
119
165
|
})));
|
|
120
166
|
}
|
|
121
|
-
throw new CliError("invalid_arguments", "Use library-books search|list|get|add|delete.");
|
|
167
|
+
throw new CliError("invalid_arguments", "Use library-books search|list|get|add|delete|set-stage|tag.");
|
|
122
168
|
}
|
|
123
169
|
//# sourceMappingURL=library-books.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { unwrap } from "../api.js";
|
|
2
|
+
import { CliError } from "../errors.js";
|
|
3
|
+
import { positional } from "./shared.js";
|
|
4
|
+
/** The server validates the key; `math-curricula list` shows the options. */
|
|
5
|
+
function curriculumArg(context) {
|
|
6
|
+
return positional(context.parsed, 2, "curriculum").toUpperCase();
|
|
7
|
+
}
|
|
8
|
+
export async function runMathCurriculaCommand(context) {
|
|
9
|
+
const { parsed, api, writeCommand } = context;
|
|
10
|
+
const verb = parsed.positionals[1];
|
|
11
|
+
if (verb === "list") {
|
|
12
|
+
return unwrap(await api.client.GET("/tutor/math-curricula/goals"));
|
|
13
|
+
}
|
|
14
|
+
if (verb === "link") {
|
|
15
|
+
const curriculum = curriculumArg(context);
|
|
16
|
+
const template = positional(parsed, 3, "goal template slug or ID");
|
|
17
|
+
const body = { template };
|
|
18
|
+
return writeCommand(parsed, {
|
|
19
|
+
action: "link a goal template to a math curriculum",
|
|
20
|
+
target: { curriculum, template },
|
|
21
|
+
request: body,
|
|
22
|
+
details: {
|
|
23
|
+
consequence: "Every later math review that picks this curriculum assigns the goal to the kid.",
|
|
24
|
+
},
|
|
25
|
+
}, async () => unwrap(await api.client.POST("/tutor/math-curricula/{curriculum}/goals", {
|
|
26
|
+
params: { path: { curriculum } },
|
|
27
|
+
body,
|
|
28
|
+
})));
|
|
29
|
+
}
|
|
30
|
+
if (verb === "unlink") {
|
|
31
|
+
const curriculum = curriculumArg(context);
|
|
32
|
+
const goalTemplateId = positional(parsed, 3, "goal template ID");
|
|
33
|
+
return writeCommand(parsed, {
|
|
34
|
+
action: "unlink a goal template from a math curriculum",
|
|
35
|
+
target: { curriculum, goalTemplateId },
|
|
36
|
+
request: {},
|
|
37
|
+
details: { consequence: "Goals kids already have stay." },
|
|
38
|
+
}, async () => unwrap(await api.client.DELETE("/tutor/math-curricula/{curriculum}/goals/{goalTemplateId}", { params: { path: { curriculum, goalTemplateId } } })));
|
|
39
|
+
}
|
|
40
|
+
throw new CliError("invalid_arguments", "Use math-curricula list|link|unlink.");
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=math-curricula.js.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { unwrap } from "../api.js";
|
|
4
|
+
import { flagString, hasFlag } from "../args.js";
|
|
5
|
+
import { CliError } from "../errors.js";
|
|
6
|
+
import { positional } from "./shared.js";
|
|
7
|
+
const MAX_TEXT_CHARS = 10_000;
|
|
8
|
+
/** Plain text is read as is; the server pulls the text out of Word and PDF
|
|
9
|
+
* files, OCR'ing scans, so the preview shows exactly what kids will read. */
|
|
10
|
+
async function readPassageFile(context, file) {
|
|
11
|
+
const resolved = path.resolve(file);
|
|
12
|
+
if (!/\.(docx|pdf)$/i.test(file)) {
|
|
13
|
+
return (await fs.readFile(resolved, "utf8")).trim();
|
|
14
|
+
}
|
|
15
|
+
const bytes = await fs.readFile(resolved);
|
|
16
|
+
const { text } = unwrap(await context.api.client.POST("/reading-checks/passages/extract", {
|
|
17
|
+
body: {
|
|
18
|
+
fileName: path.basename(file),
|
|
19
|
+
base64: bytes.toString("base64"),
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
22
|
+
return text.trim();
|
|
23
|
+
}
|
|
24
|
+
export async function runReadingChecksCommand(context) {
|
|
25
|
+
const { parsed, api, writeCommand } = context;
|
|
26
|
+
const [, group, verb] = parsed.positionals;
|
|
27
|
+
if (group === "passages" && verb === "list") {
|
|
28
|
+
return unwrap(await api.client.GET("/reading-checks/passages"));
|
|
29
|
+
}
|
|
30
|
+
if (group === "passages" && verb === "set-text") {
|
|
31
|
+
const passageId = positional(parsed, 3, "passage ID");
|
|
32
|
+
const file = flagString(parsed, "file");
|
|
33
|
+
const clear = hasFlag(parsed, "clear");
|
|
34
|
+
if (Boolean(file) === clear) {
|
|
35
|
+
throw new CliError("invalid_arguments", "Pass exactly one of --file <path> or --clear.");
|
|
36
|
+
}
|
|
37
|
+
const text = file ? await readPassageFile(context, file) : null;
|
|
38
|
+
if (text === "") {
|
|
39
|
+
throw new CliError("invalid_arguments", `${file} is empty.`);
|
|
40
|
+
}
|
|
41
|
+
if (text && text.length > MAX_TEXT_CHARS) {
|
|
42
|
+
throw new CliError("invalid_arguments", `${file} has ${text.length} characters; a passage is at most ${MAX_TEXT_CHARS}.`);
|
|
43
|
+
}
|
|
44
|
+
const body = { text };
|
|
45
|
+
return writeCommand(parsed, {
|
|
46
|
+
action: text
|
|
47
|
+
? "set the page a kid reads aloud for a reading-check passage"
|
|
48
|
+
: "clear a reading-check passage's page text",
|
|
49
|
+
target: { passageId },
|
|
50
|
+
request: body,
|
|
51
|
+
details: {
|
|
52
|
+
consequence: text
|
|
53
|
+
? "Checks on this passage show this page and score the read against it."
|
|
54
|
+
: "Kids read this passage from the book; the read is scored on pace alone.",
|
|
55
|
+
},
|
|
56
|
+
}, async () => unwrap(await api.client.PUT("/reading-checks/passages/{passageId}", {
|
|
57
|
+
params: { path: { passageId } },
|
|
58
|
+
body,
|
|
59
|
+
})));
|
|
60
|
+
}
|
|
61
|
+
throw new CliError("invalid_arguments", "Use reading-checks passages list|set-text.");
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=reading-checks.js.map
|
package/dist/help.js
CHANGED
|
@@ -614,6 +614,15 @@ Usage:
|
|
|
614
614
|
recess [--json] rocky free set-budget --student <user-id> (--budget <usd> | --default)
|
|
615
615
|
[--confirm]
|
|
616
616
|
recess [--json] rocky free revoke --student <user-id> [--confirm]
|
|
617
|
+
recess [--json] flags list
|
|
618
|
+
recess [--json] flags get <key>
|
|
619
|
+
recess [--json] flags create <key> [--name TEXT] [--description TEXT] [--confirm]
|
|
620
|
+
recess [--json] flags set <key> [--enabled on|off] [--everyone on|off] [--name TEXT]
|
|
621
|
+
[--description TEXT] [--payload-file <path.json|none>] [--confirm]
|
|
622
|
+
recess [--json] flags add <key> [--user <id,...>] [--email <email,...>] [--role <ROLE,...>] [--confirm]
|
|
623
|
+
recess [--json] flags remove <key> [--user <id,...>] [--email <email,...>] [--role <ROLE,...>]
|
|
624
|
+
[--confirm]
|
|
625
|
+
recess [--json] flags delete <key> [--confirm]
|
|
617
626
|
recess [--json] tutor-templates list [--q TEXT] [--subject TEXT] [--grade N]
|
|
618
627
|
recess [--json] tutor-templates get <slug>
|
|
619
628
|
recess [--json] tutor-templates assign <slug> [--student <kid-id>] [--confirm]
|
|
@@ -628,12 +637,19 @@ Usage:
|
|
|
628
637
|
[--visibility PUBLIC|STAFF] [--confirm]
|
|
629
638
|
recess [--json] tutor-templates delete <slug> [--confirm]
|
|
630
639
|
recess [--json] library-books search <query>
|
|
631
|
-
recess [--json] library-books list [--q TEXT]
|
|
640
|
+
recess [--json] library-books list [--q TEXT] [--stage 1-5] [--tag TEXT]
|
|
632
641
|
recess [--json] library-books get <book-id>
|
|
642
|
+
recess [--json] library-books set-stage <book-id> <1-5|none> [--confirm]
|
|
643
|
+
recess [--json] library-books tag <book-id> (--tags a,b | --clear) [--confirm]
|
|
633
644
|
recess [--json] library-books add (--md5 <md5> --title TEXT [--author TEXT]
|
|
634
645
|
--extension pdf|epub [--cover-url <url>] | --from-search N --query TEXT)
|
|
635
646
|
[--confirm]
|
|
636
647
|
recess [--json] library-books delete <book-id> [--confirm]
|
|
648
|
+
recess [--json] math-curricula list
|
|
649
|
+
recess [--json] math-curricula link <curriculum> <template> [--confirm]
|
|
650
|
+
recess [--json] math-curricula unlink <curriculum> <template-id> [--confirm]
|
|
651
|
+
recess [--json] reading-checks passages list
|
|
652
|
+
recess [--json] reading-checks passages set-text <passage-id> (--file <path> | --clear) [--confirm]
|
|
637
653
|
recess [--json] challenge-of-the-week list [--past N] [--ahead N]
|
|
638
654
|
recess [--json] challenge-of-the-week show <week>
|
|
639
655
|
recess [--json] challenge-of-the-week queue <template> --week <week> [--note TEXT] [--confirm]
|
|
@@ -1471,6 +1487,13 @@ export const COMMAND_SUMMARIES = {
|
|
|
1471
1487
|
"rocky free grant": "Grant free Rocky to a kid or guardian.",
|
|
1472
1488
|
"rocky free set-budget": "Change a free Rocky grant's weekly budget.",
|
|
1473
1489
|
"rocky free revoke": "Revoke a user's free Rocky grant.",
|
|
1490
|
+
"flags list": "List every feature flag with who it targets.",
|
|
1491
|
+
"flags get": "Read one feature flag: status, targets, payload.",
|
|
1492
|
+
"flags create": "Create a feature flag (off, targeting no one).",
|
|
1493
|
+
"flags set": "Turn a flag on/off, on for everyone, or change its description or payload.",
|
|
1494
|
+
"flags add": "Turn a flag on for more users, emails or roles.",
|
|
1495
|
+
"flags remove": "Stop targeting users, emails or roles with a flag.",
|
|
1496
|
+
"flags delete": "Delete a feature flag.",
|
|
1474
1497
|
"tutor-templates list": "List tutor templates.",
|
|
1475
1498
|
"tutor-templates get": "Read one tutor template.",
|
|
1476
1499
|
"tutor-templates assign": "Assign a tutor template to a kid.",
|
|
@@ -1483,6 +1506,13 @@ export const COMMAND_SUMMARIES = {
|
|
|
1483
1506
|
"library-books get": "Read one library book: status, pages, chapters.",
|
|
1484
1507
|
"library-books add": "Add a web search result to the book library.",
|
|
1485
1508
|
"library-books delete": "Remove a book from the book library.",
|
|
1509
|
+
"library-books set-stage": "Put a library book on a reader stage's reading plan (ADMIN, GUIDE).",
|
|
1510
|
+
"library-books tag": "Replace a library book's tags (ADMIN, GUIDE).",
|
|
1511
|
+
"math-curricula list": "Each math curriculum and its linked goal templates.",
|
|
1512
|
+
"math-curricula link": "Link a goal template to a math curriculum; math reviews that pick it assign the goal.",
|
|
1513
|
+
"math-curricula unlink": "Unlink a goal template from a math curriculum.",
|
|
1514
|
+
"reading-checks passages list": "Each reading-check passage, its stage, and whether its page text is set.",
|
|
1515
|
+
"reading-checks passages set-text": "Set the page a kid reads aloud for a passage, from a text, Word (.docx) or PDF file (scans are OCR'd); --clear goes back to reading from the book.",
|
|
1486
1516
|
"challenge-of-the-week list": "List Challenge of the Week picks: past, this week, upcoming, and the bench.",
|
|
1487
1517
|
"challenge-of-the-week show": "Read one week's Challenge of the Week pick and note.",
|
|
1488
1518
|
"challenge-of-the-week queue": "Queue a challenge for an empty week, with an optional note for kids.",
|
|
@@ -1550,8 +1580,11 @@ export const NOUN_SUMMARIES = {
|
|
|
1550
1580
|
todos: "Kids' todos: create, edit, complete, analysis, applets.",
|
|
1551
1581
|
memories: "Kid memory files and the context Rocky sees.",
|
|
1552
1582
|
rocky: "A kid's Rocky personality settings; free Rocky grants and budgets.",
|
|
1583
|
+
flags: "Feature flags: on/off, everyone, and who they target by user, email or role.",
|
|
1553
1584
|
"tutor-templates": "Tutor templates and their assignment to kids.",
|
|
1554
|
-
"library-books": "Book library: search the web, add and delete books, read status.",
|
|
1585
|
+
"library-books": "Book library: search the web, add and delete books, read status, reader stages, tags.",
|
|
1586
|
+
"math-curricula": "Math curricula and the goals a math review assigns (ADMIN, GUIDE).",
|
|
1587
|
+
"reading-checks": "Reading-check passages and the page text kids read (ADMIN, GUIDE).",
|
|
1555
1588
|
"challenge-of-the-week": "Challenge of the Week: queue weekly picks and the bench (ADMIN, GUIDE).",
|
|
1556
1589
|
mastery: "Mastery graphs and the content linked to them.",
|
|
1557
1590
|
};
|