recess-cli 3.19.0 → 3.19.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/cli.js CHANGED
@@ -1823,44 +1823,6 @@ function resolvedStudentDetails(student) {
1823
1823
  function goalTemplatePreviewUrl(webOrigin, templateId) {
1824
1824
  return new URL(`/challenges-v2/${encodeURIComponent(templateId)}`, webOrigin).toString();
1825
1825
  }
1826
- /**
1827
- * The classic-challenge fields passed as flags (`classic-create`/`-update`);
1828
- * only flags present land, so an update changes exactly what was sent. The
1829
- * server owns the real validation (`classic-challenge-source.ts`).
1830
- */
1831
- async function classicChallengeFlags(parsed) {
1832
- const instructionsFile = flagString(parsed, "instructions-file");
1833
- if (instructionsFile && flagString(parsed, "instructions") !== undefined) {
1834
- throw new CliError("invalid_arguments", "Pass --instructions or --instructions-file, not both.");
1835
- }
1836
- const instructions = instructionsFile
1837
- ? await fs.readFile(path.resolve(instructionsFile), "utf8")
1838
- : flagString(parsed, "instructions");
1839
- const integer = (flag, min, max) => {
1840
- const value = flagNumber(parsed, flag);
1841
- if (value !== undefined &&
1842
- (!Number.isInteger(value) || value < min || value > max)) {
1843
- throw new CliError("invalid_arguments", `--${flag} must be an integer from ${min} to ${max}.`);
1844
- }
1845
- return value;
1846
- };
1847
- const coinAmount = integer("coin-amount", 0, 1000);
1848
- const estimatedMinutes = integer("estimated-minutes", 5, 600);
1849
- const text = {
1850
- title: flagString(parsed, "title"),
1851
- description: flagString(parsed, "description"),
1852
- instructions,
1853
- submissionPrompt: flagString(parsed, "submission-prompt"),
1854
- gradeTag: flagString(parsed, "grade-tag"),
1855
- category: flagString(parsed, "category"),
1856
- imageUrl: flagString(parsed, "image-url"),
1857
- };
1858
- return {
1859
- ...Object.fromEntries(Object.entries(text).filter(([, value]) => value !== undefined)),
1860
- ...(coinAmount === undefined ? {} : { coinAmount }),
1861
- ...(estimatedMinutes === undefined ? {} : { estimatedMinutes }),
1862
- };
1863
- }
1864
1826
  /** Runs the template with Rocky as a kid would (staff only; ephemeral, never touches real todos). */
1865
1827
  function goalTemplatePlayTestUrl(webOrigin, templateId) {
1866
1828
  return new URL(`/challenges-v2/${encodeURIComponent(templateId)}?play=1`, webOrigin).toString();
@@ -4626,78 +4588,6 @@ export async function executeRecessCommand(argv, options = {}) {
4626
4588
  };
4627
4589
  });
4628
4590
  }
4629
- // Classic challenges: one photo-upload module a guide approves, authored
4630
- // from a few fields (`routes/ai/goal-templates/classic-routes.ts`).
4631
- if (verb === "classic-create") {
4632
- const fields = await classicChallengeFlags(parsed);
4633
- const { title, description, instructions, gradeTag, coinAmount } = fields;
4634
- if (!title ||
4635
- !description ||
4636
- !instructions ||
4637
- !gradeTag ||
4638
- coinAmount === undefined) {
4639
- throw new CliError("invalid_arguments", "classic-create needs --title, --description, --instructions (or --instructions-file), --grade-tag and --coin-amount.");
4640
- }
4641
- const body = {
4642
- ...fields,
4643
- title,
4644
- description,
4645
- instructions,
4646
- gradeTag,
4647
- coinAmount,
4648
- };
4649
- return writeCommand(parsed, {
4650
- action: "create a PRIVATE classic challenge (kid uploads photos; a guide approves from /challenges-v2/review)",
4651
- target: { title },
4652
- request: body,
4653
- details: {
4654
- note: "Starts PRIVATE. Card art is painted automatically when no --image-url is given. Publish with goal-templates set-metadata <id> --visibility PUBLIC once it looks right.",
4655
- },
4656
- }, async () => {
4657
- const created = unwrap(await api.client.POST("/ai/goal-templates/classic", { body }));
4658
- return {
4659
- ...created,
4660
- previewUrl: goalTemplatePreviewUrl(config.webOrigin, created.templateId),
4661
- };
4662
- });
4663
- }
4664
- if (verb === "classic-get" || verb === "classic-update") {
4665
- const id = await resolveGoalTemplateId(api, positional(parsed, 2, "template ID or slug"));
4666
- const current = unwrap(await api.client.GET("/ai/goal-templates/{id}/classic", {
4667
- params: { path: { id } },
4668
- }));
4669
- if (verb === "classic-get") {
4670
- return {
4671
- ...current,
4672
- previewUrl: goalTemplatePreviewUrl(config.webOrigin, id),
4673
- };
4674
- }
4675
- const body = await classicChallengeFlags(parsed);
4676
- const changed = Object.keys(body);
4677
- if (changed.length === 0) {
4678
- throw new CliError("invalid_arguments", "Pass at least one field to change (--title, --description, --instructions/--instructions-file, --submission-prompt, --grade-tag, --coin-amount, --estimated-minutes, --category, --image-url).");
4679
- }
4680
- const before = {
4681
- ...current.source,
4682
- imageUrl: current.imageUrl,
4683
- };
4684
- return writeCommand(parsed, {
4685
- action: "edit a classic challenge (only the fields sent change; cuts a new version)",
4686
- target: {
4687
- templateId: id,
4688
- title: current.source.title,
4689
- version: current.version,
4690
- visibility: current.visibility,
4691
- },
4692
- request: body,
4693
- details: {
4694
- current: Object.fromEntries(changed.map((key) => [key, before[key] ?? null])),
4695
- },
4696
- }, async () => unwrap(await api.client.PUT("/ai/goal-templates/{id}/classic", {
4697
- params: { path: { id } },
4698
- body,
4699
- })));
4700
- }
4701
4591
  if (verb === "policy") {
4702
4592
  const id = await resolveGoalTemplateId(api, positional(parsed, 2, "template ID or slug"));
4703
4593
  return unwrap(await api.client.GET("/ai/goal-templates/{id}/policy", {
@@ -5459,7 +5349,7 @@ export async function executeRecessCommand(argv, options = {}) {
5459
5349
  },
5460
5350
  })));
5461
5351
  }
5462
- throw new CliError("invalid_arguments", "Use goal-templates list|get|versions|validate-spec|create|classic-create|classic-get|classic-update|patch-spec|set-metadata|generate-image|delete|snapshot-files|capture-snapshot|publish|answers-template|apply|apply-starter.");
5352
+ throw new CliError("invalid_arguments", "Use goal-templates list|get|versions|validate-spec|create|patch-spec|set-metadata|generate-image|delete|snapshot-files|capture-snapshot|publish|answers-template|apply|apply-starter.");
5463
5353
  }
5464
5354
  if (noun === "goals" && (verb === "notes" || verb === "progress")) {
5465
5355
  const student = await studentFlag(api, parsed, { required: true });
@@ -6834,6 +6724,9 @@ export async function executeRecessCommand(argv, options = {}) {
6834
6724
  : { kind: "draft", draftSlug: draftSlug };
6835
6725
  const message = flagString(parsed, "message") ??
6836
6726
  `recess-cli: attach textbook PDF ${fileName}`;
6727
+ const assignedEdits = hasFlag(parsed, "allow-assigned-edits")
6728
+ ? { allowAssignedEdits: true }
6729
+ : {};
6837
6730
  const placeholderManifest = JSON.stringify({
6838
6731
  kind: "pending-pdf-upload",
6839
6732
  fileName,
@@ -6841,6 +6734,7 @@ export async function executeRecessCommand(argv, options = {}) {
6841
6734
  sizeBytes: fileStat.size,
6842
6735
  });
6843
6736
  const body = {
6737
+ ...assignedEdits,
6844
6738
  studentUserId: studentId,
6845
6739
  target,
6846
6740
  message,
@@ -6862,6 +6756,7 @@ export async function executeRecessCommand(argv, options = {}) {
6862
6756
  action: "upload a textbook PDF and attach it to a student's goal",
6863
6757
  target: preflight.target,
6864
6758
  request: {
6759
+ ...assignedEdits,
6865
6760
  sourceFile: absolutePath,
6866
6761
  sourceSha256,
6867
6762
  sizeBytes: fileStat.size,
@@ -6870,6 +6765,7 @@ export async function executeRecessCommand(argv, options = {}) {
6870
6765
  },
6871
6766
  details: {
6872
6767
  ...resolvedStudentDetails(student),
6768
+ ...(preflight.warnings?.length ? { warnings: preflight.warnings } : {}),
6873
6769
  currentChangeId: preflight.currentChangeId,
6874
6770
  note: "The PDF is stored separately and the goal workspace receives a small verified reference, matching planner-authored textbook goals.",
6875
6771
  },
@@ -117,10 +117,6 @@ const FAMILY_AI_COMMANDS = new Set([
117
117
  "goal-templates apply",
118
118
  "goal-templates apply-starter",
119
119
  "goal-templates capture-snapshot",
120
- "goal-templates classic-create",
121
- // classic-get/-update: staff, or the author on their own PRIVATE draft.
122
- "goal-templates classic-get",
123
- "goal-templates classic-update",
124
120
  "goal-templates create",
125
121
  // set-metadata/delete/patch-spec: the server lets a non-staff author touch
126
122
  // only their own PRIVATE templates, plus unpublish (set-metadata
package/dist/help.js CHANGED
@@ -451,15 +451,6 @@ Usage:
451
451
  recess [--json] goal-templates validate-spec --file <path/template.json>
452
452
  recess [--json] goal-templates create --file <path/template.json>
453
453
  [--coin-amount N] [--confirm]
454
- recess [--json] goal-templates classic-create --title TEXT --description TEXT
455
- (--instructions TEXT | --instructions-file <path.md>) --grade-tag "Grades 3-6"
456
- --coin-amount N [--submission-prompt TEXT] [--estimated-minutes N]
457
- [--category TEXT] [--image-url URL] [--confirm]
458
- recess [--json] goal-templates classic-get <template-id|slug>
459
- recess [--json] goal-templates classic-update <template-id|slug> [--title TEXT]
460
- [--description TEXT] [--instructions TEXT | --instructions-file <path.md>]
461
- [--grade-tag TEXT] [--coin-amount N] [--submission-prompt TEXT]
462
- [--estimated-minutes N] [--category TEXT] [--image-url URL] [--confirm]
463
454
  recess [--json] goal-templates patch-spec <template-id|slug> [--expected-version N]
464
455
  --patches-file <path/patches.json> [--confirm --approval-token TOKEN]
465
456
  [--confirm-destructive-changes --destructive-change-token TOKEN]
@@ -578,7 +569,7 @@ Usage:
578
569
  [--confirm --approval-token TOKEN]
579
570
  recess [--json] goals pdf upload --student <goal-owner-id>
580
571
  (--goal <goal-id> | --draft <draft-slug>) --source-file <local.pdf>
581
- [--path uploads/name.pdf] [--message TEXT]
572
+ [--path uploads/name.pdf] [--message TEXT] [--allow-assigned-edits]
582
573
  [--confirm --approval-token TOKEN]
583
574
  recess [--json] goals video upload --source-file <local.mp4>
584
575
  [--confirm --approval-token TOKEN]
@@ -593,9 +584,10 @@ Shared courses: every kid on a template reads the course's latest published
593
584
  version, so "goal-templates publish" is the one way to change a lesson; it previews
594
585
  "affects N kids (M mid-lesson)". Per-kid tailoring is a note ("goals notes set"),
595
586
  never a lesson edit (a goal that owns its lessons takes "goals files push").
596
- Goal file writes/pushes warn and refuse curriculum edits with unfinished assignments
597
- unless --allow-assigned-edits is supplied. This can change lessons while a student
598
- is working; assignments are not retired/completed and student answers are not merged.
587
+ Goal file writes/pushes and PDF uploads warn and refuse curriculum edits with
588
+ unfinished assignments unless --allow-assigned-edits is supplied. This can change
589
+ lessons while a student is working; assignments are not retired/completed and
590
+ student answers are not merged.
599
591
  The flag requires a fresh preview and confirmation; revision checks still apply.
600
592
  Goal file writes/pushes require --allow-state-modification to modify state or
601
593
  student-work folders, or replace/delete an existing resources/artifacts file.
@@ -616,9 +608,6 @@ the backend's own dryRun before the gate and previews the per-student outcome.
616
608
  "set-metadata", "delete", "patch-spec" and "set-policy" take an optional
617
609
  --expected-version; omitted, the current version is read and pinned into the
618
610
  preview, so a change before confirm is refused. A stale one 409s STALE_WRITE.
619
- "classic-create" makes a single human-reviewed module (kid submits photos, a guide
620
- approves from /challenges-v2/review) from a few fields, as a PRIVATE draft; publish
621
- with "set-metadata <id> --visibility PUBLIC". Edit it with "classic-update", not patch-spec.
622
611
  --student on goal, todo, goal-file and template-apply commands takes an ID or an
623
612
  exact roster name. "answers-template" prints a fillable answers file for "apply". The spec is unreachable from "set-metadata"
624
613
  by design — an existing spec is edited only through the guarded /ai patch path.
@@ -1212,9 +1201,6 @@ export const COMMAND_SUMMARIES = {
1212
1201
  "goal-templates versions": "List a template's version history.",
1213
1202
  "goal-templates validate-spec": "Validate a template file (no write).",
1214
1203
  "goal-templates create": "Create a goal template from a file.",
1215
- "goal-templates classic-create": "Create a classic challenge: kid uploads photos, a guide approves (starts PRIVATE).",
1216
- "goal-templates classic-get": "Read a classic challenge's editable fields.",
1217
- "goal-templates classic-update": "Edit a classic challenge's fields (only those passed change).",
1218
1204
  "goal-templates patch-spec": "Patch a template's setup-workflow spec (own PRIVATE ones for guardians).",
1219
1205
  "goal-templates set-metadata": "Edit a template's title, art, tags, visibility (own PRIVATE ones for guardians, who may also unpublish their own: --visibility PRIVATE alone).",
1220
1206
  "goal-templates delete": "Delete a goal template (own PRIVATE ones for guardians).",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recess-cli",
3
- "version": "3.19.0",
3
+ "version": "3.19.1",
4
4
  "description": "Safe Recess administration and family AI tools from the command line.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {