@letterstory/cli 0.121.5 → 0.121.7
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 +12 -1
- package/lib/commands/admin.mjs +2 -2
- package/lib/commands/automations.mjs +68 -0
- package/lib/commands.mjs +1 -0
- package/package.json +1 -1
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.
|
|
64
|
+
export const VERSION = "0.121.7";
|
|
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,
|
package/lib/commands/admin.mjs
CHANGED
|
@@ -3543,7 +3543,7 @@ async function cmdAdminCrm(ctx) {
|
|
|
3543
3543
|
c
|
|
3544
3544
|
? `\n like ${c.name} (${c.kind} ${c.on}${c.primaryReason ? `, ${c.primaryReason}` : ""}): ${c.matched}/5 matched — ${c.features
|
|
3545
3545
|
.filter((f) => f.matched)
|
|
3546
|
-
.map((f) => `${f.feature} ${f.now}`)
|
|
3546
|
+
.map((f) => `${f.label ?? f.feature}: ${f.nowLabel ?? f.now}`)
|
|
3547
3547
|
.join(", ")}`
|
|
3548
3548
|
: "\n no past case matches 3 of 5";
|
|
3549
3549
|
return out(await staffRequest(ctx, "GET", `${CRM}/at-risk`), (r) =>
|
|
@@ -3564,7 +3564,7 @@ async function cmdAdminCrm(ctx) {
|
|
|
3564
3564
|
? r.signals
|
|
3565
3565
|
.map(
|
|
3566
3566
|
(x) =>
|
|
3567
|
-
`${x.score.toFixed(2)} ${x.name} → ${x.product} (${x.rule}) ${x.reasons.join("; ")} ${x.accountId}${x.beforePastExpansions.length ? `\n before past expansions: ${x.beforePastExpansions.map((p) => `${p.name} ${p.on}`).join(", ")}` : ""}`
|
|
3567
|
+
`${x.score.toFixed(2)} ${x.name} → ${x.product} (${x.ruleLabel ?? x.rule}) ${x.reasons.join("; ")} ${x.accountId}${x.beforePastExpansions.length ? `\n before past expansions: ${x.beforePastExpansions.map((p) => `${p.name} ${p.on}`).join(", ")}` : ""}`
|
|
3568
3568
|
)
|
|
3569
3569
|
.join("\n")
|
|
3570
3570
|
: "(no next-product verdicts)"
|
|
@@ -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";
|