@letterstory/cli 0.100.0 → 0.100.2
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 +1 -1
- package/lib/commands/admin.mjs +61 -1
- package/package.json +1 -1
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.
|
|
62
|
+
export const VERSION = "0.100.2";
|
|
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
|
package/lib/commands/admin.mjs
CHANGED
|
@@ -2838,6 +2838,9 @@ 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
|
|
2843
|
+
* outreach catch-up [--dry-run] handle #launch-outreach posts the bot missed
|
|
2841
2844
|
* outreach set <id> [--reached|--not-reached] [--response "…" --tone positive]
|
|
2842
2845
|
* [--owner-id <uuid>] [--channel …] [--ask …] [--draft "…"] [--archive|--restore]
|
|
2843
2846
|
*/
|
|
@@ -2952,8 +2955,65 @@ async function cmdAdminCrmOutreach(ctx, args) {
|
|
|
2952
2955
|
const r = await staffRequest(ctx, "PATCH", `${CRM}/outreach/${id}`, body);
|
|
2953
2956
|
return json ? printResult(io, flags, r) : io.log(line(r));
|
|
2954
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
|
+
}
|
|
2985
|
+
case "catch-up": {
|
|
2986
|
+
// admin crm outreach catch-up [--dry-run] — handle #launch-outreach posts the bot
|
|
2987
|
+
// missed, calling again until none remain (each call is bounded server-side).
|
|
2988
|
+
const dryRun = flagBool(flags["dry-run"]);
|
|
2989
|
+
let total = 0;
|
|
2990
|
+
let after;
|
|
2991
|
+
for (let i = 0; i < 20; i++) {
|
|
2992
|
+
const r = await staffPost(
|
|
2993
|
+
ctx,
|
|
2994
|
+
`${CRM}/outreach/catch-up`,
|
|
2995
|
+
dryRun ? { dryRun: true } : compact({ after })
|
|
2996
|
+
);
|
|
2997
|
+
after = r.nextAfter ?? after;
|
|
2998
|
+
if (json) printResult(io, flags, r);
|
|
2999
|
+
else
|
|
3000
|
+
for (const it of r.items)
|
|
3001
|
+
io.log(
|
|
3002
|
+
`${it.ts} ${it.outcome ?? "pending"} ${it.preview}${it.files ? ` [${it.files} file(s)]` : ""}`
|
|
3003
|
+
);
|
|
3004
|
+
total += r.processed;
|
|
3005
|
+
if (dryRun || r.remaining === 0 || r.items.some((it) => it.outcome?.startsWith("failed:"))) {
|
|
3006
|
+
if (!json)
|
|
3007
|
+
io.log(dryRun ? `${r.pending} post(s) the bot missed` : `caught up: ${total} post(s) handled`);
|
|
3008
|
+
return;
|
|
3009
|
+
}
|
|
3010
|
+
}
|
|
3011
|
+
return;
|
|
3012
|
+
}
|
|
2955
3013
|
default:
|
|
2956
|
-
throw new CliError(
|
|
3014
|
+
throw new CliError(
|
|
3015
|
+
"Usage: admin crm outreach [list|add|lookup|set|relookup|customers|catch-up] … (see --help)"
|
|
3016
|
+
);
|
|
2957
3017
|
}
|
|
2958
3018
|
}
|
|
2959
3019
|
|