@letterstory/cli 0.176.17 → 0.176.18

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
@@ -81,7 +81,7 @@ import {
81
81
  import { fetchParkedSections, withoutParked } from "./parked.mjs";
82
82
 
83
83
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
84
- export const VERSION = "0.176.17";
84
+ export const VERSION = "0.176.18";
85
85
 
86
86
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
87
87
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -195,6 +195,9 @@ export const BOOLEAN_FLAGS = new Set([
195
195
  "overwrite",
196
196
  // admin demo set --clear-baseline (reset --rebuild is listed below)
197
197
  "clear-baseline",
198
+ "keep-repo",
199
+ // admin demo new --full
200
+ "full",
198
201
  "forget-company",
199
202
  "forget-site",
200
203
  "reread-company",
@@ -1074,6 +1077,15 @@ Admin (STAFF key — --staff-key / LETTERSTORY_STAFF_API_KEY; acts before an org
1074
1077
  Visitors hidden or parked; the company read and the site map
1075
1078
  forgotten (the company is kept as company_before), so the
1076
1079
  domain typed into Set-up maps and reads it all afresh.
1080
+ admin demo domains The farm domains a new demo org could take (live
1081
+ phantoms; the phantom is kept). Needs demo:read.
1082
+ admin demo new <domain> [--name <n>] [--brief <t>] [--full] [--no-wait]
1083
+ A new demo org on a farm phantom's domain: a made-up
1084
+ company, a one-page site in the demo GitHub org served by
1085
+ Pages, the domain moved off its phantom (kept), the org
1086
+ enrolled and shown as blank. Takes minutes; calls again
1087
+ until done (--no-wait: once). Auto-Plan stays off.
1088
+ admin demo teardown <org-id> [--keep-repo] Put the site back: the domain to its phantom, the repo gone.
1077
1089
  admin demo check <org-id> Is it ready to show? Competitors, targets, answers, the
1078
1090
  Plan's rows, the issues open, no PR open, GitHub, the
1079
1091
  phantom's site. Exits 1 when not ready.
@@ -6477,7 +6477,7 @@ const DEMO_ITEM_FLAGS = [
6477
6477
  "setup",
6478
6478
  ];
6479
6479
  const DEMO_USAGE =
6480
- "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>] [--baseline <owner/repo>[@sha] | --clear-baseline] [--copy-from <org-id> [--copy-scenarios a,b] [--overwrite]] [--auto-reset <scenario>|off] [--every <minutes>] [--release] | bootstrap <org-id>... --from <org-id> [--scenarios a,b] [--overwrite] | reset <org-id> <scenario> [--clean-slate] [--close-prs since_applied|all_open|none] [--hold <minutes>] [--restore-repo revert|force] [--rebuild] [--reread-company] [--forget-company] [--forget-site] | check <org-id>";
6480
+ "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>] [--baseline <owner/repo>[@sha] | --clear-baseline] [--copy-from <org-id> [--copy-scenarios a,b] [--overwrite]] [--auto-reset <scenario>|off] [--every <minutes>] [--release] | domains | new <domain> [--name <n>] [--brief <t>] [--full] [--no-wait] | teardown <org-id> [--keep-repo] | bootstrap <org-id>... --from <org-id> [--scenarios a,b] [--overwrite] | reset <org-id> <scenario> [--clean-slate] [--close-prs since_applied|all_open|none] [--hold <minutes>] [--restore-repo revert|force] [--rebuild] [--reread-company] [--forget-company] [--forget-site] | check <org-id>";
6481
6481
 
6482
6482
  const readinessLines = (r) =>
6483
6483
  r
@@ -6603,6 +6603,61 @@ async function cmdAdminDemo(ctx) {
6603
6603
  printResult(io, flags, result, (r) => r.notes.join("\n") || "No change.");
6604
6604
  return 0;
6605
6605
  }
6606
+ case "domains": {
6607
+ const r = await staffRequest(ctx, "GET", `${DEMO}/domains`);
6608
+ printResult(io, flags, r, (x) =>
6609
+ [
6610
+ `${x.available.length} farm domains a demo could take (live phantoms; the phantom is kept):`,
6611
+ ...x.available.map((d) => ` ${d.domain} ${d.phantom_name} (${d.org_name})`),
6612
+ x.in_use.length
6613
+ ? `\nIn use by a demo:\n${x.in_use.map((d) => ` ${d.domain} ${d.org_id} ${d.stage}`).join("\n")}`
6614
+ : "",
6615
+ ]
6616
+ .filter(Boolean)
6617
+ .join("\n")
6618
+ );
6619
+ return 0;
6620
+ }
6621
+ case "new": {
6622
+ // A new demo org on a farm phantom's domain. It takes minutes (Pages' first build, the certificate), so
6623
+ // each call works for a bounded time and says what it waits for; this calls again until done.
6624
+ const domain = requirePositional(positionals, 1, "domain");
6625
+ const body = compact({
6626
+ domain,
6627
+ name: flagStr(flags.name),
6628
+ brief: flagStr(flags.brief),
6629
+ full: flagBool(flags.full) || undefined,
6630
+ });
6631
+ for (let attempt = 0; ; attempt++) {
6632
+ const r = await staffPost(ctx, `${DEMO}/orgs`, body);
6633
+ if (r.status === "done" || flagBool(flags["no-wait"]) || attempt >= 12) {
6634
+ printResult(io, flags, r, (x) =>
6635
+ [
6636
+ `${x.status === "done" ? "READY" : "WAITING"} ${x.name} ${x.domain} ${x.org_id} (${x.stage})`,
6637
+ x.waiting_for
6638
+ ? ` waiting for: ${x.waiting_for} (run the same command again to carry on)`
6639
+ : "",
6640
+ x.repo ? ` repo: ${x.repo} ${x.pages_url}` : "",
6641
+ ...x.notes.map((n) => ` ${n}`),
6642
+ ]
6643
+ .filter(Boolean)
6644
+ .join("\n")
6645
+ );
6646
+ return r.status === "done" ? 0 : 1;
6647
+ }
6648
+ io.log(`waiting for ${r.waiting_for} …`);
6649
+ }
6650
+ }
6651
+ case "teardown": {
6652
+ const orgId = requirePositional(positionals, 1, "org-id");
6653
+ const r = await staffPost(
6654
+ ctx,
6655
+ `${DEMO}/${encodeURIComponent(orgId)}/teardown`,
6656
+ compact({ delete_repo: flagBool(flags["keep-repo"]) ? false : undefined })
6657
+ );
6658
+ printResult(io, flags, r, (x) => [`Torn down: ${x.domain}`, ...x.notes.map((n) => ` ${n}`)].join("\n"));
6659
+ return 0;
6660
+ }
6606
6661
  case "bootstrap": {
6607
6662
  // Several test orgs set up from one that already is: enrolled, its saved scenarios copied. Never
6608
6663
  // turns auto-reset on, so each resets only when someone resets it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.176.17",
3
+ "version": "0.176.18",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",