@letterstory/cli 0.165.1 → 0.167.0
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 +8 -10
- package/lib/commands/admin.mjs +34 -14
- package/lib/commands/org.mjs +4 -3
- package/lib/commands/outbound.mjs +8 -1
- package/lib/commands/visits.mjs +8 -0
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
} from "./commands.mjs";
|
|
75
75
|
|
|
76
76
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
77
|
-
export const VERSION = "0.
|
|
77
|
+
export const VERSION = "0.167.0";
|
|
78
78
|
|
|
79
79
|
/** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
|
|
80
80
|
export const EXIT_PAYMENT_REQUIRED = 3;
|
|
@@ -919,14 +919,10 @@ Admin (STAFF key — --staff-key / LETTERSTORY_STAFF_API_KEY; acts before an org
|
|
|
919
919
|
The blind read: mark a shown item; the marks fill the case
|
|
920
920
|
the run exports and the status's agreement. Needs recipes:write.
|
|
921
921
|
admin letterpress settings What steers Letterpress beside the recipes: the one
|
|
922
|
-
judgement's weights per ask
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
with recipes as direction). Shadow: both run and are
|
|
927
|
-
recorded on every run, today's shown; live: the new one
|
|
928
|
-
decides. Recorded as yours. Needs recipes:write.
|
|
929
|
-
admin letterpress set <weights.<ask>.<reading>|lenses.<lens>.mode|lenses.<lens>.bar.<reading>|lenses.<lens>.bar|asks.<lens>.ask|asks.<lens>.guidance> <value>
|
|
922
|
+
judgement's weights per ask, each lens's bar and read
|
|
923
|
+
budget, each surface's ask and guidance, the dismissal
|
|
924
|
+
window. Needs recipes:read.
|
|
925
|
+
admin letterpress set <weights.<ask>.<reading>|lenses.<lens>.bar.<reading>|lenses.<lens>.bar|lenses.<lens>.research.turns|lenses.<lens>.research.ms|asks.<lens>.ask|asks.<lens>.guidance|dismissals.block_days> <value>
|
|
930
926
|
Change one weight, one bar, or a lens's ask and guidance (the
|
|
931
927
|
opinions Letterpress chooses by, as staff's words); the version
|
|
932
928
|
bumps and the previous body is kept. Needs recipes:write.
|
|
@@ -1444,7 +1440,9 @@ Mailers (the sending mailboxes):
|
|
|
1444
1440
|
Recent mail (envelopes)
|
|
1445
1441
|
mailers message <mailer-id> <uid> --folder inbox|sent
|
|
1446
1442
|
One message in full (plain-text body)
|
|
1447
|
-
mailers forward <mailer-id> (--to <email> | --clear)
|
|
1443
|
+
mailers forward <mailer-id> (--to <email> | --clear) Forward replies to sequences to an address
|
|
1444
|
+
mailers forwards <mailer-id> [--outcome forwarded|held|failed] [--limit <n>]
|
|
1445
|
+
What forwarding forwarded or held, and why
|
|
1448
1446
|
mailers warmup start|pause <mailer-id> Start / pause warming (14+ days; ready at score 85)
|
|
1449
1447
|
mailers limit <mailer-id> <per-day> Daily send limit, 0..500 (not while warming)
|
|
1450
1448
|
mailers retire <mailer-id> [--release-mailbox --yes] Disable a mailer; --release-mailbox also deletes
|
package/lib/commands/admin.mjs
CHANGED
|
@@ -5048,7 +5048,7 @@ function recipeFromFlags(flags) {
|
|
|
5048
5048
|
const ENGINE = "/api/superadmin/engine-settings";
|
|
5049
5049
|
const LETTERPRESS = "/api/superadmin/letterpress";
|
|
5050
5050
|
const ENGINE_USAGE =
|
|
5051
|
-
"Usage: admin letterpress status | gaps | replay <run-id> | mark <run-id> <item-id> <right|weak|wrong|lead|clear> [--note …] | settings |
|
|
5051
|
+
"Usage: admin letterpress status | gaps | replay <run-id> | mark <run-id> <item-id> <right|weak|wrong|lead|clear> [--note …] | settings | set <weights.<ask>.<reading>|lenses.<lens>.bar.<reading>|lenses.<lens>.bar|lenses.<lens>.research.turns|lenses.<lens>.research.ms|asks.<lens>.ask|asks.<lens>.guidance|dismissals.block_days> <value>";
|
|
5052
5052
|
|
|
5053
5053
|
/** One number of the settings from a dotted path and a value: the PUT body save_engine_settings reads. */
|
|
5054
5054
|
function engineSettingsPatch(path, value) {
|
|
@@ -5060,8 +5060,11 @@ function engineSettingsPatch(path, value) {
|
|
|
5060
5060
|
}
|
|
5061
5061
|
if (parts[0] === "asks" && (parts[2] === "ask" || parts[2] === "guidance") && parts.length === 3)
|
|
5062
5062
|
return { asks: { [parts[1]]: { [parts[2]]: String(value) } } };
|
|
5063
|
-
if (parts[0] === "
|
|
5064
|
-
|
|
5063
|
+
if (parts[0] === "dismissals" && parts[1] === "block_days" && parts.length === 2) {
|
|
5064
|
+
const n = Number(value);
|
|
5065
|
+
if (!Number.isInteger(n)) throw new CliError(`${path}: a whole number of days`);
|
|
5066
|
+
return { dismissals: { block_days: n } };
|
|
5067
|
+
}
|
|
5065
5068
|
if (parts[0] === "lenses" && parts[2] === "bar" && parts.length === 3 && value === "none")
|
|
5066
5069
|
return { lenses: { [parts[1]]: { bar: null } } };
|
|
5067
5070
|
if (parts[0] === "lenses" && parts[2] === "bar" && parts.length === 4) {
|
|
@@ -5072,12 +5075,12 @@ function engineSettingsPatch(path, value) {
|
|
|
5072
5075
|
throw new CliError(ENGINE_USAGE);
|
|
5073
5076
|
}
|
|
5074
5077
|
|
|
5075
|
-
/** The settings as a few lines: each lens's
|
|
5078
|
+
/** The settings as a few lines: each lens's bar and budget, the dismissal window, then the weights per ask. */
|
|
5076
5079
|
function engineSettingsText(r) {
|
|
5077
5080
|
const s = r.settings;
|
|
5078
5081
|
const lenses = Object.entries(s.lenses).map(
|
|
5079
5082
|
([lens, l]) =>
|
|
5080
|
-
`${lens.padEnd(6)}
|
|
5083
|
+
`${lens.padEnd(6)} reads ${l.research ? `${l.research.turns} turns, ${Math.round(l.research.ms / 1000)}s` : "default"} bar ${
|
|
5081
5084
|
l.bar
|
|
5082
5085
|
? Object.entries(l.bar)
|
|
5083
5086
|
.map(([k, v]) => `${k}≥${v}`)
|
|
@@ -5100,7 +5103,10 @@ function engineSettingsText(r) {
|
|
|
5100
5103
|
.map((l) => ` · ${l}`),
|
|
5101
5104
|
]);
|
|
5102
5105
|
const head = `Engine settings v${r.version}${r.defaults_only ? " (the defaults; no row yet)" : ""}${r.updated_by ? ` · by ${r.updated_by}` : ""}${r.changed ? ` · changed: ${r.changed.join(", ") || "nothing"}` : ""}`;
|
|
5103
|
-
|
|
5106
|
+
const dismissals = s.dismissals
|
|
5107
|
+
? `a dismissal blocks for ${s.dismissals.block_days} days, then is dated history`
|
|
5108
|
+
: null;
|
|
5109
|
+
return [head, ...lenses, ...(dismissals ? [dismissals] : []), "", ...weights, "", ...asks].join("\n");
|
|
5104
5110
|
}
|
|
5105
5111
|
|
|
5106
5112
|
/**
|
|
@@ -5191,13 +5197,6 @@ async function cmdAdminLetterpress(ctx) {
|
|
|
5191
5197
|
printResult(io, flags, result, engineSettingsText);
|
|
5192
5198
|
return 0;
|
|
5193
5199
|
}
|
|
5194
|
-
case "flip": {
|
|
5195
|
-
const [, lens, mode] = positionals;
|
|
5196
|
-
if (!lens || !mode) throw new CliError(ENGINE_USAGE);
|
|
5197
|
-
const result = await staffRequest(ctx, "PUT", ENGINE, { lenses: { [lens]: { mode } } });
|
|
5198
|
-
printResult(io, flags, result, engineSettingsText);
|
|
5199
|
-
return 0;
|
|
5200
|
-
}
|
|
5201
5200
|
case "set": {
|
|
5202
5201
|
const [, path, value] = positionals;
|
|
5203
5202
|
if (!path || value === undefined) throw new CliError(ENGINE_USAGE);
|
|
@@ -5410,7 +5409,8 @@ async function cmdAdminBillingLegacyUnmark(ctx) {
|
|
|
5410
5409
|
}
|
|
5411
5410
|
|
|
5412
5411
|
const FREE_USAGE = `Usage: admin billing free exposure [--json] who the free paywall covers, and who is unassigned
|
|
5413
|
-
admin billing free backfill --why "…" [--apply] signup grant for self-serve orgs with none; a dry run unless --apply
|
|
5412
|
+
admin billing free backfill --why "…" [--apply] signup grant for self-serve orgs with none; a dry run unless --apply
|
|
5413
|
+
admin billing free repair-subjects --why "…" [--apply] staff-address signup subjects fixed, refused orgs granted (R1); a dry run unless --apply`;
|
|
5414
5414
|
|
|
5415
5415
|
const EXPOSURE_WORDS = {
|
|
5416
5416
|
needs_legacy: "pay today: need a legacy mark (admin billing legacy mark --all)",
|
|
@@ -5461,6 +5461,26 @@ async function cmdAdminBillingFree(ctx) {
|
|
|
5461
5461
|
});
|
|
5462
5462
|
return 0;
|
|
5463
5463
|
}
|
|
5464
|
+
if (positionals[1] === "repair-subjects") {
|
|
5465
|
+
const why = flagStr(flags.why);
|
|
5466
|
+
if (!why) throw new CliError(`Say why (--why "…").\n${FREE_USAGE}`);
|
|
5467
|
+
const r = await staffPost(ctx, "/api/superadmin/billing/free-tokens/repair-subjects", {
|
|
5468
|
+
dry: !flagBool(flags.apply),
|
|
5469
|
+
why,
|
|
5470
|
+
});
|
|
5471
|
+
printResult(io, flags, r, (x) => {
|
|
5472
|
+
const granted = x.regranted.filter((g) => g.outcome === "granted" || g.outcome === "would_grant");
|
|
5473
|
+
const lines = [
|
|
5474
|
+
`${x.dry ? "Would fix" : "Fixed"} ${x.fixed.length} staff-address subject(s):`,
|
|
5475
|
+
...x.fixed.map((f) => ` ${f.orgId.slice(0, 8)} ${f.from} -> ${f.to ?? "(none)"}`),
|
|
5476
|
+
`${x.dry ? "Would grant" : "Granted"} ${granted.length} self-serve org(s) with no signup grant:`,
|
|
5477
|
+
...x.regranted.map((g) => ` ${g.orgId.slice(0, 8)} ${g.outcome}`),
|
|
5478
|
+
];
|
|
5479
|
+
if (x.dry) lines.push("Nothing written. Run again with --apply.");
|
|
5480
|
+
return lines.join("\n");
|
|
5481
|
+
});
|
|
5482
|
+
return 0;
|
|
5483
|
+
}
|
|
5464
5484
|
throw new CliError(FREE_USAGE);
|
|
5465
5485
|
}
|
|
5466
5486
|
|
package/lib/commands/org.mjs
CHANGED
|
@@ -263,12 +263,13 @@ function tokenRewardsText(r) {
|
|
|
263
263
|
return "Free tokens for actions are for workspaces on free tokens; this one is on a plan.";
|
|
264
264
|
const lines = r.rewards.map(
|
|
265
265
|
(x) =>
|
|
266
|
-
` ${x.claimed ? "✓" : x.ready === false ? "·" : "○"} ${x.action.padEnd(18)} ${String(x.tokens).padStart(6)} tokens ${x.title}${x.claimed ? " (
|
|
266
|
+
` ${x.claimed ? "✓" : x.ready === false ? "·" : "○"} ${x.action.padEnd(18)} ${String(x.tokens).padStart(6)} tokens ${x.title}${x.claimed ? " (earned)" : x.auto ? " (granted when done)" : x.ready === false ? " (not done yet)" : ""}`
|
|
267
267
|
);
|
|
268
268
|
return [
|
|
269
|
-
`Free tokens for actions: ${r.claimedTokens}
|
|
269
|
+
`Free tokens for actions: ${r.claimedTokens} earned, ${r.availableTokens} still to earn.`,
|
|
270
270
|
...lines,
|
|
271
|
-
"
|
|
271
|
+
"GitHub, GitLab, Slack and the CLI are granted on their own once done.",
|
|
272
|
+
"Claim the rest: letterstory org billing rewards claim <action>",
|
|
272
273
|
].join("\n");
|
|
273
274
|
}
|
|
274
275
|
|
|
@@ -352,6 +352,11 @@ export const ARGS = {
|
|
|
352
352
|
uid: messageRefPositional(1, "uid"),
|
|
353
353
|
folder: { flag: "folder", required: true, enum: MAILER_FOLDERS },
|
|
354
354
|
},
|
|
355
|
+
list_mailer_forwards: {
|
|
356
|
+
mailer_id: { positional: 0, label: "mailer-id", required: true },
|
|
357
|
+
outcome: { flag: "outcome", enum: ["pending", "forwarded", "held", "failed"] },
|
|
358
|
+
limit: { flag: "limit", type: "num" },
|
|
359
|
+
},
|
|
355
360
|
set_mailer_forwarding: {
|
|
356
361
|
mailer_id: { positional: 0, label: "mailer-id", required: true },
|
|
357
362
|
forward_to: {
|
|
@@ -698,7 +703,7 @@ async function prospectsColumns(ctx, sub) {
|
|
|
698
703
|
}
|
|
699
704
|
}
|
|
700
705
|
|
|
701
|
-
const MAILERS_USAGE = `Usage: mailers <list|domains|domain|quote|launch|move|messages|message|forward|warmup|limit|retire|suppressions>`;
|
|
706
|
+
const MAILERS_USAGE = `Usage: mailers <list|domains|domain|quote|launch|move|messages|message|forward|forwards|warmup|limit|retire|suppressions>`;
|
|
702
707
|
|
|
703
708
|
export async function cmdMailers(ctx) {
|
|
704
709
|
const sub = ctx.positionals[0];
|
|
@@ -746,6 +751,8 @@ export async function cmdMailers(ctx) {
|
|
|
746
751
|
return run(rest, "get_mailer_message");
|
|
747
752
|
case "forward":
|
|
748
753
|
return run(rest, "set_mailer_forwarding", "Forwarding updated.");
|
|
754
|
+
case "forwards":
|
|
755
|
+
return run(rest, "list_mailer_forwards");
|
|
749
756
|
case "warmup": {
|
|
750
757
|
const action = rest.positionals[0];
|
|
751
758
|
const inner = { ...rest, positionals: rest.positionals.slice(1) };
|
package/lib/commands/visits.mjs
CHANGED
|
@@ -224,6 +224,14 @@ async function visitsList(ctx) {
|
|
|
224
224
|
` ${a.agent.padEnd(22)} ${String(a.total).padStart(6)}${a.verified !== null && a.verified !== undefined ? ` (${a.verified} verified)` : ""}`
|
|
225
225
|
);
|
|
226
226
|
}
|
|
227
|
+
if (r.earlier) {
|
|
228
|
+
lines.push(
|
|
229
|
+
"",
|
|
230
|
+
`Before ${r.baseline} (v1 count, kept apart from the above): ${r.earlier.total} visits, ${r.earlier.verified} verified`
|
|
231
|
+
);
|
|
232
|
+
for (const a of r.earlier.agents.slice(0, 8))
|
|
233
|
+
lines.push(` ${a.agent.padEnd(22)} ${String(a.total).padStart(6)} (${a.verified} verified)`);
|
|
234
|
+
}
|
|
227
235
|
if (r.top_paths?.length) {
|
|
228
236
|
lines.push("", "Most read:");
|
|
229
237
|
for (const p of r.top_paths.slice(0, 10)) lines.push(` ${String(p.total).padStart(6)} ${p.path}`);
|