@letterstory/cli 0.177.73 → 0.177.75
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 +7 -1
- package/lib/client.mjs +1 -0
- package/lib/commands/build.mjs +19 -0
- package/lib/commands/usage.mjs +35 -0
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -90,7 +90,7 @@ import {
|
|
|
90
90
|
import { fetchParkedSections, withoutParked } from "./parked.mjs";
|
|
91
91
|
|
|
92
92
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
93
|
-
export const VERSION = "0.177.
|
|
93
|
+
export const VERSION = "0.177.75";
|
|
94
94
|
|
|
95
95
|
/** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
|
|
96
96
|
export const EXIT_PAYMENT_REQUIRED = 3;
|
|
@@ -1913,6 +1913,7 @@ Build (a change to your site, or launching what isn't code; the Build box's own
|
|
|
1913
1913
|
Staff only. The same prompt on Letterpress-1 (as Build runs it) and on
|
|
1914
1914
|
stock Claude Code and stock Codex, each a preview to compare
|
|
1915
1915
|
build benchmarks [--id <uuid>] [--limit <n>] Staff only. Benchmarks, each arm's state, preview, cost and agent time
|
|
1916
|
+
build capacity [--root <ref>] [--hours n] [--json] Resource limits, active work and queue waits
|
|
1916
1917
|
build list [--limit <n>] [--site <host>] [--kind build|fix] [--open|--archived] [--from-plan]
|
|
1917
1918
|
Your builds, newest first, with where each stands
|
|
1918
1919
|
build status <build-id> One build: each change's state, its preview and pull request
|
|
@@ -2124,6 +2125,11 @@ Refs (Visual Refs: other companies' brands to design something new after, apart
|
|
|
2124
2125
|
refs brief-show <brief-id> The brief, once ready
|
|
2125
2126
|
|
|
2126
2127
|
Usage data (what signed-in people do in your own app):
|
|
2128
|
+
usage proofs [--id <id>] Read saved proof analysis
|
|
2129
|
+
usage find-proofs --since <ISO> --until <ISO> [--focus <text>] Analyze actions
|
|
2130
|
+
usage review-proof --analysis-id <id> --card-id <id> --decision approved|dismissed
|
|
2131
|
+
usage discover-actions --since <ISO> --until <ISO> Event inventory from connected PostHog
|
|
2132
|
+
usage evaluate-action --since <ISO> --until <ISO> --definition <file.json>
|
|
2127
2133
|
usage [--days 7|30|90] [--site <id>] [--limit <n>] People, companies and the features they use
|
|
2128
2134
|
usage --host <app host> What to add to the app before anyone signed in
|
|
2129
2135
|
usage posthog connect --project <id> --key <phx_…> [--posthog-host <h>] [--host <app host>]
|
package/lib/client.mjs
CHANGED
|
@@ -48,6 +48,7 @@ function timeoutFor(kind, toolName) {
|
|
|
48
48
|
const env = Number(process.env.LETTERSTORY_TIMEOUT_MS);
|
|
49
49
|
if (Number.isFinite(env) && env > 0) return env;
|
|
50
50
|
if (kind !== "tool") return REQUEST_TIMEOUT_MS;
|
|
51
|
+
if (["generate_proof_actions", "refresh_proof_actions"].includes(toolName)) return 660_000; // Bounded analysis plus its final source read
|
|
51
52
|
if (WAKE_TOOLS.has(toolName)) return WAKE_TOOL_TIMEOUT_MS;
|
|
52
53
|
return LONG_TOOLS.has(toolName) ? LONG_TOOL_TIMEOUT_MS : TOOL_TIMEOUT_MS;
|
|
53
54
|
}
|
package/lib/commands/build.mjs
CHANGED
|
@@ -170,6 +170,11 @@ const ARGS = {
|
|
|
170
170
|
limit: { flag: "limit", type: "num" },
|
|
171
171
|
},
|
|
172
172
|
// `build list` and `build status <id>` / `build follow <id>` (the id positional).
|
|
173
|
+
get_execution_capacity: {
|
|
174
|
+
root_ref: "root",
|
|
175
|
+
hours: { flag: "hours", type: "num" },
|
|
176
|
+
limit: { flag: "limit", type: "num" },
|
|
177
|
+
},
|
|
173
178
|
list_growth_builds: {
|
|
174
179
|
id: { positional: 0, label: "build-id" },
|
|
175
180
|
limit: { flag: "limit", type: "num" },
|
|
@@ -354,6 +359,19 @@ export function buildLines(b) {
|
|
|
354
359
|
}
|
|
355
360
|
|
|
356
361
|
/** One build by id, or a plain refusal. */
|
|
362
|
+
async function buildCapacity(ctx) {
|
|
363
|
+
const { client, flags, io } = ctx;
|
|
364
|
+
refuseUnknownFlags(ctx, ["root", "hours", "limit"]);
|
|
365
|
+
const result = await client.callTool(
|
|
366
|
+
"get_execution_capacity",
|
|
367
|
+
argsFromFlags(ARGS.get_execution_capacity, flags, [])
|
|
368
|
+
);
|
|
369
|
+
printResult(io, flags, result, (r) =>
|
|
370
|
+
r.pools.map((p) => `${p.resource}: ${p.own_active} active, ${p.own_waiting} waiting`).join("\n")
|
|
371
|
+
);
|
|
372
|
+
return 0;
|
|
373
|
+
}
|
|
374
|
+
|
|
357
375
|
async function readBuild(client, args) {
|
|
358
376
|
const result = await client.callTool("list_growth_builds", args);
|
|
359
377
|
const build = result?.builds?.[0] ?? null;
|
|
@@ -508,6 +526,7 @@ const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
|
508
526
|
*/
|
|
509
527
|
export function readCommand(positionals) {
|
|
510
528
|
const [verb, ...rest] = positionals;
|
|
529
|
+
if (verb === "capacity" && rest.length === 0) return buildCapacity;
|
|
511
530
|
if ((verb === "list" || verb === "conversations") && rest.length === 0)
|
|
512
531
|
return verb === "list" ? buildList : buildConversations;
|
|
513
532
|
if (verb === "conversation" && rest.length <= 1 && (rest.length === 0 || UUID.test(rest[0])))
|
package/lib/commands/usage.mjs
CHANGED
|
@@ -33,6 +33,22 @@ const repoPart = (i) => ({
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
export const ARGS = {
|
|
36
|
+
generate_proof_actions: {
|
|
37
|
+
window: { value: (flags) => ({ since: flags.since, until: flags.until }) },
|
|
38
|
+
focus: { flag: "focus" },
|
|
39
|
+
},
|
|
40
|
+
refresh_proof_actions: {},
|
|
41
|
+
get_proof_actions: { id: { flag: "id" } },
|
|
42
|
+
decide_proof_action: {
|
|
43
|
+
analysis_id: { flag: "analysis-id" },
|
|
44
|
+
card_id: { flag: "card-id" },
|
|
45
|
+
decision: { flag: "decision" },
|
|
46
|
+
},
|
|
47
|
+
discover_action_events: { window: { value: (flags) => ({ since: flags.since, until: flags.until }) } },
|
|
48
|
+
evaluate_action: {
|
|
49
|
+
window: { value: (flags) => ({ since: flags.since, until: flags.until }) },
|
|
50
|
+
definition: { value: (flags) => JSON.parse(readFileSync(String(flags.definition), "utf8")) },
|
|
51
|
+
},
|
|
36
52
|
get_usage_data: {
|
|
37
53
|
days: {
|
|
38
54
|
value: (flags) => {
|
|
@@ -209,6 +225,25 @@ const STEP = {
|
|
|
209
225
|
|
|
210
226
|
export async function cmdUsage(ctx) {
|
|
211
227
|
const { client, flags, io } = ctx;
|
|
228
|
+
if (["proofs", "find-proofs", "review-proof", "refresh-proofs"].includes(ctx.positionals[0])) {
|
|
229
|
+
const tool = {
|
|
230
|
+
proofs: "get_proof_actions",
|
|
231
|
+
"refresh-proofs": "refresh_proof_actions",
|
|
232
|
+
"find-proofs": "generate_proof_actions",
|
|
233
|
+
"review-proof": "decide_proof_action",
|
|
234
|
+
}[ctx.positionals[0]];
|
|
235
|
+
if (tool === "generate_proof_actions" && (!flags.since || !flags.until))
|
|
236
|
+
throw new CliError("Use --since and --until with ISO timestamps.");
|
|
237
|
+
printResult(io, flags, await client.callTool(tool, argsFromFlags(ARGS[tool], flags, [])));
|
|
238
|
+
return 0;
|
|
239
|
+
}
|
|
240
|
+
if (["discover-actions", "evaluate-action"].includes(ctx.positionals[0])) {
|
|
241
|
+
const tool = ctx.positionals[0] === "discover-actions" ? "discover_action_events" : "evaluate_action";
|
|
242
|
+
if (!flags.since || !flags.until) throw new CliError("Use --since and --until with ISO timestamps.");
|
|
243
|
+
if (tool === "evaluate_action" && !flags.definition) throw new CliError("Use --definition with a JSON file.");
|
|
244
|
+
printResult(io, flags, await client.callTool(tool, argsFromFlags(ARGS[tool], flags, [])));
|
|
245
|
+
return 0;
|
|
246
|
+
}
|
|
212
247
|
if (ctx.positionals[0] === "case-study") return cmdCaseStudy(ctx);
|
|
213
248
|
if (ctx.positionals[0] === "posthog") return cmdPostHog(ctx);
|
|
214
249
|
if (ctx.positionals[0] === "import-posthog") {
|