@letterstory/cli 0.100.1 → 0.100.4

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
@@ -59,7 +59,7 @@ import {
59
59
  } from "./commands.mjs";
60
60
 
61
61
  // Keep in sync with cli/package.json.
62
- export const VERSION = "0.100.1";
62
+ export const VERSION = "0.100.4";
63
63
 
64
64
  // Flags that never take a value. Listing them explicitly means `deploy get --json <id>`
65
65
  // can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
@@ -2838,6 +2838,8 @@ async function cmdAdminCrmCapture(ctx, paths) {
2838
2838
  * outreach add "Jane Doe" [--company …] [--owner …] [--channel x] [--relationship …]
2839
2839
  * [--ask …] [--linkedin …] [--email …] [--lookup]
2840
2840
  * outreach lookup "Jane Doe from Acme" [shot.png …] prefilled from the web; writes nothing
2841
+ * outreach relookup [--missing linkedin] the web lookup again for whoever lacks it
2842
+ * outreach customers [--dry-run] every customer's primary contact onto the list
2841
2843
  * outreach catch-up [--dry-run] handle #launch-outreach posts the bot missed
2842
2844
  * outreach set <id> [--reached|--not-reached] [--response "…" --tone positive]
2843
2845
  * [--owner-id <uuid>] [--channel …] [--ask …] [--draft "…"] [--archive|--restore]
@@ -2953,6 +2955,33 @@ async function cmdAdminCrmOutreach(ctx, args) {
2953
2955
  const r = await staffRequest(ctx, "PATCH", `${CRM}/outreach/${id}`, body);
2954
2956
  return json ? printResult(io, flags, r) : io.log(line(r));
2955
2957
  }
2958
+ case "relookup": {
2959
+ // admin crm outreach relookup [--missing linkedin|company|any] — the web lookup again,
2960
+ // filling only blanks, calling until none remain (a dozen people per call).
2961
+ const missing = flagStr(flags.missing) ?? "linkedin";
2962
+ let total = 0;
2963
+ for (let i = 0; i < 30; i++) {
2964
+ const r = await staffPost(ctx, `${CRM}/outreach/relookup`, compact({ list, missing }));
2965
+ for (const f of r.filled) io.log(`${f.name}: ${f.fields.join(", ")}`);
2966
+ total += r.looked;
2967
+ if (!r.looked || r.remaining === 0) break;
2968
+ }
2969
+ return io.log(`looked up ${total}`);
2970
+ }
2971
+ case "customers": {
2972
+ // admin crm outreach customers [--dry-run] — every customer's primary contact onto the list.
2973
+ const r = await staffPost(
2974
+ ctx,
2975
+ `${CRM}/outreach/from-accounts`,
2976
+ compact({ list, dryRun: flagBool(flags["dry-run"]) || undefined })
2977
+ );
2978
+ if (json) return printResult(io, flags, r);
2979
+ return io.log(
2980
+ r.dryRun
2981
+ ? `would add up to ${r.candidates.length}: ${r.candidates.join(", ")}`
2982
+ : `added ${r.created.length}; already on the list: ${r.duplicates.length}`
2983
+ );
2984
+ }
2956
2985
  case "catch-up": {
2957
2986
  // admin crm outreach catch-up [--dry-run] — handle #launch-outreach posts the bot
2958
2987
  // missed, calling again until none remain (each call is bounded server-side).
@@ -2982,7 +3011,9 @@ async function cmdAdminCrmOutreach(ctx, args) {
2982
3011
  return;
2983
3012
  }
2984
3013
  default:
2985
- throw new CliError("Usage: admin crm outreach [list|add|lookup|set|catch-up] … (see --help)");
3014
+ throw new CliError(
3015
+ "Usage: admin crm outreach [list|add|lookup|set|relookup|customers|catch-up] … (see --help)"
3016
+ );
2986
3017
  }
2987
3018
  }
2988
3019
 
@@ -220,9 +220,17 @@ export function formatApply(result) {
220
220
  for (const a of result.skipped) lines.push(` ${SYMBOL[a.op]} ${a.section}/${a.name} — ${a.reason}`);
221
221
  if (result.failed.length) lines.push("Failed:");
222
222
  for (const a of result.failed) lines.push(` ${SYMBOL[a.op]} ${a.section}/${a.name} — ${a.error}`);
223
- if (result.gated?.length) {
223
+ // `gated` lists every gated change, allowed or not; after a real apply, show only those still held.
224
+ // A field-gated record can land in `applied` with its gated field skipped, so check `skipped` too.
225
+ const key = (a) => `${a.op} ${a.section}/${a.name}`;
226
+ const done = new Set(result.dryRun ? [] : result.applied.map(key));
227
+ const held = (result.gated ?? []).filter(
228
+ (a) =>
229
+ !done.has(key(a)) || result.skipped.some((s) => key(s) === key(a) && s.reason.includes(`gated (${a.gate})`))
230
+ );
231
+ if (held.length) {
224
232
  lines.push(`Gated (allow with --allow; confirm ${result.confirm}):`);
225
- for (const a of result.gated) lines.push(` ${SYMBOL[a.op]} ${a.section}/${a.name} — ${a.gate}`);
233
+ for (const a of held) lines.push(` ${SYMBOL[a.op]} ${a.section}/${a.name} — ${a.gate}`);
226
234
  }
227
235
  for (const w of result.plan.warnings) lines.push(`warning: ${w}`);
228
236
  return lines.join("\n");
@@ -76,7 +76,7 @@ function describe(run) {
76
76
  const lines = [
77
77
  `${run.id} ${run.repo}@${run.baseBranch} ${run.status} (${run.phase}) $${run.costUsd.toFixed(2)}`,
78
78
  ];
79
- if (run.prUrl) lines.push(` PR: ${run.prUrl}`);
79
+ if (run.prUrl) lines.push(` PR: ${run.prUrl} (${run.prState ?? "state unknown"})`);
80
80
  if (run.errorCode) lines.push(` Error (${run.errorCode}): ${run.errorDetail ?? ""}`);
81
81
  if (run.summary) lines.push(...run.summary.split("\n").map((l) => ` ${l}`));
82
82
  return lines.join("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.100.1",
3
+ "version": "0.100.4",
4
4
  "description": "Spin up and manage Letterstory phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",