recess-cli 3.13.0 → 3.15.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/api.js +41 -0
- package/dist/args.js +5 -0
- package/dist/cli.js +104 -4
- package/dist/command-schema.js +2 -0
- package/dist/commands/admissions.js +234 -46
- package/dist/commands/community-hour.js +55 -0
- package/dist/commands/reports.js +127 -23
- package/dist/commands/tuition-plans.js +41 -3
- package/dist/help.js +98 -20
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -233,6 +233,47 @@ export class RecessAdminApi {
|
|
|
233
233
|
throw apiError(response.status, body);
|
|
234
234
|
return body;
|
|
235
235
|
}
|
|
236
|
+
/** The packet's tuition agreement as a PDF, to sign by hand. */
|
|
237
|
+
async downloadAdmissionContract(packetId, optionId) {
|
|
238
|
+
this.requireAuth();
|
|
239
|
+
const url = new URL(`/admin/admissions/${encodeURIComponent(packetId)}/contract`, this.config.apiOrigin);
|
|
240
|
+
if (optionId)
|
|
241
|
+
url.searchParams.set("option", optionId);
|
|
242
|
+
const response = await fetch(url, {
|
|
243
|
+
headers: cliRequestHeaders({ cookie: this.config.sessionCookie }, this.reason, this.clientTag),
|
|
244
|
+
});
|
|
245
|
+
noteServerCliVersions(response.headers);
|
|
246
|
+
if (!response.ok) {
|
|
247
|
+
const body = await readResponseBody(response);
|
|
248
|
+
throw apiError(response.status, body);
|
|
249
|
+
}
|
|
250
|
+
const disposition = response.headers.get("content-disposition") ?? "";
|
|
251
|
+
return {
|
|
252
|
+
bytes: new Uint8Array(await response.arrayBuffer()),
|
|
253
|
+
fileName: disposition.match(/filename="?([^";]+)"?/)?.[1] ??
|
|
254
|
+
`admission-${packetId}-agreement.pdf`,
|
|
255
|
+
optionId: response.headers.get("x-admission-option") ?? optionId ?? "",
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
/** Files a hand-signed agreement; fields go before the file. */
|
|
259
|
+
async uploadAdmissionSignedAgreement(packetId, pdf, fileName, fields) {
|
|
260
|
+
this.requireAuth();
|
|
261
|
+
const formData = new FormData();
|
|
262
|
+
if (fields.optionId)
|
|
263
|
+
formData.append("optionId", fields.optionId);
|
|
264
|
+
if (fields.note)
|
|
265
|
+
formData.append("note", fields.note);
|
|
266
|
+
const pdfBody = new Uint8Array(pdf.byteLength);
|
|
267
|
+
pdfBody.set(pdf);
|
|
268
|
+
formData.append("file", new Blob([pdfBody.buffer], { type: "application/pdf" }), fileName);
|
|
269
|
+
const headers = cliRequestHeaders({ cookie: this.config.sessionCookie }, this.reason, this.clientTag);
|
|
270
|
+
applyIdempotencyHeaders(headers);
|
|
271
|
+
const response = await fetch(new URL(`/admin/admissions/${encodeURIComponent(packetId)}/signed-agreement`, this.config.apiOrigin), { method: "POST", headers, body: formData });
|
|
272
|
+
const body = await readResponseBody(response);
|
|
273
|
+
if (!response.ok)
|
|
274
|
+
throw apiError(response.status, body);
|
|
275
|
+
return body;
|
|
276
|
+
}
|
|
236
277
|
villageSession() {
|
|
237
278
|
this.requireAuth();
|
|
238
279
|
this.villageSessionPromise ??= (async () => {
|
package/dist/args.js
CHANGED
|
@@ -7,6 +7,7 @@ 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",
|
|
@@ -19,8 +20,12 @@ export const REPEATABLE_FLAGS = new Set([
|
|
|
19
20
|
*/
|
|
20
21
|
export const BOOLEAN_FLAGS = new Set([
|
|
21
22
|
"keep-plan",
|
|
23
|
+
"custom-only",
|
|
24
|
+
"no-agreement",
|
|
25
|
+
"paywall-offline",
|
|
22
26
|
"no-email",
|
|
23
27
|
"no-paywall",
|
|
28
|
+
"no-text",
|
|
24
29
|
"all",
|
|
25
30
|
"all-references",
|
|
26
31
|
"allow-assigned-edits",
|
package/dist/cli.js
CHANGED
|
@@ -18,6 +18,7 @@ import { runRoomsCommand } from "./commands/rooms.js";
|
|
|
18
18
|
import { runFeedCommand } from "./commands/feed.js";
|
|
19
19
|
import { runFamiliesCommand } from "./commands/families.js";
|
|
20
20
|
import { runStudentsTextsCommand, runUsersPhoneCommand, } from "./commands/phone-and-texts.js";
|
|
21
|
+
import { hasCommunityHour, runUsersCommunityHourCommand, } from "./commands/community-hour.js";
|
|
21
22
|
import { runTuitionPlansCommand } from "./commands/tuition-plans.js";
|
|
22
23
|
import { runReportsCommand } from "./commands/reports.js";
|
|
23
24
|
import { runMasteryCommand } from "./commands/mastery.js";
|
|
@@ -3105,6 +3106,9 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
3105
3106
|
if (noun === "users" && verb === "phone") {
|
|
3106
3107
|
return runUsersPhoneCommand({ parsed, api, writeCommand });
|
|
3107
3108
|
}
|
|
3109
|
+
if (noun === "users" && verb === "community-hour") {
|
|
3110
|
+
return runUsersCommunityHourCommand({ parsed, api, writeCommand });
|
|
3111
|
+
}
|
|
3108
3112
|
if (noun === "users" && verb === "get") {
|
|
3109
3113
|
const userId = positional(parsed, 2, "user ID");
|
|
3110
3114
|
return unwrap(await api.client.GET("/admin/users/{userId}", {
|
|
@@ -3138,6 +3142,14 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
3138
3142
|
...(target.role === "KID" ? [describe(target)] : []),
|
|
3139
3143
|
...(target.role === "KID" ? guardians.map(describe) : [describe(target)]),
|
|
3140
3144
|
];
|
|
3145
|
+
// Community Hour is a separate kid access role (`users community-hour`):
|
|
3146
|
+
// lock revokes it with the other kid roles, unlock does not grant it.
|
|
3147
|
+
const communityHourNow = target.role === "KID" ? hasCommunityHour(target.accessRoles) : null;
|
|
3148
|
+
const communityHourNote = locking && communityHourNow === true
|
|
3149
|
+
? `Lock removes the kid's Community Hour access and "users unlock" will not restore it. Restore it with: recess users community-hour unlock ${target.id}`
|
|
3150
|
+
: !locking && communityHourNow === false
|
|
3151
|
+
? `Account unlock does not grant Community Hour. To let the kid join Community Hour and enter the Village, also run: recess users community-hour unlock ${target.id}`
|
|
3152
|
+
: null;
|
|
3141
3153
|
const preview = {
|
|
3142
3154
|
userId: target.id,
|
|
3143
3155
|
name: [target.firstName, target.lastName].filter(Boolean).join(" "),
|
|
@@ -3148,6 +3160,13 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
3148
3160
|
guardians.every((member) => isUnlocked(member.attributes))
|
|
3149
3161
|
: isUnlocked(target.attributes),
|
|
3150
3162
|
accountUnlockedAfter: !locking,
|
|
3163
|
+
...(communityHourNow === null
|
|
3164
|
+
? {}
|
|
3165
|
+
: {
|
|
3166
|
+
communityHourUnlockedNow: communityHourNow,
|
|
3167
|
+
communityHourUnlockedAfter: locking ? false : communityHourNow,
|
|
3168
|
+
}),
|
|
3169
|
+
...(communityHourNote === null ? {} : { communityHourNote }),
|
|
3151
3170
|
kidIds,
|
|
3152
3171
|
guardianIds,
|
|
3153
3172
|
affected,
|
|
@@ -3158,8 +3177,8 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
3158
3177
|
const body = { kidIds, guardianIds };
|
|
3159
3178
|
return writeCommand(parsed, {
|
|
3160
3179
|
action: locking
|
|
3161
|
-
? "lock the account: revoke the kid and guardian access roles, drop the kid from their Recess channels, and clear FLAG_ACCOUNT_UNLOCKED"
|
|
3162
|
-
: "unlock the account: grant the kid and guardian access roles, restore the kid's Recess channel memberships, and set FLAG_ACCOUNT_UNLOCKED (the kid's clients are notified live)",
|
|
3180
|
+
? "lock the account: revoke the kid and guardian access roles (including the kid's Community Hour access), drop the kid from their Recess channels, and clear FLAG_ACCOUNT_UNLOCKED"
|
|
3181
|
+
: "unlock the account: grant the kid and guardian access roles (not Community Hour; that is users community-hour unlock), restore the kid's Recess channel memberships, and set FLAG_ACCOUNT_UNLOCKED (the kid's clients are notified live)",
|
|
3163
3182
|
target: { userId: target.id, kidIds, guardianIds },
|
|
3164
3183
|
request: body,
|
|
3165
3184
|
details: preview,
|
|
@@ -3229,6 +3248,23 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
3229
3248
|
if (acting.length === 0) {
|
|
3230
3249
|
throw new CliError("no_op", `Nothing to ${verb}: every candidate was skipped. See preview.skipped for why.`, 1, { preview });
|
|
3231
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
|
+
}
|
|
3232
3268
|
const billing = acting.filter((member) => member.billableEnrollments > 0);
|
|
3233
3269
|
if (disabling && billing.length > 0 && !hasFlag(parsed, "allow-billing")) {
|
|
3234
3270
|
throw new CliError("billable_enrollments", `${billing
|
|
@@ -5344,6 +5380,43 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5344
5380
|
body: { ordinal },
|
|
5345
5381
|
})));
|
|
5346
5382
|
}
|
|
5383
|
+
if (verb === "complete-module") {
|
|
5384
|
+
const moduleRef = positional(parsed, 2, "module ref (e.g. B3)");
|
|
5385
|
+
const student = await studentFlag(api, parsed, { required: true });
|
|
5386
|
+
const studentId = student.id;
|
|
5387
|
+
const goalId = flagString(parsed, "goal", { required: true });
|
|
5388
|
+
const evidence = flagString(parsed, "evidence", { required: true });
|
|
5389
|
+
const goal = unwrap(await api.client.GET("/tutor/browser/students/{userId}/goals/", {
|
|
5390
|
+
params: { path: { userId: studentId } },
|
|
5391
|
+
})).goals.find((candidate) => candidate.id === goalId);
|
|
5392
|
+
const modules = goal?.osV2?.modules ?? [];
|
|
5393
|
+
const target = modules.find((module) => module.moduleRef.toLocaleLowerCase() === moduleRef.toLocaleLowerCase());
|
|
5394
|
+
if (!target) {
|
|
5395
|
+
throw new CliError("not_found", `Module ${moduleRef} was not found on goal ${goalId}. Known refs: ${modules.map((m) => m.moduleRef).join(", ") || "none"}.`);
|
|
5396
|
+
}
|
|
5397
|
+
if (target.completedAt !== null) {
|
|
5398
|
+
throw new CliError("already_completed", `Module ${target.moduleRef} ("${target.title}") is already complete.`);
|
|
5399
|
+
}
|
|
5400
|
+
const preview = {
|
|
5401
|
+
action: "mark a lesson done in this kid's curriculum",
|
|
5402
|
+
target: {
|
|
5403
|
+
studentUserId: studentId,
|
|
5404
|
+
goalId,
|
|
5405
|
+
goalTitle: goal?.title ?? null,
|
|
5406
|
+
moduleRef: target.moduleRef,
|
|
5407
|
+
title: target.title,
|
|
5408
|
+
},
|
|
5409
|
+
request: { moduleId: target.id, evidence },
|
|
5410
|
+
details: {
|
|
5411
|
+
...resolvedStudentDetails(student),
|
|
5412
|
+
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.",
|
|
5413
|
+
},
|
|
5414
|
+
};
|
|
5415
|
+
return previewBoundWrite(parsed, preview, async () => unwrap(await api.client.POST("/tutor/students/{studentId}/goals/{goalId}/modules/{moduleId}/complete", {
|
|
5416
|
+
params: { path: { studentId, goalId, moduleId: target.id } },
|
|
5417
|
+
body: { evidence },
|
|
5418
|
+
})));
|
|
5419
|
+
}
|
|
5347
5420
|
// A module added to a live goal otherwise waits for the next daily run:
|
|
5348
5421
|
// that run reuses any launch todo already dated today for the goal.
|
|
5349
5422
|
if (verb === "launch-todo") {
|
|
@@ -5738,7 +5811,7 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5738
5811
|
}
|
|
5739
5812
|
throw new CliError("invalid_arguments", "Use goals queue get|set.");
|
|
5740
5813
|
}
|
|
5741
|
-
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.");
|
|
5814
|
+
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.");
|
|
5742
5815
|
}
|
|
5743
5816
|
if (noun === "channels") {
|
|
5744
5817
|
return runChannelsCommand({ parsed, api, writeCommand });
|
|
@@ -5890,7 +5963,34 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5890
5963
|
request: {},
|
|
5891
5964
|
}, async () => unwrap(await api.client.POST("/admin/browser/students/{userId}/issued-email/", { params: { path: { userId: studentId } } })));
|
|
5892
5965
|
}
|
|
5893
|
-
|
|
5966
|
+
if (verb === "web-todos") {
|
|
5967
|
+
const studentId = flagString(parsed, "student", { required: true });
|
|
5968
|
+
const on = hasFlag(parsed, "on");
|
|
5969
|
+
const off = hasFlag(parsed, "off");
|
|
5970
|
+
if (on && off) {
|
|
5971
|
+
throw new CliError("invalid_arguments", "Pass --on or --off, not both.");
|
|
5972
|
+
}
|
|
5973
|
+
if (!on && !off) {
|
|
5974
|
+
const profile = unwrap(await api.client.GET("/tutor/students/{studentId}/profile", {
|
|
5975
|
+
params: { path: { studentId } },
|
|
5976
|
+
}));
|
|
5977
|
+
return { studentId, webTodosEnabled: profile.webTodosEnabled };
|
|
5978
|
+
}
|
|
5979
|
+
return writeCommand(parsed, {
|
|
5980
|
+
action: on
|
|
5981
|
+
? "let a kid's todos run on web"
|
|
5982
|
+
: "send a kid's web todos to the desktop app instead",
|
|
5983
|
+
target: { studentUserId: studentId },
|
|
5984
|
+
request: { webTodosEnabled: on },
|
|
5985
|
+
}, async () => {
|
|
5986
|
+
unwrap(await api.client.PATCH("/tutor/students/{studentId}/profile", {
|
|
5987
|
+
params: { path: { studentId } },
|
|
5988
|
+
body: { webTodosEnabled: on },
|
|
5989
|
+
}));
|
|
5990
|
+
return { studentId, webTodosEnabled: on };
|
|
5991
|
+
});
|
|
5992
|
+
}
|
|
5993
|
+
throw new CliError("invalid_arguments", "Use students list|today|schedule|todos|analysis|xp-history|upload-map-scores|issue-email|web-todos.");
|
|
5894
5994
|
}
|
|
5895
5995
|
if (noun === "todos") {
|
|
5896
5996
|
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,6 +265,7 @@ 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",
|
|
268
270
|
"students todos",
|
|
269
271
|
"students analysis",
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
1
4
|
import { unwrap } from "../api.js";
|
|
2
5
|
import { flagList, flagString, hasFlag } from "../args.js";
|
|
3
6
|
import { CliError } from "../errors.js";
|
|
@@ -17,13 +20,63 @@ const STEP_LABELS = {
|
|
|
17
20
|
DONE: "done",
|
|
18
21
|
};
|
|
19
22
|
/** One packet as terminal text: who, where they are, and each kid's answers. */
|
|
20
|
-
|
|
23
|
+
/** One answer as text: yes/no, a confirmed checkbox, file names, a list. */
|
|
24
|
+
function answerText(value, type) {
|
|
25
|
+
if (typeof value === "boolean") {
|
|
26
|
+
return type === "checkbox"
|
|
27
|
+
? value
|
|
28
|
+
? "confirmed"
|
|
29
|
+
: ""
|
|
30
|
+
: value
|
|
31
|
+
? "yes"
|
|
32
|
+
: "no";
|
|
33
|
+
}
|
|
34
|
+
if (value === null || value === undefined)
|
|
35
|
+
return "";
|
|
36
|
+
if (Array.isArray(value)) {
|
|
37
|
+
return value
|
|
38
|
+
.map((v) => typeof v === "object" && v && "fileName" in v
|
|
39
|
+
? String(v.fileName)
|
|
40
|
+
: String(v))
|
|
41
|
+
.join("; ");
|
|
42
|
+
}
|
|
43
|
+
return typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A kid's answers under the questionnaire's sections, each line the question
|
|
47
|
+
* text. Keys the questionnaire doesn't know (an older version) print under
|
|
48
|
+
* "Other" by their raw key, so nothing is hidden.
|
|
49
|
+
*/
|
|
50
|
+
function renderAnswers(responses, questions) {
|
|
51
|
+
const lines = [];
|
|
52
|
+
let section = null;
|
|
53
|
+
const push = (title, label, text) => {
|
|
54
|
+
if (!text)
|
|
55
|
+
return;
|
|
56
|
+
if (title !== section) {
|
|
57
|
+
lines.push(` ${title}`);
|
|
58
|
+
section = title;
|
|
59
|
+
}
|
|
60
|
+
lines.push(` ${label}`, ` ${text.replace(/\n/g, "\n ")}`);
|
|
61
|
+
};
|
|
62
|
+
for (const q of questions) {
|
|
63
|
+
if (q.id in responses)
|
|
64
|
+
push(q.section, q.label, answerText(responses[q.id], q.type));
|
|
65
|
+
}
|
|
66
|
+
const known = new Set(questions.map((q) => q.id));
|
|
67
|
+
for (const [key, value] of Object.entries(responses)) {
|
|
68
|
+
if (!known.has(key))
|
|
69
|
+
push("Other", key, answerText(value));
|
|
70
|
+
}
|
|
71
|
+
return lines;
|
|
72
|
+
}
|
|
73
|
+
function renderPacket(packet, admissionUrl, questions = []) {
|
|
21
74
|
const when = (iso) => (iso ? iso.slice(0, 10) : "–");
|
|
22
75
|
const out = [
|
|
23
76
|
`ADMISSION PACKET ${packet.id}`,
|
|
24
77
|
`${packet.parentFirstName} ${packet.parentLastName} <${packet.parentEmail}>${packet.parentPhone ? ` · ${packet.parentPhone}` : ""} · ${packet.stateCode}`,
|
|
25
|
-
`${packet.enrollmentType === "PARTNER_SCHOOL" ? `Through ${packet.partnerSchool?.name ?? "partner school"}` : packet.enrollmentType === "PROGRAM" ? "Online learning program" : "Direct enrollment"} · ${packet.institution.name} · tier ${packet.tierId}${packet.paywallCents ? ` · paywall ${dollars(packet.paywallCents)}` : " · no paywall"}`,
|
|
26
|
-
`Status: ${packet.status} (${STEP_LABELS[packet.step]})`,
|
|
78
|
+
`${packet.enrollmentType === "PARTNER_SCHOOL" ? `Through ${packet.partnerSchool?.name ?? "partner school"}` : packet.enrollmentType === "PROGRAM" ? "Online learning program" : "Direct enrollment"} · ${packet.institution.name} · tier ${packet.tierId}${packet.paywallOutOfBand ? ` · out-of-band paywall${packet.paywallCents ? ` ${dollars(packet.paywallCents)}` : " (the signed plan's first invoice)"}` : packet.paywallCents ? ` · paywall ${dollars(packet.paywallCents)}` : " · no paywall"}`,
|
|
79
|
+
`Status: ${packet.status} (${STEP_LABELS[packet.step]})${packet.noAgreement ? " · no tuition agreement" : ""}`,
|
|
27
80
|
packet.financialAidApplication
|
|
28
81
|
? `Financial aid answers in the envelope: application ${packet.financialAidApplication.id} (${packet.financialAidApplication.createdAt.slice(0, 10)})`
|
|
29
82
|
: "No financial aid application attached (nothing to initial).",
|
|
@@ -37,14 +90,24 @@ function renderPacket(packet, admissionUrl) {
|
|
|
37
90
|
],
|
|
38
91
|
[
|
|
39
92
|
" Signed",
|
|
40
|
-
when(packet.signedAt),
|
|
41
|
-
packet.
|
|
42
|
-
?
|
|
43
|
-
:
|
|
93
|
+
packet.noAgreement ? "–" : when(packet.signedAt),
|
|
94
|
+
packet.noAgreement
|
|
95
|
+
? "no agreement (skipped)"
|
|
96
|
+
: packet.chosenOptionId
|
|
97
|
+
? `option ${packet.chosenOptionId}${packet.documensoEnvelopeId ? ` · documenso ${packet.documensoEnvelopeId}` : ""}`
|
|
98
|
+
: "",
|
|
44
99
|
],
|
|
45
100
|
[" Consent", when(packet.consentedAt), ""],
|
|
46
101
|
[" Questions", when(packet.questionsCompletedAt), ""],
|
|
47
|
-
...(packet.paywallCents
|
|
102
|
+
...(packet.paywallCents || packet.paywallOutOfBand
|
|
103
|
+
? [
|
|
104
|
+
[
|
|
105
|
+
" Paid",
|
|
106
|
+
when(packet.paidAt),
|
|
107
|
+
packet.paywallOutOfBand ? "out of band (staff mark it paid)" : "",
|
|
108
|
+
],
|
|
109
|
+
]
|
|
110
|
+
: []),
|
|
48
111
|
[" Complete", when(packet.completedAt), ""],
|
|
49
112
|
]),
|
|
50
113
|
];
|
|
@@ -55,11 +118,19 @@ function renderPacket(packet, admissionUrl) {
|
|
|
55
118
|
out.push("", "Agreed plan (as signed):");
|
|
56
119
|
for (const kid of packet.agreedPlan) {
|
|
57
120
|
out.push(` ${kid.studentName}: ${kid.term.label}, ${kid.payment.label.toLowerCase()} · ${kid.term.startDate} to ${kid.term.endDate} (${kid.term.instructionalDays} days) · total ${dollars(kid.payment.totalCents)}${kid.payment.discountCents ? ` (saves ${dollars(kid.payment.discountCents)})` : ""}`);
|
|
58
|
-
for (const
|
|
121
|
+
for (const row of kid.customRows ?? []) {
|
|
122
|
+
out.push(` ${row.label}: ${row.amountText ?? dollars(row.amountCents ?? 0)} · ${row.whenText ?? `invoiced ${row.date}`}${row.note ? ` (${row.note})` : ""}`);
|
|
123
|
+
}
|
|
124
|
+
for (const inst of kid.customRows?.length ? [] : kid.installments) {
|
|
59
125
|
out.push(` ${inst.label}: ${dollars(inst.amountCents)}${inst.award === "PENDING" ? " at most, set once the award is confirmed" : ""} · invoiced ${inst.invoiceDate} · due ${inst.dueDate}`);
|
|
60
126
|
}
|
|
61
127
|
}
|
|
62
128
|
}
|
|
129
|
+
if (packet.status === "ACCOUNT_CREATED" &&
|
|
130
|
+
packet.chosenOptionId &&
|
|
131
|
+
!packet.documensoEnvelopeId) {
|
|
132
|
+
out.push("", `Waiting on a hand-signed contract (option ${packet.chosenOptionId}): download it with \`recess admissions contract ${packet.id}\`, then file the signed copy with \`recess admissions upload-signed ${packet.id} --file <pdf>\`.`);
|
|
133
|
+
}
|
|
63
134
|
if (packet.signedAt) {
|
|
64
135
|
out.push(packet.signedAgreementKey
|
|
65
136
|
? `Signed agreement archived ${when(packet.signedAgreementAt)}: ${packet.signedAgreementKey}`
|
|
@@ -70,23 +141,14 @@ function renderPacket(packet, admissionUrl) {
|
|
|
70
141
|
out.push("", "Kids:");
|
|
71
142
|
for (const kid of packet.kids) {
|
|
72
143
|
out.push(` ${kid.firstName}${kid.lastName ? ` ${kid.lastName}` : ""}${kid.birthdate ? ` · born ${kid.birthdate}` : ""}${kid.grade ? ` · grade ${kid.grade}` : ""}${kid.gender ? ` · gender ${kid.gender}` : ""}${kid.ethnicity ? ` · ethnicity ${kid.ethnicity}` : ""}${kid.hispanicLatino ? ` · Hispanic/Latino ${kid.hispanicLatino}` : ""}${kid.kidUserId ? ` · user ${kid.kidUserId}` : ""}`);
|
|
73
|
-
if (kid.responses)
|
|
74
|
-
|
|
75
|
-
const shown = Array.isArray(value)
|
|
76
|
-
? value
|
|
77
|
-
.map((v) => typeof v === "object" && v && "fileName" in v
|
|
78
|
-
? String(v.fileName)
|
|
79
|
-
: String(v))
|
|
80
|
-
.join("; ")
|
|
81
|
-
: String(value);
|
|
82
|
-
if (shown)
|
|
83
|
-
out.push(` ${key}: ${shown}`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
144
|
+
if (kid.responses)
|
|
145
|
+
out.push(...renderAnswers(kid.responses, questions));
|
|
86
146
|
}
|
|
87
|
-
out.push("",
|
|
88
|
-
|
|
89
|
-
.
|
|
147
|
+
out.push("", packet.noAgreement
|
|
148
|
+
? "Plan spec: none (no tuition agreement)"
|
|
149
|
+
: `Plan spec: ${Object.entries(packet.planSpec)
|
|
150
|
+
.map(([k, v]) => `${k}=${Array.isArray(v) ? v.join("|") : String(v)}`)
|
|
151
|
+
.join(" ")}`);
|
|
90
152
|
if (packet.staffNotes)
|
|
91
153
|
out.push(`Staff notes: ${packet.staffNotes}`);
|
|
92
154
|
if (admissionUrl)
|
|
@@ -105,6 +167,16 @@ const STATUSES = [
|
|
|
105
167
|
export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
106
168
|
const verb = parsed.positionals[1];
|
|
107
169
|
const json = hasFlag(parsed, "json");
|
|
170
|
+
// Write responses carry the packet but not the questionnaire; fetch the
|
|
171
|
+
// labels only when there are answers to print.
|
|
172
|
+
const render = async (packet, admissionUrl) => {
|
|
173
|
+
const questions = packet.kids.some((k) => k.responses)
|
|
174
|
+
? unwrap(await api.client.GET("/admin/admissions/{packetId}", {
|
|
175
|
+
params: { path: { packetId: packet.id } },
|
|
176
|
+
})).questions
|
|
177
|
+
: [];
|
|
178
|
+
return renderPacket(packet, admissionUrl, questions);
|
|
179
|
+
};
|
|
108
180
|
if (verb === "list") {
|
|
109
181
|
const status = flagString(parsed, "status");
|
|
110
182
|
const { packets } = unwrap(await api.client.GET("/admin/admissions/", {
|
|
@@ -142,10 +214,12 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
142
214
|
}
|
|
143
215
|
if (verb === "get") {
|
|
144
216
|
const packetId = positional(parsed, 2, "packet ID");
|
|
145
|
-
const { packet } = unwrap(await api.client.GET("/admin/admissions/{packetId}", {
|
|
217
|
+
const { packet, questions } = unwrap(await api.client.GET("/admin/admissions/{packetId}", {
|
|
146
218
|
params: { path: { packetId } },
|
|
147
219
|
}));
|
|
148
|
-
return json
|
|
220
|
+
return json
|
|
221
|
+
? { packet }
|
|
222
|
+
: { help: renderPacket(packet, undefined, questions) };
|
|
149
223
|
}
|
|
150
224
|
if (verb === "create") {
|
|
151
225
|
const parentName = flagString(parsed, "parent", { required: true })
|
|
@@ -168,8 +242,18 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
168
242
|
...(grade ? { grade } : {}),
|
|
169
243
|
};
|
|
170
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
|
+
}
|
|
171
255
|
if (!kids.length) {
|
|
172
|
-
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.');
|
|
173
257
|
}
|
|
174
258
|
const enrollmentChoice = assertChoice(flagString(parsed, "enrollment", { required: true }), ["direct", "partner-school", "program"], "--enrollment");
|
|
175
259
|
const enrollment = enrollmentChoice === "partner-school"
|
|
@@ -186,12 +270,24 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
186
270
|
if (paywall !== undefined && (!Number.isFinite(paywall) || paywall <= 0)) {
|
|
187
271
|
throw new CliError("invalid_arguments", "--paywall must be a positive dollar amount (the family share to collect in the dashboard).");
|
|
188
272
|
}
|
|
189
|
-
const
|
|
273
|
+
const noAgreement = hasFlag(parsed, "no-agreement");
|
|
274
|
+
if (noAgreement &&
|
|
275
|
+
(flagString(parsed, "start") || flagString(parsed, "annual"))) {
|
|
276
|
+
throw new CliError("invalid_arguments", "--no-agreement takes no tuition plan; drop --start/--annual and the other plan flags.");
|
|
277
|
+
}
|
|
278
|
+
const plan = noAgreement ? null : parseTuitionPlanSpecFlags(parsed);
|
|
279
|
+
const offline = hasFlag(parsed, "paywall-offline");
|
|
280
|
+
if (noAgreement && offline) {
|
|
281
|
+
throw new CliError("invalid_arguments", "--paywall-offline bills the signed plan's first invoice, so it needs an agreement. Use --paywall DOLLARS instead.");
|
|
282
|
+
}
|
|
283
|
+
if (offline && paywall !== undefined) {
|
|
284
|
+
throw new CliError("invalid_arguments", "Use --paywall DOLLARS (card) or --paywall-offline (the plan's first invoice, marked paid by staff), not both.");
|
|
285
|
+
}
|
|
190
286
|
const warnings = [];
|
|
191
287
|
if (paywall !== undefined && enrollment === "PARTNER_SCHOOL") {
|
|
192
288
|
warnings.push("A paywall on a partner-school enrollment is unusual: the partner usually invoices.");
|
|
193
289
|
}
|
|
194
|
-
if (paywall !== undefined && plan
|
|
290
|
+
if (paywall !== undefined && plan?.stateFunding === "true") {
|
|
195
291
|
warnings.push("A paywall on an ESA-funded plan is unusual: those invoices are paid later from the award.");
|
|
196
292
|
}
|
|
197
293
|
const staffNotes = flagList(parsed, "staff-note")
|
|
@@ -219,15 +315,18 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
219
315
|
? { tierId: flagString(parsed, "tier") }
|
|
220
316
|
: {}),
|
|
221
317
|
kids,
|
|
222
|
-
plan
|
|
318
|
+
...(plan
|
|
319
|
+
? { plan: plan }
|
|
320
|
+
: { noAgreement: true }),
|
|
223
321
|
...(paywall !== undefined
|
|
224
322
|
? { paywallCents: Math.round(paywall * 100) }
|
|
225
323
|
: {}),
|
|
324
|
+
...(offline ? { paywallOutOfBand: true } : {}),
|
|
226
325
|
...(staffNotes ? { staffNotes } : {}),
|
|
227
326
|
sendEmail: !hasFlag(parsed, "no-email"),
|
|
228
327
|
};
|
|
229
328
|
return writeCommand(parsed, {
|
|
230
|
-
action: `create an admission packet for ${body.parentEmail} (${kids.map((k) => k.firstName).join(", ")}) and ${body.sendEmail ? "email them the link" : "return the link without emailing"}`,
|
|
329
|
+
action: `create an admission packet${noAgreement ? " without a tuition agreement" : ""} for ${body.parentEmail} (${kids.map((k) => k.firstName).join(", ")}) and ${body.sendEmail ? "email them the link" : "return the link without emailing"}`,
|
|
231
330
|
target: { parentEmail: body.parentEmail, school: body.institutionSlug },
|
|
232
331
|
request: body,
|
|
233
332
|
...(warnings.length ? { details: { warnings } } : {}),
|
|
@@ -237,10 +336,16 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
237
336
|
return result;
|
|
238
337
|
return {
|
|
239
338
|
help: [
|
|
240
|
-
|
|
339
|
+
await render(result.packet, result.admissionUrl),
|
|
241
340
|
"",
|
|
242
|
-
|
|
243
|
-
|
|
341
|
+
...(result.plan
|
|
342
|
+
? [
|
|
343
|
+
`Tuition plan: ${result.plan.introduction}`,
|
|
344
|
+
...result.plan.options.map((o) => ` ${o.id}: ${o.label} ${dollars(o.totalCents)}`),
|
|
345
|
+
]
|
|
346
|
+
: [
|
|
347
|
+
"No tuition agreement: the parent goes from the account to consent.",
|
|
348
|
+
]),
|
|
244
349
|
"",
|
|
245
350
|
result.emailed
|
|
246
351
|
? `Emailed ${result.packet.parentEmail}.`
|
|
@@ -264,7 +369,7 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
264
369
|
}));
|
|
265
370
|
return json
|
|
266
371
|
? result
|
|
267
|
-
: { help:
|
|
372
|
+
: { help: await render(result.packet, result.admissionUrl) };
|
|
268
373
|
});
|
|
269
374
|
}
|
|
270
375
|
if (verb === "void") {
|
|
@@ -279,7 +384,7 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
279
384
|
params: { path: { packetId } },
|
|
280
385
|
body: { reason },
|
|
281
386
|
}));
|
|
282
|
-
return json ? result : { help:
|
|
387
|
+
return json ? result : { help: await render(result.packet) };
|
|
283
388
|
});
|
|
284
389
|
}
|
|
285
390
|
if (verb === "mark-signed") {
|
|
@@ -295,7 +400,7 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
295
400
|
params: { path: { packetId } },
|
|
296
401
|
body: { optionId, ...(note ? { note } : {}) },
|
|
297
402
|
}));
|
|
298
|
-
return json ? result : { help:
|
|
403
|
+
return json ? result : { help: await render(result.packet) };
|
|
299
404
|
});
|
|
300
405
|
}
|
|
301
406
|
if (verb === "requote") {
|
|
@@ -304,14 +409,23 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
304
409
|
// wants monthly after signing pay in full); otherwise the plan flags
|
|
305
410
|
// replace it.
|
|
306
411
|
const keepPlan = hasFlag(parsed, "keep-plan");
|
|
307
|
-
const
|
|
412
|
+
const dropAgreement = hasFlag(parsed, "no-agreement");
|
|
413
|
+
if (keepPlan && dropAgreement) {
|
|
414
|
+
throw new CliError("invalid_arguments", "Use --keep-plan, --no-agreement or new plan flags, not a mix.");
|
|
415
|
+
}
|
|
416
|
+
const plan = keepPlan || dropAgreement ? null : parseTuitionPlanSpecFlags(parsed);
|
|
308
417
|
const paywallRaw = flagString(parsed, "paywall")?.replace(/[$,]/g, "");
|
|
309
418
|
const paywall = paywallRaw === undefined ? undefined : Number(paywallRaw);
|
|
310
419
|
if (paywall !== undefined && (!Number.isFinite(paywall) || paywall <= 0)) {
|
|
311
420
|
throw new CliError("invalid_arguments", "--paywall must be a positive dollar amount; --no-paywall removes it.");
|
|
312
421
|
}
|
|
313
|
-
|
|
314
|
-
|
|
422
|
+
const offlinePaywall = hasFlag(parsed, "paywall-offline");
|
|
423
|
+
if ([
|
|
424
|
+
paywall !== undefined,
|
|
425
|
+
hasFlag(parsed, "no-paywall"),
|
|
426
|
+
offlinePaywall,
|
|
427
|
+
].filter(Boolean).length > 1) {
|
|
428
|
+
throw new CliError("invalid_arguments", "Use one of --paywall DOLLARS, --paywall-offline or --no-paywall.");
|
|
315
429
|
}
|
|
316
430
|
const note = flagString(parsed, "note")?.trim();
|
|
317
431
|
// Undefined keeps the packet's paywall; null removes it.
|
|
@@ -322,11 +436,16 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
322
436
|
: undefined;
|
|
323
437
|
const body = {
|
|
324
438
|
...(plan ? { plan: plan } : {}),
|
|
325
|
-
...(
|
|
439
|
+
...(dropAgreement ? { noAgreement: true } : {}),
|
|
440
|
+
...(offlinePaywall
|
|
441
|
+
? { paywallOutOfBand: true }
|
|
442
|
+
: paywallCents !== undefined
|
|
443
|
+
? { paywallCents }
|
|
444
|
+
: {}),
|
|
326
445
|
...(note ? { note } : {}),
|
|
327
446
|
};
|
|
328
447
|
return writeCommand(parsed, {
|
|
329
|
-
action: `requote admission packet ${packetId}: ${keepPlan ? "reopen the payment choice on the same plan" : "replace its tuition plan"}${paywallCents === null ? " and remove the paywall" : paywallCents ? ` and set the paywall to ${dollars(paywallCents)}` : ""}; the family signs again from the same link`,
|
|
448
|
+
action: `requote admission packet ${packetId}: ${dropAgreement ? "drop the tuition agreement (no plan or signing)" : keepPlan ? "reopen the payment choice on the same plan" : "replace its tuition plan"}${offlinePaywall ? " and collect the first invoice out of band" : paywallCents === null ? " and remove the paywall" : paywallCents ? ` and set the paywall to ${dollars(paywallCents)}` : ""}; ${dropAgreement ? "the family continues from the same link without signing" : "the family signs again from the same link"}`,
|
|
330
449
|
target: { packetId },
|
|
331
450
|
request: body,
|
|
332
451
|
}, async () => {
|
|
@@ -334,7 +453,7 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
334
453
|
params: { path: { packetId } },
|
|
335
454
|
body,
|
|
336
455
|
}));
|
|
337
|
-
return json ? result : { help:
|
|
456
|
+
return json ? result : { help: await render(result.packet) };
|
|
338
457
|
});
|
|
339
458
|
}
|
|
340
459
|
if (verb === "archive-agreement") {
|
|
@@ -348,10 +467,79 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
348
467
|
return json
|
|
349
468
|
? result
|
|
350
469
|
: {
|
|
351
|
-
help: `${result.archived ? "Archived." : "Nothing to archive yet: the envelope is not complete, or the packet was signed outside Documenso."}\n\n${
|
|
470
|
+
help: `${result.archived ? "Archived." : "Nothing to archive yet: the envelope is not complete, or the packet was signed outside Documenso."}\n\n${await render(result.packet)}`,
|
|
471
|
+
};
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
if (verb === "mark-paid") {
|
|
475
|
+
const packetId = positional(parsed, 2, "packet ID");
|
|
476
|
+
const note = flagString(parsed, "note")?.trim();
|
|
477
|
+
return writeCommand(parsed, {
|
|
478
|
+
action: `mark admission packet ${packetId}'s first invoice as paid out of band: this unblocks class registration and completes enrollment`,
|
|
479
|
+
target: { packetId },
|
|
480
|
+
request: note ? { note } : {},
|
|
481
|
+
}, async () => {
|
|
482
|
+
const result = unwrap(await api.client.POST("/admin/admissions/{packetId}/mark-paid", {
|
|
483
|
+
params: { path: { packetId } },
|
|
484
|
+
body: note ? { note } : {},
|
|
485
|
+
}));
|
|
486
|
+
return json ? result : { help: await render(result.packet) };
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
if (verb === "contract") {
|
|
490
|
+
const packetId = positional(parsed, 2, "packet ID");
|
|
491
|
+
const option = flagString(parsed, "option");
|
|
492
|
+
const contract = await api.downloadAdmissionContract(packetId, option);
|
|
493
|
+
const out = path.resolve(flagString(parsed, "out") ?? contract.fileName);
|
|
494
|
+
await fs.writeFile(out, contract.bytes);
|
|
495
|
+
const result = {
|
|
496
|
+
packetId,
|
|
497
|
+
optionId: contract.optionId,
|
|
498
|
+
path: out,
|
|
499
|
+
bytes: contract.bytes.byteLength,
|
|
500
|
+
};
|
|
501
|
+
return json
|
|
502
|
+
? result
|
|
503
|
+
: {
|
|
504
|
+
help: `Saved the agreement for option ${contract.optionId} to ${out}. Once it's signed, file it with \`recess admissions upload-signed ${packetId} --file <pdf>\`.`,
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
if (verb === "upload-signed") {
|
|
508
|
+
const packetId = positional(parsed, 2, "packet ID");
|
|
509
|
+
const filePath = path.resolve(flagString(parsed, "file", { required: true }));
|
|
510
|
+
const optionId = flagString(parsed, "option");
|
|
511
|
+
const note = flagString(parsed, "note")?.trim();
|
|
512
|
+
let bytes;
|
|
513
|
+
try {
|
|
514
|
+
bytes = new Uint8Array(await fs.readFile(filePath));
|
|
515
|
+
}
|
|
516
|
+
catch {
|
|
517
|
+
throw new CliError("invalid_arguments", `Can't read --file ${filePath}.`);
|
|
518
|
+
}
|
|
519
|
+
if (Buffer.from(bytes.subarray(0, 5)).toString("latin1") !== "%PDF-") {
|
|
520
|
+
throw new CliError("invalid_arguments", `${filePath} isn't a PDF.`);
|
|
521
|
+
}
|
|
522
|
+
const fileName = path.basename(filePath);
|
|
523
|
+
const sha256 = createHash("sha256").update(bytes).digest("hex");
|
|
524
|
+
return writeCommand(parsed, {
|
|
525
|
+
action: `file ${fileName} as admission packet ${packetId}'s signed agreement; if the packet is waiting on signature this records the signature${optionId ? ` for option ${optionId}` : " for the option the parent chose"} and moves the family to consent`,
|
|
526
|
+
target: { packetId },
|
|
527
|
+
request: {
|
|
528
|
+
fileName,
|
|
529
|
+
bytes: bytes.byteLength,
|
|
530
|
+
sha256,
|
|
531
|
+
...(optionId ? { optionId } : {}),
|
|
532
|
+
...(note ? { note } : {}),
|
|
533
|
+
},
|
|
534
|
+
}, async () => {
|
|
535
|
+
const result = (await api.uploadAdmissionSignedAgreement(packetId, bytes, fileName, { ...(optionId ? { optionId } : {}), ...(note ? { note } : {}) }));
|
|
536
|
+
return json
|
|
537
|
+
? result
|
|
538
|
+
: {
|
|
539
|
+
help: `${result.signed ? "Signed agreement filed and the signature recorded." : "Signed agreement filed (the packet was already past signing)."}\n\n${await render(result.packet)}`,
|
|
352
540
|
};
|
|
353
541
|
});
|
|
354
542
|
}
|
|
355
|
-
throw new CliError("invalid_arguments", "Usage: recess admissions create|get|list|resend|void|mark-signed|requote|archive-agreement. See `recess help`.");
|
|
543
|
+
throw new CliError("invalid_arguments", "Usage: recess admissions create|get|list|resend|void|mark-signed|upload-signed|contract|mark-paid|requote|archive-agreement. See `recess help`.");
|
|
356
544
|
}
|
|
357
545
|
//# sourceMappingURL=admissions.js.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { unwrap } from "../api.js";
|
|
2
|
+
import { CliError } from "../errors.js";
|
|
3
|
+
import { positional } from "./shared.js";
|
|
4
|
+
/**
|
|
5
|
+
* Community Hour access is this one access role (permission
|
|
6
|
+
* `recess:join-event`): the gate for joining Community Hour and entering the
|
|
7
|
+
* Village. Account unlock does not grant it; account lock revokes it.
|
|
8
|
+
*/
|
|
9
|
+
const COMMUNITY_HOUR_ROLE = "recess:participant";
|
|
10
|
+
export function hasCommunityHour(accessRoles) {
|
|
11
|
+
return (accessRoles ?? []).some((role) => role.name === COMMUNITY_HOUR_ROLE);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `users community-hour get|unlock|lock` — the CLI twin of the "Unlock
|
|
15
|
+
* Community Hour" / "Lock Community Hour" button on the student admin page.
|
|
16
|
+
* One kid per run; the server's PATCH is a set-to, so a rerun is harmless.
|
|
17
|
+
*/
|
|
18
|
+
export async function runUsersCommunityHourCommand({ parsed, api, writeCommand, }) {
|
|
19
|
+
const action = positional(parsed, 2, "users community-hour action");
|
|
20
|
+
if (!["get", "unlock", "lock"].includes(action)) {
|
|
21
|
+
throw new CliError("invalid_arguments", "Use users community-hour get|unlock|lock.");
|
|
22
|
+
}
|
|
23
|
+
const userId = positional(parsed, 3, "kid ID");
|
|
24
|
+
const { user } = unwrap(await api.client.GET("/admin/users/{userId}", {
|
|
25
|
+
params: { path: { userId } },
|
|
26
|
+
}));
|
|
27
|
+
const current = {
|
|
28
|
+
userId: user.id,
|
|
29
|
+
name: [user.firstName, user.lastName].filter(Boolean).join(" "),
|
|
30
|
+
role: user.role,
|
|
31
|
+
communityHourUnlocked: hasCommunityHour(user.accessRoles),
|
|
32
|
+
accountUnlocked: (user.attributes ?? []).some((attribute) => attribute.attribute === "FLAG_ACCOUNT_UNLOCKED"),
|
|
33
|
+
};
|
|
34
|
+
if (user.role !== "KID") {
|
|
35
|
+
throw new CliError("invalid_arguments", `${current.name || user.id} is a ${user.role}, not a KID. Community Hour access is per kid: pass the kid's user ID.`, 1, { current });
|
|
36
|
+
}
|
|
37
|
+
if (action === "get")
|
|
38
|
+
return current;
|
|
39
|
+
const enabled = action === "unlock";
|
|
40
|
+
return writeCommand(parsed, {
|
|
41
|
+
action: enabled
|
|
42
|
+
? "unlock Community Hour for this kid: they can join Community Hour and enter the Village (the Village picks it up within about 30 seconds; the kid's open screens update on their next reload). A kid with no Community Hour group is assigned one first. Account unlock, app and chat access are unchanged"
|
|
43
|
+
: "lock Community Hour for this kid: they can no longer join Community Hour or enter the Village. Account unlock, app and chat access are unchanged",
|
|
44
|
+
target: { userId: user.id },
|
|
45
|
+
request: { enabled },
|
|
46
|
+
details: { current, communityHourUnlockedAfter: enabled },
|
|
47
|
+
}, async () => {
|
|
48
|
+
unwrap(await api.client.PATCH("/admin/users/{userId}/community-hour", {
|
|
49
|
+
params: { path: { userId: user.id } },
|
|
50
|
+
body: { enabled },
|
|
51
|
+
}));
|
|
52
|
+
return { ...current, communityHourUnlocked: enabled };
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=community-hour.js.map
|
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
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
1
2
|
import fs from "node:fs/promises";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { unwrap } from "../api.js";
|
|
@@ -66,16 +67,25 @@ function renderPlan(plan, webUrl, pdfPath) {
|
|
|
66
67
|
for (const o of plan.options) {
|
|
67
68
|
out.push("", `${o.label.toUpperCase()} (${o.startDate} → ${o.endDate}, ${o.instructionalDays} school days)`, ` ${o.description}`, renderColumns(o.paymentPlans.map((p) => [
|
|
68
69
|
` ${p.label}`,
|
|
69
|
-
|
|
70
|
+
p.kind === "STAFF_CUSTOM"
|
|
71
|
+
? "custom"
|
|
72
|
+
: `${esa && p.kind !== "PAY_IN_FULL" ? "you pay at most " : ""}${dollars(p.totalCents)}`,
|
|
70
73
|
p.summary,
|
|
71
74
|
p.scheduleLine,
|
|
72
75
|
])),
|
|
73
76
|
// Award unknown: each payment is billed as is, or a ceiling for now.
|
|
74
77
|
...(esa
|
|
75
78
|
? o.paymentPlans
|
|
76
|
-
.filter((p) => p.kind !== "PAY_IN_FULL")
|
|
79
|
+
.filter((p) => p.kind !== "PAY_IN_FULL" && p.kind !== "STAFF_CUSTOM")
|
|
77
80
|
.flatMap((p) => p.installments.map((inst) => ` ${p.kind === "MONTHLY" ? `invoiced ${inst.invoiceDate}, due ${inst.dueDate}` : `${inst.serviceStart} → ${inst.serviceEnd}`} tuition ${dollars(inst.fullTuitionCents ?? inst.amountCents)} you pay ${inst.award === "NONE" ? dollars(inst.amountCents) : `up to ${dollars(inst.amountCents)}`}${inst.illustrativeNote ? ` (${inst.illustrativeNote})` : ""} ${inst.note ?? ""}`))
|
|
78
|
-
: [])
|
|
81
|
+
: []),
|
|
82
|
+
// A staff-written option: every row as the family will see it.
|
|
83
|
+
...o.paymentPlans
|
|
84
|
+
.filter((p) => p.kind === "STAFF_CUSTOM")
|
|
85
|
+
.flatMap((p) => [
|
|
86
|
+
` ${p.label.toUpperCase()} (custom): ${p.description}`,
|
|
87
|
+
...(p.customRows ?? []).map((r) => ` ${r.label} ${r.amountText ?? dollars(r.amountCents ?? 0)} ${r.whenText ?? `invoiced ${r.date}`}${r.note ? ` ${r.note}` : ""}`),
|
|
88
|
+
]));
|
|
79
89
|
}
|
|
80
90
|
if (plan.staffNotes.length) {
|
|
81
91
|
out.push("", "Notes:", ...plan.staffNotes.map((n) => ` ${n}`));
|
|
@@ -178,6 +188,32 @@ export function parseTuitionPlanSpecFlags(parsed) {
|
|
|
178
188
|
throw new CliError("invalid_arguments", "--esa-scenarios takes up to six dollar amounts, comma-separated (e.g. 7300,14000,34000).");
|
|
179
189
|
}
|
|
180
190
|
}
|
|
191
|
+
// A staff-written option, as JSON inline or `@path/to/plan.json`; the
|
|
192
|
+
// server validates it (CustomPlanSpecSchema).
|
|
193
|
+
const customRaw = flagString(parsed, "custom-plan")?.trim();
|
|
194
|
+
let customPlan;
|
|
195
|
+
if (customRaw) {
|
|
196
|
+
const text = customRaw.startsWith("@")
|
|
197
|
+
? (() => {
|
|
198
|
+
try {
|
|
199
|
+
return readFileSync(path.resolve(customRaw.slice(1)), "utf-8");
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
throw new CliError("invalid_arguments", `Can't read --custom-plan file ${customRaw.slice(1)}.`);
|
|
203
|
+
}
|
|
204
|
+
})()
|
|
205
|
+
: customRaw;
|
|
206
|
+
try {
|
|
207
|
+
customPlan = JSON.stringify(JSON.parse(text));
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
throw new CliError("invalid_arguments", "--custom-plan takes JSON (or @file.json): {label, summary?, clause?, continueFrom?, rows: [{label, note?, amount?, amountText?, date?, when?}]}.");
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const customOnly = hasFlag(parsed, "custom-only");
|
|
214
|
+
if (customOnly && !customPlan) {
|
|
215
|
+
throw new CliError("invalid_arguments", "--custom-only needs --custom-plan.");
|
|
216
|
+
}
|
|
181
217
|
const subsetQuery = {
|
|
182
218
|
// Florida is refused as a direct enrollment without this.
|
|
183
219
|
...(hasFlag(parsed, "force-direct")
|
|
@@ -191,6 +227,8 @@ export function parseTuitionPlanSpecFlags(parsed) {
|
|
|
191
227
|
...(endDate ? { endDate } : {}),
|
|
192
228
|
...(terms ? { terms: terms.join(",") } : {}),
|
|
193
229
|
...(payments ? { payments: payments.join(",") } : {}),
|
|
230
|
+
...(customPlan ? { customPlan } : {}),
|
|
231
|
+
...(customOnly ? { customOnly: "true" } : {}),
|
|
194
232
|
};
|
|
195
233
|
return {
|
|
196
234
|
startDate: requiredFlag(parsed, "start", ISO_DATE),
|
package/dist/help.js
CHANGED
|
@@ -54,6 +54,9 @@ Usage:
|
|
|
54
54
|
recess [--json] users phone clear <user-id> [--confirm]
|
|
55
55
|
recess [--json] users lock <user-id> [--confirm]
|
|
56
56
|
recess [--json] users unlock <user-id> [--confirm]
|
|
57
|
+
recess [--json] users community-hour get <kid-id>
|
|
58
|
+
recess [--json] users community-hour unlock <kid-id> [--confirm]
|
|
59
|
+
recess [--json] users community-hour lock <kid-id> [--confirm]
|
|
57
60
|
recess [--json] users disable <user-id> [--whole-family] [--allow-billing] [--confirm]
|
|
58
61
|
recess [--json] users restore <user-id> --role kid|guardian|guide|program [--confirm]
|
|
59
62
|
recess [--json] users tier list-tiers
|
|
@@ -76,6 +79,7 @@ Usage:
|
|
|
76
79
|
recess [--json] students upload-map-scores --student <kid-id>
|
|
77
80
|
--file </path/to/map-report.pdf> [--confirm]
|
|
78
81
|
recess [--json] students issue-email --student <kid-id> [--confirm]
|
|
82
|
+
recess [--json] students web-todos --student <kid-id> [--on|--off] [--confirm]
|
|
79
83
|
recess [--json] students notes add --student <kid-id> --text TEXT [--confirm]
|
|
80
84
|
recess [--json] chat-logs list --student <user-id> [--limit 100] [--cursor <cursor>]
|
|
81
85
|
recess [--json] chat-logs get <conversation-id>
|
|
@@ -196,28 +200,36 @@ Usage:
|
|
|
196
200
|
[--one-on-one-price DOLLARS] [--one-on-one-sessions N] [--end YYYY-MM-DD]
|
|
197
201
|
[--terms full-year,school-year,custom] [--payments upfront,installments]
|
|
198
202
|
[--note TEXT]... [--bill-date upfront|N=YYYY-MM-DD]... [--amount N=DOLLARS]... [--even-installments]
|
|
199
|
-
[--esa-award-unknown [--esa-scenarios DOLLARS,...]] [--
|
|
203
|
+
[--esa-award-unknown [--esa-scenarios DOLLARS,...]] [--custom-plan JSON|@file] [--custom-only]
|
|
204
|
+
[--pdf <path>] [--open]
|
|
200
205
|
recess [--json] tuition-plans states
|
|
201
206
|
recess [--json] admissions create --school <institution-slug> --enrollment direct|partner-school|program
|
|
202
207
|
[--partner-school <slug|id>] --parent "First Last" --email EMAIL [--phone TEXT] --state XX
|
|
203
|
-
--kid "First Last:YYYY-MM-DD[:grade]" (repeat per child) [--
|
|
208
|
+
--kid "First Last:YYYY-MM-DD[:grade]" (repeat per child) [--existing-kid USER_ID[:grade]]...
|
|
209
|
+
[--application <application-id>]
|
|
204
210
|
[--financial-aid <financial-aid-application-id>|none]
|
|
205
|
-
[--tier complete] [--paywall DOLLARS] [--staff-note TEXT]... [--no-email]
|
|
206
|
-
--start YYYY-MM-DD --annual DOLLARS [--state-funding] [--end YYYY-MM-DD]
|
|
211
|
+
[--tier complete] [--paywall DOLLARS|--paywall-offline] [--staff-note TEXT]... [--no-email]
|
|
212
|
+
(--no-agreement | --start YYYY-MM-DD --annual DOLLARS) [--state-funding] [--end YYYY-MM-DD]
|
|
207
213
|
[--terms full-year,school-year,custom] [--payments upfront,installments] [--note TEXT]...
|
|
208
214
|
[--bill-date upfront|N=YYYY-MM-DD]... [--amount N=DOLLARS]... [--even-installments] [--force-direct]
|
|
209
|
-
[--esa-award-unknown [--esa-scenarios DOLLARS,...]] [--
|
|
215
|
+
[--esa-award-unknown [--esa-scenarios DOLLARS,...]] [--custom-plan JSON|@file] [--custom-only]
|
|
216
|
+
[--elective-price DOLLARS]
|
|
210
217
|
[--one-on-one-price DOLLARS] [--one-on-one-sessions N] [--confirm]
|
|
211
218
|
recess [--json] admissions get <packet-id>
|
|
212
219
|
recess [--json] admissions list [--status SENT|ACCOUNT_CREATED|SIGNED|CONSENTED|QUESTIONS_DONE|COMPLETE|VOIDED] [--email TEXT] [--limit N]
|
|
213
220
|
recess [--json] admissions resend <packet-id> [--no-email] [--confirm]
|
|
214
221
|
recess [--json] admissions void <packet-id> --reason TEXT [--confirm]
|
|
215
222
|
recess [--json] admissions mark-signed <packet-id> --option <term:payment> [--note TEXT] [--confirm]
|
|
216
|
-
recess [--json] admissions requote <packet-id> (--keep-plan | --start YYYY-MM-DD --annual DOLLARS [plan flags as in create])
|
|
217
|
-
[--paywall DOLLARS|--no-paywall] [--note TEXT] [--confirm]
|
|
223
|
+
recess [--json] admissions requote <packet-id> (--keep-plan | --no-agreement | --start YYYY-MM-DD --annual DOLLARS [plan flags as in create])
|
|
224
|
+
[--paywall DOLLARS|--paywall-offline|--no-paywall] [--note TEXT] [--confirm]
|
|
218
225
|
recess [--json] admissions archive-agreement <packet-id> [--confirm]
|
|
226
|
+
recess [--json] admissions mark-paid <packet-id> [--note TEXT] [--confirm]
|
|
227
|
+
recess [--json] admissions contract <packet-id> [--option <term:payment>] [--out <file>]
|
|
228
|
+
recess [--json] admissions upload-signed <packet-id> --file <pdf> [--option <term:payment>] [--note TEXT] [--confirm]
|
|
219
229
|
recess [--json] reports activity [--partner-school <slug|id>] [--guide <name|email|id>]
|
|
220
230
|
[--cohort <cohort-id>] [--week YYYY-MM-DD] [--no-ai] [--out <dir>]
|
|
231
|
+
recess [--json] reports parent-recap --student <student-id> [--week YYYY-MM-DD] [--no-ai] [--summary <file.json>] [--out <dir>]
|
|
232
|
+
recess [--json] reports parent-recap publish --student <student-id> --week YYYY-MM-DD [--no-text] [--to <phone>] [--confirm]
|
|
221
233
|
recess [--json] cohorts get <cohort-id> [--events-tab ACTIVE|ENDED|CANCELED|ARCHIVED]
|
|
222
234
|
recess [--json] cohorts schedule get <cohort-id>
|
|
223
235
|
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>]
|
|
@@ -491,6 +503,8 @@ Usage:
|
|
|
491
503
|
[--confirm --approval-token TOKEN]
|
|
492
504
|
recess [--json] goals move-module <module-ref> --student <kid-id> --goal <goal-id>
|
|
493
505
|
(--to-end | --position <n>) [--confirm --approval-token TOKEN]
|
|
506
|
+
recess [--json] goals complete-module <module-ref> --student <kid-id> --goal <goal-id>
|
|
507
|
+
--evidence <text> [--confirm --approval-token TOKEN]
|
|
494
508
|
recess [--json] goals launch-todo <goal-id> --student <kid-id> [--module <module-ref>]
|
|
495
509
|
[--due-date YYYY-MM-DD] [--confirm --approval-token TOKEN]
|
|
496
510
|
recess [--json] goals queue get <goal-id> --student <kid-id>
|
|
@@ -618,16 +632,30 @@ slot override; "users tier set" is the tier-driven path.
|
|
|
618
632
|
recess.gg/ai/students/<kid-id>/admin. They act on the whole account, not one
|
|
619
633
|
person: a KID target is locked or unlocked together with every GUARDIAN in
|
|
620
634
|
their family, because an unlocked kid under a locked guardian is not actually
|
|
621
|
-
unlocked. Unlock grants the kid and guardian access roles, restores
|
|
622
|
-
Recess channel memberships, sets FLAG_ACCOUNT_UNLOCKED, and notifies
|
|
623
|
-
live clients;
|
|
624
|
-
|
|
625
|
-
|
|
635
|
+
unlocked. Unlock grants the kid and guardian app and chat access roles, restores
|
|
636
|
+
the kid's Recess channel memberships, sets FLAG_ACCOUNT_UNLOCKED, and notifies
|
|
637
|
+
the kid's live clients; it does NOT grant Community Hour. Lock revokes those
|
|
638
|
+
roles plus the kid's Community Hour access, drops the kid from their Recess
|
|
639
|
+
channels, and clears the flag. Rerunning "unlock" on an already unlocked account
|
|
640
|
+
is the "Refresh Unlock" button and is safe. The preview shows each affected
|
|
641
|
+
person's current flag and, for a kid, Community Hour now and after; "users get"
|
|
642
|
+
is the read.
|
|
643
|
+
|
|
644
|
+
"users community-hour unlock|lock" is the CLI twin of the "Unlock Community
|
|
645
|
+
Hour"/"Lock Community Hour" button on recess.gg/ai/students/<kid-id>/admin.
|
|
646
|
+
Community Hour access (the kid's recess:participant access role) is separate
|
|
647
|
+
from account unlock: without it a kid cannot join Community Hour or enter the
|
|
648
|
+
Village at all. Kids only, one kid per run. Unlock first assigns a Community
|
|
649
|
+
Hour group if the kid has none, and fails with a conflict when no group has
|
|
650
|
+
room; the Village picks the change up within about 30 seconds. "users unlock"
|
|
651
|
+
does not grant it and "users lock" removes it. "users community-hour get" (or
|
|
652
|
+
"users get": accessRoles contains recess:participant) is the read.
|
|
626
653
|
|
|
627
654
|
"users disable" is the harder stop, and a different mechanism: it sets
|
|
628
655
|
User.role to DISABLED, so the account stops resolving in every dashboard,
|
|
629
656
|
search, chat, and todo query at the database layer, and its coherent-feed
|
|
630
|
-
personal data is purged. "users lock" only strips access roles
|
|
657
|
+
personal data is purged. "users lock" only strips access roles (Community Hour
|
|
658
|
+
included). Disabling is
|
|
631
659
|
SOFT and reversible — "users restore <id> --role ..." puts the account back —
|
|
632
660
|
and it is NOT a GDPR erasure; nothing is deleted. A read-only preflight resolves
|
|
633
661
|
the whole family (including members already DISABLED, which ordinary reads hide)
|
|
@@ -636,7 +664,9 @@ every member of the target's family; ADMIN/MODERATOR members, your own account,
|
|
|
636
664
|
and anyone already in the destination role are listed under preview.skipped
|
|
637
665
|
rather than silently dropped. A target holding an ACTIVE or PAST_DUE enrollment
|
|
638
666
|
is refused until billing is cancelled or "--allow-billing" deliberately orphans
|
|
639
|
-
the seat.
|
|
667
|
+
the seat. An active school student (a kid in a SCHOOL family, not withdrawn)
|
|
668
|
+
is refused outright: withdraw them with "users school withdraw", which also
|
|
669
|
+
disables the account. Restore names the role explicitly because DISABLED does not record
|
|
640
670
|
what the account was; ADMIN and MODERATOR are not restorable from the CLI.
|
|
641
671
|
Note that after a disable "users get" and "users search" no longer resolve the
|
|
642
672
|
account — the confirmed write's own response is the record of what changed.
|
|
@@ -705,6 +735,30 @@ the CSVs, and the per-student AI summaries JSON to --out (default
|
|
|
705
735
|
10-30 seconds; AI summaries name the student and quote their work, so review
|
|
706
736
|
them before sending a report outside Recess.
|
|
707
737
|
|
|
738
|
+
Parent-recap notes: "reports parent-recap" drafts one student's weekly recap on
|
|
739
|
+
their dashboard (/ai/students/<id>/recaps/<week>): XP trend, plan completion,
|
|
740
|
+
subject mix, elective attendance, and parent-voice wins, challenges, and guide-
|
|
741
|
+
note summary. Drafts are staff-only; it prints the review link and writes the
|
|
742
|
+
editable _summary.json (--out, default the current folder). Redraft with
|
|
743
|
+
--summary to replace the copy; a published recap can't be redrafted. "publish"
|
|
744
|
+
shows it to the family and texts guardians the link (--no-text skips the text;
|
|
745
|
+
--to texts one [Test] link to that number and publishes nothing).
|
|
746
|
+
|
|
747
|
+
Custom plans (--custom-plan, generate/create/requote): for an arrangement the
|
|
748
|
+
computed options cannot express, e.g. a bridge payment until ESA funding
|
|
749
|
+
starts. JSON inline or @file: {"label", "summary"?, "clause"?, "continueFrom"?,
|
|
750
|
+
"rows": [{"label", "note"?, "amount"? (dollars), "amountText"?, "date"?
|
|
751
|
+
(invoice date), "when"?}]}. Each row needs an amount or amountText and a date or
|
|
752
|
+
when; the first row needs a date and an amount (the first invoice). Rows show
|
|
753
|
+
exactly as written; dated rows with amounts are real invoices. "continueFrom": N
|
|
754
|
+
then carries on with the computed installment plan from installment N (e.g. a
|
|
755
|
+
September bridge, then the regular quarters from 2). "continueOverrides": {"N":
|
|
756
|
+
{"amount"?, "note"?}} adjusts continued installment N: a precommitted amount
|
|
757
|
+
makes it firm (no "up to"); a note replaces "Set once your award is confirmed."
|
|
758
|
+
It is offered first on the
|
|
759
|
+
first term, gets its own page in the PDF and an agreement line, and "clause"
|
|
760
|
+
prints as "If I choose <label>: <clause>". --custom-only drops the computed
|
|
761
|
+
options; --payments upfront keeps pay in full beside it.
|
|
708
762
|
Tuition-plan notes: "generate" computes a Recess Academy tuition plan (nothing is
|
|
709
763
|
stored): a 180-instructional-day term at --annual (tuition net of Recess aid) and
|
|
710
764
|
a term through the state's typical school-year end. Each is paid in full upfront
|
|
@@ -758,14 +812,33 @@ family (--parent, --email, --state, one --kid per child), how they enroll
|
|
|
758
812
|
same flags "tuition-plans generate" takes (--annual, --start, --state-funding,
|
|
759
813
|
--esa-award-unknown, ...; --note prints on the plan, --staff-note stays on the
|
|
760
814
|
packet). The plan is built once on create, so a bad spec fails there. --paywall
|
|
761
|
-
DOLLARS adds a card step at the end for that family share
|
|
762
|
-
|
|
763
|
-
|
|
815
|
+
DOLLARS adds a card step at the end for that family share, and the plan shows it
|
|
816
|
+
as a deposit: its first row, credited against the first invoices (split across
|
|
817
|
+
children like the charge); leave it off for partner-school and ESA-funded
|
|
818
|
+
families (the CLI warns). --no-email returns the
|
|
819
|
+
link without sending it. --existing-kid
|
|
820
|
+
enrolls a kid who already has an account (a family from an older invite flow)
|
|
821
|
+
instead of creating one: the kid must be in the family of the guardian who owns
|
|
822
|
+
--email, the parent signs in with that account to start, and the kid's account,
|
|
823
|
+
tier and history are left as they are. The envelope opens with the family's financial aid answers
|
|
764
824
|
for them to initial as true; they come from --financial-aid, else the application's
|
|
765
825
|
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
|
|
766
826
|
it. "get" prints the agreed plan as signed (each child's option, term and every
|
|
767
827
|
installment) and whether the signed agreement is archived in our storage; the
|
|
768
828
|
copy is taken when the envelope completes, and "archive-agreement" retries it.
|
|
829
|
+
Without Documenso (signing by hand), the parent's choice still freezes the
|
|
830
|
+
plan: "contract" saves the agreement PDF they would sign (their option, or
|
|
831
|
+
--option), and "upload-signed" files the signed copy as the packet's agreement
|
|
832
|
+
and records the signature, moving the family to consent ("mark-signed" does the
|
|
833
|
+
same with no file). The admin dashboard at /admin/admissions does both.
|
|
834
|
+
--no-agreement (create or requote) skips the tuition agreement entirely: no
|
|
835
|
+
plan flags, no quote, no signing; the parent goes from the account straight to
|
|
836
|
+
consent and questions. A card --paywall still works; --paywall-offline needs a
|
|
837
|
+
plan. Requoting with plan flags adds an agreement back.
|
|
838
|
+
--paywall-offline (create or requote) collects the signed plan's first invoice
|
|
839
|
+
outside Recess instead of by card: after the questions the family sees the
|
|
840
|
+
amount and due date, class registration stays blocked, and "mark-paid"
|
|
841
|
+
records it received, lifts the block and completes the packet.
|
|
769
842
|
"requote" replaces the tuition plan on a packet that has not been paid (same
|
|
770
843
|
plan flags as create, or --keep-plan to reopen the payment choice on the plan
|
|
771
844
|
as it is; --paywall/--no-paywall changes the family share): the Documenso
|
|
@@ -864,8 +937,11 @@ export const COMMAND_SUMMARIES = {
|
|
|
864
937
|
"users phone get": "Read a user's phone number and verification.",
|
|
865
938
|
"users phone set": "Set a user's phone number (stored E.164, unverified).",
|
|
866
939
|
"users phone clear": "Remove a user's phone number.",
|
|
867
|
-
"users
|
|
868
|
-
"users unlock": "
|
|
940
|
+
"users community-hour get": "Show whether a kid can join Community Hour.",
|
|
941
|
+
"users community-hour unlock": "Let a kid join Community Hour and enter the Village.",
|
|
942
|
+
"users community-hour lock": "Stop a kid joining Community Hour or the Village.",
|
|
943
|
+
"users lock": "Lock a kid's account with their guardians (removes Community Hour).",
|
|
944
|
+
"users unlock": "Unlock a kid's account with guardians (not Community Hour); rerun = refresh.",
|
|
869
945
|
"users disable": "Soft-disable an account or whole family (reversible; refuses live billing).",
|
|
870
946
|
"users restore": "Restore a disabled account to a named role.",
|
|
871
947
|
"users tier list-tiers": "List membership tiers and their slots.",
|
|
@@ -880,6 +956,7 @@ export const COMMAND_SUMMARIES = {
|
|
|
880
956
|
"students texts set-guardian": "Change one adult's SMS frequency, focus, or on/off.",
|
|
881
957
|
"students upload-map-scores": "Upload a NWEA MAP score report PDF for a kid.",
|
|
882
958
|
"students issue-email": "Issue a Recess email address for a kid.",
|
|
959
|
+
"students web-todos": "Show or set whether a kid's todos run on web (off: they open in the desktop app).",
|
|
883
960
|
"students notes add": "Add a staff-visible guide note to a kid's profile (Rocky reads it).",
|
|
884
961
|
"chat-logs list": "List a student's AI chat conversations.",
|
|
885
962
|
"chat-logs get": "Read one AI chat conversation.",
|
|
@@ -1134,6 +1211,7 @@ export const COMMAND_SUMMARIES = {
|
|
|
1134
1211
|
"goals archive": "Archive a goal.",
|
|
1135
1212
|
"goals unarchive": "Unarchive a goal.",
|
|
1136
1213
|
"goals move-module": "Reorder a module in a goal's queue.",
|
|
1214
|
+
"goals complete-module": "Mark a module done so the goal moves on.",
|
|
1137
1215
|
"goals launch-todo": "Create a goal module's todo now.",
|
|
1138
1216
|
"goals queue get": "Read a goal's module queue.",
|
|
1139
1217
|
"goals queue set": "Replace a goal's module queue from JSON.",
|
|
@@ -1178,7 +1256,7 @@ export const NOUN_SUMMARIES = {
|
|
|
1178
1256
|
jobs: "Local ledger of write operations by operation key.",
|
|
1179
1257
|
feedback: "Send or list feedback about this CLI.",
|
|
1180
1258
|
auth: "Sign in (browser or headless), session status, sign out.",
|
|
1181
|
-
users: "Accounts: search/get, lock/unlock, disable/restore, phone, tier, school status.",
|
|
1259
|
+
users: "Accounts: search/get, lock/unlock, community-hour, disable/restore, phone, tier, school status.",
|
|
1182
1260
|
guides: "Create and invite guide accounts.",
|
|
1183
1261
|
guardians: "Invite guardians into a family.",
|
|
1184
1262
|
students: "Kids: roster, today, schedule, todos, analysis, XP, SMS summaries, notes.",
|