recess-cli 3.36.0 → 3.38.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/command-schema.js +10 -0
- package/dist/commands/family.js +109 -2
- package/dist/commands/reading-checks.js +32 -1
- package/dist/help.js +14 -2
- package/package.json +1 -1
package/dist/command-schema.js
CHANGED
|
@@ -49,6 +49,7 @@ export const FAMILY_REMOTE_READS = [
|
|
|
49
49
|
"kid friends",
|
|
50
50
|
"kid goal-note",
|
|
51
51
|
"kid goals",
|
|
52
|
+
"kid challenges",
|
|
52
53
|
"kid help",
|
|
53
54
|
"kid logins",
|
|
54
55
|
"kid map-scores",
|
|
@@ -121,6 +122,9 @@ export const FAMILY_REMOTE_WRITES = [
|
|
|
121
122
|
"kid set-goal-required",
|
|
122
123
|
"kid set-goal-coins",
|
|
123
124
|
"kid set-goal-days",
|
|
125
|
+
"kid mark-done",
|
|
126
|
+
"kid rename-challenge",
|
|
127
|
+
"kid set-todo-naming",
|
|
124
128
|
"kid set-profile",
|
|
125
129
|
"kid set-rooms",
|
|
126
130
|
"kid set-texts",
|
|
@@ -281,6 +285,7 @@ const FAMILY_COMMANDS = new Set([
|
|
|
281
285
|
"kid goal-note",
|
|
282
286
|
"kid goal-schedule",
|
|
283
287
|
"kid goals",
|
|
288
|
+
"kid challenges",
|
|
284
289
|
"kid help",
|
|
285
290
|
"kid help-done",
|
|
286
291
|
"kid join-challenge",
|
|
@@ -304,6 +309,9 @@ const FAMILY_COMMANDS = new Set([
|
|
|
304
309
|
"kid set-goal-required",
|
|
305
310
|
"kid set-goal-coins",
|
|
306
311
|
"kid set-goal-days",
|
|
312
|
+
"kid mark-done",
|
|
313
|
+
"kid rename-challenge",
|
|
314
|
+
"kid set-todo-naming",
|
|
307
315
|
"kid set-profile",
|
|
308
316
|
"kid set-rooms",
|
|
309
317
|
"kid set-texts",
|
|
@@ -353,6 +361,7 @@ const FAMILY_COMMANDS = new Set([
|
|
|
353
361
|
const GUIDE_FAMILY_COMMANDS = new Set([
|
|
354
362
|
"skills guardian get",
|
|
355
363
|
"skills guardian list",
|
|
364
|
+
"kid set-goal-coins",
|
|
356
365
|
]);
|
|
357
366
|
const FAMILY_AI_COMMANDS = new Set([
|
|
358
367
|
"apps assign",
|
|
@@ -450,6 +459,7 @@ const STAFF_COMMANDS = new Set([
|
|
|
450
459
|
"math-curricula unlink",
|
|
451
460
|
"reading-checks passages list",
|
|
452
461
|
"reading-checks passages set-text",
|
|
462
|
+
"reading-checks passages set-pdf",
|
|
453
463
|
"students mastery",
|
|
454
464
|
"apps link",
|
|
455
465
|
"apps links",
|
package/dist/commands/family.js
CHANGED
|
@@ -2,6 +2,7 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { unwrap } from "../api.js";
|
|
3
3
|
import { flagString, hasFlag } from "../args.js";
|
|
4
4
|
import { apiError, CliError } from "../errors.js";
|
|
5
|
+
import { resolveStudentReference } from "../goal-authoring.js";
|
|
5
6
|
import { assertChoice, flagBooleanValue, flagIdList, flagInteger, } from "./shared.js";
|
|
6
7
|
// packages/web-schema COMMUNITY_HOUR_COURSE_ID: the daily coworking pods are
|
|
7
8
|
// this course's event series (apps/web `$lib/onboarding/cowork.ts`).
|
|
@@ -50,6 +51,25 @@ async function resolveFamilyKid(api, parsed) {
|
|
|
50
51
|
}
|
|
51
52
|
throw new CliError("student_not_found", `--student "${reference}" is not one of your kids. Use an id, full name, or unique first name.`, 1, { candidates });
|
|
52
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* `set-goal-coins` also serves a kid's tutor: a kid outside the caller's
|
|
56
|
+
* family resolves through their tutor roster (`resolveStudentReference`).
|
|
57
|
+
* The server decides access; a parent's own miss keeps its family error.
|
|
58
|
+
*/
|
|
59
|
+
async function resolveFamilyOrTutoredKid(api, parsed) {
|
|
60
|
+
try {
|
|
61
|
+
return await resolveFamilyKid(api, parsed);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
if (error instanceof CliError && error.code === "ambiguous_student")
|
|
65
|
+
throw error;
|
|
66
|
+
const reference = flagString(parsed, "student", { required: true });
|
|
67
|
+
const student = await resolveStudentReference(api, reference).catch(() => {
|
|
68
|
+
throw error;
|
|
69
|
+
});
|
|
70
|
+
return { id: student.id, firstName: student.name, lastName: null };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
53
73
|
function kidTarget(kid) {
|
|
54
74
|
return { kidId: kid.id, kid: kidName(kid) };
|
|
55
75
|
}
|
|
@@ -912,7 +932,9 @@ export async function runFamilyCommand({ parsed, api, writeCommand, }) {
|
|
|
912
932
|
}
|
|
913
933
|
export async function runKidCommand({ parsed, api, writeCommand, }) {
|
|
914
934
|
const verb = parsed.positionals[1];
|
|
915
|
-
const kid =
|
|
935
|
+
const kid = verb === "set-goal-coins"
|
|
936
|
+
? await resolveFamilyOrTutoredKid(api, parsed)
|
|
937
|
+
: await resolveFamilyKid(api, parsed);
|
|
916
938
|
const kidId = kid.id;
|
|
917
939
|
const name = kidName(kid);
|
|
918
940
|
// Undoable writes logged to the family change log apply at once, like
|
|
@@ -935,6 +957,8 @@ export async function runKidCommand({ parsed, api, writeCommand, }) {
|
|
|
935
957
|
goalTitle: todo.goalTitle,
|
|
936
958
|
// false = an extra the kid picked, beyond the day's plan.
|
|
937
959
|
required: todo.required,
|
|
960
|
+
coins: todo.reward,
|
|
961
|
+
...(todo.tag === "FLASHCARD_REVIEW" ? { kind: "flashcards" } : {}),
|
|
938
962
|
minutes: todo.estimatedTimeInMins,
|
|
939
963
|
type: todo.type,
|
|
940
964
|
completedAt: todo.completedAt,
|
|
@@ -947,6 +971,10 @@ export async function runKidCommand({ parsed, api, writeCommand, }) {
|
|
|
947
971
|
},
|
|
948
972
|
wins: today.insights.wins,
|
|
949
973
|
struggles: today.insights.struggles,
|
|
974
|
+
// Adaptive coins: a required to-do pays 10 × its subject's multiplier.
|
|
975
|
+
...(today.coinMultipliers && {
|
|
976
|
+
coinMultipliers: today.coinMultipliers,
|
|
977
|
+
}),
|
|
950
978
|
};
|
|
951
979
|
}
|
|
952
980
|
if (verb === "goals") {
|
|
@@ -1856,6 +1884,85 @@ export async function runKidCommand({ parsed, api, writeCommand, }) {
|
|
|
1856
1884
|
};
|
|
1857
1885
|
});
|
|
1858
1886
|
}
|
|
1887
|
+
if (verb === "challenges") {
|
|
1888
|
+
// The short list for a text: one line each, plus the page with the rest.
|
|
1889
|
+
const { goals } = unwrap(await api.client.GET("/parent/kid/{kidId}/goals/", {
|
|
1890
|
+
params: { path: { kidId } },
|
|
1891
|
+
}));
|
|
1892
|
+
return {
|
|
1893
|
+
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/kids/${kidId}/challenges`,
|
|
1895
|
+
browse: `${api.config.webOrigin}/activity/challenges`,
|
|
1896
|
+
};
|
|
1897
|
+
}
|
|
1898
|
+
if (verb === "mark-done") {
|
|
1899
|
+
const todoId = flagUuid(parsed, "todo", { required: true });
|
|
1900
|
+
const note = flagString(parsed, "note")?.trim();
|
|
1901
|
+
const body = note ? { note: note.slice(0, 500) } : {};
|
|
1902
|
+
return writeNow(parsed, {
|
|
1903
|
+
action: `mark ${name}'s todo ${todoId} done`,
|
|
1904
|
+
target: { ...kidTarget(kid), todoId },
|
|
1905
|
+
request: body,
|
|
1906
|
+
details: {
|
|
1907
|
+
consequence: "It's completed without a session and pays its coins and XP like any finished to-do (undo: family undo reopens it and takes them back).",
|
|
1908
|
+
},
|
|
1909
|
+
}, async () => unwrap(await api.client.POST("/parent-v2/kid/{kidId}/todos/{todoId}/done/", {
|
|
1910
|
+
params: { path: { kidId, todoId } },
|
|
1911
|
+
body,
|
|
1912
|
+
})));
|
|
1913
|
+
}
|
|
1914
|
+
if (verb === "rename-challenge") {
|
|
1915
|
+
const goalId = flagUuid(parsed, "goal", { required: true });
|
|
1916
|
+
const title = flagString(parsed, "title", { required: true }).trim();
|
|
1917
|
+
if (!title || title.length > 120)
|
|
1918
|
+
throw new CliError("invalid_arguments", "--title must be 1 to 120 characters.");
|
|
1919
|
+
return writeNow(parsed, {
|
|
1920
|
+
action: `rename ${name}'s challenge ${goalId} to "${title}"`,
|
|
1921
|
+
target: { ...kidTarget(kid), goalId },
|
|
1922
|
+
request: { title },
|
|
1923
|
+
details: {
|
|
1924
|
+
consequence: "Only this kid's challenge is renamed, never the library's (undo: family undo).",
|
|
1925
|
+
},
|
|
1926
|
+
}, async () => {
|
|
1927
|
+
const result = unwrap(await api.client.PATCH("/parent-v2/kid/{kidId}/challenges/{goalId}/title/", { params: { path: { kidId, goalId } }, body: { title } }));
|
|
1928
|
+
return result.change
|
|
1929
|
+
? result
|
|
1930
|
+
: {
|
|
1931
|
+
status: "no_change",
|
|
1932
|
+
reason: `It's already called "${result.title}".`,
|
|
1933
|
+
goalId,
|
|
1934
|
+
};
|
|
1935
|
+
});
|
|
1936
|
+
}
|
|
1937
|
+
if (verb === "set-todo-naming") {
|
|
1938
|
+
const goalId = flagUuid(parsed, "goal", { required: true });
|
|
1939
|
+
const clear = hasFlag(parsed, "clear");
|
|
1940
|
+
const text = flagString(parsed, "text")?.trim();
|
|
1941
|
+
if ((text === undefined) === !clear || (!clear && !text))
|
|
1942
|
+
throw new CliError("invalid_arguments", "Pass --text TEXT, or --clear to remove it.");
|
|
1943
|
+
return writeNow(parsed, {
|
|
1944
|
+
action: clear
|
|
1945
|
+
? `clear how ${name}'s challenge ${goalId} titles its to-dos`
|
|
1946
|
+
: `title ${name}'s new to-dos for challenge ${goalId}: ${text}`,
|
|
1947
|
+
target: { ...kidTarget(kid), goalId },
|
|
1948
|
+
request: { text: clear ? null : text },
|
|
1949
|
+
details: {
|
|
1950
|
+
consequence: "Writes one \"To-do titles: …\" line into the challenge's description for the next plans; today's to-dos keep their titles (rename one with edit-todo; undo: family undo).",
|
|
1951
|
+
},
|
|
1952
|
+
}, async () => {
|
|
1953
|
+
const result = unwrap(await api.client.PATCH("/parent-v2/kid/{kidId}/challenges/{goalId}/todo-naming/", {
|
|
1954
|
+
params: { path: { kidId, goalId } },
|
|
1955
|
+
body: { text: clear ? null : text },
|
|
1956
|
+
}));
|
|
1957
|
+
return result.change
|
|
1958
|
+
? result
|
|
1959
|
+
: {
|
|
1960
|
+
status: "no_change",
|
|
1961
|
+
reason: `"${result.title}" already reads that way.`,
|
|
1962
|
+
goalId,
|
|
1963
|
+
};
|
|
1964
|
+
});
|
|
1965
|
+
}
|
|
1859
1966
|
if (verb === "help") {
|
|
1860
1967
|
const date = flagDate(parsed, "date");
|
|
1861
1968
|
const result = await api.client.GET("/parent-v2/kid/{kidId}/digest/", {
|
|
@@ -2298,7 +2405,7 @@ export async function runKidCommand({ parsed, api, writeCommand, }) {
|
|
|
2298
2405
|
body,
|
|
2299
2406
|
})));
|
|
2300
2407
|
}
|
|
2301
|
-
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|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.");
|
|
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.");
|
|
2302
2409
|
}
|
|
2303
2410
|
/**
|
|
2304
2411
|
* `me`: the caller's OWN to-dos and challenges (a parent learning too), over
|
|
@@ -58,6 +58,37 @@ export async function runReadingChecksCommand(context) {
|
|
|
58
58
|
body,
|
|
59
59
|
})));
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
if (group === "passages" && verb === "set-pdf") {
|
|
62
|
+
const passageId = positional(parsed, 3, "passage ID");
|
|
63
|
+
const file = flagString(parsed, "file");
|
|
64
|
+
const clear = hasFlag(parsed, "clear");
|
|
65
|
+
if (Boolean(file) === clear) {
|
|
66
|
+
throw new CliError("invalid_arguments", "Pass exactly one of --file <path> or --clear.");
|
|
67
|
+
}
|
|
68
|
+
if (file && !/\.pdf$/i.test(file)) {
|
|
69
|
+
throw new CliError("invalid_arguments", `${file} isn't a .pdf file.`);
|
|
70
|
+
}
|
|
71
|
+
const body = {
|
|
72
|
+
base64: file
|
|
73
|
+
? (await fs.readFile(path.resolve(file))).toString("base64")
|
|
74
|
+
: null,
|
|
75
|
+
};
|
|
76
|
+
return writeCommand(parsed, {
|
|
77
|
+
action: file
|
|
78
|
+
? "set the book pages a kid sees for a reading-check passage"
|
|
79
|
+
: "drop a reading-check passage's book pages",
|
|
80
|
+
target: { passageId, file: file ?? null },
|
|
81
|
+
request: { pdf: file ? path.basename(file) : null },
|
|
82
|
+
details: {
|
|
83
|
+
consequence: file
|
|
84
|
+
? "Checks on this passage show these pages and score the read against the text on them."
|
|
85
|
+
: "Kids see the page text instead of the book pages.",
|
|
86
|
+
},
|
|
87
|
+
}, async () => unwrap(await api.client.PUT("/reading-checks/passages/{passageId}/pdf", {
|
|
88
|
+
params: { path: { passageId } },
|
|
89
|
+
body,
|
|
90
|
+
})));
|
|
91
|
+
}
|
|
92
|
+
throw new CliError("invalid_arguments", "Use reading-checks passages list|set-text|set-pdf.");
|
|
62
93
|
}
|
|
63
94
|
//# sourceMappingURL=reading-checks.js.map
|
package/dist/help.js
CHANGED
|
@@ -288,6 +288,11 @@ Usage:
|
|
|
288
288
|
recess [--json] kid set-goal-coins --student <kid> --goal <goal-id> --value 0-20|default [--confirm]
|
|
289
289
|
recess [--json] kid set-goal-days --student <kid> --goal <goal-id>
|
|
290
290
|
--days <"Tue, Thu"|Mon-Fri|weekdays|daily> [--confirm]
|
|
291
|
+
recess [--json] kid challenges --student <kid>
|
|
292
|
+
recess [--json] kid mark-done --student <kid> --todo <todo-id> [--note TEXT] [--confirm]
|
|
293
|
+
recess [--json] kid rename-challenge --student <kid> --goal <goal-id> --title TEXT [--confirm]
|
|
294
|
+
recess [--json] kid set-todo-naming --student <kid> --goal <goal-id> (--text TEXT | --clear)
|
|
295
|
+
[--confirm]
|
|
291
296
|
recess [--json] kid help --student <kid> [--date YYYY-MM-DD]
|
|
292
297
|
recess [--json] kid help-done --student <kid> --item <help-item-id> [--date YYYY-MM-DD] [--confirm]
|
|
293
298
|
recess [--json] kid excuse-days --student <kid> --from YYYY-MM-DD [--to YYYY-MM-DD]
|
|
@@ -730,6 +735,7 @@ Usage:
|
|
|
730
735
|
recess [--json] math-curricula unlink <curriculum> <template-id> [--confirm]
|
|
731
736
|
recess [--json] reading-checks passages list
|
|
732
737
|
recess [--json] reading-checks passages set-text <passage-id> (--file <path> | --clear) [--confirm]
|
|
738
|
+
recess [--json] reading-checks passages set-pdf <passage-id> (--file <path.pdf> | --clear) [--confirm]
|
|
733
739
|
recess [--json] challenge-of-the-week list [--past N] [--ahead N]
|
|
734
740
|
recess [--json] challenge-of-the-week show <week>
|
|
735
741
|
recess [--json] challenge-of-the-week queue <template> --week <week> [--note TEXT] [--confirm]
|
|
@@ -962,7 +968,8 @@ new device. Plan changes apply at once with no confirm step and are logged
|
|
|
962
968
|
(undo: family undo, or family undo --change ID): excuse, unexcuse-weekly,
|
|
963
969
|
goal-schedule, pause-goal, resume-goal, set-goal-note, add-todo, move-todo,
|
|
964
970
|
remove-todo, edit-todo, repeat-todo, join-challenge, set-goal-games,
|
|
965
|
-
set-goal-required, set-goal-coins,
|
|
971
|
+
set-goal-required, set-goal-coins, set-goal-days, mark-done, rename-challenge,
|
|
972
|
+
set-todo-naming, help-done, excuse-days, unexcuse-days, and "set" fields
|
|
966
973
|
that apply at once. --confirm on them changes nothing: a rerun with it returns
|
|
967
974
|
the first result (alreadyApplied) instead of applying twice. Every other write
|
|
968
975
|
previews first, then needs --confirm. Passwords are
|
|
@@ -1406,7 +1413,11 @@ export const COMMAND_SUMMARIES = {
|
|
|
1406
1413
|
"kid leave-challenge": "Take a kid off a challenge; progress is kept.",
|
|
1407
1414
|
"kid set-goal-games": "Practice games on/off after one challenge's lessons (at once).",
|
|
1408
1415
|
"kid set-goal-required": "Whether a kid may drop one challenge themselves (at once).",
|
|
1409
|
-
"kid set-goal-coins": "Coins each of one challenge's to-dos pays, 0-20 or default (at once).",
|
|
1416
|
+
"kid set-goal-coins": "Coins each of one challenge's to-dos pays, 0-20 or default, fixed (at once; tutors too).",
|
|
1417
|
+
"kid challenges": "A kid's challenges, one line each, plus the page with the rest.",
|
|
1418
|
+
"kid mark-done": "Mark a to-do done a parent vouches for; it pays as usual (at once).",
|
|
1419
|
+
"kid rename-challenge": "Rename one of a kid's challenges (at once).",
|
|
1420
|
+
"kid set-todo-naming": "How one challenge's new to-dos are titled (at once).",
|
|
1410
1421
|
"kid help": "The day's ways to help (from the daily summary).",
|
|
1411
1422
|
"kid help-done": "Mark a help item done; the kid's Rocky hears (at once).",
|
|
1412
1423
|
"kid excuse-days": "Give a kid days off; their todos move (at once).",
|
|
@@ -1673,6 +1684,7 @@ export const COMMAND_SUMMARIES = {
|
|
|
1673
1684
|
"math-curricula unlink": "Unlink a goal template from a math curriculum.",
|
|
1674
1685
|
"reading-checks passages list": "Each reading-check passage, its stage, and whether its page text is set.",
|
|
1675
1686
|
"reading-checks passages set-text": "Set the page a kid reads aloud for a passage, from a text, Word (.docx) or PDF file (scans are OCR'd); --clear goes back to reading from the book.",
|
|
1687
|
+
"reading-checks passages set-pdf": "Show kids the book pages themselves from a PDF (up to 5 pages); the text on them is saved for scoring. --clear drops the pages and keeps the text.",
|
|
1676
1688
|
"challenge-of-the-week list": "List Challenge of the Week picks: past, this week, upcoming, and the bench.",
|
|
1677
1689
|
"challenge-of-the-week show": "Read one week's Challenge of the Week pick and note.",
|
|
1678
1690
|
"challenge-of-the-week queue": "Queue a challenge for an empty week, with an optional note for kids.",
|