@letterstory/cli 0.176.11 → 0.176.13
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 +11 -4
- package/lib/commands/automations.mjs +21 -1
- package/lib/commands/seers.mjs +31 -4
- package/lib/commands/vary.mjs +1 -0
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
import { fetchParkedSections, withoutParked } from "./parked.mjs";
|
|
81
81
|
|
|
82
82
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
83
|
-
export const VERSION = "0.176.
|
|
83
|
+
export const VERSION = "0.176.13";
|
|
84
84
|
|
|
85
85
|
/** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
|
|
86
86
|
export const EXIT_PAYMENT_REQUIRED = 3;
|
|
@@ -89,6 +89,10 @@ export const EXIT_PAYMENT_REQUIRED = 3;
|
|
|
89
89
|
// can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
|
|
90
90
|
// `negate` spelling) in a command's ARGS map must be listed; boolean-flags.test.ts enforces it.
|
|
91
91
|
export const BOOLEAN_FLAGS = new Set([
|
|
92
|
+
// automations set: stop reading a data feed.
|
|
93
|
+
"no-reads",
|
|
94
|
+
// vary start: pause the test running on the page first.
|
|
95
|
+
"pause-running",
|
|
92
96
|
// bench run: the spec was just changed.
|
|
93
97
|
"spec-changed",
|
|
94
98
|
// bench update: remove the README's disclosure.
|
|
@@ -575,10 +579,13 @@ Reviewers:
|
|
|
575
579
|
automations dismiss <topic-id> --collection <id> Set one subject aside
|
|
576
580
|
automations add topic|series|signal|best --collection <id> [--topic <id>] [--goal <target-id>]
|
|
577
581
|
[--seer <id>] [--pace <n> | --on "fri 09:00 America/New_York"] [--brief <text>]
|
|
578
|
-
[--new-topic <name>] [--new-series <name>]
|
|
582
|
+
[--reads <seer-id> [--window <days>]] [--new-topic <name>] [--new-series <name>]
|
|
579
583
|
Add one (refused if it says the same as another).
|
|
580
584
|
--on pins it: one post a week, on that day and time
|
|
585
|
+
--reads: a data feed (a data_feed seer) whose records in
|
|
586
|
+
the window before each post are the post's own data
|
|
581
587
|
automations set <automation-id> --collection <id> [--pace <n> | --on "<day> <HH:MM> <tz>" | --unpin]
|
|
588
|
+
[--reads <seer-id> [--window <days>] | --no-reads]
|
|
582
589
|
[--pause | --resume] [--goal <id>] [--brief <text>] [--remap]
|
|
583
590
|
automations remove <automation-id> --collection <id>
|
|
584
591
|
automate options What an automation can be made of here: the triggers,
|
|
@@ -1785,7 +1792,7 @@ Sim (Simulations: a free, simulated copy of your API for agents, and what they d
|
|
|
1785
1792
|
sim session <session-id> One session, call by call
|
|
1786
1793
|
sim report <id> [--since 30d] Funnel, missing operations, argument errors, loops, by agent
|
|
1787
1794
|
|
|
1788
|
-
Vary (
|
|
1795
|
+
Vary (A/B tests of a page's words and images on your own site):
|
|
1789
1796
|
vary [list] [--status running] [--site <id>] Your variationals and how many visitors each has seen
|
|
1790
1797
|
vary create --page <url> [--name <n>] [--goals-file <path>]
|
|
1791
1798
|
vary get <id> Variants, their changes, and the results against the original
|
|
@@ -1793,7 +1800,7 @@ Vary (Variationals: A/B tests of a page's words and images on your own site):
|
|
|
1793
1800
|
vary save-variant <id> --deltas-file <path> [--key b] [--name <n>]
|
|
1794
1801
|
vary weights <id> a=50,b=50 How visitors are split (whole percent, adding to 100)
|
|
1795
1802
|
vary goals <id> --goals-file <path> What counts as a conversion (the first is primary)
|
|
1796
|
-
vary start <id> | vary pause <id> | vary end <id> [--winner b]
|
|
1803
|
+
vary start <id> [--pause-running] | vary pause <id> | vary end <id> [--winner b]
|
|
1797
1804
|
vary remove-variant <id> <key> | vary delete <id>
|
|
1798
1805
|
|
|
1799
1806
|
Bench (Benches: open-source benchmarks on their own domains, kept running; @letterstory.com only):
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Same flag/positional/io conventions as posts.mjs — no commander, no color.
|
|
4
4
|
|
|
5
5
|
import { CliError } from "../client.mjs";
|
|
6
|
-
import { printResult, ok, argsFromFlags, refuseUnknownFlags } from "./shared.mjs";
|
|
6
|
+
import { flagStr, printResult, ok, argsFromFlags, refuseUnknownFlags } from "./shared.mjs";
|
|
7
7
|
|
|
8
8
|
const WEEKDAYS = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
|
|
9
9
|
|
|
@@ -23,6 +23,24 @@ export function parsePublishAt(text) {
|
|
|
23
23
|
return { weekday, time, timezone };
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* `--reads <seer-id> [--window <days>]` → { seer_id, window_days } (the tool's `reads`): a data
|
|
28
|
+
* feed the automation reads, the window ending at each post's publish instant (7 days unless set).
|
|
29
|
+
* `--no-reads` sends null (stop reading one).
|
|
30
|
+
*/
|
|
31
|
+
export function parseReads(flags) {
|
|
32
|
+
if (flags["no-reads"] === true) return null;
|
|
33
|
+
const seer = flagStr(flags.reads);
|
|
34
|
+
if (seer === undefined) {
|
|
35
|
+
if (flags.window !== undefined) throw new CliError("--window goes with --reads <seer-id>");
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const days = flags.window === undefined ? 7 : Number(flags.window);
|
|
39
|
+
if (!Number.isInteger(days) || days < 1)
|
|
40
|
+
throw new CliError("--window takes a whole number of days, e.g. --window 7");
|
|
41
|
+
return { seer_id: seer, window_days: days };
|
|
42
|
+
}
|
|
43
|
+
|
|
26
44
|
/** See `argsFromFlags` in shared.mjs; `scripts/parity-check.ts` diffs these keys against the tool. */
|
|
27
45
|
export const ARGS = {
|
|
28
46
|
list_automations: {
|
|
@@ -56,6 +74,7 @@ export const ARGS = {
|
|
|
56
74
|
seer_id: { flag: "seer" },
|
|
57
75
|
pace_per_week: { flag: "pace", type: "num" },
|
|
58
76
|
publish_at: { value: (flags) => parsePublishAt(flags.on) },
|
|
77
|
+
reads: { value: (flags) => parseReads(flags) ?? undefined },
|
|
59
78
|
brief: { flag: "brief" },
|
|
60
79
|
new_topic: {
|
|
61
80
|
value: (flags) => (typeof flags["new-topic"] === "string" ? { name: flags["new-topic"] } : undefined),
|
|
@@ -69,6 +88,7 @@ export const ARGS = {
|
|
|
69
88
|
automation_id: { positional: 0, label: "automation-id", required: true },
|
|
70
89
|
pace_per_week: { flag: "pace", type: "num" },
|
|
71
90
|
publish_at: { value: (flags) => (flags.unpin === true ? null : parsePublishAt(flags.on)) },
|
|
91
|
+
reads: { value: (flags) => parseReads(flags) },
|
|
72
92
|
paused: {
|
|
73
93
|
value: (flags) => (flags.pause === true ? true : flags.resume === true ? false : undefined),
|
|
74
94
|
},
|
package/lib/commands/seers.mjs
CHANGED
|
@@ -60,7 +60,7 @@ export const ARGS = {
|
|
|
60
60
|
// forever but never produce (auto mode is rejected without one).
|
|
61
61
|
collection_id: { flag: "collection" },
|
|
62
62
|
provider: { flag: "provider", required: true },
|
|
63
|
-
mode: { flag: "mode", enum: ["suggest", "auto"] },
|
|
63
|
+
mode: { flag: "mode", enum: ["suggest", "auto", "record"] },
|
|
64
64
|
poll_interval_minutes: { flag: "interval", type: "num" },
|
|
65
65
|
// The whole config document — provider source params plus the behavior keys
|
|
66
66
|
// (auto_draft_scope, template_key, mention_degree, kernel_family, relevance{…}).
|
|
@@ -72,7 +72,7 @@ export const ARGS = {
|
|
|
72
72
|
// --collection <uuid> sets it, --clear-collection sends null (the seer becomes
|
|
73
73
|
// detect-only — rejected if it's mode "auto"), neither leaves it unchanged.
|
|
74
74
|
collection_id: clearableValue("collection", "clear-collection"),
|
|
75
|
-
mode: { flag: "mode", enum: ["suggest", "auto"] },
|
|
75
|
+
mode: { flag: "mode", enum: ["suggest", "auto", "record"] },
|
|
76
76
|
enabled: { value: (flags) => readEnabledFlag(flags) },
|
|
77
77
|
poll_interval_minutes: { flag: "interval", type: "num" },
|
|
78
78
|
config: { value: (flags) => readJsonObjectFlag(flags, "config") },
|
|
@@ -84,6 +84,14 @@ export const ARGS = {
|
|
|
84
84
|
seer_id: { positional: 0, label: "seer-id", required: true },
|
|
85
85
|
limit: { flag: "limit", type: "num" },
|
|
86
86
|
offset: { flag: "offset", type: "num" },
|
|
87
|
+
// A window by each event's own date: `seers events <id> --since 2026-10-30T13:00:00Z`.
|
|
88
|
+
since: { flag: "since" },
|
|
89
|
+
until: { flag: "until" },
|
|
90
|
+
},
|
|
91
|
+
// `seers credential <id> --token "Bearer …"` (a private data feed's header value; --clear removes it).
|
|
92
|
+
set_seer_credential: {
|
|
93
|
+
seer_id: { positional: 0, label: "seer-id", required: true },
|
|
94
|
+
token: { value: (flags) => (flags.clear ? null : flagStr(flags.token)) },
|
|
87
95
|
},
|
|
88
96
|
dismiss_seer_event: {
|
|
89
97
|
seer_id: { positional: 0, label: "seer-id", required: true },
|
|
@@ -146,6 +154,8 @@ export async function cmdSeers(ctx) {
|
|
|
146
154
|
return seersRuns(rest);
|
|
147
155
|
case "balance":
|
|
148
156
|
return seersBalance(rest);
|
|
157
|
+
case "credential":
|
|
158
|
+
return seersCredential(rest);
|
|
149
159
|
case "events":
|
|
150
160
|
return seersEvents(rest);
|
|
151
161
|
case "dismiss":
|
|
@@ -170,7 +180,7 @@ export async function cmdSeers(ctx) {
|
|
|
170
180
|
return seersApply(rest);
|
|
171
181
|
default:
|
|
172
182
|
throw new CliError(
|
|
173
|
-
`Unknown seers subcommand: ${sub ?? "(none)"}. Try: list, get, create, update, delete, run, run-status, runs, balance, events, dismiss, headlines, held, release, discard, providers, connections, connect, export, apply`
|
|
183
|
+
`Unknown seers subcommand: ${sub ?? "(none)"}. Try: list, get, create, update, delete, run, run-status, runs, balance, events, credential, dismiss, headlines, held, release, discard, providers, connections, connect, export, apply`
|
|
174
184
|
);
|
|
175
185
|
}
|
|
176
186
|
}
|
|
@@ -340,6 +350,16 @@ async function seersBalance(ctx) {
|
|
|
340
350
|
|
|
341
351
|
// --- Events / headlines / holding pen ----------------------------------------------
|
|
342
352
|
|
|
353
|
+
async function seersCredential(ctx) {
|
|
354
|
+
const { client, positionals, flags, io } = ctx;
|
|
355
|
+
const args = argsFromFlags(ARGS.set_seer_credential, flags, positionals);
|
|
356
|
+
if (args.token === undefined) throw new CliError("Pass --token <header value> or --clear");
|
|
357
|
+
const result = await client.callTool("set_seer_credential", args);
|
|
358
|
+
ok(ctx, args.token === null ? "Credential removed." : "Credential stored.");
|
|
359
|
+
printResult(io, flags, result);
|
|
360
|
+
return 0;
|
|
361
|
+
}
|
|
362
|
+
|
|
343
363
|
async function seersEvents(ctx) {
|
|
344
364
|
const { client, positionals, flags, io } = ctx;
|
|
345
365
|
const args = argsFromFlags(ARGS.list_seer_events, flags, positionals);
|
|
@@ -348,7 +368,14 @@ async function seersEvents(ctx) {
|
|
|
348
368
|
const lines = (r.events ?? []).map((e) => {
|
|
349
369
|
const blocked = e.auto_production_blocked_reason ? ` [blocked: ${e.auto_production_blocked_reason}]` : "";
|
|
350
370
|
const aliases = e.aliases?.length ? ` (+${e.aliases.length} aliases)` : "";
|
|
351
|
-
|
|
371
|
+
const fields =
|
|
372
|
+
e.payload?.fields && typeof e.payload.fields === "object"
|
|
373
|
+
? " " +
|
|
374
|
+
Object.entries(e.payload.fields)
|
|
375
|
+
.map(([k, v]) => `${k}=${v}`)
|
|
376
|
+
.join(" ")
|
|
377
|
+
: "";
|
|
378
|
+
return `${e.id} [${e.status}] ${e.payload?.occurred_at ?? e.detected_at} ${e.title}${aliases}${blocked}${fields}`;
|
|
352
379
|
});
|
|
353
380
|
if (!lines.length) lines.push("No events detected yet.");
|
|
354
381
|
if (r.has_more) lines.push(`… more available (--offset ${r.next_offset})`);
|
package/lib/commands/vary.mjs
CHANGED
|
@@ -85,6 +85,7 @@ export const ARGS = {
|
|
|
85
85
|
weights: weightsArg(),
|
|
86
86
|
status: { flag: "status", enum: ["running", "paused", "ended"] },
|
|
87
87
|
winner: "winner",
|
|
88
|
+
pause_running: { flag: "pause-running", type: "bool" },
|
|
88
89
|
},
|
|
89
90
|
save_variational_variant: {
|
|
90
91
|
variational_id: variationalId,
|