@letterstory/cli 0.176.16 → 0.176.18

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
@@ -66,6 +66,7 @@ import {
66
66
  cmdRepo,
67
67
  cmdBuild,
68
68
  cmdAsk,
69
+ cmdPlan,
69
70
  cmdSite,
70
71
  cmdEvals,
71
72
  cmdOfferings,
@@ -80,7 +81,7 @@ import {
80
81
  import { fetchParkedSections, withoutParked } from "./parked.mjs";
81
82
 
82
83
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
83
- export const VERSION = "0.176.16";
84
+ export const VERSION = "0.176.18";
84
85
 
85
86
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
86
87
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -194,6 +195,9 @@ export const BOOLEAN_FLAGS = new Set([
194
195
  "overwrite",
195
196
  // admin demo set --clear-baseline (reset --rebuild is listed below)
196
197
  "clear-baseline",
198
+ "keep-repo",
199
+ // admin demo new --full
200
+ "full",
197
201
  "forget-company",
198
202
  "forget-site",
199
203
  "reread-company",
@@ -602,8 +606,8 @@ Reviewers:
602
606
  automate list Your automations: an event, which ones it acts on,
603
607
  and what Letterpress then does
604
608
  automate show <automation-id>
605
- automate add [--template post_new_issues|fix_new_issues|recommended_actions|competitor_pages|icp_visitors]
606
- [--name <n>] [--trigger competitor_page|visitor_identified|issue_found|build_suggestion|custom]
609
+ automate add [--template post_new_issues|fix_new_issues|recommended_actions|competitor_pages|icp_visitors|plan_updates]
610
+ [--name <n>] [--trigger competitor_page|visitor_identified|issue_found|build_suggestion|plan_update|custom]
607
611
  [--prompt <what Letterpress does with each event>] [--slack-channel <C…>] [--instruction <which events>]
608
612
  [--event <name>] [--kind post|landing] [--competitor <host>] [--site <host>]
609
613
  [--hot-leads-only] [--per-day <n>] [--off]
@@ -1073,6 +1077,15 @@ Admin (STAFF key — --staff-key / LETTERSTORY_STAFF_API_KEY; acts before an org
1073
1077
  Visitors hidden or parked; the company read and the site map
1074
1078
  forgotten (the company is kept as company_before), so the
1075
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.
1076
1089
  admin demo check <org-id> Is it ready to show? Competitors, targets, answers, the
1077
1090
  Plan's rows, the issues open, no PR open, GitHub, the
1078
1091
  phantom's site. Exits 1 when not ready.
@@ -1630,6 +1643,12 @@ Insights:
1630
1643
  Plan tab's box), what's broken (--lens fix, most pressing
1631
1644
  first), what to build (--lens build), or your own words. Nothing asked:
1632
1645
  each list's head. The same answer as the console and Slack.
1646
+ plan auto [activate|disable] [--site host] [--veto-hours <1-168>|off] [--auto-merge on|off]
1647
+ [--aggression low|medium|high|xhigh] [--slack-channel <C…>|none]
1648
+ Auto-Plan on a site: Letterpress picks its strategies and builds
1649
+ them; each pick waits --veto-hours for a veto. Settings shown when none given.
1650
+ plan pending [--site host] What Auto-Plan picked and is waiting to build
1651
+ plan veto <proposal-id> Veto one: it is never built
1633
1652
  insights summary [--period …] [--part <block>]... Measure Overview: AI named/cited rates, share of voice, search, targets
1634
1653
  insights reads [--period …] [--site all|own|phantoms|<key>]... [--path <path>] [--engine <operator>]
1635
1654
  Measure → Reads: AI engines and people reading your sites, counted one way
@@ -1652,7 +1671,7 @@ Insights:
1652
1671
  Build (a change to your site, or launching what isn't code; the Build box's own door):
1653
1672
  build <words…> [--prompt <text>] [--site <host>] [--subject <host/path>]... [--action build|build_pr|build_merge|slack|linear]
1654
1673
  [--attach <path>]... [--attach-url <name>=<https url>]... [--attach-ref <path>]... [--attach-url-ref <name>=<https url>]...
1655
- [--harness letterpress-1|claude-code|codex] [--notify-slack] [--again]
1674
+ [--harness letterpress-1|claude-code|codex] [--effort low|medium|high|xhigh] [--notify-slack] [--again]
1656
1675
  Build from your words: "add a pricing page" opens a preview or PR;
1657
1676
  "launch a phantom for us", "set up mailers" or "onboard my blog" is
1658
1677
  done by Build itself (a phantom site buys its own domain), and the
@@ -1728,11 +1747,12 @@ Repo changes (Claude Code edits your repo in a sandbox; the Letter GitHub App op
1728
1747
  [--branch <base>] [--attach <path>]... [--attach-url <name>=<https url>]...
1729
1748
  [--attach-ref <path>]... [--attach-url-ref <name>=<https url>]...
1730
1749
  [--action build|build_pr|build_merge|slack|linear] [--with-preview]
1731
- [--harness letterpress-1|claude-code|codex] [--verifier|--no-verifier] [--wait]
1750
+ [--harness letterpress-1|claude-code|codex] [--effort low|medium|high|xhigh] [--verifier|--no-verifier] [--wait]
1732
1751
  Start a change (attached files go to the sandbox;
1733
1752
  -ref ones are context, never put in the repo);
1734
1753
  --with-preview keeps a preview up next to the PR;
1735
1754
  --harness picks the coding agent (default: the deployment's);
1755
+ --effort is how hard it works (default: its own);
1736
1756
  --verifier reviews the change and has the agent fix
1737
1757
  what's blocking before it goes out;
1738
1758
  --wait follows it to the PR;
@@ -1927,6 +1947,7 @@ const CLIENT_COMMANDS = {
1927
1947
  repo: cmdRepo,
1928
1948
  build: cmdBuild,
1929
1949
  ask: cmdAsk,
1950
+ plan: cmdPlan,
1930
1951
  site: cmdSite,
1931
1952
  evals: cmdEvals,
1932
1953
  visits: cmdVisits,
@@ -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.
@@ -7,8 +7,15 @@
7
7
  import { CliError } from "../client.mjs";
8
8
  import { printResult, ok, argsFromFlags, flagList, refuseUnknownFlags } from "./shared.mjs";
9
9
 
10
- const TRIGGERS = ["competitor_page", "visitor_identified", "issue_found", "build_suggestion", "custom"];
11
- const TEMPLATES = ["post_new_issues", "fix_new_issues", "recommended_actions", "competitor_pages", "icp_visitors"];
10
+ const TRIGGERS = ["competitor_page", "visitor_identified", "issue_found", "build_suggestion", "plan_update", "custom"];
11
+ const TEMPLATES = [
12
+ "post_new_issues",
13
+ "fix_new_issues",
14
+ "recommended_actions",
15
+ "competitor_pages",
16
+ "icp_visitors",
17
+ "plan_updates",
18
+ ];
12
19
  const STATUSES = ["pending", "proposed", "acting", "acted", "skipped", "failed", "rejected"];
13
20
 
14
21
  const triggerParams = {
@@ -31,6 +31,8 @@ const ARGS = {
31
31
  delivery: { flag: "action", enum: ["build", "build_pr", "build_merge", "slack", "linear"] },
32
32
  notify_slack: { flag: "notify-slack", type: "bool" },
33
33
  harness: { flag: "harness", enum: ["letterpress-1", "claude-code", "codex"] },
34
+ // --effort low|medium|high|xhigh: how hard the coding agent works on each change; omitted, its own default.
35
+ effort: { flag: "effort", enum: ["low", "medium", "high", "xhigh"] },
34
36
  again: { flag: "again", type: "bool" },
35
37
  // --recipe <id>: the recipe the build carries out (a Plan row's), recorded on it.
36
38
  recipe: "recipe",
@@ -0,0 +1,97 @@
1
+ // `plan` — Auto-Plan on one site (Plan → Auto-Plan; Plan is scoped to one website, --site, else the
2
+ // organization's own domain). The same calls as the Plan's modal and its sidebar's Pending rows.
3
+ // plan auto → get_auto_plan
4
+ // plan auto [activate|disable] [--veto-hours <1-168>|off] [--auto-merge on|off]
5
+ // [--aggression low|medium|high|xhigh] [--slack-channel <C…>|none] → set_auto_plan
6
+ // plan pending → list_auto_plan_proposals (status pending)
7
+ // plan veto <proposal-id> → veto_auto_plan_proposal
8
+
9
+ import { CliError } from "../client.mjs";
10
+ import { argsFromFlags, flagStr, printResult, refuseUnknownFlags } from "./shared.mjs";
11
+
12
+ const onOff = (name) => (flags) => {
13
+ const v = flagStr(flags[name]);
14
+ if (v === undefined) return undefined;
15
+ if (["on", "true", "1"].includes(v)) return true;
16
+ if (["off", "false", "0"].includes(v)) return false;
17
+ throw new CliError(`--${name} takes on or off.`);
18
+ };
19
+
20
+ export const ARGS = {
21
+ get_auto_plan: { domain: "site" },
22
+ set_auto_plan: {
23
+ domain: "site",
24
+ // `plan auto activate` / `plan auto disable`.
25
+ enabled: {
26
+ value: (_flags, positionals) =>
27
+ positionals[0] === "activate" ? true : positionals[0] === "disable" ? false : undefined,
28
+ },
29
+ // --veto-hours <n> waits that long for a veto before each pick builds; --veto-hours off builds at once.
30
+ veto_hours: {
31
+ value: (flags) => {
32
+ const v = flagStr(flags["veto-hours"]);
33
+ if (v === undefined) return undefined;
34
+ if (v === "off") return null;
35
+ const n = Number(v);
36
+ if (!Number.isInteger(n)) throw new CliError("--veto-hours takes a whole number of hours, or off.");
37
+ return n;
38
+ },
39
+ },
40
+ merge: { value: onOff("auto-merge") },
41
+ aggression: { flag: "aggression", enum: ["low", "medium", "high", "xhigh"] },
42
+ slack_channel: {
43
+ value: (flags) => {
44
+ const v = flagStr(flags["slack-channel"]);
45
+ return v === undefined ? undefined : v === "none" ? null : v;
46
+ },
47
+ },
48
+ },
49
+ list_auto_plan_proposals: {
50
+ domain: "site",
51
+ status: { flag: "status", enum: ["pending", "vetoed", "started", "failed"] },
52
+ limit: { flag: "limit", type: "num" },
53
+ },
54
+ veto_auto_plan_proposal: { id: { positional: 0, required: true, label: "proposal-id" } },
55
+ };
56
+
57
+ const SETTING_FLAGS = ["veto-hours", "auto-merge", "aggression", "slack-channel"];
58
+
59
+ export async function cmdPlan(ctx) {
60
+ const { client, flags, io } = ctx;
61
+ const sub = ctx.positionals[0];
62
+ const rest = ctx.positionals.slice(1);
63
+ if (sub === "auto") {
64
+ refuseUnknownFlags(ctx, {}, ["site", ...SETTING_FLAGS]);
65
+ if (rest[0] && !["activate", "disable"].includes(rest[0]))
66
+ throw new CliError("plan auto takes activate or disable, then its settings.");
67
+ const setting = !!rest[0] || SETTING_FLAGS.some((f) => flags[f] !== undefined);
68
+ const tool = setting ? "set_auto_plan" : "get_auto_plan";
69
+ const result = await client.callTool(tool, argsFromFlags(ARGS[tool], flags, rest));
70
+ printResult(io, flags, result, (r) => r.message);
71
+ return 0;
72
+ }
73
+ if (sub === "pending" || sub === "proposals") {
74
+ refuseUnknownFlags(ctx, {}, ["site", "status", "limit"]);
75
+ const args = argsFromFlags(ARGS.list_auto_plan_proposals, flags, rest);
76
+ const result = await client.callTool("list_auto_plan_proposals", {
77
+ ...(sub === "pending" ? { status: "pending" } : {}),
78
+ ...args,
79
+ });
80
+ printResult(io, flags, result, (r) =>
81
+ r.proposals.length
82
+ ? r.proposals.map((p) => ` ${p.status.padEnd(8)} ${p.title} (builds ${p.due_at}) ${p.id}`).join("\n")
83
+ : "Nothing pending."
84
+ );
85
+ return 0;
86
+ }
87
+ if (sub === "veto") {
88
+ refuseUnknownFlags(ctx, {}, []);
89
+ const result = await client.callTool(
90
+ "veto_auto_plan_proposal",
91
+ argsFromFlags(ARGS.veto_auto_plan_proposal, flags, rest)
92
+ );
93
+ printResult(io, flags, result, (r) => r.message);
94
+ return 0;
95
+ }
96
+ throw new CliError("Usage: plan auto [settings…] | plan pending | plan veto <proposal-id>");
97
+ }
@@ -90,6 +90,8 @@ const ARGS = {
90
90
  // --harness letterpress-1|claude-code|codex: the coding agent (codex is GPT, through OpenAI's Codex CLI);
91
91
  // omitted, the organization's default.
92
92
  harness: { flag: "harness", enum: ["claude-code", "letterpress-1", "codex"] },
93
+ // --effort low|medium|high|xhigh: how hard the coding agent works; omitted, its own default.
94
+ effort: { flag: "effort", enum: ["low", "medium", "high", "xhigh"] },
93
95
  // --again: start it even when an open change already asks for the same thing.
94
96
  again: { flag: "again", type: "bool" },
95
97
  // --page <path>, repeatable or comma-separated: the pages the change is about ("/pricing"), so another change
package/lib/commands.mjs CHANGED
@@ -47,6 +47,7 @@ export * from "./commands/feedback.mjs";
47
47
  export * from "./commands/repo.mjs";
48
48
  export * from "./commands/build.mjs";
49
49
  export * from "./commands/ask.mjs";
50
+ export * from "./commands/plan.mjs";
50
51
  export * from "./commands/site.mjs";
51
52
  export * from "./commands/evals.mjs";
52
53
  export * from "./commands/visits.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.176.16",
3
+ "version": "0.176.18",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",