recess-cli 3.23.0 → 3.25.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 CHANGED
@@ -39,6 +39,7 @@ export const BOOLEAN_FLAGS = new Set([
39
39
  "allow-state-modification",
40
40
  "allow-strand",
41
41
  "analyzed",
42
+ "struggling",
42
43
  "append",
43
44
  "apply",
44
45
  "archived",
package/dist/cli.js CHANGED
@@ -15,6 +15,7 @@ import { runChatLogsCommand } from "./commands/chat-logs.js";
15
15
  import { runLibraryBooksCommand } from "./commands/library-books.js";
16
16
  import { runDbCommand } from "./commands/db.js";
17
17
  import { runRoomsCommand } from "./commands/rooms.js";
18
+ import { runDmsCommand } from "./commands/dms.js";
18
19
  import { runFeedCommand } from "./commands/feed.js";
19
20
  import { runFamiliesCommand } from "./commands/families.js";
20
21
  import { runFamilyCommand, runKidCommand } from "./commands/family.js";
@@ -374,6 +375,7 @@ async function localWriteCommand(parsed, preview, execute, options = {}) {
374
375
  fingerprint,
375
376
  target: preview.target,
376
377
  ...(preview.action.startsWith("mastery.") ||
378
+ preview.action.startsWith("apps.link") ||
377
379
  preview.request.attendanceTakenAt ||
378
380
  preview.request.zeroBalance === "true"
379
381
  ? { preview }
@@ -1675,6 +1677,9 @@ function parseGoalTemplateDocument(doc) {
1675
1677
  ...(rawCoinAmount === undefined || rawCoinAmount === null
1676
1678
  ? {}
1677
1679
  : { coinAmount: rawCoinAmount }),
1680
+ ...(optionalDocString(doc, "chatTitle") === undefined
1681
+ ? {}
1682
+ : { chatTitle: optionalDocString(doc, "chatTitle") }),
1678
1683
  ...(optionalDocString(doc, "category") === undefined
1679
1684
  ? {}
1680
1685
  : { category: optionalDocString(doc, "category") }),
@@ -4579,6 +4584,7 @@ export async function executeRecessCommand(argv, options = {}) {
4579
4584
  tags: document.tags,
4580
4585
  isStarter: document.isStarter ?? false,
4581
4586
  coinAmount: document.coinAmount ?? null,
4587
+ chatTitle: document.chatTitle ?? null,
4582
4588
  visibility: "PRIVATE",
4583
4589
  },
4584
4590
  details: {
@@ -4873,6 +4879,8 @@ export async function executeRecessCommand(argv, options = {}) {
4873
4879
  (!Number.isInteger(coinAmount) || coinAmount < 1)) {
4874
4880
  throw new CliError("invalid_arguments", "--coin-amount must be a positive integer.");
4875
4881
  }
4882
+ // "none" clears the title; kids who earned it keep it.
4883
+ const chatTitleRaw = flagString(parsed, "chat-title");
4876
4884
  const visibility = flagString(parsed, "visibility");
4877
4885
  const targetPlatform = flagString(parsed, "target-platform");
4878
4886
  const isStarterRaw = flagString(parsed, "is-starter");
@@ -4895,6 +4903,13 @@ export async function executeRecessCommand(argv, options = {}) {
4895
4903
  ? { imageUrl: flagString(parsed, "image-url") }
4896
4904
  : {}),
4897
4905
  ...(coinAmount === undefined ? {} : { coinAmount }),
4906
+ ...(chatTitleRaw === undefined
4907
+ ? {}
4908
+ : {
4909
+ chatTitle: chatTitleRaw.trim().toLowerCase() === "none"
4910
+ ? null
4911
+ : chatTitleRaw,
4912
+ }),
4898
4913
  ...(flagString(parsed, "category")
4899
4914
  ? { category: flagString(parsed, "category") }
4900
4915
  : {}),
@@ -4942,7 +4957,7 @@ export async function executeRecessCommand(argv, options = {}) {
4942
4957
  // shape that caused the template incident; editing an existing spec goes
4943
4958
  // through the guarded /ai patch path with its destructive-change token.
4944
4959
  if (Object.keys(body).length === 1) {
4945
- throw new CliError("invalid_arguments", "Pass at least one field to change (--title, --description, --emoji, --image-url, --coin-amount, --category, --tags, --sort-order, --is-starter, --setup-audience, --kind, --visibility, --target-platform, --agent-instructions-file, --output-template-file).");
4960
+ throw new CliError("invalid_arguments", "Pass at least one field to change (--title, --description, --emoji, --image-url, --coin-amount, --chat-title, --category, --tags, --sort-order, --is-starter, --setup-audience, --kind, --visibility, --target-platform, --agent-instructions-file, --output-template-file).");
4946
4961
  }
4947
4962
  return writeCommand(parsed, {
4948
4963
  action: "update goal template metadata (never its setupWorkflowSpec)",
@@ -6028,6 +6043,9 @@ export async function executeRecessCommand(argv, options = {}) {
6028
6043
  if (noun === "feed") {
6029
6044
  return runFeedCommand({ parsed, api, writeCommand });
6030
6045
  }
6046
+ if (noun === "dms") {
6047
+ return runDmsCommand({ parsed, api, writeCommand });
6048
+ }
6031
6049
  if (noun === "students" && verb === "texts") {
6032
6050
  return runStudentsTextsCommand({ parsed, api, writeCommand });
6033
6051
  }
@@ -6138,6 +6156,34 @@ export async function executeRecessCommand(argv, options = {}) {
6138
6156
  },
6139
6157
  }));
6140
6158
  }
6159
+ if (verb === "mastery") {
6160
+ const userId = flagString(parsed, "student", { required: true });
6161
+ const status = flagString(parsed, "status");
6162
+ return unwrap(await api.client.GET("/tutor/browser/students/{userId}/mastery/skills/", {
6163
+ params: {
6164
+ path: { userId },
6165
+ query: {
6166
+ domainSlug: flagString(parsed, "domain"),
6167
+ ...(status
6168
+ ? {
6169
+ status: assertChoice(status, [
6170
+ "UNSEEN",
6171
+ "EXPOSED",
6172
+ "PRACTICING",
6173
+ "PROFICIENT",
6174
+ "MASTERED",
6175
+ "STALE",
6176
+ "BLOCKED",
6177
+ ], "--status"),
6178
+ }
6179
+ : {}),
6180
+ ...(hasFlag(parsed, "struggling")
6181
+ ? { struggling: "true" }
6182
+ : {}),
6183
+ },
6184
+ },
6185
+ }));
6186
+ }
6141
6187
  if (verb === "math-academy") {
6142
6188
  const studentId = flagString(parsed, "student", { required: true });
6143
6189
  const startDate = flagString(parsed, "from");
@@ -6218,7 +6264,7 @@ export async function executeRecessCommand(argv, options = {}) {
6218
6264
  return { studentId, flashcardReviewEnabled: on };
6219
6265
  });
6220
6266
  }
6221
- throw new CliError("invalid_arguments", "Use students list|today|schedule|todos|analysis|xp-history|upload-map-scores|issue-email|web-todos|flashcards.");
6267
+ throw new CliError("invalid_arguments", "Use students list|today|schedule|todos|analysis|xp-history|mastery|upload-map-scores|issue-email|web-todos|flashcards.");
6222
6268
  }
6223
6269
  if (noun === "todos") {
6224
6270
  if (verb === "create") {
@@ -6442,6 +6488,13 @@ export async function executeRecessCommand(argv, options = {}) {
6442
6488
  const student = await studentFlag(api, parsed, { required: true });
6443
6489
  const studentId = student.id;
6444
6490
  const targetDueDateISO = flagDateOnly(parsed, "due-date");
6491
+ const mode = flagString(parsed, "mode");
6492
+ if (mode !== undefined &&
6493
+ mode !== "game" &&
6494
+ mode !== "lesson" &&
6495
+ mode !== "diagram") {
6496
+ throw new CliError("invalid_arguments", "--mode must be game, lesson or diagram.");
6497
+ }
6445
6498
  const [todo, learningAnalysis] = await Promise.all([
6446
6499
  api.client.GET("/tutor/browser/todos/{id}/", {
6447
6500
  params: { path: { id: todoId } },
@@ -6468,15 +6521,21 @@ export async function executeRecessCommand(argv, options = {}) {
6468
6521
  },
6469
6522
  request: {
6470
6523
  targetDueDateISO: targetDueDateISO ?? null,
6524
+ format: mode ?? null,
6471
6525
  },
6472
6526
  details: {
6473
6527
  dueDate: targetDueDateISO ?? "tomorrow in the student's timezone",
6474
- versionRouting: "The server evaluates applet-gen-v2 for this student and uses v1 when the flag is off or its evaluation fails.",
6528
+ format: mode
6529
+ ? `always builds a ${mode}`
6530
+ : "always builds; the builder picks a game, lesson or diagram",
6475
6531
  },
6476
6532
  };
6477
6533
  return previewBoundWrite(parsed, preview, async () => unwrap(await api.client.POST("/admin/learning-pipeline/{analysisId}/generate-applet/", {
6478
6534
  params: { path: { analysisId: analysis.id } },
6479
- body: targetDueDateISO ? { targetDueDateISO } : {},
6535
+ body: {
6536
+ ...(targetDueDateISO ? { targetDueDateISO } : {}),
6537
+ ...(mode ? { format: mode } : {}),
6538
+ },
6480
6539
  })));
6481
6540
  }
6482
6541
  throw new CliError("invalid_arguments", "Use todos create|edit|complete|delete|restore|generate-learning-analysis|generate-applet.");
@@ -302,6 +302,10 @@ const FAMILY_AI_COMMANDS = new Set([
302
302
  "tutor-templates unassign",
303
303
  ]);
304
304
  const STAFF_COMMANDS = new Set([
305
+ "students mastery",
306
+ "apps link",
307
+ "apps links",
308
+ "apps unlink",
305
309
  "rooms transcripts get",
306
310
  "rooms transcripts search",
307
311
  "cohorts schedule get",
@@ -130,6 +130,12 @@ function renderPacket(packet, admissionUrl, questions = []) {
130
130
  if (packet.status === "VOIDED") {
131
131
  out.push(`Voided ${when(packet.voidedAt)}: ${packet.voidReason ?? ""}`);
132
132
  }
133
+ if (packet.status === "COMPLETE") {
134
+ out.push("", "Orientation:");
135
+ for (const kid of packet.kids) {
136
+ out.push(` ${kid.firstName} (kid ${kid.id}): ${kid.orientationRegistered ? "registered in a Beginning cohort" : kid.orientationWeekOf ? `week of ${kid.orientationWeekOf}, not registered yet (waiting for that week's cohort)` : "no week yet: set one with `recess admissions orientation-week`"}`);
137
+ }
138
+ }
133
139
  if (packet.agreedPlan?.length) {
134
140
  out.push("", "Agreed plan (as signed):");
135
141
  for (const kid of packet.agreedPlan) {
@@ -571,6 +577,25 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
571
577
  return json ? result : { help: await render(result.packet) };
572
578
  });
573
579
  }
580
+ if (verb === "orientation-week") {
581
+ const packetId = positional(parsed, 2, "packet ID");
582
+ const kidId = flagString(parsed, "kid")?.trim();
583
+ const weekOf = flagString(parsed, "week")?.trim();
584
+ if (!kidId || !weekOf || !ISO_DATE.test(weekOf)) {
585
+ throw new CliError("invalid_arguments", "Use --kid <packet-kid-id> --week YYYY-MM-DD (the week's Monday). `recess admissions get` lists the kid ids.");
586
+ }
587
+ return writeCommand(parsed, {
588
+ action: `set the orientation week of ${weekOf} for kid ${kidId} on admission packet ${packetId}: they are registered in that week's Beginning cohort when it exists, and Eliana's email goes out the Thursday before`,
589
+ target: { packetId },
590
+ request: { kidId, weekOf },
591
+ }, async () => {
592
+ const result = unwrap(await api.client.POST("/admin/admissions/{packetId}/orientation-week", {
593
+ params: { path: { packetId } },
594
+ body: { kidId, weekOf },
595
+ }));
596
+ return json ? result : { help: await render(result.packet) };
597
+ });
598
+ }
574
599
  if (verb === "set-paywall") {
575
600
  const packetId = positional(parsed, 2, "packet ID");
576
601
  const paywallRaw = flagString(parsed, "paywall")?.replace(/[$,]/g, "");
@@ -657,6 +682,6 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
657
682
  };
658
683
  });
659
684
  }
660
- throw new CliError("invalid_arguments", "Usage: recess admissions create|get|list|resend|void|mark-signed|upload-signed|contract|mark-paid|set-paywall|requote|archive-agreement. See `recess help`.");
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`.");
661
686
  }
662
687
  //# sourceMappingURL=admissions.js.map
@@ -6,6 +6,7 @@ import { unwrap } from "../api.js";
6
6
  import { flagNumber, flagString, hasFlag } from "../args.js";
7
7
  import { CliError } from "../errors.js";
8
8
  import { positional } from "./shared.js";
9
+ import { runSkillLinkCommand, SKILL_LINK_VERBS } from "./skill-links.js";
9
10
  const PROJECT_FILE = ".recess/app.json";
10
11
  const CONTRACT_FILE = "contract.json";
11
12
  const MANIFEST_FILE = "manifest.json";
@@ -559,6 +560,8 @@ export async function runAppsCommand(ctx) {
559
560
  throw new CliError("remote_command_unavailable", `apps ${verb ?? ""} is not available over hosted MCP.`);
560
561
  }
561
562
  }
563
+ if (SKILL_LINK_VERBS.has(verb ?? ""))
564
+ return runSkillLinkCommand(ctx);
562
565
  if (verb === "scaffold") {
563
566
  const result = await scaffoldResult(ctx, flagString(parsed, "for-todo"));
564
567
  return {
@@ -0,0 +1,72 @@
1
+ import { currentOperationKey, unwrap } from "../api.js";
2
+ import { flagString } from "../args.js";
3
+ import { CliError } from "../errors.js";
4
+ import { flagIdList } from "./shared.js";
5
+ /**
6
+ * The send id is derived from the approved operation key; the server derives
7
+ * each message id from it, so a retried confirmation never DMs anyone twice.
8
+ */
9
+ function sendIdForOperation() {
10
+ const hex = /^op_([a-f0-9]{32})_/.exec(currentOperationKey() ?? "")?.[1];
11
+ if (!hex) {
12
+ throw new CliError("confirmation_required", "A DM can only be sent through a confirmed operation.");
13
+ }
14
+ return [
15
+ hex.slice(0, 8),
16
+ hex.slice(8, 12),
17
+ hex.slice(12, 16),
18
+ hex.slice(16, 20),
19
+ hex.slice(20),
20
+ ].join("-");
21
+ }
22
+ /**
23
+ * Read-only preflight so the approval names every recipient. Sorted so a
24
+ * confirm-time rerun reproduces the approved preview byte for byte.
25
+ */
26
+ async function resolveRecipients(api, userIds) {
27
+ const profiles = await Promise.all(userIds.map(async (userId) => unwrap(await api.client.GET("/admin/users/{userId}", {
28
+ params: { path: { userId } },
29
+ }))));
30
+ const disabled = profiles.filter(({ user }) => user.role === "DISABLED");
31
+ if (disabled.length) {
32
+ throw new CliError("invalid_arguments", `Disabled accounts cannot receive DMs: ${disabled
33
+ .map(({ user }) => user.id)
34
+ .join(", ")}.`);
35
+ }
36
+ return profiles
37
+ .map(({ user }) => ({
38
+ id: user.id,
39
+ name: [user.firstName, user.lastName].filter(Boolean).join(" "),
40
+ role: user.role,
41
+ }))
42
+ .sort((a, b) => a.id.localeCompare(b.id));
43
+ }
44
+ export async function runDmsCommand({ parsed, api, writeCommand, }) {
45
+ if (parsed.positionals[1] !== "send") {
46
+ throw new CliError("invalid_arguments", "Use `dms send`.");
47
+ }
48
+ const userIds = Array.from(new Set(flagIdList(parsed, "users")));
49
+ if (userIds.length === 0) {
50
+ throw new CliError("invalid_arguments", "--users is required.");
51
+ }
52
+ if (userIds.length > 50) {
53
+ throw new CliError("invalid_arguments", "--users takes at most 50 ids.");
54
+ }
55
+ const text = flagString(parsed, "text", { required: true }).trim();
56
+ if (!text || text.length > 4000) {
57
+ throw new CliError("invalid_arguments", "--text must be 1 to 4000 characters.");
58
+ }
59
+ return writeCommand(parsed, {
60
+ action: `send this Recess DM as you, 1:1, to ${userIds.length} user(s) (each gets their own DM thread, live and as a push notification)`,
61
+ target: { userIds },
62
+ request: { text },
63
+ details: { recipients: await resolveRecipients(api, userIds) },
64
+ }, async () => unwrap(await api.client.POST("/admin/chat/send-dm/", {
65
+ body: {
66
+ id: sendIdForOperation(),
67
+ recipientUserIds: userIds,
68
+ content: text,
69
+ },
70
+ })));
71
+ }
72
+ //# sourceMappingURL=dms.js.map
@@ -139,7 +139,7 @@ export async function runMasteryCommand({ parsed, api, writeCommand: gate, }) {
139
139
  request: body,
140
140
  details: {
141
141
  graphSha256: hash(graph.graphJson),
142
- consequence: "Makes this draft the active curriculum graph. Retires the previous release. Existing content links stay on their original release and need review/relinking. First publication may queue historical todo evidence backfill.",
142
+ consequence: "Makes this draft the active curriculum graph. Retires the previous release. Content and page links move to the new release for every skill it keeps. First publication may queue historical todo evidence backfill.",
143
143
  },
144
144
  }, async () => unwrap(await api.client.POST("/ai/rcs/drafts/{id}/promote", {
145
145
  params: { path: { id } },
@@ -1,13 +1,13 @@
1
1
  import { unwrap } from "../api.js";
2
2
  import { flagNumber, flagString, hasFlag } from "../args.js";
3
3
  import { CliError } from "../errors.js";
4
- const MAX_DAILY_BUDGET_USD = 20;
4
+ const MAX_WEEKLY_BUDGET_USD = 100;
5
5
  function budgetFlag(context) {
6
6
  const budget = flagNumber(context.parsed, "budget");
7
7
  if (budget === undefined)
8
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).`);
9
+ if (budget <= 0 || budget > MAX_WEEKLY_BUDGET_USD) {
10
+ throw new CliError("invalid_arguments", `--budget must be more than 0 and at most ${MAX_WEEKLY_BUDGET_USD} (USD per week).`);
11
11
  }
12
12
  return budget;
13
13
  }
@@ -19,9 +19,9 @@ function currentStatus(status) {
19
19
  schoolTierId: status.schoolTierId,
20
20
  viaFlag: status.viaFlag,
21
21
  grant: status.grant,
22
- dailyBudgetUsd: status.dailyBudgetUsd,
23
- defaultDailyBudgetUsd: status.defaultDailyBudgetUsd,
24
- todayUsd: status.days.find((day) => day.day === status.today)?.costUsd ?? 0,
22
+ weeklyBudgetUsd: status.weeklyBudgetUsd,
23
+ defaultWeeklyBudgetUsd: status.defaultWeeklyBudgetUsd,
24
+ weekUsd: status.weekUsd,
25
25
  };
26
26
  }
27
27
  export async function runRockyFreeCommand(context) {
@@ -42,36 +42,36 @@ export async function runRockyFreeCommand(context) {
42
42
  }));
43
43
  if (verb === "get")
44
44
  return status;
45
- const putBudget = (dailyBudgetUsd) => async () => unwrap(await api.client.PUT("/tutor/students/{studentId}/free-rocky", {
45
+ const putBudget = (weeklyBudgetUsd) => async () => unwrap(await api.client.PUT("/tutor/students/{studentId}/free-rocky", {
46
46
  params: { path: { studentId } },
47
- body: { dailyBudgetUsd },
47
+ body: { weeklyBudgetUsd },
48
48
  }));
49
49
  if (verb === "grant") {
50
50
  if (hasFlag(parsed, "default")) {
51
51
  throw new CliError("invalid_arguments", "grant takes --budget or nothing (the default budget); --default is for set-budget.");
52
52
  }
53
- const dailyBudgetUsd = budgetFlag(context) ?? null;
53
+ const weeklyBudgetUsd = budgetFlag(context) ?? null;
54
54
  const alreadyGranted = status.grant?.active === true;
55
55
  return writeCommand(parsed, {
56
56
  action: alreadyGranted
57
- ? "change the daily budget of this user's existing free Rocky grant"
57
+ ? "change the weekly budget of this user's existing free Rocky grant"
58
58
  : "grant free Rocky to this user",
59
59
  target: { studentUserId: studentId },
60
- request: { dailyBudgetUsd },
60
+ request: { weeklyBudgetUsd },
61
61
  details: {
62
62
  current: currentStatus(status),
63
63
  warnings: status.warnings,
64
- budgetAfterUsd: dailyBudgetUsd ?? status.defaultDailyBudgetUsd,
65
- budgetSource: dailyBudgetUsd === null ? "default" : "custom",
64
+ budgetAfterUsd: weeklyBudgetUsd ?? status.defaultWeeklyBudgetUsd,
65
+ budgetSource: weeklyBudgetUsd === null ? "default" : "custom",
66
66
  consequences: [
67
67
  alreadyGranted
68
- ? "The grant is already active: only its daily budget changes; grantedAt and grantedBy stay."
68
+ ? "The grant is already active: only its weekly budget changes; grantedAt and grantedBy stay."
69
69
  : "Starts a new grant stamped with you as grantedBy; a revoked grant is re-granted.",
70
70
  "ADMIN-only (exact-admin): a GUIDE session gets 403.",
71
71
  ],
72
72
  reverse: `\`rocky free revoke --student ${studentId}\``,
73
73
  },
74
- }, putBudget(dailyBudgetUsd));
74
+ }, putBudget(weeklyBudgetUsd));
75
75
  }
76
76
  if (!status.grant?.active) {
77
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.`);
@@ -82,19 +82,19 @@ export async function runRockyFreeCommand(context) {
82
82
  if ((budget === undefined) === !useDefault) {
83
83
  throw new CliError("invalid_arguments", "Pass exactly one of --budget <usd> or --default.");
84
84
  }
85
- const dailyBudgetUsd = budget ?? null;
85
+ const weeklyBudgetUsd = budget ?? null;
86
86
  return writeCommand(parsed, {
87
- action: "change the daily budget of this user's free Rocky grant",
87
+ action: "change the weekly budget of this user's free Rocky grant",
88
88
  target: { studentUserId: studentId },
89
- request: { dailyBudgetUsd },
89
+ request: { weeklyBudgetUsd },
90
90
  details: {
91
91
  current: currentStatus(status),
92
92
  warnings: status.warnings,
93
- budgetBeforeUsd: status.dailyBudgetUsd,
94
- budgetAfterUsd: dailyBudgetUsd ?? status.defaultDailyBudgetUsd,
95
- budgetSource: dailyBudgetUsd === null ? "default" : "custom",
93
+ budgetBeforeUsd: status.weeklyBudgetUsd,
94
+ budgetAfterUsd: weeklyBudgetUsd ?? status.defaultWeeklyBudgetUsd,
95
+ budgetSource: weeklyBudgetUsd === null ? "default" : "custom",
96
96
  },
97
- }, putBudget(dailyBudgetUsd));
97
+ }, putBudget(weeklyBudgetUsd));
98
98
  }
99
99
  return writeCommand(parsed, {
100
100
  action: "revoke this user's free Rocky grant",
@@ -0,0 +1,91 @@
1
+ import { unwrap } from "../api.js";
2
+ import { flagString, hasFlag } from "../args.js";
3
+ import { CliError } from "../errors.js";
4
+ import { getJob } from "../jobs.js";
5
+ import { positional } from "./shared.js";
6
+ export const SKILL_LINK_VERBS = new Set(["link", "links", "unlink"]);
7
+ export async function runSkillLinkCommand({ parsed, api, writeCommand, }) {
8
+ const verb = parsed.positionals[1];
9
+ if (verb === "links") {
10
+ return unwrap(await api.client.GET("/apps/links", {
11
+ params: { query: { domainSlug: flagString(parsed, "domain") } },
12
+ }));
13
+ }
14
+ if (verb === "link") {
15
+ const url = positional(parsed, 2, "page URL");
16
+ // A confirmed run saves exactly the skill the human approved; picking again
17
+ // could land on a different one.
18
+ if (hasFlag(parsed, "confirm")) {
19
+ const key = flagString(parsed, "operation-key", { required: true });
20
+ const { history } = await getJob(key);
21
+ const approved = history.find((event) => event.status === "awaiting_confirmation")?.preview;
22
+ if ((approved?.action !== "apps.link" &&
23
+ approved?.action !== "apps.link-new-skill") ||
24
+ approved.target.url !== url)
25
+ throw new CliError("approval_mismatch", "Run an unchanged preview on this machine before confirming.");
26
+ return writeCommand(parsed, approved, async () => approved.action === "apps.link"
27
+ ? unwrap(await api.client.POST("/apps/links", {
28
+ body: approved.request,
29
+ }))
30
+ : unwrap(await api.client.POST("/apps/links/new-skill", {
31
+ body: approved.request,
32
+ })));
33
+ }
34
+ const about = flagString(parsed, "about", { required: true });
35
+ const objectiveId = flagString(parsed, "skill");
36
+ const domainSlug = flagString(parsed, "domain");
37
+ const preview = unwrap(await api.client.GET("/apps/links/preview", {
38
+ params: { query: { url, about, objectiveId, domainSlug } },
39
+ }));
40
+ if (preview.newSkill) {
41
+ const plan = preview.newSkill;
42
+ const body = { url, about, title: preview.title, plan };
43
+ return writeCommand(parsed, {
44
+ action: "apps.link-new-skill",
45
+ target: { url },
46
+ request: body,
47
+ details: {
48
+ ...preview,
49
+ consequence: plan.newGraph
50
+ ? `No graph covers this. Generates a new "${plan.graphTitle}" mastery graph (${plan.domainSlug}) that includes the skill "${plan.skillTitle}", publishes it as soon as it is built (a few minutes), then links this page. Check with \`recess apps links\`.`
51
+ : `No skill on the "${plan.graphTitle}" graph fits. Adds the skill "${plan.skillTitle}" to it, publishes the graph, then links this page (a minute or two). Check with \`recess apps links\`.`,
52
+ },
53
+ }, async () => unwrap(await api.client.POST("/apps/links/new-skill", { body })));
54
+ }
55
+ if (!preview.skill)
56
+ throw new CliError("no_skill", "No mastery skill fits this description. Describe the one skill a kid shows on this page, or pass --skill <micro-skill-id>.");
57
+ if (!objectiveId && !preview.confident)
58
+ throw new CliError("skill_unclear", `Best guess is "${preview.skill.title}" (${preview.skill.objectiveId}) at ${preview.skill.confidence.toFixed(2)} confidence, too low to link. The page may cover several skills: describe the one it tests, or pass --skill <micro-skill-id>.`, 1, { preview });
59
+ const body = {
60
+ url,
61
+ about,
62
+ objectiveId: preview.skill.objectiveId,
63
+ domainSlug: preview.skill.domainSlug,
64
+ confidence: preview.skill.confidence,
65
+ };
66
+ return writeCommand(parsed, {
67
+ action: "apps.link",
68
+ target: { url },
69
+ request: body,
70
+ details: {
71
+ ...preview,
72
+ consequence: "Links this page to one mastery skill, live at once. Kids who finish it as a todo get assessment credit on that skill, and kids who miss the skill can be given it.",
73
+ },
74
+ }, async () => unwrap(await api.client.POST("/apps/links", { body })));
75
+ }
76
+ if (verb === "unlink") {
77
+ const id = positional(parsed, 2, "link ID");
78
+ return writeCommand(parsed, {
79
+ action: "apps.unlink",
80
+ target: { linkId: id },
81
+ request: { id },
82
+ details: {
83
+ consequence: "Removes this page's skill link. Credit kids already earned stays.",
84
+ },
85
+ }, async () => unwrap(await api.client.DELETE("/apps/links/{id}", {
86
+ params: { path: { id } },
87
+ })));
88
+ }
89
+ throw new CliError("unknown_command", "Use recess help apps.");
90
+ }
91
+ //# sourceMappingURL=skill-links.js.map
package/dist/help.js CHANGED
@@ -100,6 +100,8 @@ Usage:
100
100
  [--range week|month|quarter|year]
101
101
  recess [--json] students math-academy --student <kid-id>
102
102
  [--from YYYY-MM-DD] [--to YYYY-MM-DD]
103
+ recess [--json] students mastery --student <kid-id> [--domain <slug>]
104
+ [--status UNSEEN|EXPOSED|PRACTICING|PROFICIENT|MASTERED|STALE|BLOCKED] [--struggling]
103
105
  recess [--json] enrollments list --user <user-id>
104
106
  recess [--json] subscriptions list --family <family-id> [--kid <kid-id>]
105
107
  recess [--json] invoices list --subscription <subscription-id>
@@ -120,6 +122,9 @@ Usage:
120
122
  recess [--json] apps publish [dir] [--name TEXT] [--open] [--assign <kid-id>] [--due YYYY-MM-DD] [--no-wait]
121
123
  recess [--json] apps assign [dir] --student <kid-id> [--due YYYY-MM-DD]
122
124
  recess [--json] apps status <build-id>
125
+ recess [--json] apps link <url> --about TEXT [--skill <micro-skill-id>] [--domain <slug>] [--confirm]
126
+ recess [--json] apps links [--domain <slug>]
127
+ recess [--json] apps unlink <link-id> [--confirm]
123
128
  recess [--json] applications list [--status SUBMITTED|CLAIMED|ENROLLED|CLOSED]
124
129
  [--status-scope active|closed] [--disposition READY_TO_ENROLL|TRIAL|PENDING_FUNDING|NO]
125
130
  [--dispositioned true|false] [--quality QUALIFIED|NEEDS_NURTURE|UNKNOWN]
@@ -288,6 +293,7 @@ Usage:
288
293
  recess [--json] admissions attach-aid <packet-id> --financial-aid <financial-aid-application-id>|none [--confirm]
289
294
  recess [--json] admissions mark-paid <packet-id> [--note TEXT] [--confirm]
290
295
  recess [--json] admissions set-paywall <packet-id> (--paywall DOLLARS | --paywall-offline | --no-paywall) [--note TEXT] [--confirm]
296
+ recess [--json] admissions orientation-week <packet-id> --kid <packet-kid-id> --week YYYY-MM-DD [--confirm]
291
297
  recess [--json] admissions contract <packet-id> [--option <term:payment>] [--out <file>]
292
298
  recess [--json] admissions upload-signed <packet-id> --file <pdf> [--option <term:payment>] [--note TEXT] [--confirm]
293
299
  recess [--json] reports activity [--partner-school <slug|id>] [--guide <name|email|id>]
@@ -306,6 +312,7 @@ Usage:
306
312
  recess [--json] cohorts email <cohort-id> --target ALL_PARENTS|ALL_PARENTS_GUIDES
307
313
  --content TEXT [--confirm]
308
314
  recess [--json] feed post --users <id,id,...> --text TEXT [--send-email] [--confirm]
315
+ recess [--json] dms send --users <id,id,...> --text TEXT [--confirm]
309
316
  recess [--json] events get <event-id>
310
317
  recess [--json] events list --date YYYY-MM-DD [--timezone <iana>] [--search TEXT]
311
318
  recess [--json] events take-attendance <event-id> --attended <id,id,...>
@@ -518,8 +525,9 @@ Usage:
518
525
  [--confirm-destructive-changes --destructive-change-token TOKEN]
519
526
  recess [--json] goal-templates set-metadata <template-id> [--expected-version N]
520
527
  [--title TEXT] [--description TEXT] [--emoji X] [--category TEXT] [--tags A,B]
521
- [--image-url URL] [--coin-amount N] [--sort-order N] [--is-starter true|false]
522
- [--setup-audience KID_FRIENDLY|PARENT_SETUP] [--kind SIMPLE|BLUEPRINT]
528
+ [--image-url URL] [--coin-amount N] [--chat-title TEXT|none] [--sort-order N]
529
+ [--is-starter true|false] [--setup-audience KID_FRIENDLY|PARENT_SETUP]
530
+ [--kind SIMPLE|BLUEPRINT]
523
531
  [--visibility PUBLIC|PRIVATE|STAFF_ONLY] [--target-platform ANY|MOBILE|DESKTOP]
524
532
  [--agent-instructions-file <path>] [--output-template-file <path>] [--confirm]
525
533
  recess [--json] goal-templates delete <template-id> [--expected-version N] [--confirm]
@@ -580,7 +588,7 @@ Usage:
580
588
  [--confirm --approval-token TOKEN]
581
589
  recess [--json] todos generate-learning-analysis <todo-id> [--confirm]
582
590
  recess [--json] todos generate-applet <todo-id> --student <kid-id>
583
- [--due-date YYYY-MM-DD] [--confirm --approval-token TOKEN]
591
+ [--mode game|lesson|diagram] [--due-date YYYY-MM-DD] [--confirm --approval-token TOKEN]
584
592
  recess [--json] memories files --student <kid-id>
585
593
  recess [--json] memories read --student <kid-id> --path <path>
586
594
  recess [--json] memories edit --student <kid-id> --path <path> --content-file <file> [--confirm] [--approval-token <token>]
@@ -1111,6 +1119,7 @@ export const COMMAND_SUMMARIES = {
1111
1119
  "students analysis": "Read the learning analysis for a completed todo.",
1112
1120
  "students xp-history": "Show a kid's XP history over a range.",
1113
1121
  "students math-academy": "Show a linked kid's Math Academy course, league and task activity.",
1122
+ "students mastery": "Show a kid's mastery-graph skills: status, confidence, assessments and struggles.",
1114
1123
  "enrollments list": "List a user's enrollments.",
1115
1124
  "subscriptions list": "List a family's Stripe subscriptions.",
1116
1125
  "invoices list": "List a subscription's invoices.",
@@ -1129,6 +1138,9 @@ export const COMMAND_SUMMARIES = {
1129
1138
  "apps publish": "Build and publish a Studio app (optionally assign it to a kid).",
1130
1139
  "apps assign": "Assign a published Studio app to a kid as a todo.",
1131
1140
  "apps status": "Check a Studio build's status.",
1141
+ "apps link": "Link a page on any site to the one mastery skill it tests.",
1142
+ "apps links": "List pages linked to mastery skills.",
1143
+ "apps unlink": "Remove a page's skill link.",
1132
1144
  "applications list": "List enrollment applications with filters.",
1133
1145
  "applications get": "Read one enrollment application.",
1134
1146
  "applications quotes": "List an application's tuition quotes.",
@@ -1243,6 +1255,7 @@ export const COMMAND_SUMMARIES = {
1243
1255
  "cohorts resume-billing": "Resume billing for a cohort.",
1244
1256
  "cohorts email": "Email a cohort's parents (and guides).",
1245
1257
  "feed post": "Post a message to users' feeds (optionally email).",
1258
+ "dms send": "Send a Recess chat DM as yourself to each user (1:1).",
1246
1259
  "events get": "Read one class event.",
1247
1260
  "events list": "List class events on a date.",
1248
1261
  "events take-attendance": "Record attendance for an event.",
@@ -1404,7 +1417,7 @@ export const COMMAND_SUMMARIES = {
1404
1417
  "todos delete": "Delete a todo (soft).",
1405
1418
  "todos restore": "Restore a deleted todo.",
1406
1419
  "todos generate-learning-analysis": "Generate a todo's learning analysis (LLM).",
1407
- "todos generate-applet": "Generate a practice applet todo from a todo.",
1420
+ "todos generate-applet": "Generate a practice game, lesson or diagram todo from a todo (the builder picks unless --mode).",
1408
1421
  "memories files": "List a kid's memory files.",
1409
1422
  "memories read": "Read one kid memory file.",
1410
1423
  "memories edit": "Edit a kid memory file (publication disabled).",
@@ -1418,7 +1431,7 @@ export const COMMAND_SUMMARIES = {
1418
1431
  "rocky free list": "List everyone with an active free Rocky grant.",
1419
1432
  "rocky free get": "Read a user's free Rocky plan, grant, budget, and usage.",
1420
1433
  "rocky free grant": "Grant free Rocky to a kid or guardian.",
1421
- "rocky free set-budget": "Change a free Rocky grant's daily budget.",
1434
+ "rocky free set-budget": "Change a free Rocky grant's weekly budget.",
1422
1435
  "rocky free revoke": "Revoke a user's free Rocky grant.",
1423
1436
  "tutor-templates list": "List tutor templates.",
1424
1437
  "tutor-templates get": "Read one tutor template.",
@@ -1471,6 +1484,7 @@ export const NOUN_SUMMARIES = {
1471
1484
  channels: "Community channels and their members.",
1472
1485
  "tuition-plans": "Compute tuition plan sheets (stores nothing).",
1473
1486
  feed: "Post messages to users' feeds.",
1487
+ dms: "Send Recess chat DMs as yourself.",
1474
1488
  events: "Class events: list, attendance, cancel, reschedule, add.",
1475
1489
  registrations: "Approve or deny cohort registrations.",
1476
1490
  request: "Raw read-only GET of any API path.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recess-cli",
3
- "version": "3.23.0",
3
+ "version": "3.25.0",
4
4
  "description": "Safe Recess administration and family AI tools from the command line.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {