recess-cli 3.38.0 → 3.40.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 +2 -0
- package/dist/cli.js +178 -8
- package/dist/command-schema.js +19 -0
- package/dist/commands/admissions.js +32 -2
- package/dist/commands/family.js +80 -2
- package/dist/help.js +24 -7
- package/package.json +1 -1
package/dist/args.js
CHANGED
|
@@ -44,6 +44,7 @@ export const BOOLEAN_FLAGS = new Set([
|
|
|
44
44
|
"append",
|
|
45
45
|
"apply",
|
|
46
46
|
"archived",
|
|
47
|
+
"auto",
|
|
47
48
|
"cancel-subscriptions",
|
|
48
49
|
"clear",
|
|
49
50
|
"clear-focus",
|
|
@@ -75,6 +76,7 @@ export const BOOLEAN_FLAGS = new Set([
|
|
|
75
76
|
"no-json",
|
|
76
77
|
"no-wait",
|
|
77
78
|
"open",
|
|
79
|
+
"optional",
|
|
78
80
|
"pretty",
|
|
79
81
|
"refresh",
|
|
80
82
|
"replace-description-pointer",
|
package/dist/cli.js
CHANGED
|
@@ -1248,6 +1248,35 @@ const PAYOUT_STATUS_SIDE_EFFECTS = {
|
|
|
1248
1248
|
PAID: "marks the invoice paid and deducts its total from the recipient's account balance",
|
|
1249
1249
|
CANCELED: "cancels the invoice and reverses any balance items carried on it",
|
|
1250
1250
|
};
|
|
1251
|
+
// One pay run step at a time, in order; `from` is the run status it needs.
|
|
1252
|
+
const PAYRUN_STEPS = {
|
|
1253
|
+
draft: {
|
|
1254
|
+
api: "draft",
|
|
1255
|
+
from: "UPCOMING",
|
|
1256
|
+
effect: "generates each recipient's DRAFT invoice for this cycle",
|
|
1257
|
+
},
|
|
1258
|
+
review: {
|
|
1259
|
+
api: "review",
|
|
1260
|
+
from: "DRAFT",
|
|
1261
|
+
effect: "moves the run and its DRAFT invoices to IN_REVIEW",
|
|
1262
|
+
},
|
|
1263
|
+
finalize: {
|
|
1264
|
+
api: "finalize",
|
|
1265
|
+
from: "IN_REVIEW",
|
|
1266
|
+
effect: "approves the run and FINALIZES its invoices to OPEN, adding each total to the recipient's account balance",
|
|
1267
|
+
},
|
|
1268
|
+
pay: {
|
|
1269
|
+
api: "pay",
|
|
1270
|
+
from: "APPROVED",
|
|
1271
|
+
effect: "MOVES MONEY: creates a Mercury send-money request for every OPEN invoice",
|
|
1272
|
+
},
|
|
1273
|
+
"mark-paid": {
|
|
1274
|
+
api: "mark_paid",
|
|
1275
|
+
from: "APPROVED",
|
|
1276
|
+
effect: "marks the run PAID and closes it; invoice statuses are not changed",
|
|
1277
|
+
},
|
|
1278
|
+
};
|
|
1279
|
+
const PAYRUN_STEP_NAMES = Object.keys(PAYRUN_STEPS);
|
|
1251
1280
|
const SCHOOL_TIER_OPTIONS = [
|
|
1252
1281
|
{ id: "social", name: "Social", defaultClassSlots: 2 },
|
|
1253
1282
|
{ id: "academics", name: "Academics", defaultClassSlots: 0 },
|
|
@@ -2191,10 +2220,19 @@ async function readAssignmentSelection(filePath) {
|
|
|
2191
2220
|
}
|
|
2192
2221
|
/** Hosted goal-template authoring and skills are guide/admin only (see below). */
|
|
2193
2222
|
const HOSTED_STAFF_NOUNS = new Set(["goal-templates", "skills"]);
|
|
2223
|
+
/**
|
|
2224
|
+
* Staff reach every hosted noun; a `family_ai` session (a guardian with goal
|
|
2225
|
+
* creation: Parent Rocky's power-parent lane) also reaches goal-templates.
|
|
2226
|
+
*/
|
|
2227
|
+
function hostedNounAllowed(noun, role, scope) {
|
|
2228
|
+
return (role === "GUIDE" ||
|
|
2229
|
+
role === "ADMIN" ||
|
|
2230
|
+
!HOSTED_STAFF_NOUNS.has(noun) ||
|
|
2231
|
+
(noun === "goal-templates" && scope === "family_ai"));
|
|
2232
|
+
}
|
|
2194
2233
|
/** The hosted catalog, minus nouns the hosted gate would refuse this role. */
|
|
2195
2234
|
function hostedCommands(commands, discovery) {
|
|
2196
|
-
|
|
2197
|
-
return remoteCommands(commands).filter((command) => staff || !HOSTED_STAFF_NOUNS.has(command.path[0]));
|
|
2235
|
+
return remoteCommands(commands).filter((command) => hostedNounAllowed(command.path[0], discovery.role, discovery.scope));
|
|
2198
2236
|
}
|
|
2199
2237
|
export async function executeRecessCommand(argv, options = {}) {
|
|
2200
2238
|
const parsed = parseArgs(argv);
|
|
@@ -2289,9 +2327,7 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
2289
2327
|
].includes(command.path.join(" "))) {
|
|
2290
2328
|
throw new CliError("invalid_arguments", "Structured input is accepted only by hosted apps validate and goal-templates validate-spec/create.");
|
|
2291
2329
|
}
|
|
2292
|
-
if (
|
|
2293
|
-
options.session?.user.role !== "GUIDE" &&
|
|
2294
|
-
options.session?.user.role !== "ADMIN") {
|
|
2330
|
+
if (!hostedNounAllowed(noun, options.session?.user.role, options.discovery?.scope)) {
|
|
2295
2331
|
throw new CliError("forbidden", "Hosted goal-template authoring requires a guide or admin.");
|
|
2296
2332
|
}
|
|
2297
2333
|
if (noun === "skills" &&
|
|
@@ -3815,6 +3851,117 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
3815
3851
|
},
|
|
3816
3852
|
}));
|
|
3817
3853
|
}
|
|
3854
|
+
if (area === "payruns" && action === "advance") {
|
|
3855
|
+
const payrunId = positional(parsed, 3, "payrun ID");
|
|
3856
|
+
const stepName = assertChoice(flagString(parsed, "step", { required: true }), PAYRUN_STEP_NAMES, "--step");
|
|
3857
|
+
const step = PAYRUN_STEPS[stepName];
|
|
3858
|
+
const sendEmail = hasFlag(parsed, "send-email");
|
|
3859
|
+
const emails = stepName === "review" || stepName === "finalize";
|
|
3860
|
+
if (sendEmail && !emails) {
|
|
3861
|
+
throw new CliError("invalid_arguments", "--send-email only applies to --step review or finalize.");
|
|
3862
|
+
}
|
|
3863
|
+
const readRun = async () => unwrap(await api.client.GET("/admin/payout/payrun/payrun/", {
|
|
3864
|
+
params: { query: { id: payrunId } },
|
|
3865
|
+
})).payRuns[0];
|
|
3866
|
+
const countByStatus = (run) => {
|
|
3867
|
+
const counts = {};
|
|
3868
|
+
for (const invoice of run.payoutInvoices) {
|
|
3869
|
+
counts[invoice.status] = (counts[invoice.status] ?? 0) + 1;
|
|
3870
|
+
}
|
|
3871
|
+
return counts;
|
|
3872
|
+
};
|
|
3873
|
+
const summarize = (invoices) => invoices.map((invoice) => ({
|
|
3874
|
+
invoiceId: invoice.id,
|
|
3875
|
+
recipient: invoice.recipient.name,
|
|
3876
|
+
mercuryUserId: invoice.recipient.mercuryUserId,
|
|
3877
|
+
totalAmountCents: invoice.totalAmountCents,
|
|
3878
|
+
}));
|
|
3879
|
+
const run = await readRun();
|
|
3880
|
+
if (run.status !== step.from) {
|
|
3881
|
+
throw new CliError("invalid_arguments", `--step ${stepName} needs a ${step.from} pay run; this one is ${run.status}.`);
|
|
3882
|
+
}
|
|
3883
|
+
const open = run.payoutInvoices.filter((i) => i.status === "OPEN");
|
|
3884
|
+
const openTotalCents = open.reduce((sum, invoice) => sum + invoice.totalAmountCents, 0);
|
|
3885
|
+
if (stepName === "pay" && !open.length) {
|
|
3886
|
+
throw new CliError("invalid_arguments", "This pay run has no OPEN invoices to pay.");
|
|
3887
|
+
}
|
|
3888
|
+
if (stepName === "mark-paid") {
|
|
3889
|
+
// The run's status is all this writes, and a PAID run can no longer be
|
|
3890
|
+
// paid: closing it over an unsent invoice would strand that invoice.
|
|
3891
|
+
const unsent = run.payoutInvoices.filter((i) => ["DRAFT", "IN_REVIEW", "OPEN"].includes(i.status));
|
|
3892
|
+
if (unsent.length) {
|
|
3893
|
+
throw new CliError("invalid_arguments", `${unsent.length} invoice(s) have not been sent for payment. Run --step pay, or settle each with \`payout invoices set-status\`, before marking the run paid.`, 1, { invoices: summarize(unsent) });
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
const emailEffect = emails
|
|
3897
|
+
? sendEmail
|
|
3898
|
+
? " and emails the guides"
|
|
3899
|
+
: " WITHOUT emailing the guides (pass --send-email to notify)"
|
|
3900
|
+
: "";
|
|
3901
|
+
return writeCommand(parsed, {
|
|
3902
|
+
action: `advance pay run ${run.name ?? payrunId}: ${step.effect}${emailEffect}`,
|
|
3903
|
+
target: { payrunId },
|
|
3904
|
+
// The approval key hashes this whole preview, so a confirm that reads
|
|
3905
|
+
// different invoices needs a fresh one; `expectedInvoices` below then
|
|
3906
|
+
// holds the server to what was read, up to the moment it pays.
|
|
3907
|
+
request: {
|
|
3908
|
+
step: stepName,
|
|
3909
|
+
fromStatus: run.status,
|
|
3910
|
+
...(emails ? { sendEmail } : {}),
|
|
3911
|
+
...(stepName === "pay"
|
|
3912
|
+
? { openInvoiceCount: open.length, openTotalCents }
|
|
3913
|
+
: {}),
|
|
3914
|
+
},
|
|
3915
|
+
details: {
|
|
3916
|
+
invoicesByStatus: countByStatus(run),
|
|
3917
|
+
...(stepName === "pay" ? { invoices: summarize(open) } : {}),
|
|
3918
|
+
},
|
|
3919
|
+
}, async () => {
|
|
3920
|
+
const { invoiceResults } = unwrap(await api.client.POST("/admin/payout/payrun/advance-payrun/", {
|
|
3921
|
+
body: {
|
|
3922
|
+
payrunId,
|
|
3923
|
+
action: step.api,
|
|
3924
|
+
sendEmail,
|
|
3925
|
+
...(stepName === "pay"
|
|
3926
|
+
? {
|
|
3927
|
+
expectedInvoices: open.map((invoice) => ({
|
|
3928
|
+
id: invoice.id,
|
|
3929
|
+
totalAmountCents: invoice.totalAmountCents,
|
|
3930
|
+
mercuryUserId: invoice.recipient.mercuryUserId,
|
|
3931
|
+
})),
|
|
3932
|
+
}
|
|
3933
|
+
: {}),
|
|
3934
|
+
},
|
|
3935
|
+
}));
|
|
3936
|
+
const after = await readRun();
|
|
3937
|
+
// The route answers ok over per-invoice failures. An invoice left OPEN
|
|
3938
|
+
// isn't proof nothing was sent: Mercury can accept a request before
|
|
3939
|
+
// the write recording it fails.
|
|
3940
|
+
const outcomes = new Map(invoiceResults?.map((r) => [r.invoiceId, r.outcome]));
|
|
3941
|
+
const notConfirmed = stepName === "pay"
|
|
3942
|
+
? after.payoutInvoices.filter((i) => i.status === "OPEN")
|
|
3943
|
+
: [];
|
|
3944
|
+
return {
|
|
3945
|
+
payrunId,
|
|
3946
|
+
step: stepName,
|
|
3947
|
+
status: after.status,
|
|
3948
|
+
invoicesByStatus: countByStatus(after),
|
|
3949
|
+
...(stepName === "pay"
|
|
3950
|
+
? {
|
|
3951
|
+
notConfirmed: summarize(notConfirmed).map((invoice) => ({
|
|
3952
|
+
...invoice,
|
|
3953
|
+
reason: outcomes.get(invoice.invoiceId) ?? "UNKNOWN",
|
|
3954
|
+
})),
|
|
3955
|
+
...(notConfirmed.length
|
|
3956
|
+
? {
|
|
3957
|
+
warning: `${notConfirmed.length} invoice(s) were not confirmed as sent. PAYMENT_ERROR or UNKNOWN may still have reached Mercury, so check there. INVOICE_CHANGED needs a fresh preview. Rerunning --step pay retries only these.`,
|
|
3958
|
+
}
|
|
3959
|
+
: {}),
|
|
3960
|
+
}
|
|
3961
|
+
: {}),
|
|
3962
|
+
};
|
|
3963
|
+
});
|
|
3964
|
+
}
|
|
3818
3965
|
if (area === "recipients" && action === "list") {
|
|
3819
3966
|
const search = flagString(parsed, "search");
|
|
3820
3967
|
const userId = flagString(parsed, "user");
|
|
@@ -4047,7 +4194,7 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
4047
4194
|
params: { path: { id: itemId } },
|
|
4048
4195
|
})));
|
|
4049
4196
|
}
|
|
4050
|
-
throw new CliError("invalid_arguments", "Use payout payruns list, payout recipients list, payout invoices list|get|set-status, or payout items add|edit|delete.");
|
|
4197
|
+
throw new CliError("invalid_arguments", "Use payout payruns list|advance, payout recipients list, payout invoices list|get|set-status, or payout items add|edit|delete.");
|
|
4051
4198
|
}
|
|
4052
4199
|
if (noun === "cohorts" && verb === "get") {
|
|
4053
4200
|
const cohortId = positional(parsed, 2, "cohort ID");
|
|
@@ -5233,6 +5380,8 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5233
5380
|
if (verb === "apply") {
|
|
5234
5381
|
const id = await resolveGoalTemplateId(api, positional(parsed, 2, "template ID or slug"));
|
|
5235
5382
|
const answersFile = flagString(parsed, "answers-file");
|
|
5383
|
+
if (isRemote && answersFile)
|
|
5384
|
+
throw new CliError("remote_flag_unavailable", "--answers-file is not available over the hosted CLI; pass --student.");
|
|
5236
5385
|
const students = await resolveStudentList();
|
|
5237
5386
|
if (!answersFile && students.length === 0) {
|
|
5238
5387
|
throw new CliError("invalid_arguments", "Pass --student <kid-id-or-name> and/or --answers-file <path>. `goal-templates answers-template <id>` prints the answers shape.");
|
|
@@ -5297,14 +5446,19 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5297
5446
|
note: "Counts come from the backend's own dry run. `skipped_existing` items are idempotent — re-applying does not duplicate them.",
|
|
5298
5447
|
},
|
|
5299
5448
|
};
|
|
5300
|
-
|
|
5449
|
+
const apply = async () => unwrap(await api.client.POST("/ai/goal-templates/{id}/apply-workflow", {
|
|
5301
5450
|
params: { path: { id } },
|
|
5302
5451
|
body: {
|
|
5303
5452
|
answers,
|
|
5304
5453
|
dryRun: false,
|
|
5305
5454
|
expectedTemplateVersion: preflight.templateVersion,
|
|
5306
5455
|
},
|
|
5307
|
-
}))
|
|
5456
|
+
}));
|
|
5457
|
+
// Hosted (Parent Rocky's power-parent lane): the operation store's
|
|
5458
|
+
// preview → confirm, not the local approval ledger.
|
|
5459
|
+
return isRemote
|
|
5460
|
+
? writeCommand(parsed, preview, apply)
|
|
5461
|
+
: previewBoundWrite(parsed, preview, apply);
|
|
5308
5462
|
}
|
|
5309
5463
|
if (verb === "apply-starter") {
|
|
5310
5464
|
const id = await resolveGoalTemplateId(api, positional(parsed, 2, "template ID or slug"));
|
|
@@ -5698,6 +5852,16 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5698
5852
|
})));
|
|
5699
5853
|
}
|
|
5700
5854
|
if (verb === "create") {
|
|
5855
|
+
// Hosted: a description-only goal (no local files, no draft lane).
|
|
5856
|
+
const localOnly = [
|
|
5857
|
+
"description-file",
|
|
5858
|
+
"source-dir",
|
|
5859
|
+
"draft",
|
|
5860
|
+
"enable-applet-follow-ups",
|
|
5861
|
+
"disable-applet-follow-ups",
|
|
5862
|
+
].find((name) => hasFlag(parsed, name));
|
|
5863
|
+
if (isRemote && localOnly)
|
|
5864
|
+
throw new CliError("remote_flag_unavailable", `--${localOnly} is not available over the hosted CLI; pass --description.`);
|
|
5701
5865
|
const requestedStudent = await studentFlag(api, parsed);
|
|
5702
5866
|
const requestedStudentId = requestedStudent?.id;
|
|
5703
5867
|
const sourceDirectory = flagString(parsed, "source-dir");
|
|
@@ -5845,6 +6009,10 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5845
6009
|
request: {
|
|
5846
6010
|
title,
|
|
5847
6011
|
descriptionChars: description.length,
|
|
6012
|
+
// Binds the text itself: a confirm can't swap the description.
|
|
6013
|
+
descriptionSha256: createHash("sha256")
|
|
6014
|
+
.update(description)
|
|
6015
|
+
.digest("hex"),
|
|
5848
6016
|
targetDate: targetDate ?? null,
|
|
5849
6017
|
schedule: schedule ?? null,
|
|
5850
6018
|
},
|
|
@@ -6361,6 +6529,8 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
6361
6529
|
? { url: flagString(parsed, "url") }
|
|
6362
6530
|
: {}),
|
|
6363
6531
|
...(targetDurationInMins !== undefined ? { targetDurationInMins } : {}),
|
|
6532
|
+
// An extra: off the kid's required day, never gates the feed lock.
|
|
6533
|
+
...(hasFlag(parsed, "optional") ? { required: false } : {}),
|
|
6364
6534
|
};
|
|
6365
6535
|
return writeCommand(parsed, {
|
|
6366
6536
|
action: "create a todo for a managed student",
|
package/dist/command-schema.js
CHANGED
|
@@ -120,9 +120,11 @@ export const FAMILY_REMOTE_WRITES = [
|
|
|
120
120
|
"kid set-goal-games",
|
|
121
121
|
"kid set-goal-note",
|
|
122
122
|
"kid set-goal-required",
|
|
123
|
+
"kid set-challenge-order",
|
|
123
124
|
"kid set-goal-coins",
|
|
124
125
|
"kid set-goal-days",
|
|
125
126
|
"kid mark-done",
|
|
127
|
+
"kid set-todo-required",
|
|
126
128
|
"kid rename-challenge",
|
|
127
129
|
"kid set-todo-naming",
|
|
128
130
|
"kid set-profile",
|
|
@@ -152,6 +154,10 @@ const REMOTE_COMMAND_SCOPES = new Map([
|
|
|
152
154
|
["goal-templates get", [RECESS_MCP_SCOPES.templatesRead]],
|
|
153
155
|
["goal-templates validate-spec", [RECESS_MCP_SCOPES.templatesWrite]],
|
|
154
156
|
["goal-templates create", [RECESS_MCP_SCOPES.templatesWrite]],
|
|
157
|
+
// Parent Rocky's power-parent lane (family_ai): apply a template, or a
|
|
158
|
+
// description-only goal.
|
|
159
|
+
["goal-templates apply", [RECESS_MCP_SCOPES.templatesWrite]],
|
|
160
|
+
["goals create", [RECESS_MCP_SCOPES.templatesWrite]],
|
|
155
161
|
["skills guardian get", [RECESS_MCP_SCOPES.templatesRead]],
|
|
156
162
|
["doctor", []],
|
|
157
163
|
["help", []],
|
|
@@ -184,6 +190,14 @@ const REMOTE_COMMAND_SCOPES = new Map([
|
|
|
184
190
|
]),
|
|
185
191
|
]);
|
|
186
192
|
const REMOTE_USAGE = new Map([
|
|
193
|
+
[
|
|
194
|
+
"goal-templates apply",
|
|
195
|
+
"recess goal-templates apply <template-id> --student <kid-id> [--dry-run] [--confirm --operation-key <key>]",
|
|
196
|
+
],
|
|
197
|
+
[
|
|
198
|
+
"goals create",
|
|
199
|
+
"recess goals create --student <kid-id> --title TEXT --description TEXT [--target-date <iso>] [--schedule TEXT] [--confirm --operation-key <key>]",
|
|
200
|
+
],
|
|
187
201
|
["goal-templates validate-spec", "recess goal-templates validate-spec"],
|
|
188
202
|
[
|
|
189
203
|
"goal-templates create",
|
|
@@ -207,6 +221,8 @@ const REMOTE_USAGE = new Map([
|
|
|
207
221
|
]);
|
|
208
222
|
const REMOTE_CONFIRMATION_COMMANDS = new Set([
|
|
209
223
|
"goal-templates create",
|
|
224
|
+
"goal-templates apply",
|
|
225
|
+
"goals create",
|
|
210
226
|
"apps validate",
|
|
211
227
|
"apps publish",
|
|
212
228
|
"apps assign",
|
|
@@ -307,9 +323,11 @@ const FAMILY_COMMANDS = new Set([
|
|
|
307
323
|
"kid set-goal-games",
|
|
308
324
|
"kid set-goal-note",
|
|
309
325
|
"kid set-goal-required",
|
|
326
|
+
"kid set-challenge-order",
|
|
310
327
|
"kid set-goal-coins",
|
|
311
328
|
"kid set-goal-days",
|
|
312
329
|
"kid mark-done",
|
|
330
|
+
"kid set-todo-required",
|
|
313
331
|
"kid rename-challenge",
|
|
314
332
|
"kid set-todo-naming",
|
|
315
333
|
"kid set-profile",
|
|
@@ -540,6 +558,7 @@ const STAFF_COMMANDS = new Set([
|
|
|
540
558
|
"payout items add",
|
|
541
559
|
"payout items delete",
|
|
542
560
|
"payout items edit",
|
|
561
|
+
"payout payruns advance",
|
|
543
562
|
"payout payruns list",
|
|
544
563
|
"payout recipients list",
|
|
545
564
|
"placement give",
|
|
@@ -418,7 +418,20 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
418
418
|
params: { path: { packetId } },
|
|
419
419
|
body: { reason },
|
|
420
420
|
}));
|
|
421
|
-
|
|
421
|
+
if (json)
|
|
422
|
+
return result;
|
|
423
|
+
const outcome = [
|
|
424
|
+
result.kidsDisabled.length
|
|
425
|
+
? `Disabled: ${result.kidsDisabled.join(", ")}`
|
|
426
|
+
: "Disabled: no kids",
|
|
427
|
+
...result.kidsKept.map((kid) => `Kept ${kid.firstName}: ${kid.reason}`),
|
|
428
|
+
result.chargesCanceled
|
|
429
|
+
? "Canceled the unpaid charge."
|
|
430
|
+
: "No unpaid charge to cancel.",
|
|
431
|
+
];
|
|
432
|
+
return {
|
|
433
|
+
help: `${await render(result.packet)}\n\n${outcome.join("\n")}`,
|
|
434
|
+
};
|
|
422
435
|
});
|
|
423
436
|
}
|
|
424
437
|
if (verb === "mark-signed") {
|
|
@@ -596,6 +609,23 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
596
609
|
return json ? result : { help: await render(result.packet) };
|
|
597
610
|
});
|
|
598
611
|
}
|
|
612
|
+
if (verb === "pay-link") {
|
|
613
|
+
const packetId = positional(parsed, 2, "packet ID");
|
|
614
|
+
return writeCommand(parsed, {
|
|
615
|
+
action: `create a no-sign-in payment link for admission packet ${packetId}`,
|
|
616
|
+
target: { packetId },
|
|
617
|
+
request: {},
|
|
618
|
+
}, async () => {
|
|
619
|
+
const result = unwrap(await api.client.POST("/admin/admissions/{packetId}/pay-link", {
|
|
620
|
+
params: { path: { packetId } },
|
|
621
|
+
}));
|
|
622
|
+
return json
|
|
623
|
+
? result
|
|
624
|
+
: {
|
|
625
|
+
help: `${result.url}\nWorks without signing in until ${result.expiresAt}, or until the family has nothing left to pay.`,
|
|
626
|
+
};
|
|
627
|
+
});
|
|
628
|
+
}
|
|
599
629
|
if (verb === "set-paywall") {
|
|
600
630
|
const packetId = positional(parsed, 2, "packet ID");
|
|
601
631
|
const paywallRaw = flagString(parsed, "paywall")?.replace(/[$,]/g, "");
|
|
@@ -682,6 +712,6 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
682
712
|
};
|
|
683
713
|
});
|
|
684
714
|
}
|
|
685
|
-
throw new CliError("invalid_arguments", "Usage: recess admissions create|get|list|resend|void|mark-signed|upload-signed|contract|mark-paid|set-paywall|orientation-week|requote|archive-agreement. See `recess help`.");
|
|
715
|
+
throw new CliError("invalid_arguments", "Usage: recess admissions create|get|list|resend|void|mark-signed|upload-signed|contract|mark-paid|pay-link|set-paywall|orientation-week|requote|archive-agreement. See `recess help`.");
|
|
686
716
|
}
|
|
687
717
|
//# sourceMappingURL=admissions.js.map
|
package/dist/commands/family.js
CHANGED
|
@@ -1832,6 +1832,61 @@ export async function runKidCommand({ parsed, api, writeCommand, }) {
|
|
|
1832
1832
|
};
|
|
1833
1833
|
});
|
|
1834
1834
|
}
|
|
1835
|
+
if (verb === "set-challenge-order") {
|
|
1836
|
+
// The order the kid's challenges (and so their to-dos) run in; "rocky"
|
|
1837
|
+
// is Rocky's practice. Required ones stay first (the server regroups).
|
|
1838
|
+
const auto = hasFlag(parsed, "auto");
|
|
1839
|
+
const raw = flagString(parsed, "order")?.trim();
|
|
1840
|
+
if (auto === (raw !== undefined) || raw === "")
|
|
1841
|
+
throw new CliError("invalid_arguments", 'Pass --order "<challenge>,<challenge>,rocky,…" (ids or titles), or --auto for Rocky\'s order.');
|
|
1842
|
+
const { goals } = unwrap(await api.client.GET("/parent/kid/{kidId}/goals/", {
|
|
1843
|
+
params: { path: { kidId } },
|
|
1844
|
+
}));
|
|
1845
|
+
const active = goals.filter((goal) => goal.status === "ACTIVE");
|
|
1846
|
+
const items = auto
|
|
1847
|
+
? null
|
|
1848
|
+
: raw
|
|
1849
|
+
.split(",")
|
|
1850
|
+
.map((entry) => entry.trim())
|
|
1851
|
+
.filter(Boolean)
|
|
1852
|
+
.map((entry) => {
|
|
1853
|
+
if (entry.toLowerCase() === "rocky")
|
|
1854
|
+
return "rocky";
|
|
1855
|
+
const hits = active.filter((goal) => goal.id === entry ||
|
|
1856
|
+
goal.title.trim().toLowerCase() === entry.toLowerCase());
|
|
1857
|
+
if (hits.length !== 1)
|
|
1858
|
+
throw new CliError("invalid_arguments", hits.length
|
|
1859
|
+
? `"${entry}" matches more than one of ${name}'s challenges: use its id.`
|
|
1860
|
+
: `${name} has no active challenge "${entry}". Run \`kid challenges\` for theirs.`);
|
|
1861
|
+
return hits[0].id;
|
|
1862
|
+
});
|
|
1863
|
+
const titleOf = (id) => id === "rocky"
|
|
1864
|
+
? "Rocky's practice"
|
|
1865
|
+
: (active.find((goal) => goal.id === id)?.title ?? id);
|
|
1866
|
+
return writeNow(parsed, {
|
|
1867
|
+
action: items
|
|
1868
|
+
? `run ${name}'s challenges in this order: ${items.map(titleOf).join(", ")}`
|
|
1869
|
+
: `put ${name}'s challenges back in Rocky's order`,
|
|
1870
|
+
target: kidTarget(kid),
|
|
1871
|
+
request: { items },
|
|
1872
|
+
details: {
|
|
1873
|
+
consequence: "Their to-dos follow it; required challenges stay before optional ones (undo: family undo).",
|
|
1874
|
+
},
|
|
1875
|
+
}, async () => {
|
|
1876
|
+
const result = unwrap(await api.client.PUT("/parent-v2/kid/{kidId}/challenges/order/", {
|
|
1877
|
+
params: { path: { kidId } },
|
|
1878
|
+
body: { items },
|
|
1879
|
+
}));
|
|
1880
|
+
const order = result.order.items.map(titleOf);
|
|
1881
|
+
return result.change
|
|
1882
|
+
? { ...result, order, custom: result.order.custom }
|
|
1883
|
+
: {
|
|
1884
|
+
status: "no_change",
|
|
1885
|
+
reason: `${name}'s challenges already run in that order.`,
|
|
1886
|
+
order,
|
|
1887
|
+
};
|
|
1888
|
+
});
|
|
1889
|
+
}
|
|
1835
1890
|
if (verb === "set-goal-coins") {
|
|
1836
1891
|
const goalId = flagUuid(parsed, "goal", { required: true });
|
|
1837
1892
|
const raw = flagString(parsed, "value", { required: true })
|
|
@@ -1891,7 +1946,7 @@ export async function runKidCommand({ parsed, api, writeCommand, }) {
|
|
|
1891
1946
|
}));
|
|
1892
1947
|
return {
|
|
1893
1948
|
challenges: goals.map((goal) => `${goal.id} · ${goal.title} · ${goal.required ? "required" : "optional"} · ${goal.todoCoins ?? (goal.required ? 20 : 5)} coins/to-do · ${goal.status.toLowerCase()}`),
|
|
1894
|
-
page: `${api.config.webOrigin}/ai
|
|
1949
|
+
page: `${api.config.webOrigin}/ai?kid=${encodeURIComponent(kidId)}&tab=challenges`,
|
|
1895
1950
|
browse: `${api.config.webOrigin}/activity/challenges`,
|
|
1896
1951
|
};
|
|
1897
1952
|
}
|
|
@@ -1911,6 +1966,29 @@ export async function runKidCommand({ parsed, api, writeCommand, }) {
|
|
|
1911
1966
|
body,
|
|
1912
1967
|
})));
|
|
1913
1968
|
}
|
|
1969
|
+
if (verb === "set-todo-required") {
|
|
1970
|
+
const todoId = flagUuid(parsed, "todo", { required: true });
|
|
1971
|
+
const value = assertChoice(flagString(parsed, "value", { required: true }).trim().toLowerCase(), ["on", "off", "default"], "--value");
|
|
1972
|
+
const required = value === "default" ? null : value === "on";
|
|
1973
|
+
return writeNow(parsed, {
|
|
1974
|
+
action: `make ${name}'s todo ${todoId} ${value === "default" ? "follow its challenge" : value === "on" ? "required" : "optional"}`,
|
|
1975
|
+
target: { ...kidTarget(kid), todoId },
|
|
1976
|
+
request: { required },
|
|
1977
|
+
details: {
|
|
1978
|
+
consequence: "Only this to-do: required is part of the day's plan, optional is an extra; default follows its challenge. The whole challenge is set-goal-required (undo: family undo).",
|
|
1979
|
+
},
|
|
1980
|
+
}, async () => {
|
|
1981
|
+
const result = unwrap(await api.client.PATCH("/parent-v2/kid/{kidId}/todos/{todoId}/required/", { params: { path: { kidId, todoId } }, body: { required } }));
|
|
1982
|
+
return result.change
|
|
1983
|
+
? result
|
|
1984
|
+
: {
|
|
1985
|
+
status: "no_change",
|
|
1986
|
+
reason: `"${result.title}" is already ${result.required === null ? "at its default" : result.required ? "required" : "optional"}.`,
|
|
1987
|
+
todoId,
|
|
1988
|
+
required: result.required,
|
|
1989
|
+
};
|
|
1990
|
+
});
|
|
1991
|
+
}
|
|
1914
1992
|
if (verb === "rename-challenge") {
|
|
1915
1993
|
const goalId = flagUuid(parsed, "goal", { required: true });
|
|
1916
1994
|
const title = flagString(parsed, "title", { required: true }).trim();
|
|
@@ -2405,7 +2483,7 @@ export async function runKidCommand({ parsed, api, writeCommand, }) {
|
|
|
2405
2483
|
body,
|
|
2406
2484
|
})));
|
|
2407
2485
|
}
|
|
2408
|
-
throw new CliError("invalid_arguments", "Use kid today|goals|xp|map-scores|classes|profile|set-profile|texts|set-texts|set-rooms|feed-lock|set-feed-lock|logins|reveal-login|add-login|edit-login|remove-login|excuse|unexcuse-weekly|cowork|switch-cowork|friends|friend-parent|pair-device|goal-schedule|pause-goal|resume-goal|goal-note|set-goal-note|add-todo|todo|move-todo|end-session|remove-todo|edit-todo|repeat-todo|join-challenge|leave-challenge|complete-challenge|set-goal-games|set-goal-required|set-goal-coins|set-goal-days|set-todo-reward|mark-done|challenges|rename-challenge|set-todo-naming|help|help-done|excuse-days|excused-days|unexcuse-days|moments|config|set|progress|schedule|attendance|browse-challenges|sign-in-code|todos|goal|conversations|social|enrollments|math-progress|memory|observe|send-note.");
|
|
2486
|
+
throw new CliError("invalid_arguments", "Use kid today|goals|xp|map-scores|classes|profile|set-profile|texts|set-texts|set-rooms|feed-lock|set-feed-lock|logins|reveal-login|add-login|edit-login|remove-login|excuse|unexcuse-weekly|cowork|switch-cowork|friends|friend-parent|pair-device|goal-schedule|pause-goal|resume-goal|goal-note|set-goal-note|add-todo|todo|move-todo|end-session|remove-todo|edit-todo|repeat-todo|join-challenge|leave-challenge|complete-challenge|set-goal-games|set-goal-required|set-challenge-order|set-goal-coins|set-goal-days|set-todo-reward|mark-done|set-todo-required|challenges|rename-challenge|set-todo-naming|help|help-done|excuse-days|excused-days|unexcuse-days|moments|config|set|progress|schedule|attendance|browse-challenges|sign-in-code|todos|goal|conversations|social|enrollments|math-progress|memory|observe|send-note.");
|
|
2409
2487
|
}
|
|
2410
2488
|
/**
|
|
2411
2489
|
* `me`: the caller's OWN to-dos and challenges (a parent learning too), over
|
package/dist/help.js
CHANGED
|
@@ -184,6 +184,7 @@ Usage:
|
|
|
184
184
|
recess [--json] payout recipients remove-schedule <account-id> --schedule <id> [--zero-balance [--zero-balance-reason TEXT]] [--confirm]
|
|
185
185
|
recess [--json] payout recipients add-schedule <account-id> --schedule <id> [--confirm]
|
|
186
186
|
recess [--json] payout payruns remove-account <payrun-id> --recipient <account-id> [--zero-balance [--zero-balance-reason TEXT]] [--confirm]
|
|
187
|
+
recess [--json] payout payruns advance <payrun-id> --step draft|review|finalize|pay|mark-paid [--send-email] [--confirm]
|
|
187
188
|
recess [--json] payout invoices get <invoice-id>
|
|
188
189
|
recess [--json] payout invoices set-status <invoice-id>
|
|
189
190
|
--status IN_REVIEW|OPEN|PAID|CANCELED [--send-email] [--confirm]
|
|
@@ -285,11 +286,15 @@ Usage:
|
|
|
285
286
|
recess [--json] kid leave-challenge --student <kid> --goal <goal-id> [--confirm]
|
|
286
287
|
recess [--json] kid set-goal-games --student <kid> --goal <goal-id> --value on|off [--confirm]
|
|
287
288
|
recess [--json] kid set-goal-required --student <kid> --goal <goal-id> --value on|off [--confirm]
|
|
289
|
+
recess [--json] kid set-challenge-order --student <kid> (--order "<goal-id|title>,…,rocky" | --auto)
|
|
290
|
+
[--confirm]
|
|
288
291
|
recess [--json] kid set-goal-coins --student <kid> --goal <goal-id> --value 0-20|default [--confirm]
|
|
289
292
|
recess [--json] kid set-goal-days --student <kid> --goal <goal-id>
|
|
290
293
|
--days <"Tue, Thu"|Mon-Fri|weekdays|daily> [--confirm]
|
|
291
294
|
recess [--json] kid challenges --student <kid>
|
|
292
295
|
recess [--json] kid mark-done --student <kid> --todo <todo-id> [--note TEXT] [--confirm]
|
|
296
|
+
recess [--json] kid set-todo-required --student <kid> --todo <todo-id> --value on|off|default
|
|
297
|
+
[--confirm]
|
|
293
298
|
recess [--json] kid rename-challenge --student <kid> --goal <goal-id> --title TEXT [--confirm]
|
|
294
299
|
recess [--json] kid set-todo-naming --student <kid> --goal <goal-id> (--text TEXT | --clear)
|
|
295
300
|
[--confirm]
|
|
@@ -377,6 +382,7 @@ Usage:
|
|
|
377
382
|
recess [--json] admissions archive-agreement <packet-id> [--confirm]
|
|
378
383
|
recess [--json] admissions attach-aid <packet-id> --financial-aid <financial-aid-application-id>|none [--confirm]
|
|
379
384
|
recess [--json] admissions mark-paid <packet-id> [--note TEXT] [--confirm]
|
|
385
|
+
recess [--json] admissions pay-link <packet-id> [--confirm]
|
|
380
386
|
recess [--json] admissions set-paywall <packet-id> (--paywall DOLLARS | --paywall-offline | --no-paywall) [--note TEXT] [--confirm]
|
|
381
387
|
recess [--json] admissions orientation-week <packet-id> --kid <packet-kid-id> --week YYYY-MM-DD [--confirm]
|
|
382
388
|
recess [--json] admissions contract <packet-id> [--option <term:payment>] [--out <file>]
|
|
@@ -668,7 +674,7 @@ Usage:
|
|
|
668
674
|
--entries-file <path.json> --delta TEXT [--replace-description-pointer]
|
|
669
675
|
[--confirm --approval-token TOKEN]
|
|
670
676
|
recess [--json] todos create --student <kid-id> --title TEXT
|
|
671
|
-
[--due-date YYYY-MM-DD] [--target-minutes N] [--url URL] [--confirm]
|
|
677
|
+
[--due-date YYYY-MM-DD] [--target-minutes N] [--url URL] [--optional] [--confirm]
|
|
672
678
|
recess [--json] todos edit <todo-id> --patch-file <path/patch.json>
|
|
673
679
|
[--confirm --approval-token TOKEN]
|
|
674
680
|
recess [--json] todos complete <todo-id> --xp N
|
|
@@ -968,10 +974,10 @@ new device. Plan changes apply at once with no confirm step and are logged
|
|
|
968
974
|
(undo: family undo, or family undo --change ID): excuse, unexcuse-weekly,
|
|
969
975
|
goal-schedule, pause-goal, resume-goal, set-goal-note, add-todo, move-todo,
|
|
970
976
|
remove-todo, edit-todo, repeat-todo, join-challenge, set-goal-games,
|
|
971
|
-
set-goal-required, set-goal-coins, set-goal-days, mark-done,
|
|
972
|
-
set-todo-naming, help-done, excuse-days,
|
|
973
|
-
that apply at once. --confirm on them changes
|
|
974
|
-
the first result (alreadyApplied) instead of applying twice. Every other write
|
|
977
|
+
set-goal-required, set-challenge-order, set-goal-coins, set-goal-days, mark-done,
|
|
978
|
+
set-todo-required, rename-challenge, set-todo-naming, help-done, excuse-days,
|
|
979
|
+
unexcuse-days, and "set" fields that apply at once. --confirm on them changes
|
|
980
|
+
nothing: a rerun with it returns the first result (alreadyApplied) instead of applying twice. Every other write
|
|
975
981
|
previews first, then needs --confirm. Passwords are
|
|
976
982
|
never echoed in previews (redacted plus a sha256 prefix); "kid reveal-login" is
|
|
977
983
|
an audited read. --interests replaces the whole list. The daily summary is opt-in
|
|
@@ -1130,7 +1136,12 @@ plan flags as create, or --keep-plan to reopen the payment choice on the plan
|
|
|
1130
1136
|
as it is; --paywall/--no-paywall changes the family share): the Documenso
|
|
1131
1137
|
envelope is cancelled, the family signs again from the same link, and their
|
|
1132
1138
|
account, consent and answers stand (a completed packet completes again on its
|
|
1133
|
-
own); paid packets need a refund first and voided ones a new packet. "
|
|
1139
|
+
own); paid packets need a refund first and voided ones a new packet. "pay-link"
|
|
1140
|
+
prints a 14-day link to the pay screen for a packet on its card payment step: no
|
|
1141
|
+
sign-in, a newly entered card, and it walks the family's admission charges in
|
|
1142
|
+
turn, skipping canceled or voided packets. It can't be revoked while the family
|
|
1143
|
+
owes an admission charge, so send it only to the family.
|
|
1144
|
+
"set-paywall" changes only the paywall (--paywall DOLLARS, --paywall-offline or
|
|
1134
1145
|
--no-paywall) with no re-signing: the agreement stands, an open admission
|
|
1135
1146
|
charge Stripe never saw is canceled, and a packet at the payment step reopens
|
|
1136
1147
|
the new paywall or completes. It refuses while the parent is mid-signing.
|
|
@@ -1142,6 +1153,9 @@ with no paywall completes when the questions are in.
|
|
|
1142
1153
|
Payout notes: amounts are integer cents. "payout items add" without --date
|
|
1143
1154
|
defaults the item date to the penultimate day of the invoice's cycle (its
|
|
1144
1155
|
endDate minus one day) and shows the computed date in the preview.
|
|
1156
|
+
"payout payruns advance" moves a run one step: draft (UPCOMING), review (DRAFT),
|
|
1157
|
+
finalize (IN_REVIEW), pay (APPROVED; creates Mercury send-money requests),
|
|
1158
|
+
mark-paid (APPROVED; refused while any invoice is unsent). Admin only.
|
|
1145
1159
|
|
|
1146
1160
|
Auth notes: "auth login" runs the browser loopback flow for ADMIN, GUIDE, a GUARDIAN with
|
|
1147
1161
|
access:ai, or a KID using only Village home building. Guardian sessions are family-scoped and
|
|
@@ -1331,6 +1345,7 @@ export const COMMAND_SUMMARIES = {
|
|
|
1331
1345
|
"payout recipients remove-schedule": "Remove a recipient from a payout schedule.",
|
|
1332
1346
|
"payout recipients add-schedule": "Add a recipient to a payout schedule.",
|
|
1333
1347
|
"payout payruns remove-account": "Remove a recipient from a payout run.",
|
|
1348
|
+
"payout payruns advance": "Move a payout run one step, through paying it in Mercury.",
|
|
1334
1349
|
"payout invoices get": "Read one payout invoice and its items.",
|
|
1335
1350
|
"payout invoices set-status": "Change a payout invoice's status.",
|
|
1336
1351
|
"payout items add": "Add a line item to a payout invoice (cents).",
|
|
@@ -1413,9 +1428,11 @@ export const COMMAND_SUMMARIES = {
|
|
|
1413
1428
|
"kid leave-challenge": "Take a kid off a challenge; progress is kept.",
|
|
1414
1429
|
"kid set-goal-games": "Practice games on/off after one challenge's lessons (at once).",
|
|
1415
1430
|
"kid set-goal-required": "Whether a kid may drop one challenge themselves (at once).",
|
|
1431
|
+
"kid set-challenge-order": "Set the order a kid's challenges run in; their to-dos follow it (at once).",
|
|
1416
1432
|
"kid set-goal-coins": "Coins each of one challenge's to-dos pays, 0-20 or default, fixed (at once; tutors too).",
|
|
1417
1433
|
"kid challenges": "A kid's challenges, one line each, plus the page with the rest.",
|
|
1418
1434
|
"kid mark-done": "Mark a to-do done a parent vouches for; it pays as usual (at once).",
|
|
1435
|
+
"kid set-todo-required": "Make one to-do required, optional (an extra) or follow its challenge (at once).",
|
|
1419
1436
|
"kid rename-challenge": "Rename one of a kid's challenges (at once).",
|
|
1420
1437
|
"kid set-todo-naming": "How one challenge's new to-dos are titled (at once).",
|
|
1421
1438
|
"kid help": "The day's ways to help (from the daily summary).",
|
|
@@ -1636,7 +1653,7 @@ export const COMMAND_SUMMARIES = {
|
|
|
1636
1653
|
"goals launch-todo": "Create a goal module's todo now.",
|
|
1637
1654
|
"goals queue get": "Read a goal's module queue.",
|
|
1638
1655
|
"goals queue set": "Replace a goal's module queue from JSON.",
|
|
1639
|
-
"todos create": "Create a todo for a kid.",
|
|
1656
|
+
"todos create": "Create a todo for a kid (--optional: an extra, off the required day and feed lock).",
|
|
1640
1657
|
"todos edit": "Patch a todo's fields.",
|
|
1641
1658
|
"todos complete": "Complete a todo with XP.",
|
|
1642
1659
|
"todos delete": "Delete a todo (soft).",
|