recess-cli 3.50.2 → 3.52.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.
@@ -600,6 +600,7 @@ const STAFF_COMMANDS = new Set([
600
600
  "students map-reports upload",
601
601
  "students map-reports delete",
602
602
  "students issue-email",
603
+ "students main-book",
603
604
  "students goblins",
604
605
  "students web-todos",
605
606
  "students flashcards",
@@ -665,6 +666,18 @@ export function commandIsAvailable(command, scope) {
665
666
  }
666
667
  return scope === "full_admin";
667
668
  }
669
+ /** `local` nouns that still answer inside the Recess app chat. */
670
+ const IN_APP_LOCAL_NOUNS = new Set(["help", "agent-context", "doctor"]);
671
+ /**
672
+ * The in-app catalog: every command this session's scope reaches, minus the
673
+ * ones that manage a local install (sign-in, profiles, the job ledger).
674
+ */
675
+ export function inAppCommands(commands, context) {
676
+ return commands.filter((command) => command.access === "local"
677
+ ? IN_APP_LOCAL_NOUNS.has(command.path[0])
678
+ : command.path[0] !== "confirm" &&
679
+ commandIsAvailable(command, context.scope));
680
+ }
668
681
  function usageBlocks(help) {
669
682
  const lines = help.split("\n");
670
683
  const blocks = [];
@@ -1049,6 +1062,7 @@ function nounIndex(commands) {
1049
1062
  const width = Math.max(...Array.from(counts.keys(), (noun) => noun.length));
1050
1063
  return Array.from(counts, ([noun, count]) => ` ${`${noun} (${count})`.padEnd(width + 6)}${NOUN_SUMMARIES[noun] ?? ""}`.trimEnd());
1051
1064
  }
1065
+ const IN_APP_CONVENTIONS = "--reason TEXT says why (audit-logged). ✎ writes return a preview with an operationKey and change nothing; after the person approves in a later message, rerun the same command with --confirm --operation-key KEY. File and folder flags take paths in this chat's files folder, where written files stay.";
1052
1066
  const LOCAL_CONVENTIONS = "--reason TEXT says why (audit-logged): ✎ writes require it, reads default it. Writes preview and exit 2; after human approval run `recess confirm <operation-key>` (replays the stored preview) or rerun with --confirm --operation-key KEY.";
1053
1067
  export function scopedHelp(help, commands, scope, context, options = {}) {
1054
1068
  const matches = commands.filter((command) => pathStartsWith(command.path, scope) &&
@@ -1083,7 +1097,9 @@ export function scopedHelp(help, commands, scope, context, options = {}) {
1083
1097
  "",
1084
1098
  `Access: ${accessLabel}`,
1085
1099
  "Key: ◇ shared command ◆ admin-only command ✎ write (previews; needs confirmation)",
1086
- ...(options.remoteOnly ? [] : [LOCAL_CONVENTIONS]),
1100
+ ...(options.remoteOnly
1101
+ ? []
1102
+ : [options.inApp ? IN_APP_CONVENTIONS : LOCAL_CONVENTIONS]),
1087
1103
  "",
1088
1104
  "Usage:",
1089
1105
  ...(compactRoot
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- import fs from "node:fs/promises";
2
+ import { fs } from "../in-app.js";
3
3
  import path from "node:path";
4
4
  import { unwrap } from "../api.js";
5
5
  import { flagList, flagString, hasFlag } from "../args.js";
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- import fs from "node:fs/promises";
2
+ import { assertLocalMachine, fs } from "../in-app.js";
3
3
  import http from "node:http";
4
4
  import path from "node:path";
5
5
  import { unwrap } from "../api.js";
@@ -650,6 +650,7 @@ export async function runAppsCommand(ctx) {
650
650
  ".webp": "image/webp",
651
651
  };
652
652
  const mapTag = `<script type="importmap">${JSON.stringify({ imports: importMap })}</script>`;
653
+ assertLocalMachine();
653
654
  const server = http.createServer((req, res) => {
654
655
  void (async () => {
655
656
  const urlPath = decodeURIComponent((req.url ?? "/").split("?")[0]);
@@ -1,4 +1,4 @@
1
- import fs from "node:fs/promises";
1
+ import { fs } from "../in-app.js";
2
2
  import path from "node:path";
3
3
  import { unwrap } from "../api.js";
4
4
  import { flagString } from "../args.js";
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- import fs from "node:fs/promises";
2
+ import { fs } from "../in-app.js";
3
3
  import path from "node:path";
4
4
  import { unwrap } from "../api.js";
5
5
  import { flagNumber, flagString, hasFlag } from "../args.js";
@@ -1,4 +1,4 @@
1
- import fs from "node:fs/promises";
1
+ import { fs } from "../in-app.js";
2
2
  import path from "node:path";
3
3
  import { unwrap } from "../api.js";
4
4
  import { flagNumber, flagString } from "../args.js";
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- import fs from "node:fs/promises";
2
+ import { fs } from "../in-app.js";
3
3
  import path from "node:path";
4
4
  import { unwrap } from "../api.js";
5
5
  import { flagNumber, flagString, hasFlag } from "../args.js";
@@ -1,4 +1,4 @@
1
- import fs from "node:fs/promises";
1
+ import { fs } from "../in-app.js";
2
2
  import path from "node:path";
3
3
  import { unwrap } from "../api.js";
4
4
  import { flagString, hasFlag } from "../args.js";
@@ -1,4 +1,4 @@
1
- import fs from "node:fs/promises";
1
+ import { fs } from "../in-app.js";
2
2
  import path from "node:path";
3
3
  import { unwrap } from "../api.js";
4
4
  import { flagString, hasFlag } from "../args.js";
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- import fs from "node:fs/promises";
2
+ import { fs } from "../in-app.js";
3
3
  import path from "node:path";
4
4
  import { unwrap } from "../api.js";
5
5
  import { flagString, hasFlag } from "../args.js";
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- import fs from "node:fs/promises";
2
+ import { fs } from "../in-app.js";
3
3
  import path from "node:path";
4
4
  import { unwrap } from "../api.js";
5
5
  import { flagList, flagString, hasFlag } from "../args.js";
@@ -1,4 +1,4 @@
1
- import fs from "node:fs/promises";
1
+ import { fs } from "../in-app.js";
2
2
  import path from "node:path";
3
3
  import { flagNumber, flagString } from "../args.js";
4
4
  import { CliError } from "../errors.js";
@@ -1,5 +1,5 @@
1
1
  import { readFileSync } from "node:fs";
2
- import fs from "node:fs/promises";
2
+ import { assertLocalMachine, fs } from "../in-app.js";
3
3
  import path from "node:path";
4
4
  import { unwrap } from "../api.js";
5
5
  import { flagList, flagString, hasFlag } from "../args.js";
@@ -217,6 +217,7 @@ export function parseTuitionPlanSpecFlags(parsed, options) {
217
217
  if (customRaw) {
218
218
  const text = customRaw.startsWith("@")
219
219
  ? (() => {
220
+ assertLocalMachine();
220
221
  try {
221
222
  return readFileSync(path.resolve(customRaw.slice(1)), "utf-8");
222
223
  }
package/dist/config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
- import fs from "node:fs/promises";
2
+ import { fs } from "./in-app.js";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
5
  import { CliError } from "./errors.js";
package/dist/delivery.js CHANGED
@@ -1,4 +1,4 @@
1
- import fs from "node:fs/promises";
1
+ import { fs } from "./in-app.js";
2
2
  import path from "node:path";
3
3
  import { CliError } from "./errors.js";
4
4
  export async function deliverJson(destination, envelope) {
package/dist/feedback.js CHANGED
@@ -1,4 +1,4 @@
1
- import fs from "node:fs/promises";
1
+ import { fs } from "./in-app.js";
2
2
  import os from "node:os";
3
3
  import path from "node:path";
4
4
  import { CliError } from "./errors.js";
package/dist/help.js CHANGED
@@ -36,6 +36,8 @@ Usage:
36
36
  recess [--json] auth poll [--timeout 300]
37
37
  recess [--json] auth status|logout
38
38
  recess [--json] users search <name-or-id> [--limit 10]
39
+ recess [--json] users roster [--role kid|guardian|guide|admin|program|moderator]
40
+ [--limit 100] [--cursor <user-id>]
39
41
  recess [--json] users get <user-id>
40
42
  recess [--json] users school complete-action <user-id> <action-id> --note <text> [--confirm]
41
43
  recess [--json] users school status <user-id>
@@ -88,6 +90,9 @@ Usage:
88
90
  recess [--json] students map-reports delete --student <kid-id> --report <report-id>
89
91
  [--confirm]
90
92
  recess [--json] students issue-email --student <kid-id> [--confirm]
93
+ recess [--json] students main-book [--student <kid-id>]
94
+ [--title TEXT] [--author TEXT] [--library-book <book-id>] [--goal <goal-id>]
95
+ [--file </path/to/books.json>] [--confirm]
91
96
  recess [--json] students goblins --student <kid-id> [--course <slug>] [--search TEXT]
92
97
  [--confirm]
93
98
  recess [--json] students web-todos --student <kid-id> [--on|--off] [--confirm]
@@ -669,7 +674,7 @@ Usage:
669
674
  recess [--json] goal-templates answers-template <template-id|slug>
670
675
  [--student <kid-id-or-name>]
671
676
  recess [--json] goal-templates apply <template-id> [--student <kid-id-or-name>]
672
- [--answers-file <path>] [--dry-run] [--confirm --approval-token TOKEN]
677
+ [--answers-file <path>] [--optional] [--dry-run] [--confirm --approval-token TOKEN]
673
678
  recess [--json] goal-templates apply-starter <template-id> --student <kid-id>
674
679
  [--answers-file <path>] [--confirm]
675
680
  recess [--json] goals list --student <kid-id> [--query <text>] [--include-archived]
@@ -690,6 +695,8 @@ Usage:
690
695
  [--confirm --approval-token TOKEN]
691
696
  recess [--json] goals unarchive <goal-id> --student <kid-id>
692
697
  [--confirm --approval-token TOKEN]
698
+ recess [--json] goals set-required --student <kid-id> --goal <goal-id> --value on|off
699
+ [--confirm --approval-token TOKEN]
693
700
  recess [--json] goals move-module <module-ref> --student <kid-id> --goal <goal-id>
694
701
  (--to-end | --position <n>) [--confirm --approval-token TOKEN]
695
702
  recess [--json] goals complete-module <module-ref> --student <kid-id> --goal <goal-id>
@@ -839,6 +846,12 @@ converted back, so "validate-spec" against the same file until it passes, then
839
846
  "create". "create" runs a real server-side validation before its gate, so the
840
847
  preview shows the handler/goalShape/step keys the SERVER resolved. "apply" runs
841
848
  the backend's own dryRun before the gate and previews the per-student outcome.
849
+ "apply --optional" (full-admin) then makes each goal it created optional in the
850
+ same operation. If that fails, or a goal it names was already on the kid and is
851
+ Core (never patched: it may be a guide's), it exits optional_not_set with fixes.
852
+ "goals set-required" (full-admin) is the staff page's Core toggle for any kid's
853
+ open goal: on = Core (part of the day; the kid can't leave it), off = optional
854
+ (unlocks after core work, never behind, the kid can leave it).
842
855
  "set-metadata", "delete", "patch-spec" and "set-policy" take an optional
843
856
  --expected-version; omitted, the current version is read and pinned into the
844
857
  preview, so a change before confirm is refused. A stale one 409s STALE_WRITE.
@@ -932,6 +945,15 @@ them. --focus is that adult's own instructions for the daily summary (what to
932
945
  cover and how). A recipient with no phone number receives nothing, so check
933
946
  "users phone get" too.
934
947
 
948
+ "students main-book" takes --student or --file. With only --student it shows
949
+ the kid's main book (it still needs --reason, as the command can write). Add --title
950
+ (and --author), --library-book or --goal to set it; the book they had is marked
951
+ finished. --library-book links our library copy, so prompts know the story;
952
+ --goal links the kid's reading goal, so its finished parts count as readings.
953
+ --file takes a JSON array of { student, title, author?, libraryBookId?, goalId? }
954
+ (student is an ID or exact roster name) and sets every kid in one confirm; the
955
+ result lists each kid as set or failed.
956
+
935
957
  "students goblins" rosters a kid into Goblins (issuing their Recess email first)
936
958
  in one class per course: --course usa-3rd..usa-8th, usa-algebra-1, usa-geometry,
937
959
  usa-algebra-2 or pre-calculus; without it the kid's profile grade picks one. A
@@ -1267,6 +1289,7 @@ export const COMMAND_SUMMARIES = {
1267
1289
  "auth status": "Show the current session's user, role, and CLI scope.",
1268
1290
  "auth logout": "Sign out and delete the stored session.",
1269
1291
  "users search": "Find users by name, email, or id.",
1292
+ "users roster": "Whole-school head counts by role, plus one page of a role's people by name.",
1270
1293
  "users get": "Read a user's account, family, roles, and flags.",
1271
1294
  "users school complete-action": "Mark a school-enrollment action done.",
1272
1295
  "users school status": "Show a kid's school-enrollment status and actions.",
@@ -1304,6 +1327,7 @@ export const COMMAND_SUMMARIES = {
1304
1327
  "students map-reports upload": "File a full MAP report PDF (e.g. Learning Statements) beside that season's scores for parents, the kid, and guides.",
1305
1328
  "students map-reports delete": "Remove a filed MAP report PDF.",
1306
1329
  "students issue-email": "Issue a Recess email address for a kid.",
1330
+ "students main-book": "Show or set the main book a kid is reading, which their writing draws on; --file sets many kids at once.",
1307
1331
  "students goblins": "Roster a kid into Goblins so their Goblins todos sign them straight in.",
1308
1332
  "students web-todos": "Show or set whether a kid's todos run on web (off: they open in the desktop app).",
1309
1333
  "students flashcards": "Show or set whether a kid gets a daily flashcard review todo.",
@@ -1696,6 +1720,7 @@ export const COMMAND_SUMMARIES = {
1696
1720
  "goals complete": "Mark a goal complete.",
1697
1721
  "goals undo-completion": "Reopen a completed goal.",
1698
1722
  "goals archive": "Archive a goal.",
1723
+ "goals set-required": "Put a kid's goal in Core (on) or make it optional (off), any family.",
1699
1724
  "goals unarchive": "Unarchive a goal.",
1700
1725
  "goals move-module": "Reorder a module in a goal's queue.",
1701
1726
  "goals complete-module": "Mark a module done so the goal moves on.",