@letterstory/cli 0.175.21 → 0.175.22
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 +16 -3
- package/lib/commands/admin.mjs +52 -2
- package/lib/commands/onboard.mjs +8 -3
- package/lib/commands/site.mjs +20 -0
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
} from "./commands.mjs";
|
|
80
80
|
|
|
81
81
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
82
|
-
export const VERSION = "0.175.
|
|
82
|
+
export const VERSION = "0.175.22";
|
|
83
83
|
|
|
84
84
|
/** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
|
|
85
85
|
export const EXIT_PAYMENT_REQUIRED = 3;
|
|
@@ -245,6 +245,8 @@ export const BOOLEAN_FLAGS = new Set([
|
|
|
245
245
|
// `phantom-onboard collection --enable-planner`, `strategy sitemap --posts-only`, and the
|
|
246
246
|
// `strategy positioning set --clear-*` switches: value-less, and each sits next to a value.
|
|
247
247
|
"enable-planner",
|
|
248
|
+
// `phantom-onboard collection --start-writing`: value-less, like --enable-planner.
|
|
249
|
+
"start-writing",
|
|
248
250
|
// `phantom-onboard primitives --retry [<domain>]` re-reads a domain whose read failed.
|
|
249
251
|
"retry",
|
|
250
252
|
"posts-only",
|
|
@@ -886,7 +888,7 @@ What does this org still need? (the router — reads only, decides nothing):
|
|
|
886
888
|
Collection onboarding (your OWN blog, on your org's domain — no provisioning):
|
|
887
889
|
${bin === "phantom" ? "onboard" : "phantom-onboard"} collection [--collection <uuid>] [--name "<collection name>"]
|
|
888
890
|
[--about "the direction"] [--sitemap <url>] [--cms <provider>]
|
|
889
|
-
[--enable-planner [--cadence <n/week>] [--approval manual|review_window|autopilot]] [--watch]
|
|
891
|
+
[--start-writing | --enable-planner [--cadence <n/week>] [--approval manual|review_window|autopilot]] [--watch]
|
|
890
892
|
Import the existing blog from its sitemap
|
|
891
893
|
(auto-discovered from the org's domain unless
|
|
892
894
|
--sitemap pins one) OR from a connected CMS with
|
|
@@ -900,6 +902,9 @@ Collection onboarding (your OWN blog, on your org's domain — no provisioning):
|
|
|
900
902
|
(same activation as the app's Guided review step;
|
|
901
903
|
needs a user-scoped key). --approval defaults to
|
|
902
904
|
manual: nothing publishes unreviewed.
|
|
905
|
+
--start-writing instead starts what the blog
|
|
906
|
+
writes once it is read in: the starter
|
|
907
|
+
automations, every draft for review.
|
|
903
908
|
${bin === "phantom" ? "onboard" : "phantom-onboard"} sync-sitemap --collection <uuid>
|
|
904
909
|
Re-check an already-onboarded blog's sitemap
|
|
905
910
|
right now instead of waiting for its cadence
|
|
@@ -962,9 +967,17 @@ Admin (STAFF key — --staff-key / LETTERSTORY_STAFF_API_KEY; acts before an org
|
|
|
962
967
|
nothing. Exits 1 if any row failed.
|
|
963
968
|
admin recipes save [<id>] [--file <recipe.json>] [--name …] [--description …] [--recipe …]
|
|
964
969
|
[--when-to-use …] [--when-not-to-use …] [--weight 1..10] [--approaches seo,geo]
|
|
970
|
+
[--reads llms_txt,github]
|
|
965
971
|
Create one (no id) or change one; variations come from
|
|
966
|
-
--file.
|
|
972
|
+
--file. --reads names the facts its conditions rest on
|
|
973
|
+
(vocab lists them). Needs recipes:write.
|
|
967
974
|
admin recipes delete <id> --yes Delete for good.
|
|
975
|
+
admin recipes refit [--org <id>,…] [--recipe <id|name>] [--limit 10]
|
|
976
|
+
Decide accounts' recipes again now, not on the hourly
|
|
977
|
+
sweep's turn: --org those accounts (every recipe);
|
|
978
|
+
--recipe every account whose verdict on it is missing
|
|
979
|
+
or stale; neither, every account stale for the library.
|
|
980
|
+
Each is a model call. Needs recipes:write.
|
|
968
981
|
admin letterpress status [--customers] Letterpress as it runs now: per lens its mode, bar, recipes,
|
|
969
982
|
runs, model and prompt hash, how often the shadow agreed,
|
|
970
983
|
how runs grounded (a recipe / none). Needs recipes:read.
|
package/lib/commands/admin.mjs
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
// admin spend summary|reconcile|pnl|margin|pricing|entries|add|import|usage|remove|reference|stripe-sync|services|service … (spend:read / spend:write)
|
|
19
19
|
// admin brand-detection <org-id> (fleet:read)
|
|
20
20
|
// admin brand-detection <org-id> [--term t]... [--exact t]... [--exclude p]... [--note "…"] | --clear [--note "…"] (fleet:instrument)
|
|
21
|
-
// admin recipes list|show|runs|vocab|export|import|save|delete …
|
|
21
|
+
// admin recipes list|show|runs|vocab|export|import|save|delete|refit … (recipes:read / recipes:write)
|
|
22
22
|
// admin letterpress companies | company <org-id> | facts <org-id> (the standing fit, per company)
|
|
23
23
|
// admin letterpress beyond [--limit N] [--before ISO] (what members asked that went past the library)
|
|
24
24
|
// admin letterpress settings|flip|set … (recipes:read / recipes:write)
|
|
@@ -5031,13 +5031,16 @@ const RECIPE_FILE_FIELDS = [
|
|
|
5031
5031
|
"when_not_to_use",
|
|
5032
5032
|
"weight",
|
|
5033
5033
|
"approaches",
|
|
5034
|
+
"reads",
|
|
5034
5035
|
"runs",
|
|
5036
|
+
"primitives_access",
|
|
5037
|
+
"immediate",
|
|
5035
5038
|
"status",
|
|
5036
5039
|
"needs",
|
|
5037
5040
|
"variations",
|
|
5038
5041
|
];
|
|
5039
5042
|
const RECIPES_USAGE =
|
|
5040
|
-
"Usage: admin recipes list [--kind recipe|known_issue] [--status live|parked] [--approach seo|geo|agent_conviction|inbound_conversion|outbound|other] | show <id|name> | runs <id|name> [--days 1..90] [--limit n] | vocab | stats | export [--out <file>] | import <file> [--dry-run] | save [<id>] [--file <recipe.json>] [--kind recipe|known_issue] [--name …] [--description …] [--recipe …] [--when-to-use …] [--when-not-to-use …] [--weight 1..10] [--approaches seo,geo,…] [--runs <catalog action id>] [--status live|parked] [--needs <what a parked recipe is missing>] | delete <id> --yes";
|
|
5043
|
+
"Usage: admin recipes list [--kind recipe|known_issue] [--status live|parked] [--approach seo|geo|agent_conviction|inbound_conversion|outbound|other] | show <id|name> | runs <id|name> [--days 1..90] [--limit n] | vocab | stats | export [--out <file>] | import <file> [--dry-run] | refit [--org <id>,…] [--recipe <id|name>] [--limit n] | save [<id>] [--file <recipe.json>] [--kind recipe|known_issue] [--name …] [--description …] [--recipe …] [--when-to-use …] [--when-not-to-use …] [--weight 1..10] [--approaches seo,geo,…] [--reads llms_txt,github,…] [--runs <catalog action id>] [--primitives-access true|false] [--immediate true|false] [--status live|parked] [--needs <what a parked recipe is missing>] | delete <id> --yes";
|
|
5041
5044
|
|
|
5042
5045
|
const recipeForFile = (r) => Object.fromEntries(RECIPE_FILE_FIELDS.map((k) => [k, r[k]]));
|
|
5043
5046
|
|
|
@@ -5069,8 +5072,11 @@ function recipeDetail(r) {
|
|
|
5069
5072
|
`${r.name} weight ${r.weight}/10 ${r.id}`,
|
|
5070
5073
|
` kind: ${r.kind === "known_issue" ? "known issue (Fix's list)" : "recipe (the Plan's)"}`,
|
|
5071
5074
|
` approaches: ${recipeApproaches(r)}`,
|
|
5075
|
+
` reads: ${r.reads?.length ? r.reads.join(", ") : "— (not written: every probe runs)"}`,
|
|
5072
5076
|
` status: ${r.status === "parked" ? `parked${r.needs ? `, needs ${r.needs}` : ""}` : "live"}`,
|
|
5073
5077
|
` runs: ${r.runs || "one change to the site's code, from its own directions"}`,
|
|
5078
|
+
...(r.primitives_access ? [" letter's tools: its build may use them (primitives_access)"] : []),
|
|
5079
|
+
...(r.immediate ? [" immediate: a quick win: the Plan puts one in every top three"] : []),
|
|
5074
5080
|
...(variations.length > 1
|
|
5075
5081
|
? variations.flatMap((v, i) => [` variation ${i + 1}: ${v.name}`, ...fields(v, " ")])
|
|
5076
5082
|
: fields(r, " ")),
|
|
@@ -5120,6 +5126,16 @@ function recipeFromFlags(flags) {
|
|
|
5120
5126
|
?.split(",")
|
|
5121
5127
|
.map((a) => a.trim())
|
|
5122
5128
|
.filter(Boolean),
|
|
5129
|
+
// --primitives-access true hands a start's build Letter's own tools; false takes them away.
|
|
5130
|
+
primitives_access:
|
|
5131
|
+
flags["primitives-access"] === undefined ? undefined : String(flags["primitives-access"]) === "true",
|
|
5132
|
+
// --immediate true marks a quick win (live within a day): the Plan puts one in every top three.
|
|
5133
|
+
immediate: flags.immediate === undefined ? undefined : String(flags.immediate) === "true",
|
|
5134
|
+
// --reads llms_txt,github declares the facts its conditions rest on; --reads "" clears them.
|
|
5135
|
+
reads: flagStr(flags.reads)
|
|
5136
|
+
?.split(",")
|
|
5137
|
+
.map((k) => k.trim())
|
|
5138
|
+
.filter(Boolean),
|
|
5123
5139
|
});
|
|
5124
5140
|
}
|
|
5125
5141
|
|
|
@@ -5677,6 +5693,40 @@ async function cmdAdminRecipes(ctx) {
|
|
|
5677
5693
|
printResult(io, flags, result, (r) => recipeDetail(r.recipe));
|
|
5678
5694
|
return 0;
|
|
5679
5695
|
}
|
|
5696
|
+
case "refit": {
|
|
5697
|
+
// refit_accounts: the standing fit decided again now, not on the hourly sweep's turn.
|
|
5698
|
+
const orgs = flagStr(flags.org);
|
|
5699
|
+
const key = flagStr(flags.recipe);
|
|
5700
|
+
const limit = flagNum(flags.limit);
|
|
5701
|
+
let recipeId;
|
|
5702
|
+
if (key) {
|
|
5703
|
+
const recipe = (await all()).find((r) => r.id === key || r.name === key);
|
|
5704
|
+
if (!recipe) throw new CliError(`No recipe with id or name "${key}".`);
|
|
5705
|
+
recipeId = recipe.id;
|
|
5706
|
+
}
|
|
5707
|
+
const result = await staffPost(ctx, `${RECIPES}/refit`, {
|
|
5708
|
+
...(orgs
|
|
5709
|
+
? {
|
|
5710
|
+
org_ids: orgs
|
|
5711
|
+
.split(",")
|
|
5712
|
+
.map((s) => s.trim())
|
|
5713
|
+
.filter(Boolean),
|
|
5714
|
+
}
|
|
5715
|
+
: {}),
|
|
5716
|
+
...(recipeId ? { recipe_id: recipeId } : {}),
|
|
5717
|
+
...(limit !== undefined ? { limit } : {}),
|
|
5718
|
+
});
|
|
5719
|
+
printResult(io, flags, result, (r) =>
|
|
5720
|
+
[
|
|
5721
|
+
...r.outcomes.map(
|
|
5722
|
+
(o) =>
|
|
5723
|
+
`${o.status.padEnd(11)} ${(o.domain ?? "—").padEnd(28)} ${o.org_id}${o.reason ? ` ${o.reason}` : ""}`
|
|
5724
|
+
),
|
|
5725
|
+
`${r.picked} account(s) taken (${r.mode})${r.left ? `, ${r.left} more past the limit` : ""}: ${r.outcomes.filter((o) => o.status === "refit").length} refit, ${r.outcomes.filter((o) => o.status === "standing").length} stood, ${r.outcomes.filter((o) => o.status === "failed").length} failed, ${r.outcomes.filter((o) => o.status === "not_reached").length} not reached.`,
|
|
5726
|
+
].join("\n")
|
|
5727
|
+
);
|
|
5728
|
+
return result.outcomes?.some((o) => o.status === "failed") ? 1 : 0;
|
|
5729
|
+
}
|
|
5680
5730
|
case "delete": {
|
|
5681
5731
|
const id = requirePositional(positionals, 1, "id");
|
|
5682
5732
|
if (!flagBool(flags.yes)) {
|
package/lib/commands/onboard.mjs
CHANGED
|
@@ -89,6 +89,9 @@ export const ARGS = {
|
|
|
89
89
|
enable_planner: { flag: "enable-planner", type: "bool" },
|
|
90
90
|
cadence_per_week: { flag: "cadence", type: "num" },
|
|
91
91
|
approval_mode: { flag: "approval", enum: APPROVAL_MODES },
|
|
92
|
+
// Start what the blog writes once it is read in (the starter automations, every draft for
|
|
93
|
+
// review), the one accept apply_starter_automations makes. Not with --enable-planner.
|
|
94
|
+
start_writing: { flag: "start-writing", type: "bool" },
|
|
92
95
|
},
|
|
93
96
|
get_collection_onboard_status: {
|
|
94
97
|
job_id: { internal: "the job id onboard_collection just returned" },
|
|
@@ -425,9 +428,11 @@ function formatCollectionStatus(s) {
|
|
|
425
428
|
` series: ${r.series ?? 0}`,
|
|
426
429
|
` open topics: ${r.spokes_open ?? 0} (${r.spokes_seo_bound ?? 0} SEO-bound)`,
|
|
427
430
|
` headlines suggested: ${r.headlines_suggested ?? 0}`,
|
|
428
|
-
|
|
429
|
-
? `
|
|
430
|
-
:
|
|
431
|
+
r.writing
|
|
432
|
+
? ` Writing: ${r.writing.note}`
|
|
433
|
+
: s.enable_planner
|
|
434
|
+
? ` Planner: ON — ${s.cadence_per_week ?? "?"}/week, ${s.approval_mode ?? "manual"} approval, queue filled.`
|
|
435
|
+
: ` Review them in Headlines & Queue — the Planner is configured but OFF (pass --start-writing or --enable-planner to turn it on).`
|
|
431
436
|
);
|
|
432
437
|
}
|
|
433
438
|
return lines.join("\n");
|
package/lib/commands/site.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// (src/lib/site). One subcommand per tool:
|
|
3
3
|
// site list → list_sites site map <host> → map_site
|
|
4
4
|
// site tree <host> [path] → get_site_tree site page <host> <path> → get_site_page
|
|
5
|
+
// site llms-txt <host> → get_llms_txt (the file Letter writes; --out <file> to save it)
|
|
5
6
|
// site builds <host> → list_build_suggestions (--limit n)
|
|
6
7
|
// site research-builds <host> → research_builds (Build's suggestion pass: propose, check, Jev, store)
|
|
7
8
|
// site research-fixes <host> → research_fixes (Fix's suggestion pass: exact edits on pages that exist)
|
|
@@ -14,6 +15,8 @@
|
|
|
14
15
|
// site competitors → list_competitor_sites site watch-competitors [d] → watch_competitor_sites
|
|
15
16
|
// site highlight <domain> [--off] → set_competitor_highlight
|
|
16
17
|
|
|
18
|
+
import { writeFileSync } from "node:fs";
|
|
19
|
+
|
|
17
20
|
import { CliError } from "../client.mjs";
|
|
18
21
|
import {
|
|
19
22
|
argsFromFlags,
|
|
@@ -66,6 +69,7 @@ const ARGS = {
|
|
|
66
69
|
skip_suggest: { flag: "skip-suggest", type: "bool" },
|
|
67
70
|
},
|
|
68
71
|
unmap_site: { host: { positional: 0, required: true, label: "host" } },
|
|
72
|
+
get_llms_txt: { host: { positional: 0, required: true, label: "host" } },
|
|
69
73
|
get_site_tree: {
|
|
70
74
|
host: { positional: 0, required: true, label: "host" },
|
|
71
75
|
path: { positional: 1, label: "path" },
|
|
@@ -215,6 +219,8 @@ export async function cmdSite(ctx) {
|
|
|
215
219
|
return siteUnmap(rest);
|
|
216
220
|
case "tree":
|
|
217
221
|
return siteTree(rest);
|
|
222
|
+
case "llms-txt":
|
|
223
|
+
return siteLlmsTxt(rest);
|
|
218
224
|
case "research-builds":
|
|
219
225
|
return siteResearchBuilds(rest);
|
|
220
226
|
case "research-fixes":
|
|
@@ -399,6 +405,20 @@ async function siteUnmap(ctx) {
|
|
|
399
405
|
return 0;
|
|
400
406
|
}
|
|
401
407
|
|
|
408
|
+
async function siteLlmsTxt(ctx) {
|
|
409
|
+
const { client, flags, io } = ctx;
|
|
410
|
+
refuseUnknownFlags(ctx, ARGS.get_llms_txt, ["out"]);
|
|
411
|
+
const result = await client.callTool("get_llms_txt", argsFromFlags(ARGS.get_llms_txt, flags, ctx.positionals));
|
|
412
|
+
const out = flagStr(flags.out);
|
|
413
|
+
if (out) {
|
|
414
|
+
writeFileSync(out, result.text);
|
|
415
|
+
ok(ctx, `Wrote ${out} (${result.pages} pages). ${result.where}`);
|
|
416
|
+
return 0;
|
|
417
|
+
}
|
|
418
|
+
printResult(io, flags, result, (r) => r.text);
|
|
419
|
+
return 0;
|
|
420
|
+
}
|
|
421
|
+
|
|
402
422
|
async function siteTree(ctx) {
|
|
403
423
|
const { client, flags, io } = ctx;
|
|
404
424
|
refuseUnknownFlags(ctx, ARGS.get_site_tree);
|