@letterstory/cli 0.177.167 → 0.177.168

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
@@ -93,7 +93,7 @@ import {
93
93
  import { fetchParkedSections, withoutParked } from "./parked.mjs";
94
94
 
95
95
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
96
- export const VERSION = "0.177.167";
96
+ export const VERSION = "0.177.168";
97
97
 
98
98
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
99
99
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -32,6 +32,7 @@
32
32
  // letterstory visits transact test "What does it cost?"
33
33
  // letterstory visits transact asks [--since 7d] [--limit 50]
34
34
  // letterstory visits transact learnings [--since 7d]
35
+ // letterstory visits transact site [publish|unpublish] [--domain ask.acme.com | --domain none] the agent-optimized site
35
36
 
36
37
  import { CliError } from "../client.mjs";
37
38
  import { flagStr, printResult, argsFromFlags } from "./shared.mjs";
@@ -193,6 +194,15 @@ export const ARGS = {
193
194
  },
194
195
  visitors_list_transact_asks: { site_id: "site", days, limit: { flag: "limit", type: "num" } },
195
196
  visitors_get_transact_learnings: { site_id: "site", days },
197
+ visitors_get_agent_site: { site_id: "site" },
198
+ visitors_set_agent_site: {
199
+ site_id: "site",
200
+ publish: { value: (flags, positionals) => ({ publish: true, unpublish: false })[positionals[0]] },
201
+ domain: {
202
+ value: (flags) =>
203
+ typeof flags.domain !== "string" ? undefined : flags.domain === "none" ? null : flags.domain,
204
+ },
205
+ },
196
206
  visitors_export: {
197
207
  site_id: "site",
198
208
  days,
@@ -367,7 +377,7 @@ function transactLines(t) {
367
377
  return lines;
368
378
  }
369
379
 
370
- /** `visits transact`: read it; `on` / `off`; `add <kind> …`; `source <id>`; `search "…"`; `remove <id>`; `test "…"`; `pr`; `asks`; `learnings`. */
380
+ /** `visits transact`: read it; `on` / `off`; `add <kind> …`; `source <id>`; `search "…"`; `remove <id>`; `test "…"`; `pr`; `asks`; `learnings`; `site`. */
371
381
  async function visitsTransact(ctx) {
372
382
  const { flags, io } = ctx;
373
383
  const sub = ctx.positionals[0];
@@ -441,6 +451,24 @@ async function visitsTransact(ctx) {
441
451
  printResult(io, flags, await call(rest, "visitors_open_transact_pr"));
442
452
  return 0;
443
453
  }
454
+ if (sub === "site") {
455
+ const write =
456
+ rest.positionals[0] === "publish" || rest.positionals[0] === "unpublish" || flags.domain !== undefined;
457
+ const result = await call(rest, write ? "visitors_set_agent_site" : "visitors_get_agent_site");
458
+ printResult(io, flags, result, (r) => {
459
+ if (!r.available) return "Agent-optimized Sites aren't available yet";
460
+ if (!r.published) return "Not published";
461
+ const lines = [`Staging: ${r.staging_url}`];
462
+ if (r.domain) {
463
+ lines.push(`Domain: ${r.domain.name} (${r.domain.status})`);
464
+ if (r.domain.status === "pending")
465
+ for (const rec of r.domain.records) lines.push(` ${rec.type} ${rec.name} ${rec.value}`);
466
+ }
467
+ lines.push(`${r.questions.length} questions`, ...r.questions.map((q) => ` ${q.question} ${q.url}`));
468
+ return lines.join("\n");
469
+ });
470
+ return 0;
471
+ }
444
472
  if (sub === "learnings") {
445
473
  const result = await call(rest, "visitors_get_transact_learnings");
446
474
  printResult(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.177.167",
3
+ "version": "0.177.168",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",