@letterstory/cli 0.121.5 → 0.121.6

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/lib/cli.mjs CHANGED
@@ -19,6 +19,7 @@ import {
19
19
  cmdPosts,
20
20
  cmdPublished,
21
21
  cmdReviewers,
22
+ cmdAutomations,
22
23
  cmdCollections,
23
24
  cmdAuthors,
24
25
  cmdFlows,
@@ -60,7 +61,7 @@ import {
60
61
  } from "./commands.mjs";
61
62
 
62
63
  // Keep in sync with cli/package.json.
63
- export const VERSION = "0.121.5";
64
+ export const VERSION = "0.121.6";
64
65
 
65
66
  // Flags that never take a value. Listing them explicitly means `deploy get --json <id>`
66
67
  // can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
@@ -190,6 +191,9 @@ export const BOOLEAN_FLAGS = new Set([
190
191
  "restore",
191
192
  // `posts list --mine`: only your posts.
192
193
  "mine",
194
+ // `automations set --pause | --resume`.
195
+ "pause",
196
+ "resume",
193
197
  // `collection add "<headline>" --collection <id> --queue`.
194
198
  "queue",
195
199
  // Bool flags from command ARGS maps that were missing here.
@@ -417,6 +421,12 @@ Reviewers:
417
421
  finished draft (no email sent now)
418
422
  reviewers standing remove <reviewer-id> Stop future auto-invites
419
423
  reviewers assigned Posts waiting on your review, across letterbases
424
+ automations list --collection <id> What a letterbase writes, how often, and why
425
+ automations show <automation-id> --collection <id> What it covers, its queued posts, its next ideas
426
+ automations add topic|series|signal|best --collection <id> [--topic <id>] [--goal <target-id>]
427
+ [--seer <id>] [--pace <n>] Add one (refused if it says the same as another)
428
+ automations set <automation-id> --collection <id> [--pace <n>] [--pause | --resume] [--goal <id>]
429
+ automations remove <automation-id> --collection <id>
420
430
  reviewers invite <article-id> --email <e> [--name <n>]
421
431
  Invite a guest to review one post
422
432
  (emails them a link and a PIN)
@@ -1372,6 +1382,7 @@ const CLIENT_COMMANDS = {
1372
1382
  posts: cmdPosts,
1373
1383
  published: cmdPublished,
1374
1384
  reviewers: cmdReviewers,
1385
+ automations: cmdAutomations,
1375
1386
  collections: cmdCollections,
1376
1387
  authors: cmdAuthors,
1377
1388
  flows: cmdFlows,
@@ -0,0 +1,68 @@
1
+ // `automations` — a letterbase's automations (docs/architecture/automations.md): what it writes,
2
+ // how often, and why. list / show / add / set / remove, through the same tools the app uses.
3
+ // Same flag/positional/io conventions as posts.mjs — no commander, no color.
4
+
5
+ import { CliError } from "../client.mjs";
6
+ import { printResult, ok, argsFromFlags, refuseUnknownFlags } from "./shared.mjs";
7
+
8
+ /** See `argsFromFlags` in shared.mjs; `scripts/parity-check.ts` diffs these keys against the tool. */
9
+ export const ARGS = {
10
+ list_automations: {
11
+ collection_id: { flag: "collection", required: true },
12
+ },
13
+ get_automation: {
14
+ collection_id: { flag: "collection", required: true },
15
+ automation_id: { positional: 0, label: "automation-id", required: true },
16
+ },
17
+ create_automation: {
18
+ collection_id: { flag: "collection", required: true },
19
+ kind: { positional: 0, label: "kind", required: true, enum: ["topic", "series", "signal", "best"] },
20
+ cluster_id: { flag: "topic" },
21
+ target_id: { flag: "goal" },
22
+ seer_id: { flag: "seer" },
23
+ pace_per_week: { flag: "pace", type: "num" },
24
+ },
25
+ update_automation: {
26
+ collection_id: { flag: "collection", required: true },
27
+ automation_id: { positional: 0, label: "automation-id", required: true },
28
+ pace_per_week: { flag: "pace", type: "num" },
29
+ paused: {
30
+ value: (flags) => (flags.pause === true ? true : flags.resume === true ? false : undefined),
31
+ },
32
+ target_id: { flag: "goal" },
33
+ },
34
+ delete_automation: {
35
+ collection_id: { flag: "collection", required: true },
36
+ automation_id: { positional: 0, label: "automation-id", required: true },
37
+ },
38
+ };
39
+
40
+ export async function cmdAutomations(ctx) {
41
+ const sub = ctx.positionals[0];
42
+ const rest = { ...ctx, positionals: ctx.positionals.slice(1) };
43
+ switch (sub) {
44
+ case "list":
45
+ case "ls":
46
+ return run(rest, "list_automations");
47
+ case "show":
48
+ return run(rest, "get_automation");
49
+ case "add":
50
+ return run(rest, "create_automation", "Added.");
51
+ case "set":
52
+ refuseUnknownFlags(rest, ARGS.update_automation, ["pause", "resume"]);
53
+ return run(rest, "update_automation", "Changed.");
54
+ case "remove":
55
+ case "rm":
56
+ return run(rest, "delete_automation", "Removed.");
57
+ default:
58
+ throw new CliError(`Unknown automations subcommand: ${sub ?? "(none)"}. Try: list, show, add, set, remove`);
59
+ }
60
+ }
61
+
62
+ async function run(ctx, tool, said) {
63
+ const { client, flags, io } = ctx;
64
+ const result = await client.callTool(tool, argsFromFlags(ARGS[tool], flags, ctx.positionals));
65
+ if (said) ok(ctx, said);
66
+ printResult(io, flags, result);
67
+ return 0;
68
+ }
package/lib/commands.mjs CHANGED
@@ -11,6 +11,7 @@ export * from "./commands/phantom.mjs";
11
11
  export * from "./commands/mcp.mjs";
12
12
  export * from "./commands/posts.mjs";
13
13
  export * from "./commands/reviewers.mjs";
14
+ export * from "./commands/automations.mjs";
14
15
  export * from "./commands/collections.mjs";
15
16
  export * from "./commands/authors.mjs";
16
17
  export * from "./commands/flows.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.121.5",
3
+ "version": "0.121.6",
4
4
  "description": "Spin up and manage Letterstory phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",