recess-cli 3.10.0 → 3.11.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 +42 -10
- package/dist/cli.js +829 -130
- package/dist/command-schema.js +360 -109
- package/dist/commands/applications.js +10 -4
- package/dist/commands/channels.js +21 -1
- package/dist/commands/onboarding.js +6 -4
- package/dist/commands/safe-staff-operations.js +3 -2
- package/dist/commands/tuition-plans.js +43 -7
- package/dist/goal-authoring.js +774 -0
- package/dist/help.js +470 -36
- package/dist/index.js +17 -3
- package/dist/safety.js +20 -1
- package/dist/ui/app.js +1 -1
- package/package.json +3 -3
- package/skill/recess-cli/SKILL.md +56 -121
- package/skill/recess-cli/agents/version.json +2 -2
|
@@ -112,12 +112,14 @@ export async function runChannelsCommand({ parsed, api, writeCommand, }) {
|
|
|
112
112
|
: assertChoice(audienceFlag, AUDIENCES, "--audience");
|
|
113
113
|
const description = flagString(parsed, "description");
|
|
114
114
|
const joinAsAdmin = !hasFlag(parsed, "no-join");
|
|
115
|
+
const staffOnlyPosting = hasFlag(parsed, "staff-only");
|
|
115
116
|
const imagePath = flagString(parsed, "image");
|
|
116
117
|
const image = imagePath ? await readChannelImage(imagePath) : undefined;
|
|
117
118
|
const body = {
|
|
118
119
|
name,
|
|
119
120
|
type,
|
|
120
121
|
joinAsAdmin,
|
|
122
|
+
staffOnlyPosting,
|
|
121
123
|
...(audience !== undefined ? { audience } : {}),
|
|
122
124
|
...(description !== undefined ? { description } : {}),
|
|
123
125
|
};
|
|
@@ -187,6 +189,24 @@ export async function runChannelsCommand({ parsed, api, writeCommand, }) {
|
|
|
187
189
|
},
|
|
188
190
|
}, async () => api.uploadChannelImage(channelId, image.bytes, image.fileName, image.mimeType));
|
|
189
191
|
}
|
|
192
|
+
if (verb === "staff-only") {
|
|
193
|
+
const channelId = positional(parsed, 2, "channel ID");
|
|
194
|
+
const setting = parsed.positionals[3];
|
|
195
|
+
if (setting !== "on" && setting !== "off") {
|
|
196
|
+
throw new CliError("invalid_arguments", "Usage: channels staff-only <channel-id> on|off");
|
|
197
|
+
}
|
|
198
|
+
const staffOnlyPosting = setting === "on";
|
|
199
|
+
return writeCommand(parsed, {
|
|
200
|
+
action: staffOnlyPosting
|
|
201
|
+
? "make the channel staff-only: kids and guardians can read but not send messages"
|
|
202
|
+
: "let every member send messages in the channel again",
|
|
203
|
+
target: { channelId },
|
|
204
|
+
request: { staffOnlyPosting },
|
|
205
|
+
}, async () => unwrap(await api.client.PATCH("/admin/channels/{channelId}/staff-only", {
|
|
206
|
+
params: { path: { channelId } },
|
|
207
|
+
body: { staffOnlyPosting },
|
|
208
|
+
})));
|
|
209
|
+
}
|
|
190
210
|
if (verb === "join") {
|
|
191
211
|
const channelId = positional(parsed, 2, "channel ID");
|
|
192
212
|
const body = { channelId };
|
|
@@ -266,6 +286,6 @@ export async function runChannelsCommand({ parsed, api, writeCommand, }) {
|
|
|
266
286
|
}
|
|
267
287
|
throw new CliError("invalid_arguments", "Use channels members list|add|set-role|remove <channel-id> ...");
|
|
268
288
|
}
|
|
269
|
-
throw new CliError("invalid_arguments", "Use channels list|create|set-image|join or channels members list|add|set-role|remove.");
|
|
289
|
+
throw new CliError("invalid_arguments", "Use channels list|create|set-image|staff-only|join or channels members list|add|set-role|remove.");
|
|
270
290
|
}
|
|
271
291
|
//# sourceMappingURL=channels.js.map
|
|
@@ -757,11 +757,13 @@ export async function runOnboardingCommand({ parsed, api, writeCommand, }) {
|
|
|
757
757
|
}
|
|
758
758
|
if (verb === "meeting-cancel") {
|
|
759
759
|
const meetingId = positional(parsed, 2, "meeting ID");
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
760
|
+
// Family-facing: the server emails this text to the family. --reason
|
|
761
|
+
// stays the audit-log note only.
|
|
762
|
+
const message = flagString(parsed, "message")?.trim();
|
|
763
|
+
if (!message) {
|
|
764
|
+
throw new CliError("invalid_arguments", 'onboarding meeting-cancel requires --message TEXT: it is emailed to the family verbatim. --reason is only the audit-log note. Example: recess onboarding meeting-cancel <meeting-id> --message "We need to move our call; we will send a new time shortly." --reason "Guide unavailable"');
|
|
763
765
|
}
|
|
764
|
-
const body = { reason };
|
|
766
|
+
const body = { reason: message };
|
|
765
767
|
return writeCommand(parsed, {
|
|
766
768
|
action: "cancel the Cal.com booking and email the family the supplied reason (provisional until its webhook settles)",
|
|
767
769
|
target: { meetingId },
|
|
@@ -5,13 +5,14 @@ import { unwrap } from "../api.js";
|
|
|
5
5
|
import { flagString, hasFlag } from "../args.js";
|
|
6
6
|
import { CliError } from "../errors.js";
|
|
7
7
|
import { appendJobEvent } from "../jobs.js";
|
|
8
|
+
import { resolveApprovalToken } from "../safety.js";
|
|
8
9
|
import { assertChoice, positional } from "./shared.js";
|
|
9
10
|
const hash = (value) => createHash("sha256").update(JSON.stringify(value)).digest("hex");
|
|
10
11
|
function recoveryKey(ctx) {
|
|
11
12
|
if (!hasFlag(ctx.parsed, "confirm"))
|
|
12
13
|
return undefined;
|
|
13
14
|
const key = flagString(ctx.parsed, "operation-key");
|
|
14
|
-
const token =
|
|
15
|
+
const token = resolveApprovalToken(ctx.parsed);
|
|
15
16
|
if (key && (!token || !key.endsWith(`_${token}`)))
|
|
16
17
|
throw new CliError("approval_mismatch", "Recovery requires the original operation key and approval token.");
|
|
17
18
|
return key;
|
|
@@ -24,7 +25,7 @@ async function recovered(ctx, row, expectedInputHash) {
|
|
|
24
25
|
status: row.outcome === "outcome_unknown" ? "unknown" : "completed",
|
|
25
26
|
timestamp: new Date().toISOString(),
|
|
26
27
|
action: "recover staff operation",
|
|
27
|
-
fingerprint:
|
|
28
|
+
fingerprint: resolveApprovalToken(ctx.parsed),
|
|
28
29
|
target: { apiOrigin: ctx.api.config.apiOrigin },
|
|
29
30
|
result: row,
|
|
30
31
|
});
|
|
@@ -44,21 +44,38 @@ const dollars = (cents) => `$${(cents / 100).toLocaleString("en-US", {
|
|
|
44
44
|
})}`;
|
|
45
45
|
/** The tuition plan as terminal text, in the PDF's order: one block per term. */
|
|
46
46
|
function renderPlan(plan, webUrl, pdfPath) {
|
|
47
|
-
const out = [
|
|
48
|
-
`RECESS ACADEMY ${plan.enrollment.indicative ? "ESTIMATED " : ""}TUITION PLAN (${plan.calendarLabel})`,
|
|
49
|
-
];
|
|
47
|
+
const out = [`RECESS ACADEMY TUITION PLAN (${plan.calendarLabel})`];
|
|
50
48
|
if (plan.enrollment.disclaimer)
|
|
51
49
|
out.push(`!! ${plan.enrollment.disclaimer}`);
|
|
52
50
|
out.push("", `Tuition options for ${plan.studentName}`, `Prepared for ${plan.parentName} · ${plan.state.name} · ${plan.enrollment.partnerSchool
|
|
53
51
|
? `Through ${plan.enrollment.partnerSchool.name}`
|
|
54
|
-
: "Direct enrollment"}
|
|
52
|
+
: "Direct enrollment"}`);
|
|
53
|
+
const esa = plan.esaPreview;
|
|
54
|
+
if (esa) {
|
|
55
|
+
out.push("", `${esa.title.toUpperCase()} (PDF pages 1-2, before the prices)`, ` ${esa.introduction}`, ...esa.steps.map((s, i) => ` ${i + 1}. ${s.title}. ${s.body}`), "", ` ${esa.sectionsTitle}:`, ...esa.sections.map((s) => ` · ${s.title}. ${s.body}`), "", ` ${esa.chartTitle} (${esa.chartIntro})`, "", renderColumns([
|
|
56
|
+
[` ${esa.awardLabel}`, "Before aid", "Recess aid", "You pay"],
|
|
57
|
+
...esa.scenarios.map((s) => [
|
|
58
|
+
` ${s.label}`,
|
|
59
|
+
dollars(s.withoutAidCents),
|
|
60
|
+
dollars(s.recessAidCents),
|
|
61
|
+
dollars(s.familyCents),
|
|
62
|
+
]),
|
|
63
|
+
]), ...esa.scenarios.map((s) => ` · ${s.label}${s.detail ? ` (${s.detail.toLowerCase()})` : ""}: ${s.caption}`), ` ${esa.footnote}`);
|
|
64
|
+
}
|
|
65
|
+
out.push("", plan.introduction);
|
|
55
66
|
for (const o of plan.options) {
|
|
56
67
|
out.push("", `${o.label.toUpperCase()} (${o.startDate} → ${o.endDate}, ${o.instructionalDays} school days)`, ` ${o.description}`, renderColumns(o.paymentPlans.map((p) => [
|
|
57
68
|
` ${p.label}`,
|
|
58
|
-
dollars(p.totalCents)
|
|
69
|
+
`${esa && p.kind !== "PAY_IN_FULL" ? "you pay at most " : ""}${dollars(p.totalCents)}`,
|
|
59
70
|
p.summary,
|
|
60
71
|
p.scheduleLine,
|
|
61
|
-
]))
|
|
72
|
+
])),
|
|
73
|
+
// Award unknown: each payment is billed as is, or a ceiling for now.
|
|
74
|
+
...(esa
|
|
75
|
+
? o.paymentPlans
|
|
76
|
+
.filter((p) => p.kind !== "PAY_IN_FULL")
|
|
77
|
+
.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
|
+
: []));
|
|
62
79
|
}
|
|
63
80
|
if (plan.staffNotes.length) {
|
|
64
81
|
out.push("", "Notes:", ...plan.staffNotes.map((n) => ` ${n}`));
|
|
@@ -68,7 +85,7 @@ function renderPlan(plan, webUrl, pdfPath) {
|
|
|
68
85
|
.join(" · ")}`, "", ...plan.footnotes.map((n) => ` · ${n}`), ...(plan.agreement
|
|
69
86
|
? [
|
|
70
87
|
"",
|
|
71
|
-
"ENROLLMENT AGREEMENT (page
|
|
88
|
+
"ENROLLMENT AGREEMENT (last page of the PDF; parent checks one and signs)",
|
|
72
89
|
...plan.agreement.choices.map((c) => ` [ ] ${c.label}`),
|
|
73
90
|
...plan.agreement.clauses.map((c, i) => ` ${i + 1}. ${c}`),
|
|
74
91
|
]
|
|
@@ -159,7 +176,26 @@ export async function runTuitionPlansCommand({ parsed, api, }) {
|
|
|
159
176
|
return `${key}=${date}`;
|
|
160
177
|
});
|
|
161
178
|
const even = hasFlag(parsed, "even-installments");
|
|
179
|
+
// Award not yet known: --annual is the income-based price with no award.
|
|
180
|
+
const esaUnknown = hasFlag(parsed, "esa-award-unknown");
|
|
181
|
+
const esaScenarios = flagString(parsed, "esa-scenarios")
|
|
182
|
+
?.trim()
|
|
183
|
+
.replace(/[$\s]/g, "");
|
|
184
|
+
if (esaScenarios !== undefined) {
|
|
185
|
+
if (!esaUnknown) {
|
|
186
|
+
throw new CliError("invalid_arguments", "--esa-scenarios applies only with --esa-award-unknown.");
|
|
187
|
+
}
|
|
188
|
+
if (!/^\d+(\.\d{1,2})?(,\d+(\.\d{1,2})?){0,5}$/.test(esaScenarios)) {
|
|
189
|
+
throw new CliError("invalid_arguments", "--esa-scenarios takes up to six dollar amounts, comma-separated (e.g. 7300,14000,34000).");
|
|
190
|
+
}
|
|
191
|
+
}
|
|
162
192
|
const subsetQuery = {
|
|
193
|
+
// Florida is refused as a direct enrollment without this.
|
|
194
|
+
...(hasFlag(parsed, "force-direct")
|
|
195
|
+
? { forceDirect: "true" }
|
|
196
|
+
: {}),
|
|
197
|
+
...(esaUnknown ? { esaAwardUnknown: "true" } : {}),
|
|
198
|
+
...(esaScenarios ? { esaScenarios } : {}),
|
|
163
199
|
...(even ? { evenInstallments: "true" } : {}),
|
|
164
200
|
...(billDates.length ? { billDates: billDates.join(",") } : {}),
|
|
165
201
|
...(endDate ? { endDate } : {}),
|