@letterstory/cli 0.63.1 → 0.64.0

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
@@ -55,7 +55,7 @@ import {
55
55
  } from "./commands.mjs";
56
56
 
57
57
  // Keep in sync with cli/package.json.
58
- export const VERSION = "0.63.1";
58
+ export const VERSION = "0.64.0";
59
59
 
60
60
  // Flags that never take a value. Listing them explicitly means `deploy get --json <id>`
61
61
  // can't accidentally swallow the id as --json's value.
@@ -452,6 +452,10 @@ async function cmdAdminTuningContext(ctx) {
452
452
  * admin tuning arenas | arena <version-id> our arena's versions / one version's file and diff
453
453
  * admin tuning arena-candidate --patch '{…}' | --file f.json [--of <version-id>] [--note "…"] save a candidate
454
454
  * admin tuning research-compare --title "…" (--candidate <version-id> | --patch '{…}' | --null-check) [--keys …]
455
+ * admin tuning research-compare --title "…" --candidates <version-id>,… | --patches '[{…},{…}]' several
456
+ * candidates against ONE control arm (k + 1 runs per input, not 2k)
457
+ * admin tuning arena-dials every arena setting: help, default, evidence, live's value
458
+ * admin tuning comparison-extend <comparison-id> --keys k1,k2 | --all add inputs to a comparison on fixed inputs
455
459
  * admin tuning research-inputs [--set v1] research's fixed inputs
456
460
  * admin tuning research-split [--since-hours 72] [--at <iso>,…] what each deploy did to research in production
457
461
  * admin tuning research-standing live's level on the fixed inputs, week by week
@@ -899,12 +903,34 @@ async function cmdAdminTuning(ctx) {
899
903
  const versionId = flagStr(flags.candidate);
900
904
  const patch = jsonFlag(flags.patch, "--patch");
901
905
  const nullCheck = flagBool(flags["null-check"]);
902
- const named = [versionId !== undefined, patch !== undefined, nullCheck === true].filter(Boolean).length;
906
+ const versionIds = flagList(flags.candidates);
907
+ const patches = jsonFlag(flags.patches, "--patches");
908
+ if (patches !== undefined && !Array.isArray(patches))
909
+ throw new CliError("--patches is a JSON array of patches: '[{…},{…}]'");
910
+ const named = [
911
+ versionId !== undefined,
912
+ patch !== undefined,
913
+ nullCheck === true,
914
+ (versionIds?.length ?? 0) + (patches?.length ?? 0) > 0,
915
+ ].filter(Boolean).length;
903
916
  if (!title || named !== 1)
904
917
  throw new CliError(
905
- "Usage: admin tuning research-compare --title \"…\" (--candidate <version-id> | --patch '{…}' | --null-check) [--keys k1,k2] [--concurrency 6] [--experiment <id>]"
918
+ "Usage: admin tuning research-compare --title \"…\" (--candidate <version-id> | --patch '{…}' | --null-check | --candidates <id>,… [--patches '[{…},…]']) [--keys k1,k2] [--concurrency 6] [--experiment <id>]"
906
919
  );
907
- const candidate = versionId ? { version_id: versionId } : patch ? { patch } : { null_check: true };
920
+ const several =
921
+ versionIds?.length || patches?.length
922
+ ? [
923
+ ...(versionIds ?? []).map((v) => ({ version_id: v })),
924
+ ...(patches ?? []).map((p) => ({ patch: p })),
925
+ ]
926
+ : undefined;
927
+ const candidate = several
928
+ ? undefined
929
+ : versionId
930
+ ? { version_id: versionId }
931
+ : patch
932
+ ? { patch }
933
+ : { null_check: true };
908
934
  const r = await staffRequest(
909
935
  ctx,
910
936
  "POST",
@@ -913,6 +939,7 @@ async function cmdAdminTuning(ctx) {
913
939
  primitive: "research",
914
940
  title,
915
941
  candidate,
942
+ candidates: several,
916
943
  keys: flagList(flags.keys),
917
944
  concurrency: flagNum(flags.concurrency),
918
945
  experiment_id: flagStr(flags.experiment),
@@ -920,6 +947,34 @@ async function cmdAdminTuning(ctx) {
920
947
  );
921
948
  return json ? printResult(io, flags, r) : io.log(`research comparison ${r.comparison?.id ?? ""} started`);
922
949
  }
950
+ case "arena-dials": {
951
+ const r = await staffRequest(ctx, "GET", `${T}/arena-files/dials`);
952
+ if (json) return printResult(io, flags, r);
953
+ const valueOf = (key) => key.split(".").reduce((v, k) => (v == null ? v : v[k]), r.live.file);
954
+ const lines = [];
955
+ for (const panel of r.panels) {
956
+ lines.push(`${panel.title} — ${panel.question}`);
957
+ for (const d of r.dials.filter((x) => x.panel === panel.id))
958
+ lines.push(
959
+ ` ${d.key.padEnd(36)} live ${JSON.stringify(valueOf(d.key))} (default ${JSON.stringify(d.fleetDefault)}) ${d.label}`
960
+ );
961
+ }
962
+ lines.push(
963
+ `providers: ${r.providers.map((p) => `${p.id}${p.configured ? "" : " (no key here)"}`).join(", ")}`
964
+ );
965
+ return io.log(lines.join("\n"));
966
+ }
967
+ case "comparison-extend": {
968
+ const keys = flagBool(flags.all) ? "all" : flagList(flags.keys);
969
+ if (!id || !keys?.length)
970
+ throw new CliError("Usage: admin tuning comparison-extend <comparison-id> --keys k1,k2 | --all");
971
+ const r = await staffRequest(ctx, "POST", `${T}/comparisons/${id}/extend`, { keys });
972
+ return json
973
+ ? printResult(io, flags, r)
974
+ : io.log(
975
+ `comparison ${r.comparison.id}: ${r.comparison.added.length} input(s) added, ${r.comparison.pairs} in all`
976
+ );
977
+ }
923
978
  case "research-inputs": {
924
979
  const set = flagStr(flags.set);
925
980
  return printResult(
@@ -1182,7 +1237,7 @@ async function cmdAdminTuning(ctx) {
1182
1237
  }
1183
1238
  default:
1184
1239
  throw new CliError(
1185
- "Usage: admin tuning kernels|kernel|candidate|compare|comparisons|comparison|picks|pick|reading-list|pair|side-by-side|candidates|base-kernels|base-versions|sessions|session|session-new|propose|trial-add|trial-run|trial-save|promote|arenas|arena|arena-candidate|research-compare|research-inputs|research-split|research-standing|promote-arena|shred-compare|shred-inputs|shred-split|shred-standing|shredders|shredder|shredder-candidate|promote-shredder|enhance-compare|enhance-inputs|enhance-split|enhance-standing|enhancers|enhancer|enhancer-candidate|promote-enhancer (see --help)"
1240
+ "Usage: admin tuning kernels|kernel|candidate|compare|comparisons|comparison|picks|pick|reading-list|pair|side-by-side|candidates|base-kernels|base-versions|sessions|session|session-new|propose|trial-add|trial-run|trial-save|promote|arenas|arena|arena-candidate|arena-dials|comparison-extend|research-compare|research-inputs|research-split|research-standing|promote-arena|shred-compare|shred-inputs|shred-split|shred-standing|shredders|shredder|shredder-candidate|promote-shredder|enhance-compare|enhance-inputs|enhance-split|enhance-standing|enhancers|enhancer|enhancer-candidate|promote-enhancer (see --help)"
1186
1241
  );
1187
1242
  }
1188
1243
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.63.1",
3
+ "version": "0.64.0",
4
4
  "description": "Spin up and manage Letterstory phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",