recess-cli 3.18.1 → 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 +44 -151
- package/dist/command-schema.js +0 -6
- package/dist/help.js +11 -50
- package/package.json +1 -1
- package/dist/commands/goal-curriculum.js +0 -187
package/dist/cli.js
CHANGED
|
@@ -10,7 +10,6 @@ import { agentContext, buildCommandSchema, findCommandSchema, remoteCommands, sc
|
|
|
10
10
|
import { runAdmissionsCommand } from "./commands/admissions.js";
|
|
11
11
|
import { runApplicationsCommand } from "./commands/applications.js";
|
|
12
12
|
import { runAppsCommand } from "./commands/apps.js";
|
|
13
|
-
import { readAssignmentSelection, runGoalCurriculumCommand, } from "./commands/goal-curriculum.js";
|
|
14
13
|
import { runChannelsCommand } from "./commands/channels.js";
|
|
15
14
|
import { runChatLogsCommand } from "./commands/chat-logs.js";
|
|
16
15
|
import { runDbCommand } from "./commands/db.js";
|
|
@@ -1824,44 +1823,6 @@ function resolvedStudentDetails(student) {
|
|
|
1824
1823
|
function goalTemplatePreviewUrl(webOrigin, templateId) {
|
|
1825
1824
|
return new URL(`/challenges-v2/${encodeURIComponent(templateId)}`, webOrigin).toString();
|
|
1826
1825
|
}
|
|
1827
|
-
/**
|
|
1828
|
-
* The classic-challenge fields passed as flags (`classic-create`/`-update`);
|
|
1829
|
-
* only flags present land, so an update changes exactly what was sent. The
|
|
1830
|
-
* server owns the real validation (`classic-challenge-source.ts`).
|
|
1831
|
-
*/
|
|
1832
|
-
async function classicChallengeFlags(parsed) {
|
|
1833
|
-
const instructionsFile = flagString(parsed, "instructions-file");
|
|
1834
|
-
if (instructionsFile && flagString(parsed, "instructions") !== undefined) {
|
|
1835
|
-
throw new CliError("invalid_arguments", "Pass --instructions or --instructions-file, not both.");
|
|
1836
|
-
}
|
|
1837
|
-
const instructions = instructionsFile
|
|
1838
|
-
? await fs.readFile(path.resolve(instructionsFile), "utf8")
|
|
1839
|
-
: flagString(parsed, "instructions");
|
|
1840
|
-
const integer = (flag, min, max) => {
|
|
1841
|
-
const value = flagNumber(parsed, flag);
|
|
1842
|
-
if (value !== undefined &&
|
|
1843
|
-
(!Number.isInteger(value) || value < min || value > max)) {
|
|
1844
|
-
throw new CliError("invalid_arguments", `--${flag} must be an integer from ${min} to ${max}.`);
|
|
1845
|
-
}
|
|
1846
|
-
return value;
|
|
1847
|
-
};
|
|
1848
|
-
const coinAmount = integer("coin-amount", 0, 1000);
|
|
1849
|
-
const estimatedMinutes = integer("estimated-minutes", 5, 600);
|
|
1850
|
-
const text = {
|
|
1851
|
-
title: flagString(parsed, "title"),
|
|
1852
|
-
description: flagString(parsed, "description"),
|
|
1853
|
-
instructions,
|
|
1854
|
-
submissionPrompt: flagString(parsed, "submission-prompt"),
|
|
1855
|
-
gradeTag: flagString(parsed, "grade-tag"),
|
|
1856
|
-
category: flagString(parsed, "category"),
|
|
1857
|
-
imageUrl: flagString(parsed, "image-url"),
|
|
1858
|
-
};
|
|
1859
|
-
return {
|
|
1860
|
-
...Object.fromEntries(Object.entries(text).filter(([, value]) => value !== undefined)),
|
|
1861
|
-
...(coinAmount === undefined ? {} : { coinAmount }),
|
|
1862
|
-
...(estimatedMinutes === undefined ? {} : { estimatedMinutes }),
|
|
1863
|
-
};
|
|
1864
|
-
}
|
|
1865
1826
|
/** Runs the template with Rocky as a kid would (staff only; ephemeral, never touches real todos). */
|
|
1866
1827
|
function goalTemplatePlayTestUrl(webOrigin, templateId) {
|
|
1867
1828
|
return new URL(`/challenges-v2/${encodeURIComponent(templateId)}?play=1`, webOrigin).toString();
|
|
@@ -2143,6 +2104,39 @@ function remoteWriteCommand(argv, structuredInput, store) {
|
|
|
2143
2104
|
}
|
|
2144
2105
|
};
|
|
2145
2106
|
}
|
|
2107
|
+
/** Selection files only supply explicit IDs; they never expand a filter into a mutation. */
|
|
2108
|
+
async function readAssignmentSelection(filePath) {
|
|
2109
|
+
const absolutePath = path.resolve(filePath);
|
|
2110
|
+
const stat = await fs.stat(absolutePath);
|
|
2111
|
+
if (!stat.isFile() || stat.size > 1024 * 1024) {
|
|
2112
|
+
throw new CliError("invalid_arguments", "The assignment selection must be a regular JSON file no larger than 1 MiB.");
|
|
2113
|
+
}
|
|
2114
|
+
const bytes = await fs.readFile(absolutePath);
|
|
2115
|
+
let document;
|
|
2116
|
+
try {
|
|
2117
|
+
document = JSON.parse(bytes.toString("utf8"));
|
|
2118
|
+
}
|
|
2119
|
+
catch {
|
|
2120
|
+
throw new CliError("invalid_arguments", "The assignment selection must contain valid JSON.");
|
|
2121
|
+
}
|
|
2122
|
+
if (!document ||
|
|
2123
|
+
typeof document !== "object" ||
|
|
2124
|
+
Array.isArray(document) ||
|
|
2125
|
+
Object.keys(document).length !== 1 ||
|
|
2126
|
+
!("todoIds" in document) ||
|
|
2127
|
+
!Array.isArray(document.todoIds) ||
|
|
2128
|
+
!document.todoIds.every((id) => typeof id === "string")) {
|
|
2129
|
+
throw new CliError("invalid_arguments", 'The selection file must contain exactly {"todoIds":["assignment-uuid", ...]}.');
|
|
2130
|
+
}
|
|
2131
|
+
return {
|
|
2132
|
+
todoIds: document.todoIds,
|
|
2133
|
+
file: {
|
|
2134
|
+
absolutePath,
|
|
2135
|
+
sizeBytes: bytes.byteLength,
|
|
2136
|
+
sha256: createHash("sha256").update(bytes).digest("hex"),
|
|
2137
|
+
},
|
|
2138
|
+
};
|
|
2139
|
+
}
|
|
2146
2140
|
export async function executeRecessCommand(argv, options = {}) {
|
|
2147
2141
|
const parsed = parseArgs(argv);
|
|
2148
2142
|
const [noun, verb] = parsed.positionals;
|
|
@@ -4409,16 +4403,6 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
4409
4403
|
throw new CliError("invalid_arguments", "Use content-library search, status, set-stage, or submit.");
|
|
4410
4404
|
}
|
|
4411
4405
|
if (noun === "goal-templates") {
|
|
4412
|
-
if (verb === "curriculum") {
|
|
4413
|
-
return runGoalCurriculumCommand({
|
|
4414
|
-
parsed,
|
|
4415
|
-
api,
|
|
4416
|
-
writeCommand,
|
|
4417
|
-
resolveTemplateId: (value) => resolveGoalTemplateId(api, value),
|
|
4418
|
-
previewBoundWrite: (args, preview, execute) => previewBoundWrite(args, preview, execute, true),
|
|
4419
|
-
recoverExecutedPreview: (expected) => recoverExecutedPreview(parsed, expected),
|
|
4420
|
-
});
|
|
4421
|
-
}
|
|
4422
4406
|
const readTemplateDocument = async () => {
|
|
4423
4407
|
if (!isRemote) {
|
|
4424
4408
|
return readJsonFile(flagString(parsed, "file", { required: true }), "Template file");
|
|
@@ -4604,78 +4588,6 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
4604
4588
|
};
|
|
4605
4589
|
});
|
|
4606
4590
|
}
|
|
4607
|
-
// Classic challenges: one photo-upload module a guide approves, authored
|
|
4608
|
-
// from a few fields (`routes/ai/goal-templates/classic-routes.ts`).
|
|
4609
|
-
if (verb === "classic-create") {
|
|
4610
|
-
const fields = await classicChallengeFlags(parsed);
|
|
4611
|
-
const { title, description, instructions, gradeTag, coinAmount } = fields;
|
|
4612
|
-
if (!title ||
|
|
4613
|
-
!description ||
|
|
4614
|
-
!instructions ||
|
|
4615
|
-
!gradeTag ||
|
|
4616
|
-
coinAmount === undefined) {
|
|
4617
|
-
throw new CliError("invalid_arguments", "classic-create needs --title, --description, --instructions (or --instructions-file), --grade-tag and --coin-amount.");
|
|
4618
|
-
}
|
|
4619
|
-
const body = {
|
|
4620
|
-
...fields,
|
|
4621
|
-
title,
|
|
4622
|
-
description,
|
|
4623
|
-
instructions,
|
|
4624
|
-
gradeTag,
|
|
4625
|
-
coinAmount,
|
|
4626
|
-
};
|
|
4627
|
-
return writeCommand(parsed, {
|
|
4628
|
-
action: "create a PRIVATE classic challenge (kid uploads photos; a guide approves from /challenges-v2/review)",
|
|
4629
|
-
target: { title },
|
|
4630
|
-
request: body,
|
|
4631
|
-
details: {
|
|
4632
|
-
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.",
|
|
4633
|
-
},
|
|
4634
|
-
}, async () => {
|
|
4635
|
-
const created = unwrap(await api.client.POST("/ai/goal-templates/classic", { body }));
|
|
4636
|
-
return {
|
|
4637
|
-
...created,
|
|
4638
|
-
previewUrl: goalTemplatePreviewUrl(config.webOrigin, created.templateId),
|
|
4639
|
-
};
|
|
4640
|
-
});
|
|
4641
|
-
}
|
|
4642
|
-
if (verb === "classic-get" || verb === "classic-update") {
|
|
4643
|
-
const id = await resolveGoalTemplateId(api, positional(parsed, 2, "template ID or slug"));
|
|
4644
|
-
const current = unwrap(await api.client.GET("/ai/goal-templates/{id}/classic", {
|
|
4645
|
-
params: { path: { id } },
|
|
4646
|
-
}));
|
|
4647
|
-
if (verb === "classic-get") {
|
|
4648
|
-
return {
|
|
4649
|
-
...current,
|
|
4650
|
-
previewUrl: goalTemplatePreviewUrl(config.webOrigin, id),
|
|
4651
|
-
};
|
|
4652
|
-
}
|
|
4653
|
-
const body = await classicChallengeFlags(parsed);
|
|
4654
|
-
const changed = Object.keys(body);
|
|
4655
|
-
if (changed.length === 0) {
|
|
4656
|
-
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).");
|
|
4657
|
-
}
|
|
4658
|
-
const before = {
|
|
4659
|
-
...current.source,
|
|
4660
|
-
imageUrl: current.imageUrl,
|
|
4661
|
-
};
|
|
4662
|
-
return writeCommand(parsed, {
|
|
4663
|
-
action: "edit a classic challenge (only the fields sent change; cuts a new version)",
|
|
4664
|
-
target: {
|
|
4665
|
-
templateId: id,
|
|
4666
|
-
title: current.source.title,
|
|
4667
|
-
version: current.version,
|
|
4668
|
-
visibility: current.visibility,
|
|
4669
|
-
},
|
|
4670
|
-
request: body,
|
|
4671
|
-
details: {
|
|
4672
|
-
current: Object.fromEntries(changed.map((key) => [key, before[key] ?? null])),
|
|
4673
|
-
},
|
|
4674
|
-
}, async () => unwrap(await api.client.PUT("/ai/goal-templates/{id}/classic", {
|
|
4675
|
-
params: { path: { id } },
|
|
4676
|
-
body,
|
|
4677
|
-
})));
|
|
4678
|
-
}
|
|
4679
4591
|
if (verb === "policy") {
|
|
4680
4592
|
const id = await resolveGoalTemplateId(api, positional(parsed, 2, "template ID or slug"));
|
|
4681
4593
|
return unwrap(await api.client.GET("/ai/goal-templates/{id}/policy", {
|
|
@@ -5424,12 +5336,7 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5424
5336
|
changes: plan.changes,
|
|
5425
5337
|
stampedKeys: plan.stampedKeys,
|
|
5426
5338
|
dropped: plan.dropped,
|
|
5427
|
-
|
|
5428
|
-
? {
|
|
5429
|
-
killSwitch: "GOAL_CONTENT_SOURCE_OVERRIDE=COPY: no goal reads the course until it is lifted.",
|
|
5430
|
-
}
|
|
5431
|
-
: {}),
|
|
5432
|
-
note: "Every kid on this course (SHARED goals) reads the new version from their next session; progress and notes are keyed by Item key. The confirmed publish is fenced to this exact plan digest.",
|
|
5339
|
+
note: "Every kid on this course reads the new version from their next session; progress and notes are keyed by Item key. The confirmed publish is fenced to this exact plan digest.",
|
|
5433
5340
|
},
|
|
5434
5341
|
};
|
|
5435
5342
|
return previewBoundWrite(parsed, preview, async () => unwrap(await api.client.POST("/ai/goal-templates/{id}/publish", {
|
|
@@ -5442,7 +5349,7 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5442
5349
|
},
|
|
5443
5350
|
})));
|
|
5444
5351
|
}
|
|
5445
|
-
throw new CliError("invalid_arguments", "Use goal-templates list|get|versions|validate-spec|create|
|
|
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.");
|
|
5446
5353
|
}
|
|
5447
5354
|
if (noun === "goals" && (verb === "notes" || verb === "progress")) {
|
|
5448
5355
|
const student = await studentFlag(api, parsed, { required: true });
|
|
@@ -5459,13 +5366,13 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5459
5366
|
if (action === "list")
|
|
5460
5367
|
return notes;
|
|
5461
5368
|
if (!lesson) {
|
|
5462
|
-
return { goalId,
|
|
5369
|
+
return { goalId, note: notes.goal };
|
|
5463
5370
|
}
|
|
5464
5371
|
const match = notes.lessons.find((entry) => entry.key === lesson || entry.ref === lesson);
|
|
5465
5372
|
if (!match) {
|
|
5466
5373
|
throw new CliError("not_found", `No lesson ${lesson} on goal ${goalId}; goals notes list shows each lesson's key.`);
|
|
5467
5374
|
}
|
|
5468
|
-
return { goalId,
|
|
5375
|
+
return { goalId, lesson: match };
|
|
5469
5376
|
}
|
|
5470
5377
|
if (action === "set") {
|
|
5471
5378
|
const textFile = flagString(parsed, "text-file");
|
|
@@ -5485,32 +5392,12 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5485
5392
|
request: body,
|
|
5486
5393
|
details: {
|
|
5487
5394
|
...resolvedStudentDetails(student),
|
|
5488
|
-
note: "
|
|
5395
|
+
note: "To change the lesson itself for every kid, edit the course and run goal-templates publish.",
|
|
5489
5396
|
},
|
|
5490
5397
|
}, async () => unwrap(await api.client.PUT("/tutor/students/{studentId}/goals/{goalId}/notes", { ...params, body })));
|
|
5491
5398
|
}
|
|
5492
5399
|
throw new CliError("invalid_arguments", "Use goals notes list|get|set.");
|
|
5493
5400
|
}
|
|
5494
|
-
if (noun === "goals" && verb === "adaptations") {
|
|
5495
|
-
const action = positional(parsed, 2, "goals adaptations action");
|
|
5496
|
-
const student = await studentFlag(api, parsed, { required: true });
|
|
5497
|
-
const studentId = student.id;
|
|
5498
|
-
const goalId = flagString(parsed, "goal", { required: true });
|
|
5499
|
-
if (action === "list") {
|
|
5500
|
-
return unwrap(await api.client.GET("/tutor/students/{studentId}/goals/{goalId}/adaptations", { params: { path: { studentId, goalId } } }));
|
|
5501
|
-
}
|
|
5502
|
-
if (action === "diff") {
|
|
5503
|
-
const runId = positional(parsed, 3, "adaptation run ID");
|
|
5504
|
-
const path = flagString(parsed, "path");
|
|
5505
|
-
return unwrap(await api.client.GET("/tutor/students/{studentId}/goals/{goalId}/adaptations/{runId}/diff", {
|
|
5506
|
-
params: {
|
|
5507
|
-
path: { studentId, goalId, runId },
|
|
5508
|
-
query: path ? { path } : {},
|
|
5509
|
-
},
|
|
5510
|
-
}));
|
|
5511
|
-
}
|
|
5512
|
-
throw new CliError("invalid_arguments", "Use goals adaptations list|diff.");
|
|
5513
|
-
}
|
|
5514
5401
|
if (noun === "goals" &&
|
|
5515
5402
|
verb !== "files" &&
|
|
5516
5403
|
verb !== "pdf" &&
|
|
@@ -6837,6 +6724,9 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
6837
6724
|
: { kind: "draft", draftSlug: draftSlug };
|
|
6838
6725
|
const message = flagString(parsed, "message") ??
|
|
6839
6726
|
`recess-cli: attach textbook PDF ${fileName}`;
|
|
6727
|
+
const assignedEdits = hasFlag(parsed, "allow-assigned-edits")
|
|
6728
|
+
? { allowAssignedEdits: true }
|
|
6729
|
+
: {};
|
|
6840
6730
|
const placeholderManifest = JSON.stringify({
|
|
6841
6731
|
kind: "pending-pdf-upload",
|
|
6842
6732
|
fileName,
|
|
@@ -6844,6 +6734,7 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
6844
6734
|
sizeBytes: fileStat.size,
|
|
6845
6735
|
});
|
|
6846
6736
|
const body = {
|
|
6737
|
+
...assignedEdits,
|
|
6847
6738
|
studentUserId: studentId,
|
|
6848
6739
|
target,
|
|
6849
6740
|
message,
|
|
@@ -6865,6 +6756,7 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
6865
6756
|
action: "upload a textbook PDF and attach it to a student's goal",
|
|
6866
6757
|
target: preflight.target,
|
|
6867
6758
|
request: {
|
|
6759
|
+
...assignedEdits,
|
|
6868
6760
|
sourceFile: absolutePath,
|
|
6869
6761
|
sourceSha256,
|
|
6870
6762
|
sizeBytes: fileStat.size,
|
|
@@ -6873,6 +6765,7 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
6873
6765
|
},
|
|
6874
6766
|
details: {
|
|
6875
6767
|
...resolvedStudentDetails(student),
|
|
6768
|
+
...(preflight.warnings?.length ? { warnings: preflight.warnings } : {}),
|
|
6876
6769
|
currentChangeId: preflight.currentChangeId,
|
|
6877
6770
|
note: "The PDF is stored separately and the goal workspace receives a small verified reference, matching planner-authored textbook goals.",
|
|
6878
6771
|
},
|
package/dist/command-schema.js
CHANGED
|
@@ -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
|
|
@@ -135,8 +131,6 @@ const FAMILY_AI_COMMANDS = new Set([
|
|
|
135
131
|
"goal-templates set-metadata",
|
|
136
132
|
"goal-templates snapshot-files",
|
|
137
133
|
"goal-templates validate-spec",
|
|
138
|
-
"goals adaptations diff",
|
|
139
|
-
"goals adaptations list",
|
|
140
134
|
"goals archive",
|
|
141
135
|
"goals complete-module",
|
|
142
136
|
"goals create",
|
package/dist/help.js
CHANGED
|
@@ -447,31 +447,10 @@ Usage:
|
|
|
447
447
|
recess [--json] goal-templates retire-assignments <template-id|slug> --goal ID
|
|
448
448
|
[--todos ID,ID | --todos-file <path/selection.json>]
|
|
449
449
|
--retirement-reason TEXT [--confirm --approval-token TOKEN]
|
|
450
|
-
recess [--json] goal-templates curriculum backlog <template-id|slug>
|
|
451
|
-
--goals ID,ID [--due-before YYYY-MM-DD]
|
|
452
|
-
recess [--json] goal-templates curriculum preview <template-id|slug>
|
|
453
|
-
--goals ID,ID --version N [--resolutions-file <path/resolutions.json>]
|
|
454
|
-
recess [--json] goal-templates curriculum validate-resolutions <template-id|slug>
|
|
455
|
-
--goals ID,ID --version N --resolutions-file <path/resolutions.json>
|
|
456
|
-
recess [--json] goal-templates curriculum apply|reverse <template-id|slug>
|
|
457
|
-
--goals ID,ID --version N [--resolutions-file <path/resolutions.json>]
|
|
458
|
-
[--confirm --approval-token TOKEN]
|
|
459
|
-
recess [--json] goal-templates curriculum status <template-id|slug> --job ID
|
|
460
|
-
recess [--json] goal-templates curriculum retry <template-id|slug> --job ID
|
|
461
|
-
[--confirm --approval-token TOKEN]
|
|
462
450
|
recess [--json] goal-templates versions <template-id> [--version N]
|
|
463
451
|
recess [--json] goal-templates validate-spec --file <path/template.json>
|
|
464
452
|
recess [--json] goal-templates create --file <path/template.json>
|
|
465
453
|
[--coin-amount N] [--confirm]
|
|
466
|
-
recess [--json] goal-templates classic-create --title TEXT --description TEXT
|
|
467
|
-
(--instructions TEXT | --instructions-file <path.md>) --grade-tag "Grades 3-6"
|
|
468
|
-
--coin-amount N [--submission-prompt TEXT] [--estimated-minutes N]
|
|
469
|
-
[--category TEXT] [--image-url URL] [--confirm]
|
|
470
|
-
recess [--json] goal-templates classic-get <template-id|slug>
|
|
471
|
-
recess [--json] goal-templates classic-update <template-id|slug> [--title TEXT]
|
|
472
|
-
[--description TEXT] [--instructions TEXT | --instructions-file <path.md>]
|
|
473
|
-
[--grade-tag TEXT] [--coin-amount N] [--submission-prompt TEXT]
|
|
474
|
-
[--estimated-minutes N] [--category TEXT] [--image-url URL] [--confirm]
|
|
475
454
|
recess [--json] goal-templates patch-spec <template-id|slug> [--expected-version N]
|
|
476
455
|
--patches-file <path/patches.json> [--confirm --approval-token TOKEN]
|
|
477
456
|
[--confirm-destructive-changes --destructive-change-token TOKEN]
|
|
@@ -573,9 +552,6 @@ Usage:
|
|
|
573
552
|
[--lesson <item-key|module-ref>] (--text TEXT | --text-file <path>) [--append]
|
|
574
553
|
[--confirm --approval-token TOKEN]
|
|
575
554
|
recess [--json] goals progress --student <goal-owner-id> --goal <goal-id>
|
|
576
|
-
recess [--json] goals adaptations list --student <goal-owner-id> --goal <goal-id>
|
|
577
|
-
recess [--json] goals adaptations diff <run-id> --student <goal-owner-id>
|
|
578
|
-
--goal <goal-id> [--path P]
|
|
579
555
|
recess [--json] goals files list --student <goal-owner-id> --goal <goal-id>
|
|
580
556
|
recess [--json] goals files read --student <goal-owner-id> --goal <goal-id> --path P
|
|
581
557
|
recess [--json] goals files init --student <goal-owner-id> --draft <draft-slug>
|
|
@@ -593,7 +569,7 @@ Usage:
|
|
|
593
569
|
[--confirm --approval-token TOKEN]
|
|
594
570
|
recess [--json] goals pdf upload --student <goal-owner-id>
|
|
595
571
|
(--goal <goal-id> | --draft <draft-slug>) --source-file <local.pdf>
|
|
596
|
-
[--path uploads/name.pdf] [--message TEXT]
|
|
572
|
+
[--path uploads/name.pdf] [--message TEXT] [--allow-assigned-edits]
|
|
597
573
|
[--confirm --approval-token TOKEN]
|
|
598
574
|
recess [--json] goals video upload --source-file <local.mp4>
|
|
599
575
|
[--confirm --approval-token TOKEN]
|
|
@@ -604,14 +580,14 @@ bundled into this npm package. Load os-v2-goal-template-builder and its
|
|
|
604
580
|
references/deterministic-workflow-setup.md BEFORE authoring a template; that is
|
|
605
581
|
the same guidance the recess.gg/ai agent follows, so there is exactly one
|
|
606
582
|
standard. Responses cache under ~/.recess-cli/skills-cache/ (--refresh re-fetches).
|
|
607
|
-
Shared courses
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
583
|
+
Shared courses: every kid on a template reads the course's latest published
|
|
584
|
+
version, so "goal-templates publish" is the one way to change a lesson; it previews
|
|
585
|
+
"affects N kids (M mid-lesson)". Per-kid tailoring is a note ("goals notes set"),
|
|
586
|
+
never a lesson edit (a goal that owns its lessons takes "goals files push").
|
|
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.
|
|
615
591
|
The flag requires a fresh preview and confirmation; revision checks still apply.
|
|
616
592
|
Goal file writes/pushes require --allow-state-modification to modify state or
|
|
617
593
|
student-work folders, or replace/delete an existing resources/artifacts file.
|
|
@@ -632,9 +608,6 @@ the backend's own dryRun before the gate and previews the per-student outcome.
|
|
|
632
608
|
"set-metadata", "delete", "patch-spec" and "set-policy" take an optional
|
|
633
609
|
--expected-version; omitted, the current version is read and pinned into the
|
|
634
610
|
preview, so a change before confirm is refused. A stale one 409s STALE_WRITE.
|
|
635
|
-
"classic-create" makes a single human-reviewed module (kid submits photos, a guide
|
|
636
|
-
approves from /challenges-v2/review) from a few fields, as a PRIVATE draft; publish
|
|
637
|
-
with "set-metadata <id> --visibility PUBLIC". Edit it with "classic-update", not patch-spec.
|
|
638
611
|
--student on goal, todo, goal-file and template-apply commands takes an ID or an
|
|
639
612
|
exact roster name. "answers-template" prints a fillable answers file for "apply". The spec is unreachable from "set-metadata"
|
|
640
613
|
by design — an existing spec is edited only through the guarded /ai patch path.
|
|
@@ -1225,19 +1198,9 @@ export const COMMAND_SUMMARIES = {
|
|
|
1225
1198
|
"goal-templates migrate-policy": "Migrate students' goals to the template policy.",
|
|
1226
1199
|
"goal-templates student-policy": "Edit one student's goal policy.",
|
|
1227
1200
|
"goal-templates retire-assignments": "Retire a goal's open assignments.",
|
|
1228
|
-
"goal-templates curriculum backlog": "Show goals' curriculum backlog (deprecated for shared courses).",
|
|
1229
|
-
"goal-templates curriculum preview": "Preview a curriculum version upgrade (deprecated for shared courses).",
|
|
1230
|
-
"goal-templates curriculum validate-resolutions": "Validate curriculum-upgrade conflict resolutions (deprecated for shared courses).",
|
|
1231
|
-
"goal-templates curriculum apply": "Apply a curriculum version to goals (deprecated for shared courses).",
|
|
1232
|
-
"goal-templates curriculum reverse": "Reverse a curriculum upgrade on goals (deprecated for shared courses).",
|
|
1233
|
-
"goal-templates curriculum status": "Check a curriculum job's status (deprecated for shared courses).",
|
|
1234
|
-
"goal-templates curriculum retry": "Retry a failed curriculum job (deprecated for shared courses).",
|
|
1235
1201
|
"goal-templates versions": "List a template's version history.",
|
|
1236
1202
|
"goal-templates validate-spec": "Validate a template file (no write).",
|
|
1237
1203
|
"goal-templates create": "Create a goal template from a file.",
|
|
1238
|
-
"goal-templates classic-create": "Create a classic challenge: kid uploads photos, a guide approves (starts PRIVATE).",
|
|
1239
|
-
"goal-templates classic-get": "Read a classic challenge's editable fields.",
|
|
1240
|
-
"goal-templates classic-update": "Edit a classic challenge's fields (only those passed change).",
|
|
1241
1204
|
"goal-templates patch-spec": "Patch a template's setup-workflow spec (own PRIVATE ones for guardians).",
|
|
1242
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).",
|
|
1243
1206
|
"goal-templates delete": "Delete a goal template (own PRIVATE ones for guardians).",
|
|
@@ -1286,12 +1249,10 @@ export const COMMAND_SUMMARIES = {
|
|
|
1286
1249
|
"tutor-templates create": "Create a tutor template.",
|
|
1287
1250
|
"tutor-templates update": "Update a tutor template.",
|
|
1288
1251
|
"tutor-templates delete": "Delete a tutor template.",
|
|
1289
|
-
"goals notes list": "List Rocky's per-kid notes on a
|
|
1252
|
+
"goals notes list": "List Rocky's per-kid notes on a goal.",
|
|
1290
1253
|
"goals notes get": "Read the goal's or one lesson's note.",
|
|
1291
1254
|
"goals notes set": "Write Rocky's note for this kid on a lesson (never the lesson itself).",
|
|
1292
1255
|
"goals progress": "Per-lesson progress for one kid's goal.",
|
|
1293
|
-
"goals adaptations list": "List a goal's adaptation runs.",
|
|
1294
|
-
"goals adaptations diff": "Diff the files an adaptation run changed.",
|
|
1295
1256
|
"goals files list": "List a goal workspace's files.",
|
|
1296
1257
|
"goals files read": "Read one goal workspace file.",
|
|
1297
1258
|
"goals files init": "Start a new draft goal workspace locally.",
|
|
@@ -1336,7 +1297,7 @@ export const NOUN_SUMMARIES = {
|
|
|
1336
1297
|
db: "Read-only SQL queries and who may run them.",
|
|
1337
1298
|
"content-library": "Curated gem library: search, submit, admission stage.",
|
|
1338
1299
|
skills: "Authoring skills to load before writing templates/goals.",
|
|
1339
|
-
"goal-templates": "Goal templates: browse, author, apply, policy,
|
|
1300
|
+
"goal-templates": "Goal templates: browse, author, apply, policy, publish.",
|
|
1340
1301
|
goals: "Kids' goals: create/edit, queue, workspace files, PDFs, videos.",
|
|
1341
1302
|
todos: "Kids' todos: create, edit, complete, analysis, applets.",
|
|
1342
1303
|
memories: "Kid memory files and the context Rocky sees.",
|
package/package.json
CHANGED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
import fs from "node:fs/promises";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { unwrap } from "../api.js";
|
|
5
|
-
import { flagString } from "../args.js";
|
|
6
|
-
import { CliError } from "../errors.js";
|
|
7
|
-
import { flagInteger, positional } from "./shared.js";
|
|
8
|
-
/** Selection files only supply explicit IDs; they never expand a filter into a mutation. */
|
|
9
|
-
export async function readAssignmentSelection(filePath) {
|
|
10
|
-
const absolutePath = path.resolve(filePath);
|
|
11
|
-
const stat = await fs.stat(absolutePath);
|
|
12
|
-
if (!stat.isFile() || stat.size > 1024 * 1024) {
|
|
13
|
-
throw new CliError("invalid_arguments", "The assignment selection must be a regular JSON file no larger than 1 MiB.");
|
|
14
|
-
}
|
|
15
|
-
const bytes = await fs.readFile(absolutePath);
|
|
16
|
-
let document;
|
|
17
|
-
try {
|
|
18
|
-
document = JSON.parse(bytes.toString("utf8"));
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
throw new CliError("invalid_arguments", "The assignment selection must contain valid JSON.");
|
|
22
|
-
}
|
|
23
|
-
if (!document ||
|
|
24
|
-
typeof document !== "object" ||
|
|
25
|
-
Array.isArray(document) ||
|
|
26
|
-
Object.keys(document).length !== 1 ||
|
|
27
|
-
!("todoIds" in document) ||
|
|
28
|
-
!Array.isArray(document.todoIds) ||
|
|
29
|
-
!document.todoIds.every((id) => typeof id === "string")) {
|
|
30
|
-
throw new CliError("invalid_arguments", 'The selection file must contain exactly {"todoIds":["assignment-uuid", ...]}.');
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
todoIds: document.todoIds,
|
|
34
|
-
file: {
|
|
35
|
-
absolutePath,
|
|
36
|
-
sizeBytes: bytes.byteLength,
|
|
37
|
-
sha256: createHash("sha256").update(bytes).digest("hex"),
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
async function readResolutions(filePath) {
|
|
42
|
-
const absolutePath = path.resolve(filePath);
|
|
43
|
-
let bytes;
|
|
44
|
-
try {
|
|
45
|
-
const stat = await fs.stat(absolutePath);
|
|
46
|
-
if (!stat.isFile() || stat.size > 1024 * 1024) {
|
|
47
|
-
throw new CliError("invalid_arguments", "The resolution file must be a regular JSON file no larger than 1 MiB.");
|
|
48
|
-
}
|
|
49
|
-
bytes = await fs.readFile(absolutePath);
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
if (error.code === "ENOENT") {
|
|
53
|
-
throw new CliError("invalid_arguments", `File not found: ${absolutePath}`);
|
|
54
|
-
}
|
|
55
|
-
throw error;
|
|
56
|
-
}
|
|
57
|
-
let document;
|
|
58
|
-
try {
|
|
59
|
-
document = JSON.parse(bytes.toString("utf8"));
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
throw new CliError("invalid_arguments", "The resolution file must contain valid JSON.");
|
|
63
|
-
}
|
|
64
|
-
if (!document || typeof document !== "object" || Array.isArray(document)) {
|
|
65
|
-
throw new CliError("invalid_arguments", "The resolution file must contain a JSON object.");
|
|
66
|
-
}
|
|
67
|
-
// The backend validates document version, choices, conflict IDs, and whether
|
|
68
|
-
// each choice is supported by the current three-way comparison.
|
|
69
|
-
return {
|
|
70
|
-
document: document,
|
|
71
|
-
file: {
|
|
72
|
-
absolutePath,
|
|
73
|
-
sizeBytes: bytes.byteLength,
|
|
74
|
-
sha256: createHash("sha256").update(bytes).digest("hex"),
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
export async function runGoalCurriculumCommand({ parsed, api, resolveTemplateId, previewBoundWrite, recoverExecutedPreview, }) {
|
|
79
|
-
const verb = positional(parsed, 2, "curriculum operation");
|
|
80
|
-
const [id, session] = await Promise.all([
|
|
81
|
-
resolveTemplateId(positional(parsed, 3, "template ID or slug")),
|
|
82
|
-
api.client.GET("/auth/admin-cli/session/").then(unwrap),
|
|
83
|
-
]);
|
|
84
|
-
if (session.user.role !== "ADMIN" || session.cliScope !== "full_admin") {
|
|
85
|
-
throw new CliError("forbidden", "Curriculum updates require a full-admin session.");
|
|
86
|
-
}
|
|
87
|
-
const environment = {
|
|
88
|
-
actorId: session.user.id,
|
|
89
|
-
apiOrigin: api.config.apiOrigin,
|
|
90
|
-
};
|
|
91
|
-
if (verb === "status" || verb === "retry") {
|
|
92
|
-
const jobId = flagString(parsed, "job", { required: true });
|
|
93
|
-
if (verb === "status") {
|
|
94
|
-
return unwrap(await api.client.GET("/ai/goal-templates/{id}/curriculum/jobs/{jobId}", {
|
|
95
|
-
params: { path: { id, jobId } },
|
|
96
|
-
}));
|
|
97
|
-
}
|
|
98
|
-
const requestPreview = {
|
|
99
|
-
action: "resume the previously approved curriculum job",
|
|
100
|
-
target: { templateId: id, jobId, ...environment },
|
|
101
|
-
request: {},
|
|
102
|
-
};
|
|
103
|
-
const receipt = await recoverExecutedPreview(requestPreview);
|
|
104
|
-
const preview = receipt ?? {
|
|
105
|
-
...requestPreview,
|
|
106
|
-
details: {
|
|
107
|
-
job: unwrap(await api.client.GET("/ai/goal-templates/{id}/curriculum/jobs/{jobId}", {
|
|
108
|
-
params: { path: { id, jobId } },
|
|
109
|
-
})),
|
|
110
|
-
note: "Resumes this job's stored scope and resolutions. Completed goals are not replayed; stale goals require a new preview.",
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
return previewBoundWrite(parsed, preview, async () => unwrap(await api.client.POST("/ai/goal-templates/{id}/curriculum/jobs/{jobId}/retry", {
|
|
114
|
-
params: { path: { id, jobId } },
|
|
115
|
-
body: {},
|
|
116
|
-
})));
|
|
117
|
-
}
|
|
118
|
-
const goalIds = flagString(parsed, "goals", { required: true })
|
|
119
|
-
.split(",")
|
|
120
|
-
.map((value) => value.trim());
|
|
121
|
-
if (goalIds.some((value) => !value) ||
|
|
122
|
-
new Set(goalIds).size !== goalIds.length) {
|
|
123
|
-
throw new CliError("invalid_arguments", "--goals must list distinct, nonempty goal IDs.");
|
|
124
|
-
}
|
|
125
|
-
if (verb === "backlog") {
|
|
126
|
-
const dueBefore = flagString(parsed, "due-before");
|
|
127
|
-
return unwrap(await api.client.GET("/ai/goal-templates/{id}/curriculum/backlog", {
|
|
128
|
-
params: {
|
|
129
|
-
path: { id },
|
|
130
|
-
query: { goalIds: goalIds.join(","), dueBefore },
|
|
131
|
-
},
|
|
132
|
-
}));
|
|
133
|
-
}
|
|
134
|
-
const targetVersion = flagInteger(parsed, "version", {
|
|
135
|
-
required: true,
|
|
136
|
-
min: 1,
|
|
137
|
-
});
|
|
138
|
-
const filePath = flagString(parsed, "resolutions-file", {
|
|
139
|
-
required: verb === "validate-resolutions",
|
|
140
|
-
});
|
|
141
|
-
const resolutionFile = filePath ? await readResolutions(filePath) : undefined;
|
|
142
|
-
const body = {
|
|
143
|
-
goalIds,
|
|
144
|
-
targetVersion,
|
|
145
|
-
resolutions: resolutionFile?.document ?? { version: 1, resolutions: [] },
|
|
146
|
-
};
|
|
147
|
-
const requestPreview = {
|
|
148
|
-
action: verb === "reverse"
|
|
149
|
-
? "merge a prior template curriculum version into the selected student goals"
|
|
150
|
-
: "merge the selected template curriculum version into the selected student goals",
|
|
151
|
-
target: { templateId: id, goalIds, ...environment },
|
|
152
|
-
request: { ...body, resolutionFile: resolutionFile?.file ?? null },
|
|
153
|
-
};
|
|
154
|
-
const receipt = verb === "apply" || verb === "reverse"
|
|
155
|
-
? await recoverExecutedPreview(requestPreview)
|
|
156
|
-
: null;
|
|
157
|
-
const comparison = receipt
|
|
158
|
-
? receipt.details?.comparison
|
|
159
|
-
: unwrap(await api.client.POST("/ai/goal-templates/{id}/curriculum/preview", {
|
|
160
|
-
params: { path: { id } },
|
|
161
|
-
body,
|
|
162
|
-
}));
|
|
163
|
-
if (verb === "preview" || verb === "validate-resolutions") {
|
|
164
|
-
return { ...comparison, resolutionFile: resolutionFile?.file ?? null };
|
|
165
|
-
}
|
|
166
|
-
if (verb !== "apply" && verb !== "reverse") {
|
|
167
|
-
throw new CliError("invalid_arguments", "Use curriculum backlog|preview|validate-resolutions|apply|status|retry|reverse.");
|
|
168
|
-
}
|
|
169
|
-
const preview = receipt ?? {
|
|
170
|
-
...requestPreview,
|
|
171
|
-
details: {
|
|
172
|
-
comparison,
|
|
173
|
-
note: "Only the exact selected goals are included. Unresolved conflicts block their goal. Assignments and earned history remain protected; reverse updates preserve changes made since the earlier version.",
|
|
174
|
-
},
|
|
175
|
-
};
|
|
176
|
-
return previewBoundWrite(parsed, preview, async () => unwrap(await api.client.POST("/ai/goal-templates/{id}/curriculum/apply", {
|
|
177
|
-
params: { path: { id } },
|
|
178
|
-
body: {
|
|
179
|
-
...body,
|
|
180
|
-
fingerprint: comparison.fingerprint,
|
|
181
|
-
operationKey: flagString(parsed, "operation-key", {
|
|
182
|
-
required: true,
|
|
183
|
-
}),
|
|
184
|
-
},
|
|
185
|
-
})));
|
|
186
|
-
}
|
|
187
|
-
//# sourceMappingURL=goal-curriculum.js.map
|