@letterstory/cli 0.177.119 → 0.177.121

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
@@ -92,7 +92,7 @@ import {
92
92
  import { fetchParkedSections, withoutParked } from "./parked.mjs";
93
93
 
94
94
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
95
- export const VERSION = "0.177.119";
95
+ export const VERSION = "0.177.121";
96
96
 
97
97
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
98
98
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -179,8 +179,10 @@ export const BOOLEAN_FLAGS = new Set([
179
179
  "fresh",
180
180
  // admin letterpress tokens: today so far against yesterday and a week ago.
181
181
  "so-far",
182
- // admin letterpress telemetry | prs | tokens: every org, test and demo orgs included.
182
+ // admin letterpress telemetry | prs | tokens: every org, test and demo orgs included. log: every org's Log.
183
183
  "all-orgs",
184
+ // log --all-orgs: test, demo and Letter's own orgs too.
185
+ "with-internal",
184
186
  // admin letterpress prs | failures: since the first PR or build (all_time).
185
187
  "all-time",
186
188
  // admin letterpress failures: the builds that took far longer than usual.
@@ -1590,6 +1592,7 @@ Seers (event-driven signals -> drafts):
1590
1592
 
1591
1593
  Log (what Letter did for your org, newest first: pull requests, posts, emails, purchases):
1592
1594
  log [--limit <n>] [--before <ISO>] One page; --before pages back
1595
+ log --all-orgs [--with-internal] Staff: every org's, each with its org
1593
1596
 
1594
1597
  Org (the account as one file, its integrations and billing):
1595
1598
  org export [--sections <s>…] [--file <path>] The org's whole config as one JSON bundle
@@ -2180,6 +2183,8 @@ Usage data (what signed-in people do in your own app):
2180
2183
  usage find-proofs --since <ISO> --until <ISO> [--focus <text>] Analyze actions
2181
2184
  usage review-proof --analysis-id <id> --card-id <id> --decision approved|dismissed
2182
2185
  usage instrument --action <words> [--event <name>] [--owner <o> --repo <r>] PR that records an action
2186
+ usage test-agents [run [--rounds 4] [--engines chatgpt,claude]] Statistics on vs off with AI engines
2187
+ usage test-agents show <test_id> | stop <test_id> | questions --file <q.json>
2183
2188
  usage discover-actions --since <ISO> --until <ISO> Event inventory from connected PostHog
2184
2189
  usage evaluate-action --since <ISO> --until <ISO> --definition <file.json>
2185
2190
  usage [--days 7|30|90] [--site <id>] [--limit <n>] People, companies and the features they use
@@ -2,19 +2,24 @@
2
2
  // A thin wrapper over get_letter_log, the function the app's Log page calls.
3
3
  //
4
4
  // letterstory log [--limit <n>] [--before <ISO>]
5
+ // letterstory log --all-orgs [--with-internal] staff: every org's (get_global_log)
5
6
 
6
7
  import { argsFromFlags, printResult } from "./shared.mjs";
7
8
 
9
+ const page = {
10
+ limit: { flag: "limit", type: "num" },
11
+ before: { flag: "before" },
12
+ };
13
+
8
14
  export const ARGS = {
9
- get_letter_log: {
10
- limit: { flag: "limit", type: "num" },
11
- before: { flag: "before" },
12
- },
15
+ get_letter_log: page,
16
+ get_global_log: { ...page, customer_only: { flag: "with-internal", type: "bool", invert: true } },
13
17
  };
14
18
 
15
19
  export async function cmdLog(ctx) {
16
20
  const { client, flags, io } = ctx;
17
- const result = await client.callTool("get_letter_log", argsFromFlags(ARGS.get_letter_log, flags, ctx.positionals));
21
+ const tool = flags["all-orgs"] ? "get_global_log" : "get_letter_log";
22
+ const result = await client.callTool(tool, argsFromFlags(ARGS[tool], flags, ctx.positionals));
18
23
  printResult(
19
24
  io,
20
25
  flags,
@@ -23,7 +28,7 @@ export async function cmdLog(ctx) {
23
28
  [
24
29
  ...r.entries.map(
25
30
  (e) =>
26
- `${e.at.slice(0, 16).replace("T", " ")} ${e.action}${e.title ? ` ${e.title}` : ""}${e.by ? ` (${e.by})` : ""}`
31
+ `${e.at.slice(0, 16).replace("T", " ")} ${e.action}${e.title ? ` ${e.title}` : ""}${e.by ? ` (${e.by})` : ""}${e.org ? ` [${e.org.name ?? e.org.id}]` : ""}`
27
32
  ),
28
33
  ...(r.next_before ? [`Older: letterstory log --before ${r.next_before}`] : []),
29
34
  ].join("\n") || "Nothing yet"
@@ -75,6 +75,17 @@ export const ARGS = {
75
75
  },
76
76
  set_usage_payment_scope: paymentScopeArgs,
77
77
  preview_usage_payment_scope: paymentScopeArgs,
78
+ get_agent_tests: { test_id: { positional: 0, label: "test_id" } },
79
+ set_agent_test_questions: {
80
+ questions: {
81
+ value: (flags) => (flags.file ? JSON.parse(readFileSync(String(flags.file), "utf8")) : undefined),
82
+ },
83
+ },
84
+ start_agent_test: {
85
+ rounds: { flag: "rounds", type: "num" },
86
+ engines: { value: (flags) => (flags.engines ? flagCsv(flags.engines) : undefined) },
87
+ },
88
+ stop_agent_test: { test_id: { positional: 0, required: true, label: "test_id" } },
78
89
  get_shown_statistics: {},
79
90
  set_shown_statistic: {
80
91
  choice_id: { positional: 0, required: true, label: "choice_id" },
@@ -377,6 +388,23 @@ export async function cmdUsage(ctx) {
377
388
  }
378
389
  throw new CliError("Use shown, shown show|hide <choice_id>, shown pr or shown check");
379
390
  }
391
+ if (ctx.positionals[0] === "test-agents") {
392
+ const sub = ctx.positionals[1] ?? "status";
393
+ const rest = ctx.positionals.slice(2);
394
+ const tool = {
395
+ status: "get_agent_tests",
396
+ show: "get_agent_tests",
397
+ questions: "set_agent_test_questions",
398
+ run: "start_agent_test",
399
+ stop: "stop_agent_test",
400
+ }[sub];
401
+ if (!tool)
402
+ throw new CliError(
403
+ "Use test-agents, test-agents run, show <test_id>, questions --file <q.json> or stop <test_id>"
404
+ );
405
+ printResult(io, flags, await client.callTool(tool, argsFromFlags(ARGS[tool], flags, rest)));
406
+ return 0;
407
+ }
380
408
  if (ctx.positionals[0] === "payments") {
381
409
  const tool = {
382
410
  connect: "connect_usage_payments",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.177.119",
3
+ "version": "0.177.121",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",