@letterstory/cli 0.165.0 → 0.165.1

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
@@ -74,7 +74,7 @@ import {
74
74
  } from "./commands.mjs";
75
75
 
76
76
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
77
- export const VERSION = "0.165.0";
77
+ export const VERSION = "0.165.1";
78
78
 
79
79
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
80
80
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -1499,6 +1499,11 @@ Build (a change to your site, or launching what isn't code; the Build box's own
1499
1499
  build talk <words…> [--conversation <id>|--build <id>] [--site <host>] [--harness claude-code|letterpress-1]
1500
1500
  [--repo owner/name]
1501
1501
  One turn of a conversation with Build (questions, follow-ups on a build)
1502
+ build benchmark <words…> [--prompt <text>] [--site <host>] [--agent letterpress-1|claude-code|codex]...
1503
+ [--attach <path>]... [--attach-url <name>=<https url>]... [--attach-ref <path>]... [--attach-url-ref <name>=<https url>]...
1504
+ Staff only. The same prompt on Letterpress-1 (as Build runs it) and on
1505
+ stock Claude Code and stock Codex, each a preview to compare
1506
+ build benchmarks [--id <uuid>] [--limit <n>] Staff only. Benchmarks, each arm's state, preview, cost and agent time
1502
1507
 
1503
1508
  The Site (one model of your whole marketing site, keyed by host and path):
1504
1509
  site list Mapped hosts, and hosts you already have elsewhere
@@ -5048,7 +5048,7 @@ function recipeFromFlags(flags) {
5048
5048
  const ENGINE = "/api/superadmin/engine-settings";
5049
5049
  const LETTERPRESS = "/api/superadmin/letterpress";
5050
5050
  const ENGINE_USAGE =
5051
- "Usage: admin letterpress status | gaps | replay <run-id> | mark <run-id> <item-id> <right|weak|wrong|lead|clear> [--note …] | settings | flip <build|fix|plan> <off|shadow|live> | set <weights.<ask>.<reading>|lenses.<lens>.mode|lenses.<lens>.bar.<reading>|lenses.<lens>.bar|asks.<lens>.ask|asks.<lens>.guidance> <value>";
5051
+ "Usage: admin letterpress status | gaps | replay <run-id> | mark <run-id> <item-id> <right|weak|wrong|lead|clear> [--note …] | settings | flip <build|fix|plan> <off|shadow|live> | set <weights.<ask>.<reading>|lenses.<lens>.mode|lenses.<lens>.bar.<reading>|lenses.<lens>.bar|lenses.<lens>.research.turns|lenses.<lens>.research.ms|asks.<lens>.ask|asks.<lens>.guidance> <value>";
5052
5052
 
5053
5053
  /** One number of the settings from a dotted path and a value: the PUT body save_engine_settings reads. */
5054
5054
  function engineSettingsPatch(path, value) {
@@ -4,6 +4,9 @@
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 benchmark <words…> → start_build_benchmark (staff only: Letterpress-1, stock Claude Code
8
+ // and stock Codex on the same prompt, each a preview)
9
+ // build benchmarks → list_build_benchmarks (staff only; --id <uuid> for one)
7
10
 
8
11
  import { CliError } from "../client.mjs";
9
12
  import { argsFromFlags, flagList, flagStr, ok, printResult, refuseUnknownFlags } from "./shared.mjs";
@@ -37,6 +40,17 @@ const ARGS = {
37
40
  // --repo owner/name: the repo you're working in, where a Proofs install goes.
38
41
  repo: "repo",
39
42
  },
43
+ start_build_benchmark: {
44
+ prompt: { value: (flags, positionals) => flagStr(flags.prompt) ?? (positionals.join(" ").trim() || undefined) },
45
+ domain: "site",
46
+ files: { value: (_flags, _positionals, extra) => (extra.files?.length ? extra.files : undefined) },
47
+ // --agent (repeatable): fewer arms; all three when omitted.
48
+ agents: { flag: "agent", type: "list" },
49
+ },
50
+ list_build_benchmarks: {
51
+ id: "id",
52
+ limit: { flag: "limit", type: "num" },
53
+ },
40
54
  };
41
55
 
42
56
  const FILE_FLAGS = ["attach", "attach-url", "attach-ref", "attach-url-ref"];
@@ -55,9 +69,47 @@ async function attachedFiles(ctx) {
55
69
 
56
70
  export async function cmdBuild(ctx) {
57
71
  if (ctx.positionals[0] === "talk") return buildTalk({ ...ctx, positionals: ctx.positionals.slice(1) });
72
+ if (ctx.positionals[0] === "benchmark") return buildBenchmark({ ...ctx, positionals: ctx.positionals.slice(1) });
73
+ if (ctx.positionals[0] === "benchmarks") return buildBenchmarks({ ...ctx, positionals: ctx.positionals.slice(1) });
58
74
  return buildStart(ctx);
59
75
  }
60
76
 
77
+ /** A benchmark as lines: the prompt, then each arm's state, preview, cost and agent time. */
78
+ export function benchmarkLines(b) {
79
+ const lines = [`${b.id} ${b.status} ${b.prompt.split("\n")[0].slice(0, 100)}`];
80
+ for (const arm of b.arms ?? []) {
81
+ const time = arm.agent_ms === null ? "" : ` ${Math.round(arm.agent_ms / 1000)}s`;
82
+ lines.push(` ${arm.label}${arm.stock ? " (stock)" : ""}: ${arm.state} $${arm.cost_usd.toFixed(2)}${time}`);
83
+ if (arm.message) lines.push(` ${arm.message}`);
84
+ for (const run of arm.runs ?? []) {
85
+ lines.push(` ${run.id} ${run.preview_url ?? run.pr_url ?? run.lane ?? run.status}`);
86
+ }
87
+ }
88
+ return lines.join("\n");
89
+ }
90
+
91
+ async function buildBenchmark(ctx) {
92
+ const { client, flags, io } = ctx;
93
+ refuseUnknownFlags(ctx, {}, ["prompt", "site", "agent", ...FILE_FLAGS]);
94
+ const files = await attachedFiles(ctx);
95
+ const args = argsFromFlags(ARGS.start_build_benchmark, flags, ctx.positionals, { files });
96
+ if (!args.prompt) throw new CliError('Say what to build: letterstory build benchmark "add a pricing page"');
97
+ const result = await client.callTool("start_build_benchmark", args);
98
+ printResult(io, flags, result, (r) => benchmarkLines(r.benchmark));
99
+ return 0;
100
+ }
101
+
102
+ async function buildBenchmarks(ctx) {
103
+ const { client, flags, io } = ctx;
104
+ refuseUnknownFlags(ctx, {}, ["id", "limit"]);
105
+ const args = argsFromFlags(ARGS.list_build_benchmarks, flags, ctx.positionals);
106
+ const result = await client.callTool("list_build_benchmarks", args);
107
+ printResult(io, flags, result, (r) =>
108
+ r.benchmarks.length ? r.benchmarks.map(benchmarkLines).join("\n\n") : "No benchmarks yet."
109
+ );
110
+ return 0;
111
+ }
112
+
61
113
  async function buildStart(ctx) {
62
114
  const { client, flags, io } = ctx;
63
115
  refuseUnknownFlags(ctx, {}, [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.165.0",
3
+ "version": "0.165.1",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",