@letterstory/cli 0.177.209 → 0.177.211

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.209";
96
+ export const VERSION = "0.177.211";
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;
@@ -249,6 +249,8 @@ export const BOOLEAN_FLAGS = new Set([
249
249
  "keys",
250
250
  // login: one-link device sign-in instead of the loopback browser flow.
251
251
  "device",
252
+ // site screenshot: the whole page, not the first screen.
253
+ "full-page",
252
254
  "json",
253
255
  // sim seed: make the new seed active; collections it doesn't cover start empty.
254
256
  "activate",
@@ -2082,6 +2084,10 @@ The Site (one model of your whole marketing site, keyed by host and path):
2082
2084
  Staff: any company's site, no account: what Fix would list, each PR
2083
2085
  site suggest <host> --idea <id> | --draft-id <id>... | --pattern <folder> | --item <id> --path <path>
2084
2086
  Open PR on a suggestion the Site stores, as one job
2087
+ site screenshot [url] [--run <id>] [--path <p>] [--viewport desktop|phone] [--full-page]
2088
+ A screenshot of a page of your site or a build's preview
2089
+ site speed [url] [--run <id>] [--path <p>] [--viewport mobile|desktop]
2090
+ How fast a page loads now: LCP, CLS, INP, TTFB
2085
2091
 
2086
2092
  Repo changes (Claude Code edits your repo in a sandbox; the Letter GitHub App opens a PR):
2087
2093
  repo repos [--gitlab [--search <text>] [--page n]] Repos the Letter GitHub App can reach (--gitlab: the GitLab
@@ -2108,6 +2114,7 @@ Repo changes (Claude Code edits your repo in a sandbox; the Letter GitHub App op
2108
2114
  automate add --template … --slack-channel <C…>
2109
2115
  repo slack-targets Slack channels and people Send to Slack can use, with ids
2110
2116
  repo slack-test Post a test into the Send to Slack channel
2117
+ repo slack-delete <Slack message link> Delete a message Letter posted (only Letter's own)
2111
2118
  repo start --repo <owner/name> [--gitlab] --instructions <text>|--instructions-file <path|-> [--page <path>]...
2112
2119
  [--branch <base>] [--attach <path>]... [--attach-url <name>=<https url>]...
2113
2120
  [--attach-ref <path>]... [--attach-url-ref <name>=<https url>]...
@@ -2147,6 +2154,7 @@ Repo changes (Claude Code edits your repo in a sandbox; the Letter GitHub App op
2147
2154
  repo delete-secret --repo <owner/name> [--gitlab] --secret <KEY>
2148
2155
  Delete one
2149
2156
  repo status <run-id> Phase, spend, PR link and Claude's summary
2157
+ repo deploy <PR link | owner/repo#12> | --run <id> Whether a merged pull request is live on the site
2150
2158
  repo activity <run-id> [--follow] [--since <iso>] What the sandbox is doing, line by line (--follow: until it stops)
2151
2159
  repo say <run-id> <message…> Tell a running build something; it carries on with it
2152
2160
  repo list [--status running|succeeded|no_changes|failed|cancelled] [--limit n] [--audit <id>]
@@ -76,6 +76,13 @@ function issueList(flags) {
76
76
  }
77
77
 
78
78
  const ARGS = {
79
+ get_deploy_status: {
80
+ pull_request: { positional: 0, label: "pull request link or owner/repo#12" },
81
+ run_id: "run",
82
+ },
83
+ delete_slack_message: {
84
+ message: { positional: 0, required: true, label: "Slack message link" },
85
+ },
79
86
  start_repo_change: {
80
87
  provider,
81
88
  repo_owner: { value: (flags) => splitRepo(flags).owner },
@@ -455,9 +462,13 @@ export async function cmdRepo(ctx) {
455
462
  return repoSlackTargets(rest);
456
463
  case "slack-test":
457
464
  return repoSlackTest(rest);
465
+ case "slack-delete":
466
+ return repoSlackDelete(rest);
467
+ case "deploy":
468
+ return repoDeploy(rest);
458
469
  default:
459
470
  throw new CliError(
460
- `Unknown repo subcommand: ${sub ?? "(none)"}. Try: start, fix-audit, install-letterprove, install-visitors, sites, set-site, reset-site, secrets, set-secret, delete-secret, status, list, publish, merge, retry, revise, address-reviews, say, cancel, repos, branches, prs, settings, suggestions, slack-targets, slack-test, connect, disconnect`
471
+ `Unknown repo subcommand: ${sub ?? "(none)"}. Try: start, fix-audit, install-letterprove, install-visitors, sites, set-site, reset-site, secrets, set-secret, delete-secret, status, deploy, list, publish, merge, retry, revise, address-reviews, say, cancel, repos, branches, prs, settings, suggestions, slack-targets, slack-test, slack-delete, connect, disconnect`
461
472
  );
462
473
  }
463
474
  }
@@ -722,6 +733,34 @@ async function repoStatus(ctx) {
722
733
  return 0;
723
734
  }
724
735
 
736
+ /** `repo deploy <pull request link | owner/repo#12> | --run <id>`: is the merge live on the site. */
737
+ async function repoDeploy(ctx) {
738
+ const { client, flags, io } = ctx;
739
+ refuseUnknownFlags(ctx, ARGS.get_deploy_status);
740
+ const result = await client.callTool(
741
+ "get_deploy_status",
742
+ argsFromFlags(ARGS.get_deploy_status, flags, ctx.positionals)
743
+ );
744
+ printResult(io, flags, result, (r) =>
745
+ [`${r.repo}#${r.pr_number}: ${r.state}`, ` ${r.message}`, r.deploy_url ? ` ${r.deploy_url}` : null]
746
+ .filter(Boolean)
747
+ .join("\n")
748
+ );
749
+ return 0;
750
+ }
751
+
752
+ /** `repo slack-delete <Slack message link>`: take down a message Letter posted. Only Letter's own. */
753
+ async function repoSlackDelete(ctx) {
754
+ const { client, flags, io } = ctx;
755
+ refuseUnknownFlags(ctx, ARGS.delete_slack_message);
756
+ const result = await client.callTool(
757
+ "delete_slack_message",
758
+ argsFromFlags(ARGS.delete_slack_message, flags, ctx.positionals)
759
+ );
760
+ printResult(io, flags, result, (r) => `Deleted: ${r.text}`);
761
+ return 0;
762
+ }
763
+
725
764
  const ACTIVITY_MARK = { progress: "·", stage: "▸", say: "»", think: "◇", tool: "$", user: ">", error: "!" };
726
765
 
727
766
  /** `repo activity <run-id> [--follow] [--since <iso>]`: the build's feed; --follow prints new lines until it stops. */
@@ -17,7 +17,7 @@
17
17
  // site highlight <domain> [--off] → set_competitor_highlight
18
18
  // site prospect <url> → read_prospect_site (staff: any company's site, no account, nothing stored)
19
19
  // site suggest <host> --idea <id> | --draft-id <id>… | --pattern <folder> | --item <id> --path <p>
20
- // | --new-page <folder> --words "<what the page is>" [--auto-merge | --keep-open] → start_suggestion
20
+ // | --new-page <folder> --words "<what the page is>" [--merge once_ready|window|by_hand] → start_suggestion
21
21
 
22
22
  import { writeFileSync } from "node:fs";
23
23
 
@@ -58,6 +58,19 @@ function proposalInput(flags) {
58
58
 
59
59
  const ARGS = {
60
60
  list_sites: {},
61
+ screenshot_page: {
62
+ url: { positional: 0, label: "url" },
63
+ run_id: "run",
64
+ path: "path",
65
+ device: { flag: "viewport", enum: ["desktop", "phone"] },
66
+ full_page: { flag: "full-page", type: "bool" },
67
+ },
68
+ test_page_speed: {
69
+ url: { positional: 0, label: "url" },
70
+ run_id: "run",
71
+ path: "path",
72
+ device: { flag: "viewport", enum: ["mobile", "desktop"] },
73
+ },
61
74
  map_site: {
62
75
  host: { positional: 0, label: "host" },
63
76
  url: "url",
@@ -216,7 +229,9 @@ const ARGS = {
216
229
  return folder ? { folder: String(folder), words: String(words ?? "") } : undefined;
217
230
  },
218
231
  },
219
- // --auto-merge / --keep-open: the Auto-merge box; left out, the organization's default.
232
+ // --merge once_ready | window | by_hand: Build's merge box; --auto-merge / --keep-open, its older two-way form.
233
+ // Left out, the organization's default.
234
+ merge: { flag: "merge", enum: ["once_ready", "window", "by_hand"] },
220
235
  auto_merge: { flag: "auto-merge", type: "bool", negate: "keep-open" },
221
236
  },
222
237
  fix_site_observations: {
@@ -298,9 +313,13 @@ export async function cmdSite(ctx) {
298
313
  return siteProspect(rest);
299
314
  case "suggest":
300
315
  return siteSuggest(rest);
316
+ case "screenshot":
317
+ return siteScreenshot(rest);
318
+ case "speed":
319
+ return siteSpeed(rest);
301
320
  default:
302
321
  throw new CliError(
303
- `Unknown site subcommand: ${sub ?? "(none)"}. Try: list, map, refresh, unmap, tree, facts, builds, metrics, page, observations, observe, dismiss, families, decide-family, proposals, propose, decide, fix, competitors, watch-competitors, highlight, prospect, suggest`
322
+ `Unknown site subcommand: ${sub ?? "(none)"}. Try: list, map, refresh, unmap, tree, facts, builds, metrics, page, observations, observe, dismiss, families, decide-family, proposals, propose, decide, fix, competitors, watch-competitors, highlight, prospect, suggest, screenshot, speed`
304
323
  );
305
324
  }
306
325
  }
@@ -489,6 +508,43 @@ async function siteUnmap(ctx) {
489
508
  return 0;
490
509
  }
491
510
 
511
+ /** `site screenshot [url] [--run <id>] [--path /p] [--viewport desktop|phone] [--full-page]`: a picture of the page, as a link. */
512
+ async function siteScreenshot(ctx) {
513
+ const { client, flags, io } = ctx;
514
+ refuseUnknownFlags(ctx, ARGS.screenshot_page);
515
+ const result = await client.callTool(
516
+ "screenshot_page",
517
+ argsFromFlags(ARGS.screenshot_page, flags, ctx.positionals)
518
+ );
519
+ printResult(
520
+ io,
521
+ flags,
522
+ result,
523
+ (r) => `${r.url} (${r.device})\n${r.image_url}\nThe link opens until ${r.expires_at}.`
524
+ );
525
+ return 0;
526
+ }
527
+
528
+ /** `site speed [url] [--run <id>] [--path /p] [--viewport mobile|desktop]`: how fast the page loads now. */
529
+ async function siteSpeed(ctx) {
530
+ const { client, flags, io } = ctx;
531
+ refuseUnknownFlags(ctx, ARGS.test_page_speed);
532
+ const result = await client.callTool(
533
+ "test_page_speed",
534
+ argsFromFlags(ARGS.test_page_speed, flags, ctx.positionals)
535
+ );
536
+ const n = (v, unit = " ms") => (v === null ? "-" : `${v}${unit}`);
537
+ printResult(io, flags, result, (r) =>
538
+ [
539
+ `${r.url} (${r.device}): performance ${n(r.performance_score, "")}`,
540
+ ` LCP ${n(r.lcp_ms)} CLS ${n(r.cls, "")} INP ${n(r.inp_ms)} TTFB ${n(r.ttfb_ms)}`,
541
+ ` FCP ${n(r.fcp_ms)} TBT ${n(r.tbt_ms)} Speed Index ${n(r.speed_index_ms)}`,
542
+ ...r.opportunities.map((o) => ` · ${o.title}${o.saving ? ` (${o.saving})` : ""}`),
543
+ ].join("\n")
544
+ );
545
+ return 0;
546
+ }
547
+
492
548
  async function siteFacts(ctx) {
493
549
  const { client, flags, io } = ctx;
494
550
  refuseUnknownFlags(ctx, ARGS.get_site_facts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.177.209",
3
+ "version": "0.177.211",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",