recess-cli 2.8.0 → 2.9.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/commands/mastery.js +41 -1
- package/dist/help.js +2 -0
- package/package.json +1 -1
package/dist/commands/mastery.js
CHANGED
|
@@ -10,6 +10,18 @@ const hash = (value) => createHash("sha256").update(JSON.stringify(value)).diges
|
|
|
10
10
|
async function executeApproved(api, preview) {
|
|
11
11
|
const body = preview.request;
|
|
12
12
|
switch (preview.action) {
|
|
13
|
+
case "mastery.delete-draft":
|
|
14
|
+
return unwrap(await api.client.DELETE("/ai/rcs/drafts/{id}", {
|
|
15
|
+
params: {
|
|
16
|
+
path: { id: String(preview.target.id) },
|
|
17
|
+
query: { expectedUpdatedAt: String(body.expectedUpdatedAt) },
|
|
18
|
+
},
|
|
19
|
+
}));
|
|
20
|
+
case "mastery.archive":
|
|
21
|
+
return unwrap(await api.client.POST("/ai/rcs/releases/{id}/archive", {
|
|
22
|
+
params: { path: { id: String(preview.target.id) } },
|
|
23
|
+
body: body,
|
|
24
|
+
}));
|
|
13
25
|
case "mastery.link":
|
|
14
26
|
return unwrap(await api.client.POST("/ai/rcs/content-links", {
|
|
15
27
|
body: body,
|
|
@@ -41,7 +53,14 @@ export async function runMasteryCommand({ parsed, api, writeCommand: gate, }) {
|
|
|
41
53
|
if (session.user.role !== "ADMIN" || session.cliScope !== "full_admin")
|
|
42
54
|
throw new CliError("forbidden", "Mastery curriculum commands require a full-admin session.");
|
|
43
55
|
const verb = parsed.positionals[1];
|
|
44
|
-
const isWrite = [
|
|
56
|
+
const isWrite = [
|
|
57
|
+
"edit",
|
|
58
|
+
"publish",
|
|
59
|
+
"link",
|
|
60
|
+
"unlink",
|
|
61
|
+
"delete-draft",
|
|
62
|
+
"archive",
|
|
63
|
+
].includes(verb ?? "");
|
|
45
64
|
const file = isWrite ? flagString(parsed, "file") : undefined;
|
|
46
65
|
const invocation = hash({
|
|
47
66
|
actorId: session.user.id,
|
|
@@ -68,6 +87,27 @@ export async function runMasteryCommand({ parsed, api, writeCommand: gate, }) {
|
|
|
68
87
|
params: { query: { domainSlug: flagString(parsed, "domain") } },
|
|
69
88
|
}));
|
|
70
89
|
}
|
|
90
|
+
if (verb === "delete-draft" || verb === "archive") {
|
|
91
|
+
const id = positional(parsed, 2, verb === "archive" ? "release ID" : "draft ID");
|
|
92
|
+
const kind = verb === "archive" ? "release" : "draft";
|
|
93
|
+
const impact = unwrap(await api.client.GET("/ai/rcs/graphs/removal-preview", {
|
|
94
|
+
params: { query: { id, kind } },
|
|
95
|
+
}));
|
|
96
|
+
const preview = {
|
|
97
|
+
action: `mastery.${verb}`,
|
|
98
|
+
target: { id, kind, title: impact.title, domainSlug: impact.domainSlug },
|
|
99
|
+
request: verb === "archive"
|
|
100
|
+
? { expectedPublishedAt: impact.revision }
|
|
101
|
+
: { expectedUpdatedAt: impact.revision },
|
|
102
|
+
details: {
|
|
103
|
+
...impact,
|
|
104
|
+
consequence: verb === "archive"
|
|
105
|
+
? "Archives this exact release (DEPRECATED). Removes it from active graph selection and new diagnostics; keeps the graph, learner history, content links, and already-issued work. Does not activate a replacement or disable the whole subject."
|
|
106
|
+
: "Permanently deletes this unpublished draft and its completed assembly parts. Cannot be undone. Does not delete any published graph, learner evidence, applet, or goal.",
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
return writeCommand(parsed, preview, () => executeApproved(api, preview));
|
|
110
|
+
}
|
|
71
111
|
if (verb === "get" || verb === "edit" || verb === "publish") {
|
|
72
112
|
const id = positional(parsed, 2, "graph artifact ID");
|
|
73
113
|
const kind = verb === "publish"
|
package/dist/help.js
CHANGED
|
@@ -6,6 +6,8 @@ Usage:
|
|
|
6
6
|
recess [--json] mastery edit <graph-id> [--kind seed|draft|release]
|
|
7
7
|
[--file <graph.json> | --instruction TEXT] [--node <node-id>] [--confirm]
|
|
8
8
|
recess [--json] mastery publish <draft-id> --expected-active-release <release-id-or-none> [--confirm]
|
|
9
|
+
recess [--json] mastery delete-draft <draft-id> [--confirm]
|
|
10
|
+
recess [--json] mastery archive <release-id> [--confirm]
|
|
9
11
|
recess [--json] mastery links --graph <release-id> [--node <node-id>] [--cursor <link-id>]
|
|
10
12
|
recess [--json] mastery link <content-id> --type applet|goal --graph <release-id>
|
|
11
13
|
[--node <node-id>] [--confirm]
|