recess-cli 3.44.0 → 3.45.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 CHANGED
@@ -19,6 +19,7 @@ import { runChallengeOfTheWeekCommand } from "./commands/challenge-of-the-week.j
19
19
  import { runDbCommand } from "./commands/db.js";
20
20
  import { runRoomsCommand } from "./commands/rooms.js";
21
21
  import { runDmsCommand } from "./commands/dms.js";
22
+ import { runChangelogCommand } from "./commands/changelog.js";
22
23
  import { runFeedCommand } from "./commands/feed.js";
23
24
  import { runFamiliesCommand } from "./commands/families.js";
24
25
  import { runFamilyCommand, runKidCommand, runMeCommand, } from "./commands/family.js";
@@ -6330,6 +6331,9 @@ export async function executeRecessCommand(argv, options = {}) {
6330
6331
  if (noun === "feed") {
6331
6332
  return runFeedCommand({ parsed, api, writeCommand });
6332
6333
  }
6334
+ if (noun === "changelog") {
6335
+ return runChangelogCommand({ parsed, api, writeCommand });
6336
+ }
6333
6337
  if (noun === "dms") {
6334
6338
  return runDmsCommand({ parsed, api, writeCommand });
6335
6339
  }
@@ -0,0 +1,41 @@
1
+ import { unwrap } from "../api.js";
2
+ import { CliError } from "../errors.js";
3
+ import { positional } from "./shared.js";
4
+ /**
5
+ * `changelog preview|send <slug>` — the same send as the post page's button. The
6
+ * server holds the copy and audience, so this only names the post. It sends once,
7
+ * and only when the post is live.
8
+ */
9
+ export async function runChangelogCommand({ parsed, api, writeCommand, }) {
10
+ const action = positional(parsed, 1, "changelog action");
11
+ if (action !== "preview" && action !== "send") {
12
+ throw new CliError("invalid_arguments", "Use changelog preview|send.");
13
+ }
14
+ const slug = positional(parsed, 2, "post slug");
15
+ const params = { path: { slug } };
16
+ const preview = unwrap(await api.client.GET("/admin/changelog-sends/{slug}/", { params }));
17
+ const reach = preview.audiences.map((a) => ({
18
+ audience: a.audience,
19
+ feed: a.feed?.count ?? 0,
20
+ email: a.email?.count ?? 0,
21
+ sms: a.sms?.count ?? 0,
22
+ }));
23
+ if (action === "preview")
24
+ return { ...preview, reach };
25
+ if (preview.record) {
26
+ throw new CliError("invalid_arguments", "This post was already sent.");
27
+ }
28
+ if (!preview.live) {
29
+ throw new CliError("invalid_arguments", "This post isn't live yet.");
30
+ }
31
+ if (preview.problems.length > 0) {
32
+ throw new CliError("invalid_arguments", preview.problems.join("; "));
33
+ }
34
+ return writeCommand(parsed, {
35
+ action: `send the "${slug}" changelog post to its audience${preview.dryRun ? " (test environment: nothing leaves)" : ""}. This can't be undone or sent twice.`,
36
+ target: { slug },
37
+ request: {},
38
+ details: { reach, audiences: preview.audiences },
39
+ }, async () => unwrap(await api.client.POST("/admin/changelog-sends/{slug}/send/", { params })));
40
+ }
41
+ //# sourceMappingURL=changelog.js.map
package/dist/help.js CHANGED
@@ -418,6 +418,8 @@ Usage:
418
418
  recess [--json] cohorts email <cohort-id> --target ALL_PARENTS|ALL_PARENTS_GUIDES
419
419
  --content TEXT [--confirm]
420
420
  recess [--json] feed post --users <id,id,...> --text TEXT [--send-email] [--confirm]
421
+ recess [--json] changelog preview <slug>
422
+ recess [--json] changelog send <slug> [--confirm]
421
423
  recess [--json] dms send --users <id,id,...> --text TEXT [--confirm]
422
424
  recess [--json] events get <event-id>
423
425
  recess [--json] events list --date YYYY-MM-DD [--timezone <iana>] [--search TEXT]
@@ -1512,6 +1514,8 @@ export const COMMAND_SUMMARIES = {
1512
1514
  "cohorts resume-billing": "Resume billing for a cohort.",
1513
1515
  "cohorts email": "Email a cohort's parents (and guides).",
1514
1516
  "feed post": "Post a message to users' feeds (optionally email).",
1517
+ "changelog preview": "Show what a live changelog post would send, and to how many people.",
1518
+ "changelog send": "Send a live changelog post to its audience, once.",
1515
1519
  "dms send": "Send a Recess chat DM as yourself to each user (1:1).",
1516
1520
  "events get": "Read one class event.",
1517
1521
  "events list": "List class events on a date.",
@@ -1769,6 +1773,7 @@ export const NOUN_SUMMARIES = {
1769
1773
  "tuition-plans": "Compute tuition plan sheets (stores nothing).",
1770
1774
  placement: "Give placement quests, one kid's results, results vs MAP, question bank, mastery sync.",
1771
1775
  feed: "Post messages to users' feeds.",
1776
+ changelog: "Preview and send changelog posts.",
1772
1777
  dms: "Send Recess chat DMs as yourself.",
1773
1778
  events: "Class events: list, attendance, cancel, reschedule, add.",
1774
1779
  registrations: "Approve or deny cohort registrations.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recess-cli",
3
- "version": "3.44.0",
3
+ "version": "3.45.0",
4
4
  "description": "Safe Recess administration and family AI tools from the command line.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -46,8 +46,8 @@
46
46
  "oxlint-tsgolint": "^0.6.0",
47
47
  "typescript": "^5.9.2",
48
48
  "vitest": "^1.6.0",
49
- "@tryrecess/api-types": "0.0.0",
50
- "@tryrecess/typescript-config": "0.0.0"
49
+ "@tryrecess/typescript-config": "0.0.0",
50
+ "@tryrecess/api-types": "0.0.0"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "node node_modules/@tryrecess/typescript-config/bin/tsc-fast.mjs",