@letterstory/cli 0.168.0 → 0.168.2

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
@@ -75,7 +75,7 @@ import {
75
75
  } from "./commands.mjs";
76
76
 
77
77
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
78
- export const VERSION = "0.168.0";
78
+ export const VERSION = "0.168.2";
79
79
 
80
80
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
81
81
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -84,6 +84,8 @@ export const EXIT_PAYMENT_REQUIRED = 3;
84
84
  // can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
85
85
  // `negate` spelling) in a command's ARGS map must be listed; boolean-flags.test.ts enforces it.
86
86
  export const BOOLEAN_FLAGS = new Set([
87
+ // admin crm prospect-org: start (or retry) the org prepared for the booked call.
88
+ "start",
87
89
  // site research-builds: run now even when the stored pass is under an hour old.
88
90
  "fresh",
89
91
  // admin letterpress status | gaps: the customers' reading (no test or demo orgs).
@@ -158,6 +160,8 @@ export const BOOLEAN_FLAGS = new Set([
158
160
  "moves",
159
161
  "enroll",
160
162
  "unenroll",
163
+ // admin demo set --release
164
+ "release",
161
165
  "clean-slate",
162
166
  // admin crm record-outcome --draft
163
167
  "draft",
@@ -889,16 +893,27 @@ Admin (STAFF key — --staff-key / LETTERSTORY_STAFF_API_KEY; acts before an org
889
893
  fleet:query capability on the staff key.
890
894
  admin recipes list | show <id|name> | vocab | stats Recipes: Letter's one library of direction for
891
895
  Letterpress on Plan, Build and Fix (/superadmin/recipes),
892
- five fields each: name, recipe, when to use, when not to
893
- use, weight. vocab says what each field means; stats how
894
- each recipe's suggestions fare. Needs recipes:read.
896
+ each a name, a description, the recipe (what Letterpress
897
+ reads), when to use, when not to use, a weight, its tags
898
+ (approaches) and its variations (Letterpress follows one).
899
+ vocab says what each field means; stats how
900
+ often runs followed each recipe (and the share of the
901
+ runs that had it) and how its suggestions fare. Needs
902
+ recipes:read.
903
+ admin recipes list --approach <seo|geo|agent_conviction|inbound_conversion|outbound|other>
904
+ The recipes tagged with one approach (other: with none).
905
+ admin recipes runs <id|name> [--days 30] [--limit 100]
906
+ The runs that had the recipe to choose from, newest
907
+ first: company, what was asked, who asked, and ✓ on
908
+ the ones that used it.
895
909
  admin recipes export [--out recipes.json] The library as a file import reads back.
896
910
  admin recipes import <file> [--dry-run] Write a library in one call: each recipe matched by id,
897
911
  else name, then changed or created. --dry-run writes
898
912
  nothing. Exits 1 if any row failed.
899
- admin recipes save [<id>] [--file <recipe.json>] [--name …] [--recipe …] [--when-to-use …]
900
- [--when-not-to-use …] [--weight 1..10]
901
- Create one (no id) or change one. Needs recipes:write.
913
+ admin recipes save [<id>] [--file <recipe.json>] [--name …] [--description …] [--recipe …]
914
+ [--when-to-use …] [--when-not-to-use …] [--weight 1..10] [--approaches seo,geo]
915
+ Create one (no id) or change one; variations come from
916
+ --file. Needs recipes:write.
902
917
  admin recipes delete <id> --yes Delete for good.
903
918
  admin letterpress status [--customers] Letterpress as it runs now: per lens its mode, bar, recipes,
904
919
  runs, model and prompt hash, how often the shadow agreed,
@@ -927,11 +942,18 @@ Admin (STAFF key — --staff-key / LETTERSTORY_STAFF_API_KEY; acts before an org
927
942
  admin demo set <org-id> [--enroll] [--phantom parked] [--search-console hidden] [--inject <key>]... [--save-as n]
928
943
  Set what a demo org shows (merged); 'shown' puts a thing
929
944
  back. --file takes a scenario as JSON. Needs demo:write.
930
- admin demo reset <org-id> <scenario> [--clean-slate] [--close-prs since_applied|all_open|none]
945
+ admin demo reset <org-id> <scenario> [--clean-slate] [--close-prs since_applied|all_open|none] [--hold <min>]
931
946
  Undo the last take (its PRs closed, builds archived), then
932
947
  show a scenario: real, fresh_geo, fresh_seo, after_approve
933
948
  or a saved one. --clean-slate closes every open PR and
934
- archives every build.
949
+ archives every build. --hold <min> starts a demo: no automatic
950
+ reset for that long. Ends with the readiness check.
951
+ admin demo set <org-id> --auto-reset <scenario>|off [--every <min>] [--release]
952
+ Reset on its own every <min> (default 30) once idle 15
953
+ min and not held; --release ends a hold.
954
+ admin demo check <org-id> Is it ready to show? Competitors, targets, answers, the
955
+ Plan's rows, the issues open, no PR open, GitHub, the
956
+ phantom's site. Exits 1 when not ready.
935
957
  admin brand-detection <org-id> [--term <t>]... [--exact <t>]... [--exclude <phrase>]... [--note "…"] | --clear [--note "…"]
936
958
  How a client's brand is detected in AI answers, with
937
959
  every earlier setting; with flags, set the exact set
@@ -1071,6 +1093,8 @@ Admin (STAFF key — --staff-key / LETTERSTORY_STAFF_API_KEY; acts before an org
1071
1093
  [--slack a@acme.com,b@acme.com] [--invite a@acme.com[:admin]]… [--no-checklist]
1072
1094
  | onboarding <account-id> | retry-onboarding <onboarding-id>
1073
1095
  | onboard-plan <account-id> [--refresh]
1096
+ | prospect-org <account-id> [--start] [--domain acme.com] the org prepared for their booked call
1097
+ | prospect-orgs [--status preparing|ready|failed|skipped|parked|converted] [--limit 50]
1074
1098
  | payment-link <account-id> [--amount-cents N] [--description "…"] [--plan starter] [--ratio N] [--why "…"] [--first-invoice-credit-cents N]
1075
1099
  The staff CRM's pipeline: bulk-importing a
1076
1100
  CSV of leads, the inbound signal
@@ -18,9 +18,9 @@
18
18
  // admin spend summary|reconcile|pnl|margin|pricing|entries|add|import|usage|remove|reference|stripe-sync|services|service … (spend:read / spend:write)
19
19
  // admin brand-detection <org-id> (fleet:read)
20
20
  // admin brand-detection <org-id> [--term t]... [--exact t]... [--exclude p]... [--note "…"] | --clear [--note "…"] (fleet:instrument)
21
- // admin recipes list|show|vocab|export|import|save|delete … (recipes:read / recipes:write)
21
+ // admin recipes list|show|runs|vocab|export|import|save|delete … (recipes:read / recipes:write)
22
22
  // admin letterpress settings|flip|set … (recipes:read / recipes:write)
23
- // admin demo guide|list|show|set|reset … (demo:read / demo:write)
23
+ // admin demo guide|list|show|set|reset|check … (demo:read / demo:write)
24
24
  // admin models runs|run|star|unstar|scoreboard|requests|request|sampling … (models:read / models:write)
25
25
  // admin replays [--org <id>] [--target <id>] [--status …] [--limit n] (fleet:read)
26
26
  // admin replay --org <id> [<response-id> | --target <id>] [--surface …] (fleet:replay)
@@ -2740,6 +2740,35 @@ function onboardingLines(o) {
2740
2740
  ].join("\n");
2741
2741
  }
2742
2742
 
2743
+ function prospectOrgHeadline(p) {
2744
+ const call = p.callAt ? ` call ${p.callAt.slice(0, 16).replace("T", " ")}` : "";
2745
+ return `${p.status.padEnd(9)} ${p.accountName ?? p.accountId} ${p.domain || "(no domain)"}${call}${p.note ? ` — ${p.note}` : ""}`;
2746
+ }
2747
+
2748
+ function prospectOrgLines(p) {
2749
+ if (!p) return "(no prospect org for this account)";
2750
+ const mark = { done: "✓", skipped: "–", failed: "✗", running: "…", pending: "·" };
2751
+ return [
2752
+ `${p.id} ${prospectOrgHeadline(p)}`,
2753
+ ...(p.orgName ? [` org: ${p.orgName} (${p.orgId})`] : []),
2754
+ ...p.steps.map(
2755
+ (s) =>
2756
+ ` ${mark[s.status] ?? "?"} ${s.key.padEnd(16)} ${s.status}${s.detail ? ` ${s.detail}` : ""}${s.error ? `\n error: ${s.error}` : ""}`
2757
+ ),
2758
+ ...(p.competitors.length
2759
+ ? [
2760
+ ` competitors: ${p.competitors
2761
+ .map(
2762
+ (c) =>
2763
+ `${c.host}${c.employees != null ? ` (${c.employees} people)` : ""}${c.pages != null ? ` ${c.pages} pages` : ""}`
2764
+ )
2765
+ .join(", ")}`,
2766
+ ]
2767
+ : []),
2768
+ ...(p.openUrl ? [` open: ${p.openUrl}`] : []),
2769
+ ].join("\n");
2770
+ }
2771
+
2743
2772
  function dollars(cents) {
2744
2773
  return `$${(cents / 100).toLocaleString("en-US", { maximumFractionDigits: 2 })}`;
2745
2774
  }
@@ -3752,6 +3781,31 @@ async function cmdAdminCrm(ctx) {
3752
3781
  onboardingLines(x.onboarding)
3753
3782
  );
3754
3783
  }
3784
+ case "prospect-org": {
3785
+ // admin crm prospect-org <account-id> [--start] [--domain acme.com] — the org prepared
3786
+ // for the account's booked call (docs/architecture/prospect-orgs.md). --start (or a
3787
+ // --domain) starts it by hand, or retries its failed steps; the key then needs
3788
+ // crm:write + org:create.
3789
+ if (!id) throw new CliError("Usage: admin crm prospect-org <account-id> [--start] [--domain acme.com]");
3790
+ if (flagBool(flags.start) || flags.domain) {
3791
+ const r = await staffPost(ctx, `${CRM}/accounts/${id}/prospect-org`, compact({ domain: flags.domain }));
3792
+ return out(r, (x) => prospectOrgLines(x.prospectOrg));
3793
+ }
3794
+ return out(await staffRequest(ctx, "GET", `${CRM}/accounts/${id}/prospect-org`), (x) =>
3795
+ prospectOrgLines(x.prospectOrg)
3796
+ );
3797
+ }
3798
+ case "prospect-orgs": {
3799
+ // admin crm prospect-orgs [--status ready] [--limit 50] — the orgs prepared for booked
3800
+ // calls, newest first.
3801
+ const q = new URLSearchParams(compact({ status: flags.status, limit: flags.limit }));
3802
+ const qs = q.toString() ? `?${q}` : "";
3803
+ return out(await staffRequest(ctx, "GET", `${CRM}/prospect-orgs${qs}`), (x) =>
3804
+ x.prospectOrgs.length
3805
+ ? x.prospectOrgs.map((p) => prospectOrgHeadline(p)).join("\n")
3806
+ : "(no prospect orgs yet)"
3807
+ );
3808
+ }
3755
3809
  case "onboard-plan": {
3756
3810
  // admin crm onboard-plan <account-id> [--refresh] — what the calls say onboarding
3757
3811
  // should set up (sites, Slack/app people, notes) + paid or not. --refresh re-reads.
@@ -3797,7 +3851,7 @@ async function cmdAdminCrm(ctx) {
3797
3851
  }
3798
3852
  default:
3799
3853
  throw new CliError(
3800
- "Usage: admin crm import|capture|outreach|signals|record|signal|accounts|account|score|slack-channels|link-slack|white-glove|set-white-glove|churn|revenue|reach-outs|replies|record-churn|draft-churn-reason|undo-churn|outcomes|record-outcome|renewals|track-record|weekly-note|at-risk|expansion-signals|collections|delivery-flags|pulse|case|onboard|onboarding|retry-onboarding|onboard-plan|payment-link … (see --help)"
3854
+ "Usage: admin crm import|capture|outreach|signals|record|signal|accounts|account|score|slack-channels|link-slack|white-glove|set-white-glove|churn|revenue|reach-outs|replies|record-churn|draft-churn-reason|undo-churn|outcomes|record-outcome|renewals|track-record|weekly-note|at-risk|expansion-signals|collections|delivery-flags|pulse|case|onboard|onboarding|retry-onboarding|onboard-plan|prospect-org|prospect-orgs|payment-link … (see --help)"
3801
3855
  );
3802
3856
  }
3803
3857
  }
@@ -4932,22 +4986,50 @@ async function cmdAdminRepublish(ctx) {
4932
4986
 
4933
4987
  const RECIPES = "/api/superadmin/recipes";
4934
4988
  /** The fields a recipe file carries: what import_recipes reads back. */
4935
- const RECIPE_FILE_FIELDS = ["id", "name", "recipe", "when_to_use", "when_not_to_use", "weight"];
4989
+ const RECIPE_FILE_FIELDS = [
4990
+ "id",
4991
+ "name",
4992
+ "description",
4993
+ "recipe",
4994
+ "when_to_use",
4995
+ "when_not_to_use",
4996
+ "weight",
4997
+ "approaches",
4998
+ "variations",
4999
+ ];
4936
5000
  const RECIPES_USAGE =
4937
- "Usage: admin recipes list | show <id|name> | vocab | stats | export [--out <file>] | import <file> [--dry-run] | save [<id>] [--file <recipe.json>] [--name …] [--recipe …] [--when-to-use …] [--when-not-to-use …] [--weight 1..10] | delete <id> --yes";
5001
+ "Usage: admin recipes list [--approach seo|geo|agent_conviction|inbound_conversion|outbound|other] | show <id|name> | runs <id|name> [--days 1..90] [--limit n] | vocab | stats | export [--out <file>] | import <file> [--dry-run] | save [<id>] [--file <recipe.json>] [--name …] [--description …] [--recipe …] [--when-to-use …] [--when-not-to-use …] [--weight 1..10] [--approaches seo,geo,…] | delete <id> --yes";
4938
5002
 
4939
5003
  const recipeForFile = (r) => Object.fromEntries(RECIPE_FILE_FIELDS.map((k) => [k, r[k]]));
4940
5004
 
5005
+ /** A recipe's approaches (its tags), or "other". */
5006
+ const recipeApproaches = (r) => (r.approaches?.length ? r.approaches.join(", ") : "other");
5007
+
5008
+ /** Every variation of a recipe, its own first; an untitled one takes the recipe's name. */
5009
+ const recipeVariations = (r) => [
5010
+ r,
5011
+ ...(r.variations ?? []).map((v) => ({ ...v, name: v.name || r.name, description: v.description ?? "" })),
5012
+ ];
5013
+
4941
5014
  function recipeLine(r) {
4942
- return `${String(r.weight).padStart(2)}/10 ${r.name} ${r.id}`;
5015
+ const more = r.variations?.length ? ` ${r.variations.length + 1} variations` : "";
5016
+ return `${String(r.weight).padStart(2)}/10 ${r.name} [${recipeApproaches(r)}]${more} ${r.id}`;
4943
5017
  }
4944
5018
 
4945
5019
  function recipeDetail(r) {
5020
+ const variations = recipeVariations(r);
5021
+ const fields = (v, pad) => [
5022
+ `${pad}description: ${v.description || "—"}`,
5023
+ `${pad}recipe: ${v.recipe || "—"}`,
5024
+ `${pad}when to use: ${v.when_to_use || "—"}`,
5025
+ `${pad}when not to use: ${v.when_not_to_use || "—"}`,
5026
+ ];
4946
5027
  return [
4947
5028
  `${r.name} weight ${r.weight}/10 ${r.id}`,
4948
- ` recipe: ${r.recipe || "—"}`,
4949
- ` when to use: ${r.when_to_use || "—"}`,
4950
- ` when not to use: ${r.when_not_to_use || "—"}`,
5029
+ ` approaches: ${recipeApproaches(r)}`,
5030
+ ...(variations.length > 1
5031
+ ? variations.flatMap((v, i) => [` variation ${i + 1}: ${v.name}`, ...fields(v, " ")])
5032
+ : fields(r, " ")),
4951
5033
  ].join("\n");
4952
5034
  }
4953
5035
 
@@ -4978,10 +5060,16 @@ function recipeFromFlags(flags) {
4978
5060
  return compact({
4979
5061
  ...compact(recipeForFile(base)),
4980
5062
  name: flagStr(flags.name),
5063
+ description: flagStr(flags.description),
4981
5064
  recipe: flagStr(flags.recipe),
4982
5065
  when_to_use: flagStr(flags["when-to-use"]),
4983
5066
  when_not_to_use: flagStr(flags["when-not-to-use"]),
4984
5067
  weight: flagNum(flags.weight),
5068
+ // --approaches seo,geo sets the tags; --approaches "" clears them.
5069
+ approaches: flagStr(flags.approaches)
5070
+ ?.split(",")
5071
+ .map((a) => a.trim())
5072
+ .filter(Boolean),
4985
5073
  });
4986
5074
  }
4987
5075
 
@@ -5186,20 +5274,34 @@ async function cmdAdminRecipes(ctx) {
5186
5274
  switch (sub) {
5187
5275
  case "stats": {
5188
5276
  const result = await staffRequest(ctx, "GET", `${RECIPES}/stats`);
5277
+ const pct = (share) => (share === null ? " —" : `${String(Math.round(share * 100)).padStart(3)}%`);
5189
5278
  printResult(io, flags, result, (r) =>
5190
- r.stats.length
5191
- ? r.stats
5192
- .map(
5279
+ [
5280
+ `Runs over the last ${r.usage_days ?? 30} days (followed / had it to choose from):`,
5281
+ ...(r.usage?.length
5282
+ ? r.usage.map(
5283
+ (u) =>
5284
+ `${String(u.runs).padStart(5)} runs ${pct(u.selected_share)} of ${String(u.offered).padEnd(4)} plan ${u.by_lens.plan} build ${u.by_lens.build} fix ${u.by_lens.fix} ${u.name}`
5285
+ )
5286
+ : [" No recipes yet."]),
5287
+ "",
5288
+ "What the passes show and people dismissed:",
5289
+ ...(r.stats.length
5290
+ ? r.stats.map(
5193
5291
  (s) =>
5194
5292
  `${String(s.shown).padStart(5)} shown ${String(s.dismissed).padStart(4)} dismissed ${String(s.resolved ?? 0).padStart(4)} resolved ${String(s.built ?? 0).padStart(3)} built ${s.lens.padEnd(5)} ${s.recipe}${s.reasons.length ? `\n why: ${s.reasons.slice(0, 3).join(" · ")}` : ""}`
5195
5293
  )
5196
- .join("\n")
5197
- : "No suggestions from the passes yet."
5294
+ : [" No suggestions from the passes yet."]),
5295
+ ].join("\n")
5198
5296
  );
5199
5297
  return 0;
5200
5298
  }
5201
5299
  case "list": {
5202
- const recipes = await all();
5300
+ const approach = flagStr(flags.approach);
5301
+ const recipes = approach
5302
+ ? ((await staffRequest(ctx, "GET", `${RECIPES}?approach=${encodeURIComponent(approach)}`)).recipes ??
5303
+ [])
5304
+ : await all();
5203
5305
  printResult(io, flags, { recipes }, (r) =>
5204
5306
  r.recipes.length ? r.recipes.map(recipeLine).join("\n") : "No recipes yet."
5205
5307
  );
@@ -5212,6 +5314,27 @@ async function cmdAdminRecipes(ctx) {
5212
5314
  printResult(io, flags, { recipe }, (r) => recipeDetail(r.recipe));
5213
5315
  return 0;
5214
5316
  }
5317
+ case "runs": {
5318
+ const key = requirePositional(positionals, 1, "id|name");
5319
+ const recipe = (await all()).find((r) => r.id === key || r.name === key);
5320
+ if (!recipe) throw new CliError(`No recipe with id or name "${key}".`);
5321
+ const q = new URLSearchParams();
5322
+ const days = flagNum(flags.days);
5323
+ const limit = flagNum(flags.limit);
5324
+ if (days !== undefined) q.set("days", String(days));
5325
+ if (limit !== undefined) q.set("limit", String(limit));
5326
+ const result = await staffRequest(ctx, "GET", `${RECIPES}/${recipe.id}/runs${q.size ? `?${q}` : ""}`);
5327
+ printResult(io, flags, result, (r) =>
5328
+ [
5329
+ `${r.recipe.name}: ${r.offered} run(s) had it over the last ${r.days} days, ${r.used} used it.`,
5330
+ ...r.runs.map(
5331
+ (run) =>
5332
+ `${run.used ? "✓ used" : " - "} ${run.created_at.slice(0, 16).replace("T", " ")} ${run.company.name ?? run.company.domain} (${run.company.domain}) ${run.ask}${run.started_by?.name ? ` by ${run.started_by.name}` : ""}${run.variations.length ? ` variation ${run.variations.join(", ")}` : ""} ${run.id}`
5333
+ ),
5334
+ ].join("\n")
5335
+ );
5336
+ return 0;
5337
+ }
5215
5338
  case "vocab": {
5216
5339
  const v = await staffRequest(ctx, "GET", `${RECIPES}/vocabulary`);
5217
5340
  printResult(io, flags, v, (r) =>
@@ -5705,7 +5828,7 @@ async function cmdAdminBilling(ctx) {
5705
5828
 
5706
5829
  // `admin demo` — demo control (docs/architecture/demo-control.md): what each demo org shows,
5707
5830
  // set, rehearsed and reset. The staff routes behind /superadmin/demo, the same functions and
5708
- // schema as list_demo_orgs / get_demo_state / set_demo_state / reset_demo_state.
5831
+ // schema as list_demo_orgs / get_demo_state / set_demo_state / reset_demo_state / run_demo_readiness_check.
5709
5832
  const DEMO = "/api/superadmin/demo";
5710
5833
  const DEMO_ITEM_FLAGS = [
5711
5834
  "phantom",
@@ -5720,7 +5843,15 @@ const DEMO_ITEM_FLAGS = [
5720
5843
  "setup",
5721
5844
  ];
5722
5845
  const DEMO_USAGE =
5723
- "Usage: admin demo guide | list [--enrollable] | show <org-id> [--moves] | set <org-id> [--enroll] [--unenroll] [--file <state.json>] [--phantom parked|shown] [--main-blog …] [--visitors …] [--probes not_run|shown] [--cms hidden|shown] [--publish-target …] [--search-console …] [--github …] [--domain …] [--setup fresh|finished] [--domain-cap n] [--inject <key>]... [--hide <key>]... [--save-as <name>] | reset <org-id> <scenario> [--clean-slate] [--close-prs since_applied|all_open|none]";
5846
+ "Usage: admin demo guide | list [--enrollable] | show <org-id> [--moves] | set <org-id> [--enroll] [--unenroll] [--file <state.json>] [--phantom parked|shown] [--main-blog …] [--visitors …] [--probes not_run|shown] [--cms hidden|shown] [--publish-target …] [--search-console …] [--github …] [--domain …] [--setup fresh|finished] [--domain-cap n] [--inject <key>]... [--hide <key>]... [--save-as <name>] [--auto-reset <scenario>|off] [--every <minutes>] [--release] | reset <org-id> <scenario> [--clean-slate] [--close-prs since_applied|all_open|none] [--hold <minutes>] | check <org-id>";
5847
+
5848
+ const readinessLines = (r) =>
5849
+ r
5850
+ ? [
5851
+ `${r.ok ? "READY" : "NOT READY"} (checked ${r.at})`,
5852
+ ...r.checks.map((c) => ` ${c.ok ? "ok " : "FAIL"} ${c.label}: ${c.detail}`),
5853
+ ].join("\n")
5854
+ : "Not checked yet.";
5724
5855
 
5725
5856
  async function cmdAdminDemo(ctx) {
5726
5857
  const { flags, positionals, io } = ctx;
@@ -5758,7 +5889,11 @@ async function cmdAdminDemo(ctx) {
5758
5889
  (o) =>
5759
5890
  `${o.enrolled ? "demo" : "test"} ${o.name} ${o.domain ?? "—"} ${o.scenario ?? ""}${
5760
5891
  o.differs?.length ? ` [${o.differs.join(", ")}]` : ""
5761
- } ${o.org_id}`
5892
+ }${o.ready === true ? " ready" : o.ready === false ? " NOT READY" : ""}${
5893
+ o.auto_reset
5894
+ ? ` auto ${o.auto_reset.scenario}/${o.auto_reset.every_minutes}m`
5895
+ : ""
5896
+ }${o.held ? ` held until ${o.held.until}` : ""} ${o.org_id}`
5762
5897
  )
5763
5898
  .join("\n")
5764
5899
  : "No demo orgs yet."
@@ -5778,6 +5913,8 @@ async function cmdAdminDemo(ctx) {
5778
5913
  ...r.knobs.map((k) => ` ${k.item.padEnd(16)} real: ${k.real} · shown: ${k.shown} (${k.how})`),
5779
5914
  ` observations open: ${r.observations.open.map((o) => `${o.key}${o.injected ? " (demo)" : ""}`).join(", ") || "none"}`,
5780
5915
  ` answers: ${r.answers.map((q) => `${q.named}/${q.answers} ${q.text}`).join("; ") || "never probed"}`,
5916
+ ` auto-reset: ${r.state.auto_reset ? `${r.state.auto_reset.scenario} every ${r.state.auto_reset.every_minutes} min, next due ${r.state.auto_reset.next_due_at}` : "off"}${r.state.held ? ` · held until ${r.state.held.until}` : ""}`,
5917
+ readinessLines(r.state.readiness),
5781
5918
  ].join("\n")
5782
5919
  );
5783
5920
  return 0;
@@ -5805,6 +5942,13 @@ async function cmdAdminDemo(ctx) {
5805
5942
  enroll: flagBool(flags.enroll) || undefined,
5806
5943
  unenroll: flagBool(flags.unenroll) || undefined,
5807
5944
  save_as: flagStr(flags["save-as"]),
5945
+ auto_reset: flagStr(flags["auto-reset"])
5946
+ ? {
5947
+ scenario: flagStr(flags["auto-reset"]) === "off" ? null : flagStr(flags["auto-reset"]),
5948
+ ...(flagNum(flags.every) ? { every_minutes: flagNum(flags.every) } : {}),
5949
+ }
5950
+ : undefined,
5951
+ release_hold: flagBool(flags.release) || undefined,
5808
5952
  });
5809
5953
  if (!Object.keys(body).length) throw new CliError(DEMO_USAGE);
5810
5954
  const result = await staffRequest(ctx, "PATCH", `${DEMO}/${encodeURIComponent(orgId)}`, body);
@@ -5821,11 +5965,18 @@ async function cmdAdminDemo(ctx) {
5821
5965
  scenario,
5822
5966
  close_prs: flagStr(flags["close-prs"]),
5823
5967
  clean_slate: flagBool(flags["clean-slate"]) || undefined,
5968
+ hold_minutes: flagNum(flags.hold) ?? undefined,
5824
5969
  })
5825
5970
  );
5826
- printResult(io, flags, result, (r) => r.notes.join("\n"));
5971
+ printResult(io, flags, result, (r) => [r.notes.join("\n"), readinessLines(r.readiness)].join("\n"));
5827
5972
  return 0;
5828
5973
  }
5974
+ case "check": {
5975
+ const orgId = requirePositional(positionals, 1, "org-id");
5976
+ const result = await staffPost(ctx, `${DEMO}/${encodeURIComponent(orgId)}/check`, {});
5977
+ printResult(io, flags, result, (r) => readinessLines(r.readiness));
5978
+ return result.readiness?.ok ? 0 : 1;
5979
+ }
5829
5980
  default:
5830
5981
  throw new CliError(DEMO_USAGE);
5831
5982
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.168.0",
3
+ "version": "0.168.2",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",