@letterstory/cli 0.175.3 → 0.175.5

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
@@ -73,10 +73,11 @@ import {
73
73
  cmdTargets,
74
74
  cmdVisits,
75
75
  cmdSim,
76
+ cmdVary,
76
77
  } from "./commands.mjs";
77
78
 
78
79
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
79
- export const VERSION = "0.175.3";
80
+ export const VERSION = "0.175.5";
80
81
 
81
82
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
82
83
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -553,22 +554,22 @@ Reviewers:
553
554
  automations set <automation-id> --collection <id> [--pace <n>] [--pause | --resume] [--goal <id>]
554
555
  [--brief <text>] [--remap]
555
556
  automations remove <automation-id> --collection <id>
556
- automate options What an automation can be made of here: triggers,
557
- actions and what each can be fixed to
558
- automate list Your automations: an event, what Letter reads it
559
- for, the action it becomes
557
+ automate options What an automation can be made of here: the triggers,
558
+ and whether each one's events can come yet
559
+ automate list Your automations: an event, which ones it acts on,
560
+ and what Letterpress then does
560
561
  automate show <automation-id>
561
- automate add --name <n> --trigger competitor_page|visitor_identified|custom
562
- --action write_post|enroll_in_sequence|build_page [--instruction <text>]
563
- [--collection <id>|--sequence <id>|--host <site>] [--event <name>] [--kind post|landing]
564
- [--competitor <host>] [--site <host>] [--hot-leads-only] [--review act|ask] [--off]
565
- Make one: it starts from now
566
- automate set <automation-id> [--name <n>] [--instruction <text>] [--review act|ask] [--on|--off] ...
567
- automate try [<automation-id>] [--trigger <t> --action <a> --instruction <text> ...] [--limit <n>]
562
+ automate add --name <n> --trigger competitor_page|visitor_identified|issue_found|custom
563
+ --prompt <what Letterpress does with each event> [--instruction <which events>]
564
+ [--event <name>] [--kind post|landing] [--competitor <host>] [--site <host>]
565
+ [--hot-leads-only] [--off]
566
+ Make one: it starts from now, and acts on its own
567
+ automate set <automation-id> [--name <n>] [--instruction <text>] [--prompt <text>] [--on|--off] ...
568
+ automate try [<automation-id>] [--trigger <t> --prompt <text> --instruction <text> ...] [--limit <n>]
568
569
  What it would do with the latest events (acts on none)
569
- automate runs [--automation <id>] [--status proposed|acted|skipped|failed|rejected] [--limit <n>]
570
+ automate runs [--automation <id>] [--status acting|acted|skipped|failed|proposed|rejected] [--limit <n>]
570
571
  Every event read, what came of it and why
571
- automate approve <run-id> Make the call a run that asked first proposes
572
+ automate approve <run-id> Make the call a run left from asking first proposes
572
573
  automate reject <run-id> --reason <why>
573
574
  automate send <event-name> --title <what happened> [--key <id>] [--url <u>] [--fact k=v ...]
574
575
  [--email <e>] [--person <name>] [--company <c>]
@@ -1565,8 +1566,10 @@ Build (a change to your site, or launching what isn't code; the Build box's own
1565
1566
  done by Build itself (a phantom site buys its own domain), and the
1566
1567
  build reads Done with no PR to merge. --again repeats an open build's ask
1567
1568
  build talk <words…> [--conversation <id>|--build <id>] [--site <host>] [--harness claude-code|letterpress-1]
1568
- [--repo owner/name]
1569
+ [--repo owner/name] [--action build|build_pr|build_merge]
1569
1570
  One turn of a conversation with Build (questions, follow-ups on a build)
1571
+ build cancel <build-id> Stop a build before it merges: what's being built stops, its
1572
+ preview goes, and its open pull request is closed unmerged
1570
1573
  build benchmark <words…> [--prompt <text>] [--site <host>] [--agent letterpress-1|claude-code|codex]...
1571
1574
  [--attach <path>]... [--attach-url <name>=<https url>]... [--attach-ref <path>]... [--attach-url-ref <name>=<https url>]...
1572
1575
  Staff only. The same prompt on Letterpress-1 (as Build runs it) and on
@@ -1609,13 +1612,14 @@ Repo changes (Claude Code edits your repo in a sandbox; the Letter GitHub App op
1609
1612
  repo suggestions Fixes found and not acted on yet, and how to start each
1610
1613
  repo settings [--action build|build_pr|build_merge|slack|linear] [--branch <name>|none] [--slack-agent <name|U…>|none]
1611
1614
  [--slack-channel <C…>|none] [--slack-reports off|as_found|daily] [--reports-channel <C…>|none] [--autopilot-channel <C…>|none] [--listen <C…,C…>|none] [--autopilot on|off] [--autopilot-weekly <1-20>]
1612
- [--autopilot-severity critical|warning] [--auto-merge 1h|12h|24h|3d|off]
1615
+ [--autopilot-severity critical|warning] [--auto-merge 1h|12h|24h|3d|off] [--editor-auto-merge on|off]
1613
1616
  [--reports-remedy report|fix_pr|fix_merge] [--recommendations on|off] [--recommendations-channel <C…>|none]
1614
1617
  [--competitor-pages on|off] [--competitor-pages-mode relevant|all] [--competitor-pages-channel <C…>|none]
1615
1618
  The org's defaults for every fix: build (preview first),
1616
1619
  build_pr, or slack (post it to --slack-channel for your
1617
1620
  own agent, tagging --slack-agent), and the branch changes go to;
1618
1621
  --auto-merge merges Letter's PRs once open that long;
1622
+ --editor-auto-merge merges Letter Edit's (⌘L) changes once ready;
1619
1623
  Slack's automations: new issues (--slack-reports, and
1620
1624
  --reports-remedy to fix them on their own), recommended
1621
1625
  actions, and competitors' new pages, each with a channel
@@ -1698,6 +1702,17 @@ Sim (Simulations: a free, simulated copy of your API for agents, and what they d
1698
1702
  sim session <session-id> One session, call by call
1699
1703
  sim report <id> [--since 30d] Funnel, missing operations, argument errors, loops, by agent
1700
1704
 
1705
+ Vary (Variationals: A/B tests of a page's words and images on your own site):
1706
+ vary [list] [--status running] [--site <id>] Your variationals and how many visitors each has seen
1707
+ vary create --page <url> [--name <n>] [--goals-file <path>]
1708
+ vary get <id> Variants, their changes, and the results against the original
1709
+ vary page <id> The page's copy as changes need it, and whether each variant still applies
1710
+ vary save-variant <id> --deltas-file <path> [--key b] [--name <n>]
1711
+ vary weights <id> a=50,b=50 How visitors are split (whole percent, adding to 100)
1712
+ vary goals <id> --goals-file <path> What counts as a conversion (the first is primary)
1713
+ vary start <id> | vary pause <id> | vary end <id> [--winner b]
1714
+ vary remove-variant <id> <key> | vary delete <id>
1715
+
1701
1716
  Evals (how the pipeline is doing on your posts, and the regression cases captured from them):
1702
1717
  evals scoreboard [--collection <id>] [--days N] Every measure by stage: posts, failing, rate
1703
1718
  evals cases [--status open|guarding|proposed|retired|rejected] [--stage research|brief|links|mentions|accuracy|pipeline|shred]
@@ -1800,6 +1815,7 @@ const CLIENT_COMMANDS = {
1800
1815
  evals: cmdEvals,
1801
1816
  visits: cmdVisits,
1802
1817
  sim: cmdSim,
1818
+ vary: cmdVary,
1803
1819
  // Platform-scoped (staff key) — the only commands that act BEFORE an org exists.
1804
1820
  admin: cmdAdmin,
1805
1821
  };
@@ -1,16 +1,14 @@
1
1
  // `automate` — Letterpress → Automations (docs/architecture/event-automations.md): an event, read
2
- // against your instruction, made into an action. options / list / show / add / set / try / runs /
3
- // approve / reject / send / remove, through the same tools the app uses. (A letterbase's writing
4
- // automations are `automations`.)
2
+ // against your filter (--instruction), then done by Letterpress as your prompt (--prompt) says.
3
+ // options / list / show / add / set / try / runs / approve / reject / send / remove, through the
4
+ // same tools the app uses. (A letterbase's writing automations are `automations`.)
5
5
  // Same flag/positional/io conventions as posts.mjs — no commander, no color.
6
6
 
7
7
  import { CliError } from "../client.mjs";
8
8
  import { printResult, ok, argsFromFlags, flagList, refuseUnknownFlags } from "./shared.mjs";
9
9
 
10
- const TRIGGERS = ["competitor_page", "visitor_identified", "custom"];
11
- const ACTIONS = ["write_post", "enroll_in_sequence", "build_page"];
12
- const REVIEW = ["act", "ask"];
13
- const STATUSES = ["pending", "proposed", "acted", "skipped", "failed", "rejected"];
10
+ const TRIGGERS = ["competitor_page", "visitor_identified", "issue_found", "custom"];
11
+ const STATUSES = ["pending", "proposed", "acting", "acted", "skipped", "failed", "rejected"];
14
12
 
15
13
  const triggerParams = {
16
14
  object: {
@@ -21,13 +19,6 @@ const triggerParams = {
21
19
  event: { flag: "event" },
22
20
  },
23
21
  };
24
- const actionParams = {
25
- object: {
26
- collection_id: { flag: "collection" },
27
- sequence_id: { flag: "sequence" },
28
- host: { flag: "host" },
29
- },
30
- };
31
22
  const enabled = { value: (flags) => (flags.off === true ? false : flags.on === true ? true : undefined) };
32
23
 
33
24
  /** --fact plan=team --fact seats=40 → { plan: "team", seats: 40 } (numbers and true/false read as such). */
@@ -63,9 +54,7 @@ export const ARGS = {
63
54
  trigger: { flag: "trigger", required: true, enum: TRIGGERS },
64
55
  trigger_params: triggerParams,
65
56
  instruction: { flag: "instruction" },
66
- action: { flag: "action", required: true, enum: ACTIONS },
67
- action_params: actionParams,
68
- review: { flag: "review", enum: REVIEW },
57
+ prompt: { flag: "prompt", required: true },
69
58
  enabled,
70
59
  },
71
60
  update_event_automation: {
@@ -73,8 +62,7 @@ export const ARGS = {
73
62
  name: { flag: "name" },
74
63
  trigger_params: triggerParams,
75
64
  instruction: { flag: "instruction" },
76
- action_params: actionParams,
77
- review: { flag: "review", enum: REVIEW },
65
+ prompt: { flag: "prompt" },
78
66
  enabled,
79
67
  },
80
68
  delete_event_automation: {
@@ -85,8 +73,7 @@ export const ARGS = {
85
73
  trigger: { flag: "trigger", enum: TRIGGERS },
86
74
  trigger_params: triggerParams,
87
75
  instruction: { flag: "instruction" },
88
- action: { flag: "action", enum: ACTIONS },
89
- action_params: actionParams,
76
+ prompt: { flag: "prompt" },
90
77
  limit: { flag: "limit", type: "num" },
91
78
  },
92
79
  list_automation_runs: {
@@ -4,6 +4,7 @@
4
4
  // main blog, is carried out by Build itself with nothing to merge.
5
5
  // build <words…> → start_build (--prompt for a long ask; --again to repeat one)
6
6
  // build talk <words…> → send_build_message (--conversation <id> | --build <id> to continue)
7
+ // build cancel <id> → cancel_growth_build (stop it before it merges: its PR is closed)
7
8
  // build benchmark <words…> → start_build_benchmark (staff only: Letterpress-1, stock Claude Code
8
9
  // and stock Codex on the same prompt, each a preview)
9
10
  // build benchmarks → list_build_benchmarks (staff only; --id <uuid> for one)
@@ -43,7 +44,10 @@ const ARGS = {
43
44
  harness: { flag: "harness", enum: ["claude-code", "letterpress-1"] },
44
45
  // --repo owner/name: the repo you're working in, where a Proofs install goes.
45
46
  repo: "repo",
47
+ // --action build|build_pr|build_merge: how a build this message starts is delivered (Letter Edit's auto-merge sends build_merge).
48
+ delivery: { flag: "action", enum: ["build", "build_pr", "build_merge"] },
46
49
  },
50
+ cancel_growth_build: { id: { positional: 0, required: true, label: "build-id" } },
47
51
  start_build_benchmark: {
48
52
  prompt: { value: (flags, positionals) => flagStr(flags.prompt) ?? (positionals.join(" ").trim() || undefined) },
49
53
  domain: "site",
@@ -73,6 +77,7 @@ async function attachedFiles(ctx) {
73
77
 
74
78
  export async function cmdBuild(ctx) {
75
79
  if (ctx.positionals[0] === "talk") return buildTalk({ ...ctx, positionals: ctx.positionals.slice(1) });
80
+ if (ctx.positionals[0] === "cancel") return buildCancel({ ...ctx, positionals: ctx.positionals.slice(1) });
76
81
  if (ctx.positionals[0] === "benchmark") return buildBenchmark({ ...ctx, positionals: ctx.positionals.slice(1) });
77
82
  if (ctx.positionals[0] === "benchmarks") return buildBenchmarks({ ...ctx, positionals: ctx.positionals.slice(1) });
78
83
  return buildStart(ctx);
@@ -92,6 +97,21 @@ export function benchmarkLines(b) {
92
97
  return lines.join("\n");
93
98
  }
94
99
 
100
+ /** `build cancel <id>`: stop a build before anything of it merges (cancel_growth_build). */
101
+ async function buildCancel(ctx) {
102
+ const { client, flags, io } = ctx;
103
+ refuseUnknownFlags(ctx, {}, []);
104
+ const args = argsFromFlags(ARGS.cancel_growth_build, flags, ctx.positionals);
105
+ const result = await client.callTool("cancel_growth_build", args);
106
+ printResult(io, flags, result, (r) =>
107
+ [
108
+ r.message,
109
+ ...(r.changes ?? []).map((c) => ` ${c.outcome} ${c.title}${c.message ? `: ${c.message}` : ""}`),
110
+ ].join("\n")
111
+ );
112
+ return 0;
113
+ }
114
+
95
115
  async function buildBenchmark(ctx) {
96
116
  const { client, flags, io } = ctx;
97
117
  refuseUnknownFlags(ctx, {}, ["prompt", "site", "agent", ...FILE_FLAGS]);
@@ -149,6 +169,7 @@ async function buildTalk(ctx) {
149
169
  "subject",
150
170
  "harness",
151
171
  "repo",
172
+ "action",
152
173
  ...FILE_FLAGS,
153
174
  ]);
154
175
  const files = await attachedFiles(ctx);
@@ -234,6 +234,13 @@ const ARGS = {
234
234
  autopilot_min_severity: { flag: "autopilot-severity", enum: ["critical", "warning"] },
235
235
  // --auto-merge 1h|12h|24h|3d (or the hours: 1, 12, 24, 72), or --auto-merge off
236
236
  auto_merge_after_hours: { value: (flags) => autoMergeHours(flags["auto-merge"]) },
237
+ // --editor-auto-merge on|off: Letter Edit's (⌘L) changes merge once they're ready
238
+ editor_auto_merge: {
239
+ value: (flags) =>
240
+ flags["editor-auto-merge"] === undefined
241
+ ? undefined
242
+ : ["on", "true", "1"].includes(String(flags["editor-auto-merge"])),
243
+ },
237
244
  },
238
245
  get_repo_change: { run_id: { positional: 0, required: true, label: "run-id" } },
239
246
  get_repo_change_activity: {
@@ -853,6 +860,7 @@ async function repoSettings(ctx) {
853
860
  "autopilot-weekly",
854
861
  "autopilot-severity",
855
862
  "auto-merge",
863
+ "editor-auto-merge",
856
864
  ];
857
865
  refuseUnknownFlags(ctx, {}, settingFlags);
858
866
  const setting = settingFlags.some((f) => flags[f] !== undefined);
@@ -0,0 +1,211 @@
1
+ // `vary` — Variationals from a terminal: A/B tests of a page's words and images on your own site
2
+ // (docs/architecture/variationals.md). Thin wrappers over the variationals tools (list_variationals,
3
+ // get_variational, create_variational, update_variational, save_variational_variant,
4
+ // remove_variational_variant, delete_variational), the same lib functions the app calls.
5
+ //
6
+ // letterstory vary list [--status running]
7
+ // letterstory vary create --page https://acme.com/pricing [--name "Pricing headline"] [--goals-file goals.json]
8
+ // letterstory vary get <id>
9
+ // letterstory vary page <id> the page's blocks, as a change's tag/before/occurrence
10
+ // letterstory vary save-variant <id> --deltas-file b.json [--key b] [--name "Shorter headline"]
11
+ // b.json: [{ "kind": "text", "tag": "h1", "before": "Ship faster", "after": "Ship today" },
12
+ // { "kind": "image", "before": "https://acme.com/hero.png", "after": "/hero-team.png" }]
13
+ // letterstory vary weights <id> a=50,b=50
14
+ // letterstory vary goals <id> --goals-file goals.json
15
+ // letterstory vary start <id> | pause <id> | end <id> [--winner b]
16
+ // letterstory vary remove-variant <id> <key>
17
+ // letterstory vary delete <id>
18
+
19
+ import { readFileSync } from "node:fs";
20
+ import { CliError } from "../client.mjs";
21
+ import { flagStr, printResult, argsFromFlags, refuseUnknownFlags } from "./shared.mjs";
22
+
23
+ const variationalId = { positional: 0, label: "variational-id", required: true };
24
+
25
+ function jsonFile(flag, what) {
26
+ return {
27
+ value: (flags) => {
28
+ const path = flagStr(flags[flag]);
29
+ if (!path) return undefined;
30
+ try {
31
+ return JSON.parse(readFileSync(path, "utf8"));
32
+ } catch {
33
+ throw new CliError(`--${flag} must be a JSON file of ${what} (could not parse ${path})`);
34
+ }
35
+ },
36
+ };
37
+ }
38
+
39
+ /** a=50,b=50 → { a: 50, b: 50 } */
40
+ function weightsArg() {
41
+ return {
42
+ value: (_flags, positionals) => {
43
+ const raw = positionals[1];
44
+ if (raw === undefined) return undefined;
45
+ const out = {};
46
+ for (const part of String(raw).split(",")) {
47
+ const [key, value] = part.split("=").map((s) => s.trim());
48
+ const n = Number(value);
49
+ if (!/^[a-f]$/.test(key ?? "") || !Number.isInteger(n)) {
50
+ throw new CliError(`Weights are key=percent pairs, e.g. a=50,b=50 (got "${part}")`);
51
+ }
52
+ out[key] = n;
53
+ }
54
+ return out;
55
+ },
56
+ };
57
+ }
58
+
59
+ export const ARGS = {
60
+ list_variationals: {
61
+ with_results: { internal: "the list shows each test's visitors, so it always reads results" },
62
+ site_id: "site",
63
+ status: { flag: "status", enum: ["draft", "running", "paused", "ended"] },
64
+ },
65
+ get_variational: { variational_id: variationalId },
66
+ read_variational_page: { variational_id: variationalId },
67
+ create_variational: {
68
+ page_url: { flag: "page", required: true },
69
+ site_id: "site",
70
+ name: "name",
71
+ goals: jsonFile("goals-file", "goals"),
72
+ },
73
+ update_variational: {
74
+ variational_id: variationalId,
75
+ name: "name",
76
+ goals: jsonFile("goals-file", "goals"),
77
+ weights: weightsArg(),
78
+ status: { flag: "status", enum: ["running", "paused", "ended"] },
79
+ winner: "winner",
80
+ },
81
+ save_variational_variant: {
82
+ variational_id: variationalId,
83
+ key: "key",
84
+ name: "name",
85
+ deltas: { ...jsonFile("deltas-file", "text and image changes"), required: true },
86
+ },
87
+ remove_variational_variant: {
88
+ variational_id: variationalId,
89
+ key: { positional: 1, label: "key", required: true },
90
+ },
91
+ delete_variational: { variational_id: variationalId },
92
+ };
93
+
94
+ function call(ctx, tool) {
95
+ return ctx.client.callTool(tool, argsFromFlags(ARGS[tool], ctx.flags, ctx.positionals));
96
+ }
97
+
98
+ export async function cmdVary(ctx) {
99
+ const sub = ctx.positionals[0];
100
+ const rest = { ...ctx, positionals: ctx.positionals.slice(1) };
101
+ switch (sub) {
102
+ case undefined:
103
+ case "list":
104
+ case "ls":
105
+ refuseUnknownFlags(rest, ARGS.list_variationals);
106
+ return varyList(rest);
107
+ case "get":
108
+ case "show":
109
+ return varyShow(rest, await call(rest, "get_variational"));
110
+ case "page": {
111
+ const result = await call(rest, "read_variational_page");
112
+ printResult(rest.io, rest.flags, result, (r) =>
113
+ [
114
+ ...r.blocks.map(
115
+ (b) =>
116
+ `${b.tag.padEnd(8)} ${b.occurrence ? `#${b.occurrence} ` : ""}${b.before.replace(/\n/g, " / ")}`
117
+ ),
118
+ ...r.images.map((i) => `img ${i.before}${i.alt ? ` (${i.alt})` : ""}`),
119
+ ...r.variants.map(
120
+ (v) => `variant ${v.key.toUpperCase()}: ${v.found} of ${v.changes} changes find their block`
121
+ ),
122
+ ].join("\n")
123
+ );
124
+ return 0;
125
+ }
126
+ case "create":
127
+ refuseUnknownFlags(rest, ARGS.create_variational, ["goals-file"]);
128
+ return varyShow(rest, await call(rest, "create_variational"));
129
+ case "update":
130
+ case "weights":
131
+ case "goals":
132
+ refuseUnknownFlags(rest, ARGS.update_variational, ["goals-file"]);
133
+ return varyShow(rest, await call(rest, "update_variational"));
134
+ case "start":
135
+ case "pause":
136
+ case "end": {
137
+ refuseUnknownFlags(rest, ARGS.update_variational, []);
138
+ const status = sub === "start" ? "running" : sub === "pause" ? "paused" : "ended";
139
+ rest.flags = { ...rest.flags, status };
140
+ return varyShow(rest, await call(rest, "update_variational"));
141
+ }
142
+ case "save-variant": {
143
+ refuseUnknownFlags(rest, ARGS.save_variational_variant, ["deltas-file"]);
144
+ if (!flagStr(rest.flags["deltas-file"]))
145
+ throw new CliError("Usage: vary save-variant <id> --deltas-file <path>");
146
+ const result = await call(rest, "save_variational_variant");
147
+ return varyShow(rest, result);
148
+ }
149
+ case "remove-variant":
150
+ return varyShow(rest, await call(rest, "remove_variational_variant"));
151
+ case "delete": {
152
+ const result = await call(rest, "delete_variational");
153
+ printResult(rest.io, rest.flags, result, (r) => `Deleted ${r.deleted}.`);
154
+ return 0;
155
+ }
156
+ default:
157
+ throw new CliError(
158
+ "Usage: vary [list|get|page|create|update|weights|goals|start|pause|end|save-variant|remove-variant|delete]"
159
+ );
160
+ }
161
+ }
162
+
163
+ const pct = (r) => (r === null || r === undefined ? "—" : `${(r * 100).toFixed(1)}%`);
164
+
165
+ async function varyList(ctx) {
166
+ const result = await call(ctx, "list_variationals");
167
+ printResult(ctx.io, ctx.flags, result, (r) => {
168
+ if (!r.variationals?.length) {
169
+ return "No variationals yet. Make one: vary create --page https://<your site>/<page>";
170
+ }
171
+ return r.variationals
172
+ .map((v) => {
173
+ const visitors = (v.results?.variants ?? []).reduce((n, x) => n + x.visitors, 0);
174
+ return `${v.id} ${v.status.padEnd(7)} ${v.page_path.padEnd(28)} ${String(v.variants.length).padStart(2)} variants ${String(visitors).padStart(6)} visitors ${v.name}`;
175
+ })
176
+ .join("\n");
177
+ });
178
+ return 0;
179
+ }
180
+
181
+ function varyShow(ctx, result) {
182
+ printResult(ctx.io, ctx.flags, result, (r) => {
183
+ const v = r.variational;
184
+ const lines = [
185
+ `${v.name} — ${v.status}${v.winner ? `, winner ${v.winner.toUpperCase()}` : ""}`,
186
+ ` Page ${v.page_url}`,
187
+ ` Edit ${v.edit_url}`,
188
+ ` Goals ${v.goals.length ? v.goals.map((g) => `${g.label} (${g.kind})`).join("; ") : "none: time on page decides"}`,
189
+ "",
190
+ "Variants (weight · changes):",
191
+ ];
192
+ for (const x of v.variants) {
193
+ lines.push(
194
+ ` ${x.key.toUpperCase()} ${String(x.weight).padStart(3)}% ${x.deltas.length} changes ${x.name}`
195
+ );
196
+ }
197
+ if (v.results) {
198
+ lines.push("", v.results.summary, "", "Results (people · seconds · scroll · conversion):");
199
+ for (const x of v.results.variants) {
200
+ const call = x.versus_default ? ` ${x.versus_default.call}` : "";
201
+ lines.push(
202
+ ` ${x.key.toUpperCase()} ${String(x.visitors).padStart(6)} visitors ${x.seconds.mean === null ? "—" : `${Math.round(x.seconds.mean)}s`} ${x.scroll.mean === null ? "—" : `${Math.round(x.scroll.mean)}%`} ${pct(x.goals[0]?.rate)}${call}`
203
+ );
204
+ }
205
+ }
206
+ if (r.revised)
207
+ lines.push("", `Saved ${String(r.variant).toUpperCase()}: its results start again from this revision.`);
208
+ return lines.join("\n");
209
+ });
210
+ return 0;
211
+ }
package/lib/commands.mjs CHANGED
@@ -51,3 +51,4 @@ export * from "./commands/site.mjs";
51
51
  export * from "./commands/evals.mjs";
52
52
  export * from "./commands/visits.mjs";
53
53
  export * from "./commands/sim.mjs";
54
+ export * from "./commands/vary.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.175.3",
3
+ "version": "0.175.5",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",