recess-cli 3.21.0 → 3.22.1

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 CHANGED
@@ -48,6 +48,7 @@ export const BOOLEAN_FLAGS = new Set([
48
48
  "clear-send-hour",
49
49
  "confirm",
50
50
  "confirm-destructive-changes",
51
+ "default",
51
52
  "disable-applet-follow-ups",
52
53
  "dry-run",
53
54
  "enable-applet-follow-ups",
package/dist/cli.js CHANGED
@@ -25,6 +25,7 @@ import { runReportsCommand } from "./commands/reports.js";
25
25
  import { runMasteryCommand } from "./commands/mastery.js";
26
26
  import { runOnboardingCommand } from "./commands/onboarding.js";
27
27
  import { runScheduleCommand, runMemoryFilesCommand, } from "./commands/safe-staff-operations.js";
28
+ import { runRockyFreeCommand } from "./commands/rocky-free.js";
28
29
  import { runSchoolCommand } from "./commands/school.js";
29
30
  import { runVillageEventsCommand } from "./commands/village-events.js";
30
31
  import { assertChoice, flagIdList, positional, readJsonFile, readJsonValue, } from "./commands/shared.js";
@@ -6496,6 +6497,9 @@ export async function executeRecessCommand(argv, options = {}) {
6496
6497
  }
6497
6498
  throw new CliError("invalid_arguments", "Use memories context|log.");
6498
6499
  }
6500
+ if (noun === "rocky" && verb === "free") {
6501
+ return runRockyFreeCommand({ parsed, api, writeCommand });
6502
+ }
6499
6503
  if (noun === "rocky") {
6500
6504
  const studentId = flagString(parsed, "student", { required: true });
6501
6505
  if (verb === "get") {
@@ -582,7 +582,7 @@ export async function runKidCommand({ parsed, api, writeCommand, }) {
582
582
  consequence: [
583
583
  ...(textChange
584
584
  ? [
585
- "Controls the texts Recess sends YOU about this kid (on/off, how often, what the daily summary focuses on).",
585
+ "Controls the texts Recess sends YOU about this kid (on/off, which kinds by --frequency, your daily summary instructions).",
586
586
  ]
587
587
  : []),
588
588
  ...(dailySummaryEnabled !== undefined
@@ -0,0 +1,118 @@
1
+ import { unwrap } from "../api.js";
2
+ import { flagNumber, flagString, hasFlag } from "../args.js";
3
+ import { CliError } from "../errors.js";
4
+ const MAX_DAILY_BUDGET_USD = 20;
5
+ function budgetFlag(context) {
6
+ const budget = flagNumber(context.parsed, "budget");
7
+ if (budget === undefined)
8
+ return undefined;
9
+ if (budget <= 0 || budget > MAX_DAILY_BUDGET_USD) {
10
+ throw new CliError("invalid_arguments", `--budget must be more than 0 and at most ${MAX_DAILY_BUDGET_USD} (USD per day).`);
11
+ }
12
+ return budget;
13
+ }
14
+ function currentStatus(status) {
15
+ return {
16
+ role: status.role,
17
+ plan: status.plan,
18
+ eligible: status.eligible,
19
+ schoolTierId: status.schoolTierId,
20
+ viaFlag: status.viaFlag,
21
+ grant: status.grant,
22
+ dailyBudgetUsd: status.dailyBudgetUsd,
23
+ defaultDailyBudgetUsd: status.defaultDailyBudgetUsd,
24
+ todayUsd: status.days.find((day) => day.day === status.today)?.costUsd ?? 0,
25
+ };
26
+ }
27
+ export async function runRockyFreeCommand(context) {
28
+ const { parsed, api, writeCommand } = context;
29
+ const verb = parsed.positionals[2];
30
+ if (verb === "list") {
31
+ return unwrap(await api.client.GET("/tutor/free-rocky/grants"));
32
+ }
33
+ if (verb !== "get" &&
34
+ verb !== "grant" &&
35
+ verb !== "set-budget" &&
36
+ verb !== "revoke") {
37
+ throw new CliError("invalid_arguments", "Use rocky free list|get|grant|set-budget|revoke.");
38
+ }
39
+ const studentId = flagString(parsed, "student", { required: true });
40
+ const status = unwrap(await api.client.GET("/tutor/students/{studentId}/free-rocky", {
41
+ params: { path: { studentId } },
42
+ }));
43
+ if (verb === "get")
44
+ return status;
45
+ const putBudget = (dailyBudgetUsd) => async () => unwrap(await api.client.PUT("/tutor/students/{studentId}/free-rocky", {
46
+ params: { path: { studentId } },
47
+ body: { dailyBudgetUsd },
48
+ }));
49
+ if (verb === "grant") {
50
+ if (hasFlag(parsed, "default")) {
51
+ throw new CliError("invalid_arguments", "grant takes --budget or nothing (the default budget); --default is for set-budget.");
52
+ }
53
+ const dailyBudgetUsd = budgetFlag(context) ?? null;
54
+ const alreadyGranted = status.grant?.active === true;
55
+ return writeCommand(parsed, {
56
+ action: alreadyGranted
57
+ ? "change the daily budget of this user's existing free Rocky grant"
58
+ : "grant free Rocky to this user",
59
+ target: { studentUserId: studentId },
60
+ request: { dailyBudgetUsd },
61
+ details: {
62
+ current: currentStatus(status),
63
+ warnings: status.warnings,
64
+ budgetAfterUsd: dailyBudgetUsd ?? status.defaultDailyBudgetUsd,
65
+ budgetSource: dailyBudgetUsd === null ? "default" : "custom",
66
+ consequences: [
67
+ alreadyGranted
68
+ ? "The grant is already active: only its daily budget changes; grantedAt and grantedBy stay."
69
+ : "Starts a new grant stamped with you as grantedBy; a revoked grant is re-granted.",
70
+ "ADMIN-only (exact-admin): a GUIDE session gets 403.",
71
+ ],
72
+ reverse: `\`rocky free revoke --student ${studentId}\``,
73
+ },
74
+ }, putBudget(dailyBudgetUsd));
75
+ }
76
+ if (!status.grant?.active) {
77
+ throw new CliError("not_found", `User ${studentId} has no active free Rocky grant${status.viaFlag ? " (free Rocky comes from the feature flag, not a grant)" : ""}. Use rocky free grant.`);
78
+ }
79
+ if (verb === "set-budget") {
80
+ const budget = budgetFlag(context);
81
+ const useDefault = hasFlag(parsed, "default");
82
+ if ((budget === undefined) === !useDefault) {
83
+ throw new CliError("invalid_arguments", "Pass exactly one of --budget <usd> or --default.");
84
+ }
85
+ const dailyBudgetUsd = budget ?? null;
86
+ return writeCommand(parsed, {
87
+ action: "change the daily budget of this user's free Rocky grant",
88
+ target: { studentUserId: studentId },
89
+ request: { dailyBudgetUsd },
90
+ details: {
91
+ current: currentStatus(status),
92
+ warnings: status.warnings,
93
+ budgetBeforeUsd: status.dailyBudgetUsd,
94
+ budgetAfterUsd: dailyBudgetUsd ?? status.defaultDailyBudgetUsd,
95
+ budgetSource: dailyBudgetUsd === null ? "default" : "custom",
96
+ },
97
+ }, putBudget(dailyBudgetUsd));
98
+ }
99
+ return writeCommand(parsed, {
100
+ action: "revoke this user's free Rocky grant",
101
+ target: { studentUserId: studentId },
102
+ request: {},
103
+ details: {
104
+ current: currentStatus(status),
105
+ warnings: status.warnings,
106
+ consequences: [
107
+ status.viaFlag
108
+ ? "The feature flag still gives this user free Rocky after the revoke."
109
+ : "Free Rocky stops for this user right away.",
110
+ "The grant row is kept (revokedAt/revokedBy); `rocky free grant` re-grants it.",
111
+ "ADMIN-only (exact-admin): a GUIDE session gets 403.",
112
+ ],
113
+ },
114
+ }, async () => unwrap(await api.client.DELETE("/tutor/students/{studentId}/free-rocky", {
115
+ params: { path: { studentId } },
116
+ })));
117
+ }
118
+ //# sourceMappingURL=rocky-free.js.map
package/dist/help.js CHANGED
@@ -594,6 +594,12 @@ Usage:
594
594
  recess [--json] rocky get --student <kid-id>
595
595
  recess [--json] rocky set --student <kid-id> --patch-file <path/patch.json>
596
596
  [--expected-updated-at ISO|none] [--confirm]
597
+ recess [--json] rocky free list
598
+ recess [--json] rocky free get --student <user-id>
599
+ recess [--json] rocky free grant --student <user-id> [--budget <usd>] [--confirm]
600
+ recess [--json] rocky free set-budget --student <user-id> (--budget <usd> | --default)
601
+ [--confirm]
602
+ recess [--json] rocky free revoke --student <user-id> [--confirm]
597
603
  recess [--json] tutor-templates list [--q TEXT] [--subject TEXT] [--grade N]
598
604
  recess [--json] tutor-templates get <slug>
599
605
  recess [--json] tutor-templates assign <slug> [--student <kid-id>] [--confirm]
@@ -751,10 +757,15 @@ Parent SMS summary notes: "students texts get" shows the kid-level switch and
751
757
  end-of-day send hour (0-23 in the kid's timezone; unset = 18) plus every
752
758
  recipient's phone, texts on/off, frequency, and focus. "set" changes the
753
759
  kid-level switch/hour for all recipients. "set-guardian" changes one adult's
754
- settings: --frequency all = per-todo texts + daily summary, daily = the daily
755
- summary only, important = only non-routine summaries; --focus is that adult's
756
- custom instructions for what the summary should emphasize. A recipient with no
757
- phone number receives nothing, so check "users phone get" too.
760
+ settings. --frequency gates only two text types: all (default) also gets the
761
+ per-todo Math Academy/Beast Academy texts; daily drops those; important drops
762
+ those and any daily summary the summary agent labels routine. Neither daily nor
763
+ important caps texts at one a day: a recipient with a focus still gets live
764
+ progress summaries during the day, and the todo nudge, parent recap and a
765
+ manual "send summary" ignore frequency. Only --texts-enabled false stops all of
766
+ them. --focus is that adult's own instructions for the daily summary (what to
767
+ cover and how). A recipient with no phone number receives nothing, so check
768
+ "users phone get" too.
758
769
 
759
770
  Onboarding notes: "status" and "intake-session" are reads — "intake-session"
760
771
  looks up the current IN_PROGRESS session without creating one (prints a "none
@@ -816,7 +827,15 @@ an audited read. --interests replaces the whole list. The daily summary is opt-i
816
827
  per kid and shared by every guardian: "kid set-texts --summary true|false" turns
817
828
  it on or off, and --hour sets when it is sent, in the kid's timezone (default
818
829
  18:00). An hour needs the summary on (add --summary true); turning it off drops
819
- the hour. Plan controls (any guardian): a goal's cadence ("goal-schedule": daily,
830
+ the hour. --focus is your own instructions for the daily summary (what to
831
+ cover and how, e.g. "break out Math Academy and reading specifics"); it
832
+ replaces your previous text, and other guardians keep theirs. A focus also
833
+ makes you eligible for live progress texts during the day. --frequency gates
834
+ only two text types: ALL (default) also sends per-todo Math Academy/Beast
835
+ Academy texts; DAILY drops those; IMPORTANT drops those and any daily summary
836
+ judged routine. Neither caps texts at one a day; the daily todo nudge and
837
+ recaps ignore it. --enabled false is the only way to stop every text about a
838
+ kid. Plan controls (any guardian): a goal's cadence ("goal-schedule": daily,
820
839
  weekly, Mon,Wed,Fri or 3x/week), pausing/resuming a goal, the goal's note
821
840
  ("set-goal-note"), one-off todos ("add-todo"; no bonus/optional kind exists),
822
841
  moving a not-started todo ("move-todo"), and ending a stuck session so started
@@ -1178,8 +1197,8 @@ export const COMMAND_SUMMARIES = {
1178
1197
  "kid classes": "A kid's classes.",
1179
1198
  "kid profile": "A kid's name, birthday, email, interests.",
1180
1199
  "kid set-profile": "Change a kid's name, birthday, or interests.",
1181
- "kid texts": "The texts you get about a kid; daily summary on/off and hour.",
1182
- "kid set-texts": "Change your texts about a kid; daily summary on/off and hour.",
1200
+ "kid texts": "The texts you get about a kid; daily summary on/off, hour, and your instructions.",
1201
+ "kid set-texts": "Change your texts about a kid; daily summary on/off, hour, and your instructions.",
1183
1202
  "kid set-rooms": "Allow or block a kid in live rooms.",
1184
1203
  "kid feed-lock": "A kid's feed lock (feed opens after daily work).",
1185
1204
  "kid set-feed-lock": "Change a kid's feed lock.",
@@ -1396,6 +1415,11 @@ export const COMMAND_SUMMARIES = {
1396
1415
  "memories log": "Read a kid's memory log for a date.",
1397
1416
  "rocky get": "Read a kid's Rocky personality settings.",
1398
1417
  "rocky set": "Patch a kid's Rocky personality settings.",
1418
+ "rocky free list": "List everyone with an active free Rocky grant.",
1419
+ "rocky free get": "Read a user's free Rocky plan, grant, budget, and usage.",
1420
+ "rocky free grant": "Grant free Rocky to a kid or guardian.",
1421
+ "rocky free set-budget": "Change a free Rocky grant's daily budget.",
1422
+ "rocky free revoke": "Revoke a user's free Rocky grant.",
1399
1423
  "tutor-templates list": "List tutor templates.",
1400
1424
  "tutor-templates get": "Read one tutor template.",
1401
1425
  "tutor-templates assign": "Assign a tutor template to a kid.",
@@ -1461,7 +1485,7 @@ export const NOUN_SUMMARIES = {
1461
1485
  goals: "Kids' goals: create/edit, queue, workspace files, PDFs, videos.",
1462
1486
  todos: "Kids' todos: create, edit, complete, analysis, applets.",
1463
1487
  memories: "Kid memory files and the context Rocky sees.",
1464
- rocky: "A kid's Rocky personality settings.",
1488
+ rocky: "A kid's Rocky personality settings; free Rocky grants and budgets.",
1465
1489
  "tutor-templates": "Tutor templates and their assignment to kids.",
1466
1490
  "library-books": "Book library: search the web, add books, read status.",
1467
1491
  mastery: "Mastery graphs and the content linked to them.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recess-cli",
3
- "version": "3.21.0",
3
+ "version": "3.22.1",
4
4
  "description": "Safe Recess administration and family AI tools from the command line.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {