@letterstory/cli 0.176.13 → 0.176.15

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
@@ -80,7 +80,7 @@ import {
80
80
  import { fetchParkedSections, withoutParked } from "./parked.mjs";
81
81
 
82
82
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
83
- export const VERSION = "0.176.13";
83
+ export const VERSION = "0.176.15";
84
84
 
85
85
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
86
86
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -89,6 +89,8 @@ export const EXIT_PAYMENT_REQUIRED = 3;
89
89
  // can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
90
90
  // `negate` spelling) in a command's ARGS map must be listed; boolean-flags.test.ts enforces it.
91
91
  export const BOOLEAN_FLAGS = new Set([
92
+ // build list: also move the builds' open changes along while polling.
93
+ "advance",
92
94
  // automations set: stop reading a data feed.
93
95
  "no-reads",
94
96
  // vary start: pause the test running on the page first.
@@ -380,6 +382,12 @@ export const BOOLEAN_FLAGS = new Set([
380
382
  // A flag repeated more than once (e.g. `--topic a --topic b`, used by `strategy
381
383
  // positioning set`) accumulates into an array; a single occurrence stays a plain
382
384
  // string, so every existing single-value flag read is unaffected.
385
+ /**
386
+ * A switch that takes a VALUE under one command: `automations add|set --on "fri 09:00 America/New_York"`
387
+ * (the pin) while `on` is `automate`'s boolean. Scoped by the first word, so the global list stays.
388
+ */
389
+ const VALUE_FLAGS_BY_COMMAND = { automations: new Set(["on"]) };
390
+
383
391
  /**
384
392
  * @param {string[]} argv
385
393
  * @returns {{ positionals: string[], flags: Record<string, string | boolean | string[]> }}
@@ -387,6 +395,7 @@ export const BOOLEAN_FLAGS = new Set([
387
395
  export function parseArgs(argv) {
388
396
  const positionals = [];
389
397
  const flags = {};
398
+ const valueFlags = VALUE_FLAGS_BY_COMMAND[argv[0]] ?? new Set();
390
399
  const setFlag = (name, value) => {
391
400
  if (Object.prototype.hasOwnProperty.call(flags, name)) {
392
401
  flags[name] = [].concat(flags[name], value);
@@ -407,7 +416,7 @@ export function parseArgs(argv) {
407
416
  }
408
417
  const name = tok.slice(2);
409
418
  const next = argv[i + 1];
410
- if (BOOLEAN_FLAGS.has(name) || next === undefined || next.startsWith("--")) {
419
+ if ((BOOLEAN_FLAGS.has(name) && !valueFlags.has(name)) || next === undefined || next.startsWith("--")) {
411
420
  flags[name] = true;
412
421
  } else {
413
422
  setFlag(name, next);
@@ -10,7 +10,7 @@
10
10
  // build benchmarks → list_build_benchmarks (staff only; --id <uuid> for one)
11
11
  // build list → list_growth_builds (newest first; --site, --kind, --open/--archived)
12
12
  // build status <id> → list_growth_builds (one build: its steps, previews and PRs)
13
- // build follow <id> → list_growth_builds + get_repo_change_activity, until nothing is at work
13
+ // build follow <id> → list_growth_builds (advance) + get_repo_change_activity, until nothing is at work
14
14
  // build conversations → list_build_conversations
15
15
  // build conversation <id> → get_build_conversation (--build <id> for the one holding a build)
16
16
 
@@ -51,6 +51,8 @@ const ARGS = {
51
51
  repo: "repo",
52
52
  // --action build|build_pr|build_merge: how a build this message starts is delivered (Letter Edit's auto-merge sends build_merge).
53
53
  delivery: { flag: "action", enum: ["build", "build_pr", "build_merge"] },
54
+ // --intent build: the words are a command to make the change (what ⌘L's Make Pull Request sends), never answered with only a reply.
55
+ intent: { flag: "intent", enum: ["build"] },
54
56
  },
55
57
  cancel_growth_build: { id: { positional: 0, required: true, label: "build-id" } },
56
58
  start_build_benchmark: {
@@ -72,6 +74,8 @@ const ARGS = {
72
74
  domain: "site",
73
75
  // --archived: Build's Archived tab; --open: its Open tab; neither: both.
74
76
  archived: { flag: "archived", type: "bool", negate: "open" },
77
+ // --advance: also move the builds' open changes along while polling (a queued change takes its sandbox, a merge asked for its next step).
78
+ advance: { flag: "advance", type: "bool" },
75
79
  },
76
80
  list_build_conversations: { limit: { flag: "limit", type: "num" } },
77
81
  get_build_conversation: {
@@ -192,6 +196,7 @@ async function buildTalk(ctx) {
192
196
  "harness",
193
197
  "repo",
194
198
  "action",
199
+ "intent",
195
200
  ...FILE_FLAGS,
196
201
  ]);
197
202
  const files = await attachedFiles(ctx);
@@ -232,7 +237,7 @@ async function readBuild(client, args) {
232
237
  /** `build list`: the organization's builds, newest first. */
233
238
  async function buildList(ctx) {
234
239
  const { client, flags, io } = ctx;
235
- refuseUnknownFlags(ctx, {}, ["limit", "kind", "site", "archived", "open"]);
240
+ refuseUnknownFlags(ctx, {}, ["limit", "kind", "site", "archived", "open", "advance"]);
236
241
  const args = argsFromFlags(ARGS.list_growth_builds, flags, []);
237
242
  const result = await client.callTool("list_growth_builds", args);
238
243
  printResult(io, flags, result, (r) =>
@@ -269,7 +274,8 @@ const FEED_MARK = { progress: "·", stage: "▸", say: "»", think: "◇", tool:
269
274
  async function buildFollow(ctx) {
270
275
  const { client, flags, io } = ctx;
271
276
  refuseUnknownFlags(ctx, {}, []);
272
- const args = argsFromFlags(ARGS.list_growth_builds, {}, ctx.positionals);
277
+ // Following is watching: each read also moves the build's open changes along, as the Build page's poll does.
278
+ const args = { ...argsFromFlags(ARGS.list_growth_builds, {}, ctx.positionals), advance: true };
273
279
  if (!args.id) throw new CliError("Missing required <build-id>");
274
280
  const emit = (event, text) => io.log(flags.json ? JSON.stringify(event) : text);
275
281
  const since = new Map(); // run id → the newest line's `at`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.176.13",
3
+ "version": "0.176.15",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",