@letterstory/cli 0.176.18 → 0.176.20

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
@@ -81,7 +81,7 @@ import {
81
81
  import { fetchParkedSections, withoutParked } from "./parked.mjs";
82
82
 
83
83
  // Matches cli/package.json; publish-cli.yml rewrites both to the published version.
84
- export const VERSION = "0.176.18";
84
+ export const VERSION = "0.176.20";
85
85
 
86
86
  /** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
87
87
  export const EXIT_PAYMENT_REQUIRED = 3;
@@ -120,6 +120,8 @@ export const BOOLEAN_FLAGS = new Set([
120
120
  "again",
121
121
  // build list: only Build's Archived tab (--open, already listed, is its Open tab).
122
122
  "archived",
123
+ // plan pending --queued: only the rows a person queued for later.
124
+ "queued",
123
125
  // ask --web: read the web in the Plan's fit for a recipe the facts can't decide (off by default).
124
126
  "web",
125
127
  "notify-slack",
@@ -1649,6 +1651,11 @@ Insights:
1649
1651
  them; each pick waits --veto-hours for a veto. Settings shown when none given.
1650
1652
  plan pending [--site host] What Auto-Plan picked and is waiting to build
1651
1653
  plan veto <proposal-id> Veto one: it is never built
1654
+ plan later <action-id> [--outcome geo|…] [--site host] Queue a Plan row for later: Auto-Plan starts it once it's ready
1655
+ plan later remove <queued-id> Take a queued row back off
1656
+ plan strategies [--site host] [--archived] The goals typed on the Plan, each a strategy
1657
+ plan strategy add "<words…>" [--site host] Keep a goal in your words as a strategy
1658
+ plan strategy archive <strategy-id> [--restore] Put one away (its card leaves the Plan), or bring it back
1652
1659
  insights summary [--period …] [--part <block>]... Measure Overview: AI named/cited rates, share of voice, search, targets
1653
1660
  insights reads [--period …] [--site all|own|phantoms|<key>]... [--path <path>] [--engine <operator>]
1654
1661
  Measure → Reads: AI engines and people reading your sites, counted one way
@@ -2,6 +2,7 @@
2
2
  // this account do next. The same answer as the console's Plan, Build and Fix tabs and Slack.
3
3
  // ask → each list's head: what's broken, what to build
4
4
  // ask --outcome geo|seo|… → the plan for that outcome (the Plan tab's box)
5
+ // ask --strategy <id> → a typed strategy's next actions (plan strategies)
5
6
  // ask --lens fix | --lens build → what's broken (most pressing first) | what to build
6
7
  // ask "<words…>" → in your own words; what nothing does comes back as unmet
7
8
  // ask "<words…>" --found "<…>" → with what you read outside the account for them (a case study)
@@ -12,6 +13,8 @@ import { argsFromFlags, flagStr, printResult, refuseUnknownFlags } from "./share
12
13
  export const ARGS = {
13
14
  ask_letterpress: {
14
15
  outcome: "outcome",
16
+ // --strategy <id>: a typed strategy's next actions (plan strategies), the same door as its words.
17
+ strategy_id: "strategy",
15
18
  lens: "lens",
16
19
  words: { value: (flags, positionals) => flagStr(flags.words) ?? (positionals.join(" ").trim() || undefined) },
17
20
  // --found: what was read outside the account for the words (a case study, a competitor), as findings.
@@ -24,10 +27,10 @@ export const ARGS = {
24
27
 
25
28
  export async function cmdAsk(ctx) {
26
29
  const { client, flags, io } = ctx;
27
- refuseUnknownFlags(ctx, {}, ["outcome", "lens", "words", "found", "site", "refresh"]);
30
+ refuseUnknownFlags(ctx, {}, ["outcome", "strategy", "lens", "words", "found", "site", "refresh"]);
28
31
  const args = argsFromFlags(ARGS.ask_letterpress, flags, ctx.positionals, {});
29
- if ([args.outcome, args.lens, args.words].filter(Boolean).length > 1)
30
- throw new CliError("One ask at a time: --outcome, --lens fix|build, or your words.");
32
+ if ([args.outcome, args.strategy_id, args.lens, args.words].filter(Boolean).length > 1)
33
+ throw new CliError("One ask at a time: --outcome, --strategy <id>, --lens fix|build, or your words.");
31
34
  const result = await client.callTool("ask_letterpress", args);
32
35
  printResult(io, flags, result, (r) => {
33
36
  const lines = [r.message];
@@ -143,7 +143,7 @@ async function orgBilling(ctx) {
143
143
  [
144
144
  r.spendCap
145
145
  ? `Spend cap: ${usd(r.spendCap.usd)} of overage a month${r.spendCap.usd === 0 ? " (work stops at the allowance)" : ""}.${r.alert === "failed" ? " The alerts couldn't be moved; the cap holds." : ""}`
146
- : "No spend cap: overage is on.",
146
+ : "No spend cap is set, so overage is on",
147
147
  // The period as the cap leaves it: a cap under the overage already used stops new work now.
148
148
  ...(r.standing?.note ? [r.standing.note] : []),
149
149
  ].join("\n")
@@ -239,7 +239,7 @@ export function billingAccountText(r) {
239
239
  r.plan
240
240
  ? `Plan: ${r.plan.name}${r.plan.ratio !== 1 ? ` (${r.plan.ratio}x)` : ""}${ended ? `, cancelled${r.canceledAt ? ` on ${r.canceledAt.slice(0, 10)}` : ""}.` : r.endsAt ? `, cancelled: ends on ${r.endsAt.slice(0, 10)}.` : ""}`
241
241
  : f
242
- ? "On free tokens: no card yet."
242
+ ? "On free tokens, with no plan yet"
243
243
  : "Not billed by usage yet.",
244
244
  // A free account (no card): its balance, its grants, and whether new work needs a card now.
245
245
  ...(f
@@ -250,8 +250,8 @@ export function billingAccountText(r) {
250
250
  ` +${formatCount(g.tokens)} ${g.source}${g.sourceKey !== g.source ? `: ${g.sourceKey}` : ""}${g.channel === "agent" ? " (an agent signed you up)" : ""} ${g.createdAt.slice(0, 10)}`
251
251
  ),
252
252
  f.cardRequired
253
- ? "No free tokens left: new work needs a card. An admin adds one in Settings → Billing."
254
- : "When they run out, new work needs a card (an admin adds one in Settings → Billing).",
253
+ ? "No free tokens are left, so new work can start once an admin picks a plan in Settings → Billing"
254
+ : "When they run out, new work can start only once an admin picks a plan in Settings → Billing",
255
255
  ]
256
256
  : []),
257
257
  // What an ended plan left owing (earlierPlan): until it is settled a card can't start a new plan, so
@@ -263,8 +263,8 @@ export function billingAccountText(r) {
263
263
  ...(r.addCard && !r.earlierPlan
264
264
  ? [
265
265
  r.addCard.lockedBy
266
- ? `Paying by card starts ${r.addCard.planName}, at ${formatMoney(r.addCard.monthlyUsd)} a month (a signup from ${r.addCard.lockedBy} is in progress): an admin pays in Settings → Billing.`
267
- : `Pay by card: an admin picks a plan in Settings → Billing.${r.addCard.tokensPerMonth ? ` At your usage (about ${formatCount(r.addCard.tokensPerMonth)} tokens a month):` : ""}`,
266
+ ? `This workspace starts on ${r.addCard.planName}, ${formatMoney(r.addCard.monthlyUsd)} a month (a signup from ${r.addCard.lockedBy} is in progress), and an admin pays by card in Settings → Billing`
267
+ : `Plans an admin can start by card in Settings → Billing${r.addCard.tokensPerMonth ? `, priced at your usage (about ${formatCount(r.addCard.tokensPerMonth)} tokens a month)` : ""}:`,
268
268
  ...(r.addCard.lockedBy ? [] : (r.addCard.plans ?? [])).map(
269
269
  (p) =>
270
270
  ` ${p.planName}${[p.badge, p.cheapestForYou ? "Cheapest for you" : null]
@@ -272,7 +272,7 @@ export function billingAccountText(r) {
272
272
  .map((b) => ` [${b}]`)
273
273
  .join(
274
274
  ""
275
- )}: ${formatMoney(p.monthlyUsd)} a month, ${formatCount(p.includedTokens)} tokens, ${formatMoney(p.usdPer1kTokens, { cents: true })} per 1,000, past the pool ${formatMoney(p.overageUsdPer1kTokens, { cents: true })} per 1,000${p.expectedMonthlyUsd !== null ? `; about ${formatMoney(Math.round(p.expectedMonthlyUsd))} a month at your usage` : ""}${p.savesUsdPerMonth ? `, saves ${formatMoney(Math.round(p.savesUsdPerMonth))} a month` : ""}.${p.tagline ? ` ${p.tagline}` : ""}${p.extras?.length ? ` ${p.extras.join(", ")}.` : ""}`
275
+ )}: ${formatMoney(p.monthlyUsd)} a month, ${formatCount(p.includedTokens)} tokens, ${formatMoney(p.usdPer1kTokens)} per 1,000, then ${formatMoney(p.overageUsdPer1kTokens)} per 1,000 past that${p.expectedMonthlyUsd !== null ? `; about ${formatMoney(Math.round(p.expectedMonthlyUsd))} a month at your usage` : ""}${p.savesUsdPerMonth ? `, saves ${formatMoney(Math.round(p.savesUsdPerMonth))} a month` : ""}.${p.tagline ? ` ${p.tagline}` : ""}${p.extras?.length ? ` ${p.extras.join(", ")}.` : ""}`
276
276
  ),
277
277
  ]
278
278
  : []),
@@ -288,7 +288,7 @@ export function billingAccountText(r) {
288
288
  : r.spendCap
289
289
  ? `Spend cap: ${usd(r.spendCap.usd)} of overage a month${u?.availableTokens != null ? `, ${formatCount(Math.max(0, u.availableTokens))} tokens left under it` : ""}.`
290
290
  : r.plan
291
- ? "No spend cap: overage is on."
291
+ ? "No spend cap is set, so overage is on"
292
292
  : null,
293
293
  ...(r.pastDueAt ? [`Past due since ${r.pastDueAt}.`] : []),
294
294
  ...(r.backgroundPause ? [r.backgroundPause.message] : []),
@@ -5,6 +5,11 @@
5
5
  // [--aggression low|medium|high|xhigh] [--slack-channel <C…>|none] → set_auto_plan
6
6
  // plan pending → list_auto_plan_proposals (status pending)
7
7
  // plan veto <proposal-id> → veto_auto_plan_proposal
8
+ // plan later <action-id> [--outcome geo|…] → queue_plan_action (Auto-Plan starts it once it's ready)
9
+ // plan later remove <queued-id> → unqueue_plan_action
10
+ // plan strategies [--archived] → list_plan_strategies (the goals typed on the Plan)
11
+ // plan strategy add "<words…>" → create_plan_strategy
12
+ // plan strategy archive <strategy-id> → archive_plan_strategy (--restore brings it back)
8
13
 
9
14
  import { CliError } from "../client.mjs";
10
15
  import { argsFromFlags, flagStr, printResult, refuseUnknownFlags } from "./shared.mjs";
@@ -48,10 +53,26 @@ export const ARGS = {
48
53
  },
49
54
  list_auto_plan_proposals: {
50
55
  domain: "site",
51
- status: { flag: "status", enum: ["pending", "vetoed", "started", "failed"] },
56
+ status: { flag: "status", enum: ["pending", "vetoed", "started", "failed", "done"] },
57
+ queued: { flag: "queued", type: "bool" },
52
58
  limit: { flag: "limit", type: "num" },
53
59
  },
60
+ queue_plan_action: {
61
+ domain: "site",
62
+ action_id: { positional: 0, required: true, label: "action-id" },
63
+ outcome: "outcome",
64
+ },
65
+ unqueue_plan_action: { id: { positional: 0, required: true, label: "queued-id" } },
54
66
  veto_auto_plan_proposal: { id: { positional: 0, required: true, label: "proposal-id" } },
67
+ list_plan_strategies: { domain: "site", archived: { flag: "archived", type: "bool" } },
68
+ create_plan_strategy: {
69
+ domain: "site",
70
+ words: { value: (flags, positionals) => flagStr(flags.words) ?? (positionals.join(" ").trim() || undefined) },
71
+ },
72
+ archive_plan_strategy: {
73
+ id: { positional: 0, required: true, label: "strategy-id" },
74
+ archived: { value: (flags) => (flags.restore ? false : undefined) },
75
+ },
55
76
  };
56
77
 
57
78
  const SETTING_FLAGS = ["veto-hours", "auto-merge", "aggression", "slack-channel"];
@@ -70,8 +91,23 @@ export async function cmdPlan(ctx) {
70
91
  printResult(io, flags, result, (r) => r.message);
71
92
  return 0;
72
93
  }
94
+ if (sub === "later" && rest[0] === "remove") {
95
+ refuseUnknownFlags(ctx, {}, []);
96
+ const result = await client.callTool(
97
+ "unqueue_plan_action",
98
+ argsFromFlags(ARGS.unqueue_plan_action, flags, rest.slice(1))
99
+ );
100
+ printResult(io, flags, result, (r) => r.message);
101
+ return 0;
102
+ }
103
+ if (sub === "later") {
104
+ refuseUnknownFlags(ctx, {}, ["site", "outcome"]);
105
+ const result = await client.callTool("queue_plan_action", argsFromFlags(ARGS.queue_plan_action, flags, rest));
106
+ printResult(io, flags, result, (r) => r.message);
107
+ return 0;
108
+ }
73
109
  if (sub === "pending" || sub === "proposals") {
74
- refuseUnknownFlags(ctx, {}, ["site", "status", "limit"]);
110
+ refuseUnknownFlags(ctx, {}, ["site", "status", "queued", "limit"]);
75
111
  const args = argsFromFlags(ARGS.list_auto_plan_proposals, flags, rest);
76
112
  const result = await client.callTool("list_auto_plan_proposals", {
77
113
  ...(sub === "pending" ? { status: "pending" } : {}),
@@ -79,7 +115,16 @@ export async function cmdPlan(ctx) {
79
115
  });
80
116
  printResult(io, flags, result, (r) =>
81
117
  r.proposals.length
82
- ? r.proposals.map((p) => ` ${p.status.padEnd(8)} ${p.title} (builds ${p.due_at}) ${p.id}`).join("\n")
118
+ ? r.proposals
119
+ .map(
120
+ (p) =>
121
+ ` ${p.status.padEnd(8)} ${p.title} ${
122
+ p.queued_by
123
+ ? `(later${p.waits_on ? `, waits on ${p.waits_on}` : ""})`
124
+ : `(builds ${p.due_at})`
125
+ } ${p.id}`
126
+ )
127
+ .join("\n")
83
128
  : "Nothing pending."
84
129
  );
85
130
  return 0;
@@ -93,5 +138,41 @@ export async function cmdPlan(ctx) {
93
138
  printResult(io, flags, result, (r) => r.message);
94
139
  return 0;
95
140
  }
96
- throw new CliError("Usage: plan auto [settings…] | plan pending | plan veto <proposal-id>");
141
+ if (sub === "strategies") {
142
+ refuseUnknownFlags(ctx, {}, ["site", "archived"]);
143
+ const result = await client.callTool(
144
+ "list_plan_strategies",
145
+ argsFromFlags(ARGS.list_plan_strategies, flags, rest)
146
+ );
147
+ printResult(io, flags, result, (r) =>
148
+ r.strategies.length
149
+ ? r.strategies.map((s) => ` ${s.words} ${s.id}`).join("\n")
150
+ : 'No typed strategies. Add one: plan strategy add "<your goal>"'
151
+ );
152
+ return 0;
153
+ }
154
+ if (sub === "strategy") {
155
+ const action = rest[0];
156
+ if (action === "add") {
157
+ refuseUnknownFlags(ctx, {}, ["site", "words"]);
158
+ const args = argsFromFlags(ARGS.create_plan_strategy, flags, rest.slice(1));
159
+ if (!args.words) throw new CliError('Say the goal: plan strategy add "<your goal>"');
160
+ const result = await client.callTool("create_plan_strategy", args);
161
+ printResult(io, flags, result, (r) => r.message);
162
+ return 0;
163
+ }
164
+ if (action === "archive") {
165
+ refuseUnknownFlags(ctx, {}, ["restore"]);
166
+ const result = await client.callTool(
167
+ "archive_plan_strategy",
168
+ argsFromFlags(ARGS.archive_plan_strategy, flags, rest.slice(1))
169
+ );
170
+ printResult(io, flags, result, (r) => r.message);
171
+ return 0;
172
+ }
173
+ throw new CliError('Usage: plan strategy add "<words…>" | plan strategy archive <strategy-id> [--restore]');
174
+ }
175
+ throw new CliError(
176
+ "Usage: plan auto [settings…] | plan pending | plan veto <proposal-id> | plan later <action-id> | plan later remove <id> | plan strategies | plan strategy add|archive"
177
+ );
97
178
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.176.18",
3
+ "version": "0.176.20",
4
4
  "description": "Spin up and manage Letter phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",