@letterstory/cli 0.177.177 → 0.177.179

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.177";
96
+ export const VERSION = "0.177.179";
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;
@@ -102,6 +102,7 @@ export const EXIT_PAYMENT_REQUIRED = 3;
102
102
  // can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
103
103
  // `negate` spelling) in a command's ARGS map must be listed; boolean-flags.test.ts enforces it.
104
104
  export const BOOLEAN_FLAGS = new Set([
105
+ "background",
105
106
  "approve",
106
107
  "update",
107
108
  // repo list: open changes past --limit are listed unless --newest-only.
@@ -53,6 +53,14 @@ const paymentScopeArgs = {
53
53
  export const ARGS = {
54
54
  list_evidence_snapshots: { site_id: { flag: "site" } },
55
55
  draft_evidence_snapshot: {
56
+ background: { flag: "background", type: "bool" },
57
+ reply: {
58
+ value: (flags) => {
59
+ if (!flags["reply-to"] && !flags.answer) return undefined;
60
+ if (!flags["reply-to"] || !flags.answer) throw new CliError("Use --reply-to and --answer together");
61
+ return { id: flags["reply-to"], answer: flags.answer };
62
+ },
63
+ },
56
64
  fresh: { flag: "fresh", type: "bool" },
57
65
  choice_id: { flag: "choice" },
58
66
  days: { flag: "days", type: "num" },
@@ -29,12 +29,13 @@
29
29
  // letterstory visits transact search "sso" the knowledge base and the site's pages, as an ask searches them
30
30
  // letterstory visits transact remove <source-id>
31
31
  // letterstory visits transact test "What does it cost?"
32
+ // letterstory visits transact prebuild <site-id>... [--dry-run] staff: build customers' agent sites, Letter paying
32
33
  // letterstory visits transact asks [--since 7d] [--limit 50]
33
34
  // letterstory visits transact learnings [--since 7d]
34
35
  // letterstory visits transact site [publish|unpublish] [--domain ask.acme.com | --domain none] [--remove <slug>] the Agent Site tab
35
36
 
36
37
  import { CliError } from "../client.mjs";
37
- import { flagStr, printResult, argsFromFlags } from "./shared.mjs";
38
+ import { flagBool, flagStr, printResult, argsFromFlags } from "./shared.mjs";
38
39
 
39
40
  const PURPOSES = ["live", "index", "training", "automated_browser", "unknown"];
40
41
  const PATH_KINDS = ["page", "agent_file", "site_file", "asset"];
@@ -187,6 +188,10 @@ export const ARGS = {
187
188
  visitors_list_transact_asks: { site_id: "site", host: "host", days, limit: { flag: "limit", type: "num" } },
188
189
  visitors_get_transact_learnings: { site_id: "site", host: "host", days },
189
190
  visitors_get_agent_site: { site_id: "site", host: "host" },
191
+ visitors_prebuild_agent_sites: {
192
+ site_ids: { value: (flags, positionals) => (positionals.length ? positionals : undefined) },
193
+ dry_run: { value: (flags) => (flagBool(flags["dry-run"]) ? true : undefined) },
194
+ },
190
195
  visitors_set_agent_site: {
191
196
  site_id: "site",
192
197
  publish: { value: (flags, positionals) => ({ publish: true, unpublish: false })[positionals[0]] },
@@ -370,7 +375,7 @@ function transactLines(t) {
370
375
  return lines;
371
376
  }
372
377
 
373
- /** `visits transact`: read it; `on` / `off`; `add <kind> …`; `source <id>`; `search "…"`; `remove <id>`; `test "…"`; `asks`; `learnings`; `site`. */
378
+ /** `visits transact`: read it; `on` / `off`; `add <kind> …`; `source <id>`; `search "…"`; `remove <id>`; `test "…"`; `prebuild <site ids>` (staff); `asks`; `learnings`; `site`. */
374
379
  async function visitsTransact(ctx) {
375
380
  const { flags, io } = ctx;
376
381
  const sub = ctx.positionals[0];
@@ -440,6 +445,10 @@ async function visitsTransact(ctx) {
440
445
  );
441
446
  return 0;
442
447
  }
448
+ if (sub === "prebuild") {
449
+ printResult(io, flags, await call(rest, "visitors_prebuild_agent_sites"));
450
+ return 0;
451
+ }
443
452
  if (sub === "site") {
444
453
  const write =
445
454
  rest.positionals[0] === "publish" ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.177.177",
3
+ "version": "0.177.179",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",