@letterstory/cli 0.176.22 → 0.176.23
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/README.md +12 -0
- package/lib/cli.mjs +13 -1
- package/lib/commands/build.mjs +23 -0
- package/lib/commands/domains.mjs +155 -0
- package/lib/commands.mjs +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -133,6 +133,18 @@ Publishing to the site is a **collection run** on its collection (below). Letter
|
|
|
133
133
|
launch recipe from a client domain — positioning inferred, a masthead proposed, the first
|
|
134
134
|
posts seeded — is `phantom-onboard` (see "Propose, then onboard a phantom").
|
|
135
135
|
|
|
136
|
+
## Domains
|
|
137
|
+
|
|
138
|
+
Your organization's domains, whatever each is used for, and finding new ones:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
letterstory domains # every domain you hold and what it's used for
|
|
142
|
+
letterstory domains scan "nano banana pro" # free domains matching what people search (no charge)
|
|
143
|
+
letterstory domains scan "nano banana pro" --tld com,org,ai,xyz --expand space
|
|
144
|
+
letterstory domains buy nanobananaprofree.com --dry-run # the price and whose account pays
|
|
145
|
+
letterstory domains buy nanobananaprofree.com --yes # buys it (spends money; domains:write)
|
|
146
|
+
```
|
|
147
|
+
|
|
136
148
|
## Custom domains
|
|
137
149
|
|
|
138
150
|
```bash
|
package/lib/cli.mjs
CHANGED
|
@@ -76,12 +76,13 @@ import {
|
|
|
76
76
|
cmdVisits,
|
|
77
77
|
cmdSim,
|
|
78
78
|
cmdVary,
|
|
79
|
+
cmdDomains,
|
|
79
80
|
cmdBench,
|
|
80
81
|
} from "./commands.mjs";
|
|
81
82
|
import { fetchParkedSections, withoutParked } from "./parked.mjs";
|
|
82
83
|
|
|
83
84
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
84
|
-
export const VERSION = "0.176.
|
|
85
|
+
export const VERSION = "0.176.23";
|
|
85
86
|
|
|
86
87
|
/** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
|
|
87
88
|
export const EXIT_PAYMENT_REQUIRED = 3;
|
|
@@ -120,6 +121,7 @@ export const BOOLEAN_FLAGS = new Set([
|
|
|
120
121
|
"customers",
|
|
121
122
|
// build: repeat an open build's ask; post its progress in the org's Slack channel.
|
|
122
123
|
"again",
|
|
124
|
+
"plan-only",
|
|
123
125
|
// build list: only Build's Archived tab (--open, already listed, is its Open tab).
|
|
124
126
|
"archived",
|
|
125
127
|
// plan pending --queued: only the rows a person queued for later.
|
|
@@ -157,6 +159,8 @@ export const BOOLEAN_FLAGS = new Set([
|
|
|
157
159
|
// site tree: include children a fold-by-default family would hide; items over the whole subtree.
|
|
158
160
|
"unfold",
|
|
159
161
|
"subtree",
|
|
162
|
+
// domains scan: no add-on names (get-, -hq…).
|
|
163
|
+
"no-modifiers",
|
|
160
164
|
// site map: do not start an audit for a host that has none.
|
|
161
165
|
"no-audit",
|
|
162
166
|
// site metrics: skip the previous window (no deltas, no revamp indicator).
|
|
@@ -1830,6 +1834,13 @@ Sim (Simulations: a free, simulated copy of your API for agents, and what they d
|
|
|
1830
1834
|
sim session <session-id> One session, call by call
|
|
1831
1835
|
sim report <id> [--since 30d] Funnel, missing operations, argument errors, loops, by agent
|
|
1832
1836
|
|
|
1837
|
+
Domains (the domains you hold, and free ones that match what people search):
|
|
1838
|
+
domains [list] Every domain you hold and what each is used for
|
|
1839
|
+
domains scan "<phrase>" ["<phrase>" …] [--tld com,org,ai] [--expand none|searches|space]
|
|
1840
|
+
[--no-modifiers] [--market US] [--limit <n>]
|
|
1841
|
+
Free domains matching what people search, ranked
|
|
1842
|
+
domains buy <domain> --dry-run | --yes The price and whose account pays; --yes buys it
|
|
1843
|
+
|
|
1833
1844
|
Vary (A/B tests of a page's words and images on your own site):
|
|
1834
1845
|
vary [list] [--status running] [--site <id>] Your variationals and how many visitors each has seen
|
|
1835
1846
|
vary create --page <url> [--name <n>] [--goals-file <path>]
|
|
@@ -1962,6 +1973,7 @@ const CLIENT_COMMANDS = {
|
|
|
1962
1973
|
visits: cmdVisits,
|
|
1963
1974
|
sim: cmdSim,
|
|
1964
1975
|
vary: cmdVary,
|
|
1976
|
+
domains: cmdDomains,
|
|
1965
1977
|
bench: cmdBench,
|
|
1966
1978
|
// Platform-scoped (staff key) — the only commands that act BEFORE an org exists.
|
|
1967
1979
|
admin: cmdAdmin,
|
package/lib/commands/build.mjs
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
// build conversations → list_build_conversations
|
|
15
15
|
// build conversation <id> → get_build_conversation (--build <id> for the one holding a build)
|
|
16
16
|
|
|
17
|
+
import { readFileSync } from "node:fs";
|
|
17
18
|
import { CliError } from "../client.mjs";
|
|
18
19
|
import { argsFromFlags, flagList, flagStr, followJob, ok, printResult, refuseUnknownFlags } from "./shared.mjs";
|
|
19
20
|
import { attachmentUrls, uploadAttachments } from "./repo.mjs";
|
|
@@ -36,6 +37,20 @@ const ARGS = {
|
|
|
36
37
|
again: { flag: "again", type: "bool" },
|
|
37
38
|
// --recipe <id>: the recipe the build carries out (a Plan row's), recorded on it.
|
|
38
39
|
recipe: "recipe",
|
|
40
|
+
// --plan-only: answer what it would do and start nothing (--json for the plan to send back).
|
|
41
|
+
plan_only: { flag: "plan-only", type: "bool" },
|
|
42
|
+
// --plan-file <path>: build exactly the plan --plan-only answered.
|
|
43
|
+
plan: {
|
|
44
|
+
value: (flags) => {
|
|
45
|
+
const path = flagStr(flags["plan-file"]);
|
|
46
|
+
if (!path) return undefined;
|
|
47
|
+
try {
|
|
48
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
49
|
+
} catch (err) {
|
|
50
|
+
throw new CliError(`Couldn't read the plan in ${path}: ${err.message}`);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
},
|
|
39
54
|
},
|
|
40
55
|
send_build_message: {
|
|
41
56
|
message: {
|
|
@@ -172,6 +187,8 @@ async function buildStart(ctx) {
|
|
|
172
187
|
"notify-slack",
|
|
173
188
|
"harness",
|
|
174
189
|
"again",
|
|
190
|
+
"plan-only",
|
|
191
|
+
"plan-file",
|
|
175
192
|
...FILE_FLAGS,
|
|
176
193
|
]);
|
|
177
194
|
const files = await attachedFiles(ctx);
|
|
@@ -179,6 +196,12 @@ async function buildStart(ctx) {
|
|
|
179
196
|
if (!args.prompt) throw new CliError('Say what to build: letterstory build "launch a phantom for us"');
|
|
180
197
|
const result = await client.callTool("start_build", args);
|
|
181
198
|
printResult(io, flags, result, (r) => {
|
|
199
|
+
if (r.status === "planned")
|
|
200
|
+
return [
|
|
201
|
+
`Plan: ${r.plan.title}`,
|
|
202
|
+
...r.plan.changes.map((c) => ` ${c.title ?? c.instructions}`),
|
|
203
|
+
...r.plan.actions.map((a) => ` ${a.title}`),
|
|
204
|
+
].join("\n");
|
|
182
205
|
if (r.status !== "started") return r.message ?? r.status;
|
|
183
206
|
const steps = (r.build?.steps ?? []).map((s) => ` ${s.status} ${s.title}${s.note ? `: ${s.note}` : ""}`);
|
|
184
207
|
return [`Started: ${r.build.title} (${r.build.id})`, ...steps].join("\n");
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// `domains` — the Domains primitive from a terminal (docs/architecture/domains.md): the domains your
|
|
2
|
+
// organization holds, free ones that match what people search, and buying one as your own. Thin
|
|
3
|
+
// wrappers over list_domains, scan_domains and register_domain, the same lib functions the app calls.
|
|
4
|
+
//
|
|
5
|
+
// letterstory domains [list]
|
|
6
|
+
// letterstory domains scan "nano banana pro" ["ai headshots" …] [--tld com,org,ai] [--expand none|searches|space]
|
|
7
|
+
// letterstory domains buy nanobananaprofree.com --dry-run the price and whose account pays; buys nothing
|
|
8
|
+
// letterstory domains buy nanobananaprofree.com --yes buys it (spends money; domains:write)
|
|
9
|
+
|
|
10
|
+
import { CliError } from "../client.mjs";
|
|
11
|
+
import { flagCsv, requirePositional, printResult, argsFromFlags } from "./shared.mjs";
|
|
12
|
+
|
|
13
|
+
export const ARGS = {
|
|
14
|
+
list_domains: {},
|
|
15
|
+
// `domains scan "nano banana pro" ["ai headshots" …]` — each positional is one phrase.
|
|
16
|
+
scan_domains: {
|
|
17
|
+
phrases: {
|
|
18
|
+
value: (flags, positionals) => {
|
|
19
|
+
requirePositional(positionals, 0, "phrase");
|
|
20
|
+
return positionals;
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
// `--tld com,org` or `--tld com --tld org`.
|
|
24
|
+
tlds: {
|
|
25
|
+
value: (flags) => {
|
|
26
|
+
const tlds = flagCsv(flags.tld);
|
|
27
|
+
return tlds.length ? tlds : undefined;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
expand: { flag: "expand", enum: ["none", "searches", "space"] },
|
|
31
|
+
modifiers: { flag: "no-modifiers", type: "bool", invert: true },
|
|
32
|
+
market: { flag: "market" },
|
|
33
|
+
limit: { flag: "limit", type: "num" },
|
|
34
|
+
},
|
|
35
|
+
register_domain: {
|
|
36
|
+
domain: { value: (flags, positionals) => stripScheme(requirePositional(positionals, 0, "domain")) },
|
|
37
|
+
dry_run: { flag: "dry-run", type: "bool" },
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
function stripScheme(value) {
|
|
42
|
+
return String(value)
|
|
43
|
+
.trim()
|
|
44
|
+
.replace(/^https?:\/\//i, "")
|
|
45
|
+
.replace(/\/.*$/, "");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export async function cmdDomains(ctx) {
|
|
49
|
+
const sub = ctx.positionals[0];
|
|
50
|
+
const rest = { ...ctx, positionals: ctx.positionals.slice(1) };
|
|
51
|
+
switch (sub) {
|
|
52
|
+
case undefined:
|
|
53
|
+
case "list":
|
|
54
|
+
case "ls":
|
|
55
|
+
return domainsList(rest);
|
|
56
|
+
case "scan":
|
|
57
|
+
case "find":
|
|
58
|
+
return domainsScan(rest);
|
|
59
|
+
case "buy":
|
|
60
|
+
case "register":
|
|
61
|
+
if (rest.flags["dry-run"] !== true && rest.flags.yes !== true) {
|
|
62
|
+
rest.io.error(
|
|
63
|
+
"Buying a domain spends real money. Run with --dry-run to see the price, then --yes to buy."
|
|
64
|
+
);
|
|
65
|
+
return 1;
|
|
66
|
+
}
|
|
67
|
+
return domainsBuy(rest);
|
|
68
|
+
default:
|
|
69
|
+
throw new CliError(`Unknown domains subcommand: ${sub}. Try: list, scan, buy`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function domainsList(ctx) {
|
|
74
|
+
const { client, flags, io } = ctx;
|
|
75
|
+
const result = await client.callTool("list_domains", argsFromFlags(ARGS.list_domains, flags, ctx.positionals));
|
|
76
|
+
printResult(io, flags, result, (r) => {
|
|
77
|
+
const usd = (n) => (n == null ? "" : `$${n}`);
|
|
78
|
+
const lines = r.domains.map(
|
|
79
|
+
(d) =>
|
|
80
|
+
`${d.domain.padEnd(32)} ${(d.used_for.length ? d.used_for.map((u) => (u === "site" && d.site ? `site (${d.site.name})` : u)).join(", ") : "not yet used").padEnd(28)} ${d.status.padEnd(8)} ${d.registered_on === "org_vercel_key" ? "your Vercel" : d.registered_on === "letter" ? "Letter" : "connected"} ${usd(d.purchase_price_usd)}`
|
|
81
|
+
);
|
|
82
|
+
if (!lines.length) lines.push('No domains yet. Find one with: letterstory domains scan "<what people search>"');
|
|
83
|
+
const g = r.registration;
|
|
84
|
+
lines.push(
|
|
85
|
+
"",
|
|
86
|
+
!g.configured
|
|
87
|
+
? "Registering new domains isn't set up on this account."
|
|
88
|
+
: g.on === "org_vercel_key"
|
|
89
|
+
? "New domains are registered on your own Vercel account."
|
|
90
|
+
: g.domains_left == null
|
|
91
|
+
? "Letter registers new domains for you."
|
|
92
|
+
: `Letter can register ${g.domains_left} more for you ($${g.budget_left_usd} of first-year prices left).`
|
|
93
|
+
);
|
|
94
|
+
return lines.join("\n");
|
|
95
|
+
});
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async function domainsBuy(ctx) {
|
|
100
|
+
const { client, flags, io } = ctx;
|
|
101
|
+
const result = await client.callTool(
|
|
102
|
+
"register_domain",
|
|
103
|
+
argsFromFlags(ARGS.register_domain, flags, ctx.positionals)
|
|
104
|
+
);
|
|
105
|
+
printResult(io, flags, result, (r) => {
|
|
106
|
+
const p = r.purchase;
|
|
107
|
+
const on = p?.on === "org_vercel_key" ? "on your own Vercel account" : "by Letter, billed in tokens";
|
|
108
|
+
switch (r.outcome) {
|
|
109
|
+
case "would_buy":
|
|
110
|
+
return `${r.domain}: $${p.price_usd} for the first year${p.renewal_usd != null ? `, then $${p.renewal_usd} a year` : ""}, ${on}. Run again with --yes to buy it.`;
|
|
111
|
+
case "would_adopt":
|
|
112
|
+
return `${r.domain} is one of your phantom sites' domains; --yes adds it to your domains. Nothing is bought.`;
|
|
113
|
+
case "already_owned":
|
|
114
|
+
return `${r.domain} is already yours.`;
|
|
115
|
+
case "adopted":
|
|
116
|
+
return `${r.domain} is in your domains (nothing was bought).`;
|
|
117
|
+
default:
|
|
118
|
+
return `Bought ${r.domain}${p ? ` for $${p.price_usd}, ${on}` : ""}.`;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
return 0;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const STATUS_MARK = { available: "free", taken: "·", unknown: "?", unchecked: " " };
|
|
125
|
+
|
|
126
|
+
async function domainsScan(ctx) {
|
|
127
|
+
const { client, flags, io } = ctx;
|
|
128
|
+
const result = await client.callTool("scan_domains", argsFromFlags(ARGS.scan_domains, flags, ctx.positionals));
|
|
129
|
+
printResult(io, flags, result, (r) => {
|
|
130
|
+
const searches = (n) => (n == null ? "—" : n.toLocaleString("en-US"));
|
|
131
|
+
const price = (p) =>
|
|
132
|
+
!p
|
|
133
|
+
? ""
|
|
134
|
+
: p.purchase_usd == null
|
|
135
|
+
? "not sold here"
|
|
136
|
+
: `$${p.purchase_usd}${p.purchasable ? "" : " (over cap)"}`;
|
|
137
|
+
const lines = [`Free domains (${r.available} of ${r.checked} checked, searches in ${r.market}):`];
|
|
138
|
+
for (const d of r.domains) {
|
|
139
|
+
lines.push(
|
|
140
|
+
` ${String(d.score).padStart(5)} ${d.domain.padEnd(32)} ${d.match.padEnd(8)} ${searches(d.monthly_searches).padStart(8)}/mo ${d.phrase} ${price(d.price)}`
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
if (!r.domains.length) lines.push(" None free. Try more phrases, --expand space, or more --tld.");
|
|
144
|
+
lines.push("", `Exact match on each TLD (free / · taken):`);
|
|
145
|
+
lines.push(` ${"".padEnd(30)} ${"searches".padStart(8)} ${r.tlds.map((t) => t.padEnd(5)).join("")}`);
|
|
146
|
+
for (const row of r.coverage) {
|
|
147
|
+
lines.push(
|
|
148
|
+
` ${row.phrase.slice(0, 30).padEnd(30)} ${searches(row.monthly_searches).padStart(8)} ${row.cells.map((c) => STATUS_MARK[c.status].padEnd(5)).join("")}`
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
for (const note of r.notes) lines.push(`Note: ${note}`);
|
|
152
|
+
return lines.join("\n");
|
|
153
|
+
});
|
|
154
|
+
return 0;
|
|
155
|
+
}
|
package/lib/commands.mjs
CHANGED