recess-cli 3.14.0 → 3.16.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/args.js +4 -0
- package/dist/cli.js +114 -3
- package/dist/command-schema.js +3 -0
- package/dist/commands/admissions.js +11 -1
- package/dist/commands/reports.js +127 -23
- package/dist/help.js +33 -5
- package/package.json +3 -3
package/dist/args.js
CHANGED
|
@@ -7,10 +7,13 @@ import { CliError } from "./errors.js";
|
|
|
7
7
|
export const REPEATABLE_FLAGS = new Set([
|
|
8
8
|
"amount",
|
|
9
9
|
"bill-date",
|
|
10
|
+
"existing-kid",
|
|
10
11
|
"kid",
|
|
11
12
|
"staff-note",
|
|
12
13
|
"note",
|
|
13
14
|
"unassign",
|
|
15
|
+
"add",
|
|
16
|
+
"remove",
|
|
14
17
|
]);
|
|
15
18
|
/**
|
|
16
19
|
* Every flag that never takes a value — the ONE list. The parser must know it
|
|
@@ -24,6 +27,7 @@ export const BOOLEAN_FLAGS = new Set([
|
|
|
24
27
|
"paywall-offline",
|
|
25
28
|
"no-email",
|
|
26
29
|
"no-paywall",
|
|
30
|
+
"no-text",
|
|
27
31
|
"all",
|
|
28
32
|
"all-references",
|
|
29
33
|
"allow-assigned-edits",
|
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import { execFile } from "node:child_process";
|
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { RecessAdminApi, unwrap, withIdempotencyContext } from "./api.js";
|
|
6
|
-
import { flagNumber, flagString, hasFlag, parseArgs, } from "./args.js";
|
|
6
|
+
import { flagList, flagNumber, flagString, hasFlag, parseArgs, } from "./args.js";
|
|
7
7
|
import { login, pollDeviceAuth, requestDeviceAuth } from "./auth.js";
|
|
8
8
|
import { clearStoredSession, withConfigLock, deleteProfile, listProfiles, resolveConfig, saveProfile, useProfile, } from "./config.js";
|
|
9
9
|
import { agentContext, buildCommandSchema, findCommandSchema, remoteCommands, scopedHelp, validateInvocation, } from "./command-schema.js";
|
|
@@ -3248,6 +3248,23 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
3248
3248
|
if (acting.length === 0) {
|
|
3249
3249
|
throw new CliError("no_op", `Nothing to ${verb}: every candidate was skipped. See preview.skipped for why.`, 1, { preview });
|
|
3250
3250
|
}
|
|
3251
|
+
// An enrolled school student leaves through `users school withdraw`, which
|
|
3252
|
+
// also disables the account; the server refuses the disable either way.
|
|
3253
|
+
if (disabling) {
|
|
3254
|
+
const kids = acting.filter((member) => member.role === "KID");
|
|
3255
|
+
const statuses = await Promise.all(kids.map(async (member) => ({
|
|
3256
|
+
member,
|
|
3257
|
+
status: unwrap(await api.client.GET("/admin/users/{userId}/school-status", {
|
|
3258
|
+
params: { path: { userId: member.id } },
|
|
3259
|
+
})),
|
|
3260
|
+
})));
|
|
3261
|
+
const enrolled = statuses.filter(({ status }) => status.isSchool && !status.withdrawnAt);
|
|
3262
|
+
if (enrolled.length > 0) {
|
|
3263
|
+
throw new CliError("active_school_student", `${enrolled
|
|
3264
|
+
.map(({ member }) => `${member.name} (${member.id})`)
|
|
3265
|
+
.join(", ")} ${enrolled.length === 1 ? "is an" : "are"} active school ${enrolled.length === 1 ? "student" : "students"}. Withdraw first with \`recess users school withdraw <user-id> --note TEXT --expected-updated-at ISO\`; withdrawal also disables the account.`, 1, { preview });
|
|
3266
|
+
}
|
|
3267
|
+
}
|
|
3251
3268
|
const billing = acting.filter((member) => member.billableEnrollments > 0);
|
|
3252
3269
|
if (disabling && billing.length > 0 && !hasFlag(parsed, "allow-billing")) {
|
|
3253
3270
|
throw new CliError("billable_enrollments", `${billing
|
|
@@ -3354,6 +3371,36 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
3354
3371
|
params: { path: { userId } },
|
|
3355
3372
|
})));
|
|
3356
3373
|
}
|
|
3374
|
+
if (noun === "students" && verb === "interests") {
|
|
3375
|
+
const studentId = flagString(parsed, "student", { required: true });
|
|
3376
|
+
const add = flagList(parsed, "add")
|
|
3377
|
+
.map((label) => label.trim())
|
|
3378
|
+
.filter(Boolean);
|
|
3379
|
+
const remove = flagList(parsed, "remove");
|
|
3380
|
+
if (!add.length && !remove.length) {
|
|
3381
|
+
const profile = unwrap(await api.client.GET("/tutor/students/{studentId}/interest-profile", {
|
|
3382
|
+
params: { path: { studentId } },
|
|
3383
|
+
}));
|
|
3384
|
+
return { studentId, interests: profile.explicitInterests };
|
|
3385
|
+
}
|
|
3386
|
+
return writeCommand(parsed, {
|
|
3387
|
+
action: "change a kid's interests (Rocky's config, the feed, and OpenRead passages)",
|
|
3388
|
+
target: { studentUserId: studentId },
|
|
3389
|
+
request: { add, remove },
|
|
3390
|
+
}, async () => {
|
|
3391
|
+
const added = [];
|
|
3392
|
+
for (const label of add) {
|
|
3393
|
+
added.push(unwrap(await api.client.POST("/tutor/students/{studentId}/interests", {
|
|
3394
|
+
params: { path: { studentId } },
|
|
3395
|
+
body: { label },
|
|
3396
|
+
})).interest);
|
|
3397
|
+
}
|
|
3398
|
+
for (const interestId of remove) {
|
|
3399
|
+
unwrap(await api.client.DELETE("/tutor/students/{studentId}/interests/{interestId}", { params: { path: { studentId, interestId } } }));
|
|
3400
|
+
}
|
|
3401
|
+
return { studentId, added, removed: remove };
|
|
3402
|
+
});
|
|
3403
|
+
}
|
|
3357
3404
|
if (noun === "students" && verb === "notes") {
|
|
3358
3405
|
if (parsed.positionals[2] !== "add") {
|
|
3359
3406
|
throw new CliError("invalid_arguments", "Use students notes add.");
|
|
@@ -5363,6 +5410,43 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5363
5410
|
body: { ordinal },
|
|
5364
5411
|
})));
|
|
5365
5412
|
}
|
|
5413
|
+
if (verb === "complete-module") {
|
|
5414
|
+
const moduleRef = positional(parsed, 2, "module ref (e.g. B3)");
|
|
5415
|
+
const student = await studentFlag(api, parsed, { required: true });
|
|
5416
|
+
const studentId = student.id;
|
|
5417
|
+
const goalId = flagString(parsed, "goal", { required: true });
|
|
5418
|
+
const evidence = flagString(parsed, "evidence", { required: true });
|
|
5419
|
+
const goal = unwrap(await api.client.GET("/tutor/browser/students/{userId}/goals/", {
|
|
5420
|
+
params: { path: { userId: studentId } },
|
|
5421
|
+
})).goals.find((candidate) => candidate.id === goalId);
|
|
5422
|
+
const modules = goal?.osV2?.modules ?? [];
|
|
5423
|
+
const target = modules.find((module) => module.moduleRef.toLocaleLowerCase() === moduleRef.toLocaleLowerCase());
|
|
5424
|
+
if (!target) {
|
|
5425
|
+
throw new CliError("not_found", `Module ${moduleRef} was not found on goal ${goalId}. Known refs: ${modules.map((m) => m.moduleRef).join(", ") || "none"}.`);
|
|
5426
|
+
}
|
|
5427
|
+
if (target.completedAt !== null) {
|
|
5428
|
+
throw new CliError("already_completed", `Module ${target.moduleRef} ("${target.title}") is already complete.`);
|
|
5429
|
+
}
|
|
5430
|
+
const preview = {
|
|
5431
|
+
action: "mark a lesson done in this kid's curriculum",
|
|
5432
|
+
target: {
|
|
5433
|
+
studentUserId: studentId,
|
|
5434
|
+
goalId,
|
|
5435
|
+
goalTitle: goal?.title ?? null,
|
|
5436
|
+
moduleRef: target.moduleRef,
|
|
5437
|
+
title: target.title,
|
|
5438
|
+
},
|
|
5439
|
+
request: { moduleId: target.id, evidence },
|
|
5440
|
+
details: {
|
|
5441
|
+
...resolvedStudentDetails(student),
|
|
5442
|
+
note: "The kid's next todo for this goal moves on to the following lesson. Use it when the kid already did this lesson but it was never marked done.",
|
|
5443
|
+
},
|
|
5444
|
+
};
|
|
5445
|
+
return previewBoundWrite(parsed, preview, async () => unwrap(await api.client.POST("/tutor/students/{studentId}/goals/{goalId}/modules/{moduleId}/complete", {
|
|
5446
|
+
params: { path: { studentId, goalId, moduleId: target.id } },
|
|
5447
|
+
body: { evidence },
|
|
5448
|
+
})));
|
|
5449
|
+
}
|
|
5366
5450
|
// A module added to a live goal otherwise waits for the next daily run:
|
|
5367
5451
|
// that run reuses any launch todo already dated today for the goal.
|
|
5368
5452
|
if (verb === "launch-todo") {
|
|
@@ -5757,7 +5841,7 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5757
5841
|
}
|
|
5758
5842
|
throw new CliError("invalid_arguments", "Use goals queue get|set.");
|
|
5759
5843
|
}
|
|
5760
|
-
throw new CliError("invalid_arguments", "Use goals list|create|edit|delete|restore|archive|unarchive|complete|undo-completion|move-module|launch-todo|queue|files|pdf|video.");
|
|
5844
|
+
throw new CliError("invalid_arguments", "Use goals list|create|edit|delete|restore|archive|unarchive|complete|undo-completion|move-module|complete-module|launch-todo|queue|files|pdf|video.");
|
|
5761
5845
|
}
|
|
5762
5846
|
if (noun === "channels") {
|
|
5763
5847
|
return runChannelsCommand({ parsed, api, writeCommand });
|
|
@@ -5909,7 +5993,34 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5909
5993
|
request: {},
|
|
5910
5994
|
}, async () => unwrap(await api.client.POST("/admin/browser/students/{userId}/issued-email/", { params: { path: { userId: studentId } } })));
|
|
5911
5995
|
}
|
|
5912
|
-
|
|
5996
|
+
if (verb === "web-todos") {
|
|
5997
|
+
const studentId = flagString(parsed, "student", { required: true });
|
|
5998
|
+
const on = hasFlag(parsed, "on");
|
|
5999
|
+
const off = hasFlag(parsed, "off");
|
|
6000
|
+
if (on && off) {
|
|
6001
|
+
throw new CliError("invalid_arguments", "Pass --on or --off, not both.");
|
|
6002
|
+
}
|
|
6003
|
+
if (!on && !off) {
|
|
6004
|
+
const profile = unwrap(await api.client.GET("/tutor/students/{studentId}/profile", {
|
|
6005
|
+
params: { path: { studentId } },
|
|
6006
|
+
}));
|
|
6007
|
+
return { studentId, webTodosEnabled: profile.webTodosEnabled };
|
|
6008
|
+
}
|
|
6009
|
+
return writeCommand(parsed, {
|
|
6010
|
+
action: on
|
|
6011
|
+
? "let a kid's todos run on web"
|
|
6012
|
+
: "send a kid's web todos to the desktop app instead",
|
|
6013
|
+
target: { studentUserId: studentId },
|
|
6014
|
+
request: { webTodosEnabled: on },
|
|
6015
|
+
}, async () => {
|
|
6016
|
+
unwrap(await api.client.PATCH("/tutor/students/{studentId}/profile", {
|
|
6017
|
+
params: { path: { studentId } },
|
|
6018
|
+
body: { webTodosEnabled: on },
|
|
6019
|
+
}));
|
|
6020
|
+
return { studentId, webTodosEnabled: on };
|
|
6021
|
+
});
|
|
6022
|
+
}
|
|
6023
|
+
throw new CliError("invalid_arguments", "Use students list|today|schedule|todos|analysis|xp-history|upload-map-scores|issue-email|web-todos.");
|
|
5913
6024
|
}
|
|
5914
6025
|
if (noun === "todos") {
|
|
5915
6026
|
if (verb === "create") {
|
package/dist/command-schema.js
CHANGED
|
@@ -130,6 +130,7 @@ const FAMILY_AI_COMMANDS = new Set([
|
|
|
130
130
|
"goals adaptations diff",
|
|
131
131
|
"goals adaptations list",
|
|
132
132
|
"goals archive",
|
|
133
|
+
"goals complete-module",
|
|
133
134
|
"goals create",
|
|
134
135
|
"goals edit",
|
|
135
136
|
"goals files checkout",
|
|
@@ -264,7 +265,9 @@ const STAFF_COMMANDS = new Set([
|
|
|
264
265
|
"store-items list",
|
|
265
266
|
"students upload-map-scores",
|
|
266
267
|
"students issue-email",
|
|
268
|
+
"students web-todos",
|
|
267
269
|
"students notes add",
|
|
270
|
+
"students interests",
|
|
268
271
|
"students todos",
|
|
269
272
|
"students analysis",
|
|
270
273
|
"todos complete",
|
|
@@ -242,8 +242,18 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
242
242
|
...(grade ? { grade } : {}),
|
|
243
243
|
};
|
|
244
244
|
});
|
|
245
|
+
// An existing kid account (a family from an older invite flow): the
|
|
246
|
+
// packet enrolls it instead of creating a duplicate. "USER_ID[:grade]".
|
|
247
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
248
|
+
for (const raw of flagList(parsed, "existing-kid")) {
|
|
249
|
+
const [userId, grade] = raw.split(":").map((v) => v.trim());
|
|
250
|
+
if (!userId || !UUID.test(userId)) {
|
|
251
|
+
throw new CliError("invalid_arguments", `--existing-kid takes "USER_ID[:grade]", got "${raw}".`);
|
|
252
|
+
}
|
|
253
|
+
kids.push({ userId, ...(grade ? { grade } : {}) });
|
|
254
|
+
}
|
|
245
255
|
if (!kids.length) {
|
|
246
|
-
throw new CliError("invalid_arguments", 'At least one --kid "First Last:YYYY-MM-DD[:grade]" is required.');
|
|
256
|
+
throw new CliError("invalid_arguments", 'At least one --kid "First Last:YYYY-MM-DD[:grade]" or --existing-kid USER_ID is required.');
|
|
247
257
|
}
|
|
248
258
|
const enrollmentChoice = assertChoice(flagString(parsed, "enrollment", { required: true }), ["direct", "partner-school", "program"], "--enrollment");
|
|
249
259
|
const enrollment = enrollmentChoice === "partner-school"
|
package/dist/commands/reports.js
CHANGED
|
@@ -4,15 +4,50 @@ import { unwrap } from "../api.js";
|
|
|
4
4
|
import { flagString, hasFlag } from "../args.js";
|
|
5
5
|
import { CliError } from "../errors.js";
|
|
6
6
|
const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
7
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
8
|
+
/**
|
|
9
|
+
* Student data: write to a fresh 0600 temp file, then rename it over the
|
|
10
|
+
* destination. A plain writeFile keeps an existing file's looser mode and would
|
|
11
|
+
* follow a symlink planted at the destination.
|
|
12
|
+
*/
|
|
13
|
+
async function writePrivateFile(dir, name, data) {
|
|
14
|
+
const file = path.join(dir, name);
|
|
15
|
+
const tmp = path.join(dir, `.${name}.${process.pid}.${Date.now()}.tmp`);
|
|
16
|
+
try {
|
|
17
|
+
await fs.writeFile(tmp, data, { mode: 0o600, flag: "wx" });
|
|
18
|
+
await fs.rename(tmp, file);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
// Remove our (possibly partial) temp file; EEXIST means it isn't ours.
|
|
22
|
+
if (error.code !== "EEXIST") {
|
|
23
|
+
await fs.rm(tmp, { force: true });
|
|
24
|
+
}
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
return file;
|
|
28
|
+
}
|
|
29
|
+
function weekFlag(parsed) {
|
|
30
|
+
const weekStart = flagString(parsed, "week")?.trim();
|
|
31
|
+
if (weekStart && !ISO_DATE.test(weekStart)) {
|
|
32
|
+
throw new CliError("invalid_arguments", "--week must be the Monday of the week, as YYYY-MM-DD.");
|
|
33
|
+
}
|
|
34
|
+
return weekStart;
|
|
35
|
+
}
|
|
7
36
|
/**
|
|
8
37
|
* `recess reports activity` — the weekly student activity report, generated on
|
|
9
38
|
* the server (GET /admin/activity-reports/) and written to a local folder: the
|
|
10
39
|
* summary PDF, the CSV bundle, and the per-student summaries JSON.
|
|
40
|
+
*
|
|
41
|
+
* `recess reports parent-recap` — one kid's weekly parent recap email: preview
|
|
42
|
+
* (HTML, text, and the editable summary JSON) and `send` of the reviewed copy.
|
|
11
43
|
*/
|
|
12
|
-
export async function runReportsCommand(
|
|
44
|
+
export async function runReportsCommand(context) {
|
|
45
|
+
const { parsed, api } = context;
|
|
13
46
|
const verb = parsed.positionals[1];
|
|
47
|
+
if (verb === "parent-recap")
|
|
48
|
+
return runParentRecap(context);
|
|
14
49
|
if (verb !== "activity") {
|
|
15
|
-
throw new CliError("invalid_arguments", "Usage: recess reports activity --partner-school <slug|id> | --guide <name|email|id> | --cohort <cohort-id>. See `recess help`.");
|
|
50
|
+
throw new CliError("invalid_arguments", "Usage: recess reports activity --partner-school <slug|id> | --guide <name|email|id> | --cohort <cohort-id>, or recess reports parent-recap --student <id>. See `recess help`.");
|
|
16
51
|
}
|
|
17
52
|
const partnerSchool = flagString(parsed, "partner-school")?.trim();
|
|
18
53
|
const guide = flagString(parsed, "guide")?.trim();
|
|
@@ -20,10 +55,7 @@ export async function runReportsCommand({ parsed, api, }) {
|
|
|
20
55
|
if ([partnerSchool, guide, cohortId].filter(Boolean).length !== 1) {
|
|
21
56
|
throw new CliError("invalid_arguments", "Pass exactly one of --partner-school, --guide, or --cohort.");
|
|
22
57
|
}
|
|
23
|
-
const weekStart =
|
|
24
|
-
if (weekStart && !ISO_DATE.test(weekStart)) {
|
|
25
|
-
throw new CliError("invalid_arguments", "--week must be the Monday of the week, as YYYY-MM-DD.");
|
|
26
|
-
}
|
|
58
|
+
const weekStart = weekFlag(parsed);
|
|
27
59
|
const query = {
|
|
28
60
|
...(partnerSchool ? { partnerSchool } : {}),
|
|
29
61
|
...(guide ? { guide } : {}),
|
|
@@ -36,24 +68,8 @@ export async function runReportsCommand({ parsed, api, }) {
|
|
|
36
68
|
const dir = path.resolve(flagString(parsed, "out") ?? stem);
|
|
37
69
|
await fs.mkdir(dir, { recursive: true });
|
|
38
70
|
const files = [];
|
|
39
|
-
// Student data: write each file to a fresh 0600 temp file, then rename it
|
|
40
|
-
// over the destination. A plain writeFile keeps an existing file's looser
|
|
41
|
-
// mode and would follow a symlink planted at the destination.
|
|
42
71
|
const write = async (name, data) => {
|
|
43
|
-
|
|
44
|
-
const tmp = path.join(dir, `.${name}.${process.pid}.${Date.now()}.tmp`);
|
|
45
|
-
try {
|
|
46
|
-
await fs.writeFile(tmp, data, { mode: 0o600, flag: "wx" });
|
|
47
|
-
await fs.rename(tmp, file);
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
// Remove our (possibly partial) temp file; EEXIST means it isn't ours.
|
|
51
|
-
if (error.code !== "EEXIST") {
|
|
52
|
-
await fs.rm(tmp, { force: true });
|
|
53
|
-
}
|
|
54
|
-
throw error;
|
|
55
|
-
}
|
|
56
|
-
files.push(file);
|
|
72
|
+
files.push(await writePrivateFile(dir, name, data));
|
|
57
73
|
};
|
|
58
74
|
await write(`${stem}_summary.pdf`, Buffer.from(report.pdfBase64, "base64"));
|
|
59
75
|
for (const [name, text] of Object.entries(report.csv))
|
|
@@ -81,4 +97,92 @@ export async function runReportsCommand({ parsed, api, }) {
|
|
|
81
97
|
].join("\n"),
|
|
82
98
|
};
|
|
83
99
|
}
|
|
100
|
+
async function runParentRecap({ parsed, api, writeCommand, }) {
|
|
101
|
+
const studentId = flagString(parsed, "student")?.trim();
|
|
102
|
+
if (!studentId || !UUID.test(studentId)) {
|
|
103
|
+
throw new CliError("invalid_arguments", "--student <student-id> is required.");
|
|
104
|
+
}
|
|
105
|
+
const weekStart = weekFlag(parsed);
|
|
106
|
+
const json = hasFlag(parsed, "json");
|
|
107
|
+
if (parsed.positionals[2] === "publish") {
|
|
108
|
+
if (!weekStart) {
|
|
109
|
+
throw new CliError("invalid_arguments", "Usage: recess reports parent-recap publish --student <id> --week YYYY-MM-DD [--no-text] [--to <phone>] [--confirm].");
|
|
110
|
+
}
|
|
111
|
+
const testTo = flagString(parsed, "to")?.trim();
|
|
112
|
+
const text = !hasFlag(parsed, "no-text");
|
|
113
|
+
const body = { studentId, weekStart, text, ...(testTo ? { testTo } : {}) };
|
|
114
|
+
return writeCommand(parsed, {
|
|
115
|
+
action: testTo
|
|
116
|
+
? `text a [Test] link to the ${weekStart} recap to ${testTo} (publishes nothing)`
|
|
117
|
+
: `publish the ${weekStart} recap to the family's dashboard${text ? " and text guardians the link" : ""}`,
|
|
118
|
+
target: { studentId, weekStart, ...(testTo ? { testTo } : {}) },
|
|
119
|
+
request: body,
|
|
120
|
+
}, async () => {
|
|
121
|
+
const result = unwrap(await api.client.POST("/admin/parent-recaps/publish", { body }));
|
|
122
|
+
if (json)
|
|
123
|
+
return result;
|
|
124
|
+
return {
|
|
125
|
+
help: [
|
|
126
|
+
testTo
|
|
127
|
+
? `Test link: ${result.recap.url}`
|
|
128
|
+
: `Published: ${result.recap.url}`,
|
|
129
|
+
result.textedCount
|
|
130
|
+
? `Texted ${result.textedCount} ${result.textedCount === 1 ? "person" : "people"}.`
|
|
131
|
+
: `No texts sent: ${result.skippedReason ?? "unknown reason"}`,
|
|
132
|
+
].join("\n"),
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
let summary;
|
|
137
|
+
const summaryPath = flagString(parsed, "summary")?.trim();
|
|
138
|
+
if (summaryPath) {
|
|
139
|
+
try {
|
|
140
|
+
summary = JSON.parse(await fs.readFile(path.resolve(summaryPath), "utf8"));
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
throw new CliError("invalid_arguments", `Could not read --summary ${summaryPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const body = {
|
|
147
|
+
studentId,
|
|
148
|
+
...(weekStart ? { weekStart } : {}),
|
|
149
|
+
ai: !hasFlag(parsed, "no-ai"),
|
|
150
|
+
...(summary ? { summary } : {}),
|
|
151
|
+
};
|
|
152
|
+
// A draft is staff-only on the dashboard: nothing reaches the family until
|
|
153
|
+
// `publish`, so drafting skips the confirm round trip.
|
|
154
|
+
const recap = await writeCommand(parsed, {
|
|
155
|
+
action: `draft the ${weekStart ?? "last full week's"} parent recap (staff-only until published)`,
|
|
156
|
+
target: { studentId, ...(weekStart ? { weekStart } : {}) },
|
|
157
|
+
request: { ...body, summary: summaryPath ?? null },
|
|
158
|
+
}, async () => unwrap(await api.client.POST("/admin/parent-recaps/", { body })), { ungated: true });
|
|
159
|
+
const files = [];
|
|
160
|
+
if (recap.summary) {
|
|
161
|
+
const dir = path.resolve(flagString(parsed, "out") ?? ".");
|
|
162
|
+
await fs.mkdir(dir, { recursive: true });
|
|
163
|
+
const name = `parent-recap_${recap.data.firstName.toLowerCase().replace(/[^a-z0-9]+/g, "-")}-${studentId.slice(0, 8)}_${recap.weekStart}_summary.json`;
|
|
164
|
+
files.push(await writePrivateFile(dir, name, `${JSON.stringify(recap.summary, null, 2)}\n`));
|
|
165
|
+
}
|
|
166
|
+
if (json)
|
|
167
|
+
return { ...recap, files };
|
|
168
|
+
return {
|
|
169
|
+
help: [
|
|
170
|
+
`${recap.data.firstName}'s recap for ${recap.weekStart} to ${recap.data.weekEnd} (draft, staff-only)`,
|
|
171
|
+
`Review: ${recap.url}`,
|
|
172
|
+
...(recap.data.emptyWeek
|
|
173
|
+
? ["Nothing was recorded this week; don't publish this one."]
|
|
174
|
+
: []),
|
|
175
|
+
...(files[0]
|
|
176
|
+
? [
|
|
177
|
+
`Copy: ${files[0]}`,
|
|
178
|
+
"",
|
|
179
|
+
"To change the copy, edit that file and redraft with it:",
|
|
180
|
+
` recess reports parent-recap --student ${studentId} --week ${recap.weekStart} --summary ${files[0]}`,
|
|
181
|
+
"Then publish (shows it on the family dashboard and texts the link):",
|
|
182
|
+
` recess reports parent-recap publish --student ${studentId} --week ${recap.weekStart} [--to +1555...] --confirm`,
|
|
183
|
+
]
|
|
184
|
+
: []),
|
|
185
|
+
].join("\n"),
|
|
186
|
+
};
|
|
187
|
+
}
|
|
84
188
|
//# sourceMappingURL=reports.js.map
|
package/dist/help.js
CHANGED
|
@@ -79,7 +79,10 @@ Usage:
|
|
|
79
79
|
recess [--json] students upload-map-scores --student <kid-id>
|
|
80
80
|
--file </path/to/map-report.pdf> [--confirm]
|
|
81
81
|
recess [--json] students issue-email --student <kid-id> [--confirm]
|
|
82
|
+
recess [--json] students web-todos --student <kid-id> [--on|--off] [--confirm]
|
|
82
83
|
recess [--json] students notes add --student <kid-id> --text TEXT [--confirm]
|
|
84
|
+
recess [--json] students interests --student <kid-id> [--add LABEL]...
|
|
85
|
+
[--remove <interest-id>]... [--confirm]
|
|
83
86
|
recess [--json] chat-logs list --student <user-id> [--limit 100] [--cursor <cursor>]
|
|
84
87
|
recess [--json] chat-logs get <conversation-id>
|
|
85
88
|
recess [--json] chat-logs by-todo <todo-id>
|
|
@@ -204,7 +207,8 @@ Usage:
|
|
|
204
207
|
recess [--json] tuition-plans states
|
|
205
208
|
recess [--json] admissions create --school <institution-slug> --enrollment direct|partner-school|program
|
|
206
209
|
[--partner-school <slug|id>] --parent "First Last" --email EMAIL [--phone TEXT] --state XX
|
|
207
|
-
--kid "First Last:YYYY-MM-DD[:grade]" (repeat per child) [--
|
|
210
|
+
--kid "First Last:YYYY-MM-DD[:grade]" (repeat per child) [--existing-kid USER_ID[:grade]]...
|
|
211
|
+
[--application <application-id>]
|
|
208
212
|
[--financial-aid <financial-aid-application-id>|none]
|
|
209
213
|
[--tier complete] [--paywall DOLLARS|--paywall-offline] [--staff-note TEXT]... [--no-email]
|
|
210
214
|
(--no-agreement | --start YYYY-MM-DD --annual DOLLARS) [--state-funding] [--end YYYY-MM-DD]
|
|
@@ -226,6 +230,8 @@ Usage:
|
|
|
226
230
|
recess [--json] admissions upload-signed <packet-id> --file <pdf> [--option <term:payment>] [--note TEXT] [--confirm]
|
|
227
231
|
recess [--json] reports activity [--partner-school <slug|id>] [--guide <name|email|id>]
|
|
228
232
|
[--cohort <cohort-id>] [--week YYYY-MM-DD] [--no-ai] [--out <dir>]
|
|
233
|
+
recess [--json] reports parent-recap --student <student-id> [--week YYYY-MM-DD] [--no-ai] [--summary <file.json>] [--out <dir>]
|
|
234
|
+
recess [--json] reports parent-recap publish --student <student-id> --week YYYY-MM-DD [--no-text] [--to <phone>] [--confirm]
|
|
229
235
|
recess [--json] cohorts get <cohort-id> [--events-tab ACTIVE|ENDED|CANCELED|ARCHIVED]
|
|
230
236
|
recess [--json] cohorts schedule get <cohort-id>
|
|
231
237
|
recess [--json] cohorts schedule set <cohort-id> --days <MO,WE> --time <09:30> [--timezone <zone>] --effective-date <YYYY-MM-DD> --notify none|parents [--confirm] [--approval-token <token>]
|
|
@@ -499,6 +505,8 @@ Usage:
|
|
|
499
505
|
[--confirm --approval-token TOKEN]
|
|
500
506
|
recess [--json] goals move-module <module-ref> --student <kid-id> --goal <goal-id>
|
|
501
507
|
(--to-end | --position <n>) [--confirm --approval-token TOKEN]
|
|
508
|
+
recess [--json] goals complete-module <module-ref> --student <kid-id> --goal <goal-id>
|
|
509
|
+
--evidence <text> [--confirm --approval-token TOKEN]
|
|
502
510
|
recess [--json] goals launch-todo <goal-id> --student <kid-id> [--module <module-ref>]
|
|
503
511
|
[--due-date YYYY-MM-DD] [--confirm --approval-token TOKEN]
|
|
504
512
|
recess [--json] goals queue get <goal-id> --student <kid-id>
|
|
@@ -658,7 +666,9 @@ every member of the target's family; ADMIN/MODERATOR members, your own account,
|
|
|
658
666
|
and anyone already in the destination role are listed under preview.skipped
|
|
659
667
|
rather than silently dropped. A target holding an ACTIVE or PAST_DUE enrollment
|
|
660
668
|
is refused until billing is cancelled or "--allow-billing" deliberately orphans
|
|
661
|
-
the seat.
|
|
669
|
+
the seat. An active school student (a kid in a SCHOOL family, not withdrawn)
|
|
670
|
+
is refused outright: withdraw them with "users school withdraw", which also
|
|
671
|
+
disables the account. Restore names the role explicitly because DISABLED does not record
|
|
662
672
|
what the account was; ADMIN and MODERATOR are not restorable from the CLI.
|
|
663
673
|
Note that after a disable "users get" and "users search" no longer resolve the
|
|
664
674
|
account — the confirmed write's own response is the record of what changed.
|
|
@@ -727,6 +737,15 @@ the CSVs, and the per-student AI summaries JSON to --out (default
|
|
|
727
737
|
10-30 seconds; AI summaries name the student and quote their work, so review
|
|
728
738
|
them before sending a report outside Recess.
|
|
729
739
|
|
|
740
|
+
Parent-recap notes: "reports parent-recap" drafts one student's weekly recap on
|
|
741
|
+
their dashboard (/ai/students/<id>/recaps/<week>): XP trend, plan completion,
|
|
742
|
+
subject mix, elective attendance, and parent-voice wins, challenges, and guide-
|
|
743
|
+
note summary. Drafts are staff-only; it prints the review link and writes the
|
|
744
|
+
editable _summary.json (--out, default the current folder). Redraft with
|
|
745
|
+
--summary to replace the copy; a published recap can't be redrafted. "publish"
|
|
746
|
+
shows it to the family and texts guardians the link (--no-text skips the text;
|
|
747
|
+
--to texts one [Test] link to that number and publishes nothing).
|
|
748
|
+
|
|
730
749
|
Custom plans (--custom-plan, generate/create/requote): for an arrangement the
|
|
731
750
|
computed options cannot express, e.g. a bridge payment until ESA funding
|
|
732
751
|
starts. JSON inline or @file: {"label", "summary"?, "clause"?, "continueFrom"?,
|
|
@@ -795,9 +814,15 @@ family (--parent, --email, --state, one --kid per child), how they enroll
|
|
|
795
814
|
same flags "tuition-plans generate" takes (--annual, --start, --state-funding,
|
|
796
815
|
--esa-award-unknown, ...; --note prints on the plan, --staff-note stays on the
|
|
797
816
|
packet). The plan is built once on create, so a bad spec fails there. --paywall
|
|
798
|
-
DOLLARS adds a card step at the end for that family share
|
|
799
|
-
|
|
800
|
-
|
|
817
|
+
DOLLARS adds a card step at the end for that family share, and the plan shows it
|
|
818
|
+
as a deposit: its first row, credited against the first invoices (split across
|
|
819
|
+
children like the charge); leave it off for partner-school and ESA-funded
|
|
820
|
+
families (the CLI warns). --no-email returns the
|
|
821
|
+
link without sending it. --existing-kid
|
|
822
|
+
enrolls a kid who already has an account (a family from an older invite flow)
|
|
823
|
+
instead of creating one: the kid must be in the family of the guardian who owns
|
|
824
|
+
--email, the parent signs in with that account to start, and the kid's account,
|
|
825
|
+
tier and history are left as they are. The envelope opens with the family's financial aid answers
|
|
801
826
|
for them to initial as true; they come from --financial-aid, else the application's
|
|
802
827
|
aid form, else the newest aid form under the parent's email ("none" leaves it out). "resend" mints a new link (the old one dies) and emails
|
|
803
828
|
it. "get" prints the agreed plan as signed (each child's option, term and every
|
|
@@ -933,6 +958,8 @@ export const COMMAND_SUMMARIES = {
|
|
|
933
958
|
"students texts set-guardian": "Change one adult's SMS frequency, focus, or on/off.",
|
|
934
959
|
"students upload-map-scores": "Upload a NWEA MAP score report PDF for a kid.",
|
|
935
960
|
"students issue-email": "Issue a Recess email address for a kid.",
|
|
961
|
+
"students web-todos": "Show or set whether a kid's todos run on web (off: they open in the desktop app).",
|
|
962
|
+
"students interests": "List, add, or remove a kid's interests (Rocky, the feed, and reading/writing passages use them).",
|
|
936
963
|
"students notes add": "Add a staff-visible guide note to a kid's profile (Rocky reads it).",
|
|
937
964
|
"chat-logs list": "List a student's AI chat conversations.",
|
|
938
965
|
"chat-logs get": "Read one AI chat conversation.",
|
|
@@ -1187,6 +1214,7 @@ export const COMMAND_SUMMARIES = {
|
|
|
1187
1214
|
"goals archive": "Archive a goal.",
|
|
1188
1215
|
"goals unarchive": "Unarchive a goal.",
|
|
1189
1216
|
"goals move-module": "Reorder a module in a goal's queue.",
|
|
1217
|
+
"goals complete-module": "Mark a module done so the goal moves on.",
|
|
1190
1218
|
"goals launch-todo": "Create a goal module's todo now.",
|
|
1191
1219
|
"goals queue get": "Read a goal's module queue.",
|
|
1192
1220
|
"goals queue set": "Replace a goal's module queue from JSON.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "recess-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0",
|
|
4
4
|
"description": "Safe Recess administration and family AI tools from the command line.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"@tryrecess/typescript-config": "0.0.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
|
-
"build": "
|
|
53
|
+
"build": "node node_modules/@tryrecess/typescript-config/bin/tsc-fast.mjs",
|
|
54
54
|
"client:generate": "node scripts/generate-api-types.mjs",
|
|
55
|
-
"typecheck": "
|
|
55
|
+
"typecheck": "node node_modules/@tryrecess/typescript-config/bin/tsc-fast.mjs --noEmit",
|
|
56
56
|
"format": "oxfmt --ignore-path .oxfmtignore --check",
|
|
57
57
|
"format:fix": "oxfmt --ignore-path .oxfmtignore",
|
|
58
58
|
"lint": "oxlint --type-aware src/*.ts src/commands/*.ts",
|