@letterstory/cli 0.176.17 → 0.176.19

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.19";
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.
@@ -143,7 +143,7 @@ async function orgBilling(ctx) {
143
143
  [
144
144
  r.spendCap
145
145
  ? `Spend cap: ${usd(r.spendCap.usd)} of overage a month${r.spendCap.usd === 0 ? " (work stops at the allowance)" : ""}.${r.alert === "failed" ? " The alerts couldn't be moved; the cap holds." : ""}`
146
- : "No spend cap: overage is on.",
146
+ : "No spend cap is set, so overage is on",
147
147
  // The period as the cap leaves it: a cap under the overage already used stops new work now.
148
148
  ...(r.standing?.note ? [r.standing.note] : []),
149
149
  ].join("\n")
@@ -239,7 +239,7 @@ export function billingAccountText(r) {
239
239
  r.plan
240
240
  ? `Plan: ${r.plan.name}${r.plan.ratio !== 1 ? ` (${r.plan.ratio}x)` : ""}${ended ? `, cancelled${r.canceledAt ? ` on ${r.canceledAt.slice(0, 10)}` : ""}.` : r.endsAt ? `, cancelled: ends on ${r.endsAt.slice(0, 10)}.` : ""}`
241
241
  : f
242
- ? "On free tokens: no card yet."
242
+ ? "On free tokens, with no plan yet"
243
243
  : "Not billed by usage yet.",
244
244
  // A free account (no card): its balance, its grants, and whether new work needs a card now.
245
245
  ...(f
@@ -250,8 +250,8 @@ export function billingAccountText(r) {
250
250
  ` +${formatCount(g.tokens)} ${g.source}${g.sourceKey !== g.source ? `: ${g.sourceKey}` : ""}${g.channel === "agent" ? " (an agent signed you up)" : ""} ${g.createdAt.slice(0, 10)}`
251
251
  ),
252
252
  f.cardRequired
253
- ? "No free tokens left: new work needs a card. An admin adds one in Settings → Billing."
254
- : "When they run out, new work needs a card (an admin adds one in Settings → Billing).",
253
+ ? "No free tokens are left, so new work can start once an admin picks a plan in Settings → Billing"
254
+ : "When they run out, new work can start only once an admin picks a plan in Settings → Billing",
255
255
  ]
256
256
  : []),
257
257
  // What an ended plan left owing (earlierPlan): until it is settled a card can't start a new plan, so
@@ -263,8 +263,8 @@ export function billingAccountText(r) {
263
263
  ...(r.addCard && !r.earlierPlan
264
264
  ? [
265
265
  r.addCard.lockedBy
266
- ? `Paying by card starts ${r.addCard.planName}, at ${formatMoney(r.addCard.monthlyUsd)} a month (a signup from ${r.addCard.lockedBy} is in progress): an admin pays in Settings → Billing.`
267
- : `Pay by card: an admin picks a plan in Settings → Billing.${r.addCard.tokensPerMonth ? ` At your usage (about ${formatCount(r.addCard.tokensPerMonth)} tokens a month):` : ""}`,
266
+ ? `This workspace starts on ${r.addCard.planName}, ${formatMoney(r.addCard.monthlyUsd)} a month (a signup from ${r.addCard.lockedBy} is in progress), and an admin pays by card in Settings → Billing`
267
+ : `Plans an admin can start by card in Settings → Billing${r.addCard.tokensPerMonth ? `, priced at your usage (about ${formatCount(r.addCard.tokensPerMonth)} tokens a month)` : ""}:`,
268
268
  ...(r.addCard.lockedBy ? [] : (r.addCard.plans ?? [])).map(
269
269
  (p) =>
270
270
  ` ${p.planName}${[p.badge, p.cheapestForYou ? "Cheapest for you" : null]
@@ -272,7 +272,7 @@ export function billingAccountText(r) {
272
272
  .map((b) => ` [${b}]`)
273
273
  .join(
274
274
  ""
275
- )}: ${formatMoney(p.monthlyUsd)} a month, ${formatCount(p.includedTokens)} tokens, ${formatMoney(p.usdPer1kTokens, { cents: true })} per 1,000, past the pool ${formatMoney(p.overageUsdPer1kTokens, { cents: true })} per 1,000${p.expectedMonthlyUsd !== null ? `; about ${formatMoney(Math.round(p.expectedMonthlyUsd))} a month at your usage` : ""}${p.savesUsdPerMonth ? `, saves ${formatMoney(Math.round(p.savesUsdPerMonth))} a month` : ""}.${p.tagline ? ` ${p.tagline}` : ""}${p.extras?.length ? ` ${p.extras.join(", ")}.` : ""}`
275
+ )}: ${formatMoney(p.monthlyUsd)} a month, ${formatCount(p.includedTokens)} tokens, ${formatMoney(p.usdPer1kTokens)} per 1,000, then ${formatMoney(p.overageUsdPer1kTokens)} per 1,000 past that${p.expectedMonthlyUsd !== null ? `; about ${formatMoney(Math.round(p.expectedMonthlyUsd))} a month at your usage` : ""}${p.savesUsdPerMonth ? `, saves ${formatMoney(Math.round(p.savesUsdPerMonth))} a month` : ""}.${p.tagline ? ` ${p.tagline}` : ""}${p.extras?.length ? ` ${p.extras.join(", ")}.` : ""}`
276
276
  ),
277
277
  ]
278
278
  : []),
@@ -288,7 +288,7 @@ export function billingAccountText(r) {
288
288
  : r.spendCap
289
289
  ? `Spend cap: ${usd(r.spendCap.usd)} of overage a month${u?.availableTokens != null ? `, ${formatCount(Math.max(0, u.availableTokens))} tokens left under it` : ""}.`
290
290
  : r.plan
291
- ? "No spend cap: overage is on."
291
+ ? "No spend cap is set, so overage is on"
292
292
  : null,
293
293
  ...(r.pastDueAt ? [`Past due since ${r.pastDueAt}.`] : []),
294
294
  ...(r.backgroundPause ? [r.backgroundPause.message] : []),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.176.17",
3
+ "version": "0.176.19",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",