recess-cli 3.18.0 → 3.19.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/cli.js +148 -41
- package/dist/command-schema.js +4 -2
- package/dist/commands/admissions.js +33 -1
- package/dist/help.js +27 -32
- package/package.json +1 -1
- package/skill/recess-cli/agents/version.json +2 -2
- 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,6 +1823,44 @@ function resolvedStudentDetails(student) {
|
|
|
1824
1823
|
function goalTemplatePreviewUrl(webOrigin, templateId) {
|
|
1825
1824
|
return new URL(`/challenges-v2/${encodeURIComponent(templateId)}`, webOrigin).toString();
|
|
1826
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
|
+
}
|
|
1827
1864
|
/** Runs the template with Rocky as a kid would (staff only; ephemeral, never touches real todos). */
|
|
1828
1865
|
function goalTemplatePlayTestUrl(webOrigin, templateId) {
|
|
1829
1866
|
return new URL(`/challenges-v2/${encodeURIComponent(templateId)}?play=1`, webOrigin).toString();
|
|
@@ -2105,6 +2142,39 @@ function remoteWriteCommand(argv, structuredInput, store) {
|
|
|
2105
2142
|
}
|
|
2106
2143
|
};
|
|
2107
2144
|
}
|
|
2145
|
+
/** Selection files only supply explicit IDs; they never expand a filter into a mutation. */
|
|
2146
|
+
async function readAssignmentSelection(filePath) {
|
|
2147
|
+
const absolutePath = path.resolve(filePath);
|
|
2148
|
+
const stat = await fs.stat(absolutePath);
|
|
2149
|
+
if (!stat.isFile() || stat.size > 1024 * 1024) {
|
|
2150
|
+
throw new CliError("invalid_arguments", "The assignment selection must be a regular JSON file no larger than 1 MiB.");
|
|
2151
|
+
}
|
|
2152
|
+
const bytes = await fs.readFile(absolutePath);
|
|
2153
|
+
let document;
|
|
2154
|
+
try {
|
|
2155
|
+
document = JSON.parse(bytes.toString("utf8"));
|
|
2156
|
+
}
|
|
2157
|
+
catch {
|
|
2158
|
+
throw new CliError("invalid_arguments", "The assignment selection must contain valid JSON.");
|
|
2159
|
+
}
|
|
2160
|
+
if (!document ||
|
|
2161
|
+
typeof document !== "object" ||
|
|
2162
|
+
Array.isArray(document) ||
|
|
2163
|
+
Object.keys(document).length !== 1 ||
|
|
2164
|
+
!("todoIds" in document) ||
|
|
2165
|
+
!Array.isArray(document.todoIds) ||
|
|
2166
|
+
!document.todoIds.every((id) => typeof id === "string")) {
|
|
2167
|
+
throw new CliError("invalid_arguments", 'The selection file must contain exactly {"todoIds":["assignment-uuid", ...]}.');
|
|
2168
|
+
}
|
|
2169
|
+
return {
|
|
2170
|
+
todoIds: document.todoIds,
|
|
2171
|
+
file: {
|
|
2172
|
+
absolutePath,
|
|
2173
|
+
sizeBytes: bytes.byteLength,
|
|
2174
|
+
sha256: createHash("sha256").update(bytes).digest("hex"),
|
|
2175
|
+
},
|
|
2176
|
+
};
|
|
2177
|
+
}
|
|
2108
2178
|
export async function executeRecessCommand(argv, options = {}) {
|
|
2109
2179
|
const parsed = parseArgs(argv);
|
|
2110
2180
|
const [noun, verb] = parsed.positionals;
|
|
@@ -4371,16 +4441,6 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
4371
4441
|
throw new CliError("invalid_arguments", "Use content-library search, status, set-stage, or submit.");
|
|
4372
4442
|
}
|
|
4373
4443
|
if (noun === "goal-templates") {
|
|
4374
|
-
if (verb === "curriculum") {
|
|
4375
|
-
return runGoalCurriculumCommand({
|
|
4376
|
-
parsed,
|
|
4377
|
-
api,
|
|
4378
|
-
writeCommand,
|
|
4379
|
-
resolveTemplateId: (value) => resolveGoalTemplateId(api, value),
|
|
4380
|
-
previewBoundWrite: (args, preview, execute) => previewBoundWrite(args, preview, execute, true),
|
|
4381
|
-
recoverExecutedPreview: (expected) => recoverExecutedPreview(parsed, expected),
|
|
4382
|
-
});
|
|
4383
|
-
}
|
|
4384
4444
|
const readTemplateDocument = async () => {
|
|
4385
4445
|
if (!isRemote) {
|
|
4386
4446
|
return readJsonFile(flagString(parsed, "file", { required: true }), "Template file");
|
|
@@ -4566,6 +4626,78 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
4566
4626
|
};
|
|
4567
4627
|
});
|
|
4568
4628
|
}
|
|
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
|
+
}
|
|
4569
4701
|
if (verb === "policy") {
|
|
4570
4702
|
const id = await resolveGoalTemplateId(api, positional(parsed, 2, "template ID or slug"));
|
|
4571
4703
|
return unwrap(await api.client.GET("/ai/goal-templates/{id}/policy", {
|
|
@@ -5314,12 +5446,7 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5314
5446
|
changes: plan.changes,
|
|
5315
5447
|
stampedKeys: plan.stampedKeys,
|
|
5316
5448
|
dropped: plan.dropped,
|
|
5317
|
-
|
|
5318
|
-
? {
|
|
5319
|
-
killSwitch: "GOAL_CONTENT_SOURCE_OVERRIDE=COPY: no goal reads the course until it is lifted.",
|
|
5320
|
-
}
|
|
5321
|
-
: {}),
|
|
5322
|
-
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.",
|
|
5449
|
+
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.",
|
|
5323
5450
|
},
|
|
5324
5451
|
};
|
|
5325
5452
|
return previewBoundWrite(parsed, preview, async () => unwrap(await api.client.POST("/ai/goal-templates/{id}/publish", {
|
|
@@ -5332,7 +5459,7 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5332
5459
|
},
|
|
5333
5460
|
})));
|
|
5334
5461
|
}
|
|
5335
|
-
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.");
|
|
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.");
|
|
5336
5463
|
}
|
|
5337
5464
|
if (noun === "goals" && (verb === "notes" || verb === "progress")) {
|
|
5338
5465
|
const student = await studentFlag(api, parsed, { required: true });
|
|
@@ -5349,13 +5476,13 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5349
5476
|
if (action === "list")
|
|
5350
5477
|
return notes;
|
|
5351
5478
|
if (!lesson) {
|
|
5352
|
-
return { goalId,
|
|
5479
|
+
return { goalId, note: notes.goal };
|
|
5353
5480
|
}
|
|
5354
5481
|
const match = notes.lessons.find((entry) => entry.key === lesson || entry.ref === lesson);
|
|
5355
5482
|
if (!match) {
|
|
5356
5483
|
throw new CliError("not_found", `No lesson ${lesson} on goal ${goalId}; goals notes list shows each lesson's key.`);
|
|
5357
5484
|
}
|
|
5358
|
-
return { goalId,
|
|
5485
|
+
return { goalId, lesson: match };
|
|
5359
5486
|
}
|
|
5360
5487
|
if (action === "set") {
|
|
5361
5488
|
const textFile = flagString(parsed, "text-file");
|
|
@@ -5375,32 +5502,12 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
5375
5502
|
request: body,
|
|
5376
5503
|
details: {
|
|
5377
5504
|
...resolvedStudentDetails(student),
|
|
5378
|
-
note: "
|
|
5505
|
+
note: "To change the lesson itself for every kid, edit the course and run goal-templates publish.",
|
|
5379
5506
|
},
|
|
5380
5507
|
}, async () => unwrap(await api.client.PUT("/tutor/students/{studentId}/goals/{goalId}/notes", { ...params, body })));
|
|
5381
5508
|
}
|
|
5382
5509
|
throw new CliError("invalid_arguments", "Use goals notes list|get|set.");
|
|
5383
5510
|
}
|
|
5384
|
-
if (noun === "goals" && verb === "adaptations") {
|
|
5385
|
-
const action = positional(parsed, 2, "goals adaptations action");
|
|
5386
|
-
const student = await studentFlag(api, parsed, { required: true });
|
|
5387
|
-
const studentId = student.id;
|
|
5388
|
-
const goalId = flagString(parsed, "goal", { required: true });
|
|
5389
|
-
if (action === "list") {
|
|
5390
|
-
return unwrap(await api.client.GET("/tutor/students/{studentId}/goals/{goalId}/adaptations", { params: { path: { studentId, goalId } } }));
|
|
5391
|
-
}
|
|
5392
|
-
if (action === "diff") {
|
|
5393
|
-
const runId = positional(parsed, 3, "adaptation run ID");
|
|
5394
|
-
const path = flagString(parsed, "path");
|
|
5395
|
-
return unwrap(await api.client.GET("/tutor/students/{studentId}/goals/{goalId}/adaptations/{runId}/diff", {
|
|
5396
|
-
params: {
|
|
5397
|
-
path: { studentId, goalId, runId },
|
|
5398
|
-
query: path ? { path } : {},
|
|
5399
|
-
},
|
|
5400
|
-
}));
|
|
5401
|
-
}
|
|
5402
|
-
throw new CliError("invalid_arguments", "Use goals adaptations list|diff.");
|
|
5403
|
-
}
|
|
5404
5511
|
if (noun === "goals" &&
|
|
5405
5512
|
verb !== "files" &&
|
|
5406
5513
|
verb !== "pdf" &&
|
package/dist/command-schema.js
CHANGED
|
@@ -117,6 +117,10 @@ 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",
|
|
120
124
|
"goal-templates create",
|
|
121
125
|
// set-metadata/delete/patch-spec: the server lets a non-staff author touch
|
|
122
126
|
// only their own PRIVATE templates, plus unpublish (set-metadata
|
|
@@ -131,8 +135,6 @@ const FAMILY_AI_COMMANDS = new Set([
|
|
|
131
135
|
"goal-templates set-metadata",
|
|
132
136
|
"goal-templates snapshot-files",
|
|
133
137
|
"goal-templates validate-spec",
|
|
134
|
-
"goals adaptations diff",
|
|
135
|
-
"goals adaptations list",
|
|
136
138
|
"goals archive",
|
|
137
139
|
"goals complete-module",
|
|
138
140
|
"goals create",
|
|
@@ -486,6 +486,38 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
486
486
|
return json ? result : { help: await render(result.packet) };
|
|
487
487
|
});
|
|
488
488
|
}
|
|
489
|
+
if (verb === "set-paywall") {
|
|
490
|
+
const packetId = positional(parsed, 2, "packet ID");
|
|
491
|
+
const paywallRaw = flagString(parsed, "paywall")?.replace(/[$,]/g, "");
|
|
492
|
+
const paywall = paywallRaw === undefined ? undefined : Number(paywallRaw);
|
|
493
|
+
if (paywall !== undefined && (!Number.isFinite(paywall) || paywall <= 0)) {
|
|
494
|
+
throw new CliError("invalid_arguments", "--paywall must be a positive dollar amount; --no-paywall removes it.");
|
|
495
|
+
}
|
|
496
|
+
const offlinePaywall = hasFlag(parsed, "paywall-offline");
|
|
497
|
+
const noPaywall = hasFlag(parsed, "no-paywall");
|
|
498
|
+
if ([paywall !== undefined, noPaywall, offlinePaywall].filter(Boolean)
|
|
499
|
+
.length !== 1) {
|
|
500
|
+
throw new CliError("invalid_arguments", "Use exactly one of --paywall DOLLARS, --paywall-offline or --no-paywall.");
|
|
501
|
+
}
|
|
502
|
+
const note = flagString(parsed, "note")?.trim();
|
|
503
|
+
const body = {
|
|
504
|
+
...(offlinePaywall
|
|
505
|
+
? { paywallOutOfBand: true }
|
|
506
|
+
: { paywallCents: noPaywall ? null : Math.round(paywall * 100) }),
|
|
507
|
+
...(note ? { note } : {}),
|
|
508
|
+
};
|
|
509
|
+
return writeCommand(parsed, {
|
|
510
|
+
action: `set admission packet ${packetId}'s paywall to ${offlinePaywall ? "the signed plan's first invoice, paid out of band" : noPaywall ? "none" : `${dollars(Math.round(paywall * 100))} by card`}, keeping the agreement and signature; a packet at the payment step reopens the new paywall or completes`,
|
|
511
|
+
target: { packetId },
|
|
512
|
+
request: body,
|
|
513
|
+
}, async () => {
|
|
514
|
+
const result = unwrap(await api.client.POST("/admin/admissions/{packetId}/paywall", {
|
|
515
|
+
params: { path: { packetId } },
|
|
516
|
+
body,
|
|
517
|
+
}));
|
|
518
|
+
return json ? result : { help: await render(result.packet) };
|
|
519
|
+
});
|
|
520
|
+
}
|
|
489
521
|
if (verb === "contract") {
|
|
490
522
|
const packetId = positional(parsed, 2, "packet ID");
|
|
491
523
|
const option = flagString(parsed, "option");
|
|
@@ -540,6 +572,6 @@ export async function runAdmissionsCommand({ parsed, api, writeCommand, }) {
|
|
|
540
572
|
};
|
|
541
573
|
});
|
|
542
574
|
}
|
|
543
|
-
throw new CliError("invalid_arguments", "Usage: recess admissions create|get|list|resend|void|mark-signed|upload-signed|contract|mark-paid|requote|archive-agreement. See `recess help`.");
|
|
575
|
+
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`.");
|
|
544
576
|
}
|
|
545
577
|
//# sourceMappingURL=admissions.js.map
|
package/dist/help.js
CHANGED
|
@@ -226,6 +226,7 @@ Usage:
|
|
|
226
226
|
[--paywall DOLLARS|--paywall-offline|--no-paywall] [--note TEXT] [--confirm]
|
|
227
227
|
recess [--json] admissions archive-agreement <packet-id> [--confirm]
|
|
228
228
|
recess [--json] admissions mark-paid <packet-id> [--note TEXT] [--confirm]
|
|
229
|
+
recess [--json] admissions set-paywall <packet-id> (--paywall DOLLARS | --paywall-offline | --no-paywall) [--note TEXT] [--confirm]
|
|
229
230
|
recess [--json] admissions contract <packet-id> [--option <term:payment>] [--out <file>]
|
|
230
231
|
recess [--json] admissions upload-signed <packet-id> --file <pdf> [--option <term:payment>] [--note TEXT] [--confirm]
|
|
231
232
|
recess [--json] reports activity [--partner-school <slug|id>] [--guide <name|email|id>]
|
|
@@ -446,22 +447,19 @@ Usage:
|
|
|
446
447
|
recess [--json] goal-templates retire-assignments <template-id|slug> --goal ID
|
|
447
448
|
[--todos ID,ID | --todos-file <path/selection.json>]
|
|
448
449
|
--retirement-reason TEXT [--confirm --approval-token TOKEN]
|
|
449
|
-
recess [--json] goal-templates curriculum backlog <template-id|slug>
|
|
450
|
-
--goals ID,ID [--due-before YYYY-MM-DD]
|
|
451
|
-
recess [--json] goal-templates curriculum preview <template-id|slug>
|
|
452
|
-
--goals ID,ID --version N [--resolutions-file <path/resolutions.json>]
|
|
453
|
-
recess [--json] goal-templates curriculum validate-resolutions <template-id|slug>
|
|
454
|
-
--goals ID,ID --version N --resolutions-file <path/resolutions.json>
|
|
455
|
-
recess [--json] goal-templates curriculum apply|reverse <template-id|slug>
|
|
456
|
-
--goals ID,ID --version N [--resolutions-file <path/resolutions.json>]
|
|
457
|
-
[--confirm --approval-token TOKEN]
|
|
458
|
-
recess [--json] goal-templates curriculum status <template-id|slug> --job ID
|
|
459
|
-
recess [--json] goal-templates curriculum retry <template-id|slug> --job ID
|
|
460
|
-
[--confirm --approval-token TOKEN]
|
|
461
450
|
recess [--json] goal-templates versions <template-id> [--version N]
|
|
462
451
|
recess [--json] goal-templates validate-spec --file <path/template.json>
|
|
463
452
|
recess [--json] goal-templates create --file <path/template.json>
|
|
464
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]
|
|
465
463
|
recess [--json] goal-templates patch-spec <template-id|slug> [--expected-version N]
|
|
466
464
|
--patches-file <path/patches.json> [--confirm --approval-token TOKEN]
|
|
467
465
|
[--confirm-destructive-changes --destructive-change-token TOKEN]
|
|
@@ -563,9 +561,6 @@ Usage:
|
|
|
563
561
|
[--lesson <item-key|module-ref>] (--text TEXT | --text-file <path>) [--append]
|
|
564
562
|
[--confirm --approval-token TOKEN]
|
|
565
563
|
recess [--json] goals progress --student <goal-owner-id> --goal <goal-id>
|
|
566
|
-
recess [--json] goals adaptations list --student <goal-owner-id> --goal <goal-id>
|
|
567
|
-
recess [--json] goals adaptations diff <run-id> --student <goal-owner-id>
|
|
568
|
-
--goal <goal-id> [--path P]
|
|
569
564
|
recess [--json] goals files list --student <goal-owner-id> --goal <goal-id>
|
|
570
565
|
recess [--json] goals files read --student <goal-owner-id> --goal <goal-id> --path P
|
|
571
566
|
recess [--json] goals files init --student <goal-owner-id> --draft <draft-slug>
|
|
@@ -594,11 +589,10 @@ bundled into this npm package. Load os-v2-goal-template-builder and its
|
|
|
594
589
|
references/deterministic-workflow-setup.md BEFORE authoring a template; that is
|
|
595
590
|
the same guidance the recess.gg/ai agent follows, so there is exactly one
|
|
596
591
|
standard. Responses cache under ~/.recess-cli/skills-cache/ (--refresh re-fetches).
|
|
597
|
-
Shared courses
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
refused. capture-snapshot and the curriculum commands are deprecated for them.
|
|
592
|
+
Shared courses: every kid on a template reads the course's latest published
|
|
593
|
+
version, so "goal-templates publish" is the one way to change a lesson; it previews
|
|
594
|
+
"affects N kids (M mid-lesson)". Per-kid tailoring is a note ("goals notes set"),
|
|
595
|
+
never a lesson edit (a goal that owns its lessons takes "goals files push").
|
|
602
596
|
Goal file writes/pushes warn and refuse curriculum edits with unfinished assignments
|
|
603
597
|
unless --allow-assigned-edits is supplied. This can change lessons while a student
|
|
604
598
|
is working; assignments are not retired/completed and student answers are not merged.
|
|
@@ -622,6 +616,9 @@ the backend's own dryRun before the gate and previews the per-student outcome.
|
|
|
622
616
|
"set-metadata", "delete", "patch-spec" and "set-policy" take an optional
|
|
623
617
|
--expected-version; omitted, the current version is read and pinned into the
|
|
624
618
|
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.
|
|
625
622
|
--student on goal, todo, goal-file and template-apply commands takes an ID or an
|
|
626
623
|
exact roster name. "answers-template" prints a fillable answers file for "apply". The spec is unreachable from "set-metadata"
|
|
627
624
|
by design — an existing spec is edited only through the guarded /ai patch path.
|
|
@@ -869,7 +866,11 @@ plan flags as create, or --keep-plan to reopen the payment choice on the plan
|
|
|
869
866
|
as it is; --paywall/--no-paywall changes the family share): the Documenso
|
|
870
867
|
envelope is cancelled, the family signs again from the same link, and their
|
|
871
868
|
account, consent and answers stand (a completed packet completes again on its
|
|
872
|
-
own); paid packets need a refund first and voided ones a new packet. "
|
|
869
|
+
own); paid packets need a refund first and voided ones a new packet. "set-paywall" changes only the paywall (--paywall DOLLARS, --paywall-offline or
|
|
870
|
+
--no-paywall) with no re-signing: the agreement stands, an open admission
|
|
871
|
+
charge Stripe never saw is canceled, and a packet at the payment step reopens
|
|
872
|
+
the new paywall or completes. It refuses while the parent is mid-signing.
|
|
873
|
+
"mark-signed" records a signature taken outside the dashboard (or local
|
|
873
874
|
testing without Documenso) so the parent can continue. Status moves on its own:
|
|
874
875
|
the Documenso webhook marks SIGNED, each parent step advances it, and a packet
|
|
875
876
|
with no paywall completes when the questions are in.
|
|
@@ -1208,16 +1209,12 @@ export const COMMAND_SUMMARIES = {
|
|
|
1208
1209
|
"goal-templates migrate-policy": "Migrate students' goals to the template policy.",
|
|
1209
1210
|
"goal-templates student-policy": "Edit one student's goal policy.",
|
|
1210
1211
|
"goal-templates retire-assignments": "Retire a goal's open assignments.",
|
|
1211
|
-
"goal-templates curriculum backlog": "Show goals' curriculum backlog (deprecated for shared courses).",
|
|
1212
|
-
"goal-templates curriculum preview": "Preview a curriculum version upgrade (deprecated for shared courses).",
|
|
1213
|
-
"goal-templates curriculum validate-resolutions": "Validate curriculum-upgrade conflict resolutions (deprecated for shared courses).",
|
|
1214
|
-
"goal-templates curriculum apply": "Apply a curriculum version to goals (deprecated for shared courses).",
|
|
1215
|
-
"goal-templates curriculum reverse": "Reverse a curriculum upgrade on goals (deprecated for shared courses).",
|
|
1216
|
-
"goal-templates curriculum status": "Check a curriculum job's status (deprecated for shared courses).",
|
|
1217
|
-
"goal-templates curriculum retry": "Retry a failed curriculum job (deprecated for shared courses).",
|
|
1218
1212
|
"goal-templates versions": "List a template's version history.",
|
|
1219
1213
|
"goal-templates validate-spec": "Validate a template file (no write).",
|
|
1220
1214
|
"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).",
|
|
1221
1218
|
"goal-templates patch-spec": "Patch a template's setup-workflow spec (own PRIVATE ones for guardians).",
|
|
1222
1219
|
"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).",
|
|
1223
1220
|
"goal-templates delete": "Delete a goal template (own PRIVATE ones for guardians).",
|
|
@@ -1266,12 +1263,10 @@ export const COMMAND_SUMMARIES = {
|
|
|
1266
1263
|
"tutor-templates create": "Create a tutor template.",
|
|
1267
1264
|
"tutor-templates update": "Update a tutor template.",
|
|
1268
1265
|
"tutor-templates delete": "Delete a tutor template.",
|
|
1269
|
-
"goals notes list": "List Rocky's per-kid notes on a
|
|
1266
|
+
"goals notes list": "List Rocky's per-kid notes on a goal.",
|
|
1270
1267
|
"goals notes get": "Read the goal's or one lesson's note.",
|
|
1271
1268
|
"goals notes set": "Write Rocky's note for this kid on a lesson (never the lesson itself).",
|
|
1272
1269
|
"goals progress": "Per-lesson progress for one kid's goal.",
|
|
1273
|
-
"goals adaptations list": "List a goal's adaptation runs.",
|
|
1274
|
-
"goals adaptations diff": "Diff the files an adaptation run changed.",
|
|
1275
1270
|
"goals files list": "List a goal workspace's files.",
|
|
1276
1271
|
"goals files read": "Read one goal workspace file.",
|
|
1277
1272
|
"goals files init": "Start a new draft goal workspace locally.",
|
|
@@ -1316,7 +1311,7 @@ export const NOUN_SUMMARIES = {
|
|
|
1316
1311
|
db: "Read-only SQL queries and who may run them.",
|
|
1317
1312
|
"content-library": "Curated gem library: search, submit, admission stage.",
|
|
1318
1313
|
skills: "Authoring skills to load before writing templates/goals.",
|
|
1319
|
-
"goal-templates": "Goal templates: browse, author, apply, policy,
|
|
1314
|
+
"goal-templates": "Goal templates: browse, author, apply, policy, publish.",
|
|
1320
1315
|
goals: "Kids' goals: create/edit, queue, workspace files, PDFs, videos.",
|
|
1321
1316
|
todos: "Kids' todos: create, edit, complete, analysis, applets.",
|
|
1322
1317
|
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
|